home: move ui related things to ui module
This commit is contained in:
parent
bd6ae5ea8b
commit
f952c4121e
3 changed files with 103 additions and 119 deletions
95
home/ui.nix
95
home/ui.nix
|
|
@ -11,6 +11,96 @@ in
|
|||
./gui-software.nix
|
||||
];
|
||||
|
||||
home.file = {
|
||||
".config/kitty/light.conf".source = dotfiles/kitty/light.conf;
|
||||
".config/kitty/dark.conf".source = dotfiles/kitty/dark.conf;
|
||||
|
||||
".config/rofi/colors-dark.rasi".source = dotfiles/rofi/colors-dark.rasi;
|
||||
".config/rofi/colors-light.rasi".source = dotfiles/rofi/colors-light.rasi;
|
||||
".config/rofi/theme.rasi".source = dotfiles/rofi/theme.rasi;
|
||||
|
||||
".config/keepmenu/config.ini".source = dotfiles/keepmenu.ini;
|
||||
|
||||
".bin/runmenu".source = pkgs.writers.writeBash "runmenu" ''
|
||||
${config.programs.rofi.package}/bin/rofi -matching normal -sort -show run
|
||||
'';
|
||||
|
||||
".bin/notifications".source = bin/notifications;
|
||||
|
||||
".bin/window_dir".source = pkgs.writers.writeBash "window_dir" ''
|
||||
PID=$(${pkgs.hyprland}/bin/hyprctl activewindow | grep pid | cut -d' ' -f 2)
|
||||
PID=$(echo $(ps --ppid $PID -o pid | tail -n1))
|
||||
cwd=$(readlink /proc/"$PID"/cwd)
|
||||
echo "$cwd"
|
||||
'';
|
||||
|
||||
".bin/exec_on_stdin_newline".source = pkgs.writers.writePython3 "exec_on_stdin_newline" {} ''
|
||||
# run command whjen a newline is added to stdin
|
||||
import subprocess
|
||||
from sys import stdin, argv
|
||||
cmd = argv[1:]
|
||||
subprocess.call(cmd, shell=True)
|
||||
while stdin.readline():
|
||||
subprocess.call(cmd, shell=True)
|
||||
'';
|
||||
|
||||
".bin/screenshot".source = (import ./bin/screenshot.nix) pkgs;
|
||||
|
||||
".bin/ocrzone".source = pkgs.writers.writeBash "ocrzone" ''
|
||||
${pkgs.pkgs.sway-contrib.grimshot}/bin/grimshot save area - | \
|
||||
${pkgs.tesseract}/bin/tesseract -l fra - - | \
|
||||
${pkgs.wl-clipboard}/bin/wl-copy
|
||||
'';
|
||||
|
||||
".bin/wifi-toggle".source = pkgs.writers.writeBash "wifi-toggle" ''
|
||||
if [[ $(nmcli radio wifi) == "enabled" ]]; then
|
||||
nmcli radio wifi off
|
||||
else
|
||||
nmcli radio wifi on
|
||||
fi
|
||||
'';
|
||||
|
||||
".bin/rofi-udisk".source = pkgs.writers.writeBash "rofi-udisk" ''
|
||||
device=$(${pkgs.udiskie}/bin/udiskie-info -a -o "{ui_label} {in_use}" -f is_filesystem | \
|
||||
${pkgs.gnused}/bin/sed 's/True$/[Mounted]/' | \
|
||||
${pkgs.gnused}/bin/sed 's/False$//' | \
|
||||
${config.programs.rofi.package}/bin/rofi -dmenu | \
|
||||
${pkgs.coreutils}/bin/cut -d':' -f1)
|
||||
|
||||
if [ -n "$device" ] ; then
|
||||
if ${pkgs.mount}/bin/mount | ${pkgs.gnugrep}/bin/grep "$device" ; then
|
||||
${pkgs.libnotify}/bin/notify-send "Unmounting $device..."
|
||||
output=$(${pkgs.udisks}/bin/udisksctl unmount -b $device 2>&1)
|
||||
if [ $? -eq 0 ] ; then
|
||||
${pkgs.libnotify}/bin/notify-send "Device successfully unmounted."
|
||||
else
|
||||
${pkgs.libnotify}/bin/notify-send "Failed to unmount device" "$output"
|
||||
fi
|
||||
else
|
||||
${pkgs.libnotify}/bin/notify-send "Mounting $device..."
|
||||
output=$(${pkgs.udisks}/bin/udisksctl mount -b $device 2>&1)
|
||||
if [ $? -eq 0 ] ; then
|
||||
${pkgs.libnotify}/bin/notify-send "Device successfully mounted."
|
||||
else
|
||||
${pkgs.libnotify}/bin/notify-send "Failed to mount device" "$output"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
|
||||
".bin/mount-android".source = pkgs.writers.writeBash "mount-android" ''
|
||||
if ${pkgs.mount}/bin/mount | ${pkgs.gnugrep}/bin/grep $(realpath ~/android); then
|
||||
umount $(realpath ~/android)
|
||||
${pkgs.libnotify}/bin/notify-send "Android unmounted"
|
||||
elif ${pkgs.simple-mtpfs}/bin/simple-mtpfs $(realpath ~/android); then
|
||||
${pkgs.libnotify}/bin/notify-send "Android mounted in ~/android"
|
||||
else
|
||||
${pkgs.libnotify}/bin/notify-send "Can't find Android device"
|
||||
fi
|
||||
'';
|
||||
|
||||
".bin/dark".source = (import ./bin/dark.nix) pkgs; # deprecated, prefer darkman
|
||||
};
|
||||
|
||||
home.sessionVariables = {
|
||||
TERMINAL = defaultTerminal;
|
||||
|
|
@ -57,6 +147,10 @@ in
|
|||
emoji = [ "Noto Color Emoji" "OpenMoji Color" ];
|
||||
};
|
||||
|
||||
services.gnome-keyring.enable = true;
|
||||
|
||||
services.kdeconnect.enable = variant != "allegro";
|
||||
|
||||
programs.kitty = {
|
||||
enable = true;
|
||||
font.name = "CaskaydiaCove NFM Regular";
|
||||
|
|
@ -244,6 +338,7 @@ in
|
|||
kill -SIGUSR1 $(pgrep nvim)
|
||||
'';
|
||||
in {
|
||||
enable = true;
|
||||
lightModeScripts = {
|
||||
gtk-theme = ''
|
||||
${pkgs.dconf}/bin/dconf write /org/gnome/desktop/interface/color-scheme "'prefer-light'"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue