From 9d5b24e6ccb340c65ac9ac364f71834f8bb496fe Mon Sep 17 00:00:00 2001 From: tdback Date: Wed, 29 Jan 2025 18:30:52 -0500 Subject: xorg: inherit getExe and getExe' lib functions --- users/tdback/modules/xorg/default.nix | 44 +++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/users/tdback/modules/xorg/default.nix b/users/tdback/modules/xorg/default.nix index f93a98f..d45f00e 100644 --- a/users/tdback/modules/xorg/default.nix +++ b/users/tdback/modules/xorg/default.nix @@ -3,10 +3,14 @@ pkgs, ... }: +with pkgs.unstable; +let + inherit (lib) getExe getExe'; +in { xsession.windowManager.bspwm = { enable = true; - package = pkgs.unstable.bspwm; + package = bspwm; settings = let border = "#16191F"; @@ -36,29 +40,29 @@ }; startupPrograms = [ - "${lib.getExe pkgs.unstable.xorg.setxkbmap} -layout us" - "${lib.getExe pkgs.unstable.xorg.xsetroot} -cursor_name left_ptr" - "${lib.getExe pkgs.unstable.xorg.xset} r rate 350 40" + "${getExe xorg.setxkbmap} -layout us" + "${getExe xorg.xsetroot} -cursor_name left_ptr" + "${getExe xorg.xset} r rate 350 40" "~/.fehbg" ]; extraConfig = '' - ${lib.getExe' pkgs.unstable.bspwm "bspc"} monitor -d 1 2 3 4 5 6 7 8 9 + ${getExe' bspwm "bspc"} monitor -d 1 2 3 4 5 6 7 8 9 ''; }; services.sxhkd = { enable = true; - package = pkgs.unstable.sxhkd; + package = sxhkd; keybindings = let - bspc = lib.getExe' pkgs.unstable.bspwm "bspc"; + bspc = getExe' bspwm "bspc"; in { # Program hotkeys. - "alt + Tab" = "${lib.getExe pkgs.unstable.rofi} -show window"; - "super + r" = "${lib.getExe pkgs.unstable.rofi} -show drun"; - "super + x" = "${lib.getExe pkgs.unstable.alacritty}"; + "alt + Tab" = "${getExe rofi} -show window"; + "super + r" = "${getExe rofi} -show drun"; + "super + x" = getExe alacritty; "super + b" = "$BROWSER"; "super + p" = "snapshot -f"; "super + shift + p" = "snapshot"; @@ -66,12 +70,12 @@ "super + alt + {q,r}" = "${bspc} {quit,wm -r}"; # Function hotkeys. - "XF86AudioPrev" = "${lib.getExe pkgs.unstable.mpc} prev"; - "XF86AudioNext" = "${lib.getExe pkgs.unstable.mpc} next"; - "XF86AudioPlay" = "${lib.getExe pkgs.unstable.mpc} toggle"; - "XF86AudioLowerVolume" = "${lib.getExe pkgs.unstable.pamixer} -d 5"; - "XF86AudioRaiseVolume" = "${lib.getExe pkgs.unstable.pamixer} -i 5"; - "XF86AudioMute" = "${lib.getExe pkgs.pamixer} -t"; + "XF86AudioPrev" = "${getExe mpc} prev"; + "XF86AudioNext" = "${getExe mpc} next"; + "XF86AudioPlay" = "${getExe mpc} toggle"; + "XF86AudioLowerVolume" = "${getExe pamixer} -d 5"; + "XF86AudioRaiseVolume" = "${getExe pamixer} -i 5"; + "XF86AudioMute" = "${getExe pamixer} -t"; # Manipulate window manager. "super + q" = "${bspc} node -{c,k}"; @@ -93,14 +97,14 @@ }; # Generate X11 init scripts. - home.file = with pkgs.unstable.xorg; { + home.file = { ".xinitrc".text = '' [ -f ~/.xprofile ] && . ~/.xprofile - [ -f ~/.Xresources ] && ${lib.getExe xrdb} -merge ~/.Xresources - exec ${lib.getExe' pkgs.unstable.bspwm "bspwm"} + [ -f ~/.Xresources ] && ${getExe xorg.xrdb} -merge ~/.Xresources + exec ${getExe' bspwm "bspwm"} ''; ".xprofile".text = - "${lib.getExe xrandr} --output DP-0 --primary --mode 1920x1080 --rotate normal --rate 165"; + "${getExe xorg.xrandr} --output DP-0 --primary --mode 1920x1080 --rotate normal --rate 165"; ".Xresources".text = "Xcursor.size: 24"; }; } -- cgit v1.2.3