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
114
home/home.nix
114
home/home.nix
|
|
@ -46,97 +46,8 @@
|
|||
|
||||
home.file = {
|
||||
".docker/config.json".text = (builtins.toJSON { detachKeys= "ctrl-z,z"; });
|
||||
".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.sessionPath = [
|
||||
"$HOME/.local/bin"
|
||||
"$HOME/.bin"
|
||||
|
|
@ -146,16 +57,6 @@
|
|||
GOPATH = "${config.home.homeDirectory}/.local/share/go";
|
||||
GOMODCACHE = "${config.home.homeDirectory}/.cache/go/pkg/mod";
|
||||
|
||||
NIXOS_OZONE_WL = "1";
|
||||
GDK_BACKEND = "wayland,x11";
|
||||
QT_QPA_PLATFORM = "wayland;xcb";
|
||||
CLUTTER_BACKEND = "wayland";
|
||||
XDG_CURRENT_DESKTOP = "Hyprland";
|
||||
XDG_SESSION_TYPE = "wayland";
|
||||
XDG_SESSION_DESKTOP = "Hyprland";
|
||||
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
|
||||
WLR_NO_HARDWARE_CURSORS = "0";
|
||||
XCURSOR_SIZE = "24";
|
||||
CCACHE_MAXSIZE = "100Gi";
|
||||
} // (if variant == "allegro" then {
|
||||
TMPDIR = "/home/${config.home.username}/tmp";
|
||||
|
|
@ -188,21 +89,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
services.darkman = {
|
||||
enable = true;
|
||||
lightModeScripts = {
|
||||
rm-file-indicator = "rm $XDG_STATE_HOME/darkmode";
|
||||
};
|
||||
|
||||
darkModeScripts = {
|
||||
set-file-indicator = "touch $XDG_STATE_HOME/darkmode";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
services.gnome-keyring.enable = true;
|
||||
services.syncthing.enable = variant != "hs";
|
||||
services.kdeconnect.enable = variant != "allegro";
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
programs.nh = {
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@
|
|||
XCURSOR_SIZE = "24";
|
||||
DXVK_FILTER_DEVICE_NAME = "NVIDIA";
|
||||
SYSTEMD_PAGER = "";
|
||||
WLR_NO_HARDWARE_CURSORS = "0";
|
||||
};
|
||||
|
||||
wayland.windowManager.hyprland = {
|
||||
|
|
@ -124,7 +125,7 @@
|
|||
misc = {
|
||||
enable_anr_dialog = false;
|
||||
disable_hyprland_logo = true;
|
||||
enable_swallow = true;
|
||||
enable_swallow = false;
|
||||
mouse_move_enables_dpms = true;
|
||||
key_press_enables_dpms = true;
|
||||
swallow_regex = "^st-256color$";
|
||||
|
|
@ -350,11 +351,13 @@
|
|||
monitor=HDMI-A-1, 1920x1080, auto, 1, mirror, eDP-1
|
||||
''
|
||||
else if variant == "allegro" then ''
|
||||
monitor= DP-4, 1920x1200, 3840x0, 1
|
||||
monitor= DP-3, 1920x1200, 1920x0, 1
|
||||
monitor= DP-4, 1920x1200@75, 3840x0, 1
|
||||
monitor= DP-3, 1920x1200@75, 1920x0, 1
|
||||
monitor=eDP-1, 1920x1080, 0x0, 1
|
||||
monitor=HDMI-1, 1920x1080, auto, 1, mirror, eDP-1
|
||||
monitor=HDMI-A-1, 1920x1080, auto, 1, mirror, eDP-1
|
||||
monitor=HDMI-1, 3440x1440, auto, 1
|
||||
monitor=HDMI-A-1, 3440x1440, auto, 1
|
||||
# monitor=HDMI-1, 1920x1080, auto, 1, mirror, eDP-1
|
||||
# monitor=HDMI-A-1, 1920x1080, auto, 1, mirror, eDP-1
|
||||
''
|
||||
else ''
|
||||
'';
|
||||
|
|
|
|||
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