From 8fcc7d718e6f866ec07742e67d11134653ecb0ed Mon Sep 17 00:00:00 2001 From: Gerg-L Date: Thu, 13 Mar 2025 19:26:00 -0400 Subject: [PATCH] xorg cleanup --- nixosConfigurations/gerg-desktop/main.nix | 11 ++- nixosConfigurations/media-laptop/main.nix | 10 +-- nixosModules/DE/dwm.nix | 94 +++++++++++------------ nixosModules/DE/xfce.nix | 10 +-- nixosModules/DM/autoLogin.nix | 19 ----- nixosModules/DM/lightDM.nix | 2 +- nixosModules/X11.nix | 1 + 7 files changed, 61 insertions(+), 86 deletions(-) delete mode 100644 nixosModules/DM/autoLogin.nix diff --git a/nixosConfigurations/gerg-desktop/main.nix b/nixosConfigurations/gerg-desktop/main.nix index c7db2bb..6221e67 100644 --- a/nixosConfigurations/gerg-desktop/main.nix +++ b/nixosConfigurations/gerg-desktop/main.nix @@ -9,11 +9,7 @@ { local = { DE.dwm.enable = true; - DM = { - lightdm.enable = true; - autoLogin = true; - loginUser = "gerg"; - }; + DM.lightdm.enable = true; theming = { enable = true; kmscon.enable = true; @@ -114,7 +110,10 @@ ''; }; - services.libinput.mouse.accelProfile = "flat"; + services.displayManager.autoLogin = { + enable = true; + user = "gerg"; + }; programs = { steam.enable = true; diff --git a/nixosConfigurations/media-laptop/main.nix b/nixosConfigurations/media-laptop/main.nix index 7a03148..0e0c909 100644 --- a/nixosConfigurations/media-laptop/main.nix +++ b/nixosConfigurations/media-laptop/main.nix @@ -7,11 +7,7 @@ { local = { remoteBuild.enable = true; - DM = { - lightdm.enable = true; - autoLogin = true; - loginUser = "media"; - }; + DM.lightdm.enable = true; DE.xfce.enable = true; theming = { enable = true; @@ -35,6 +31,10 @@ sops.secrets.root.neededForUsers = true; + services.displayManager.autoLogin = { + enable = true; + user = "media"; + }; users = { mutableUsers = false; users = { diff --git a/nixosModules/DE/dwm.nix b/nixosModules/DE/dwm.nix index c869fab..ce19a16 100644 --- a/nixosModules/DE/dwm.nix +++ b/nixosModules/DE/dwm.nix @@ -38,36 +38,62 @@ sxhkd = { wantedBy = [ "graphical-session.target" ]; partOf = [ "graphical-session.target" ]; - serviceConfig = { - ExecStart = "${lib.getExe pkgs.sxhkd} -c /etc/sxhkd/sxhkdrc"; - Restart = "always"; - RestartSec = 2; - ExecReload = "pkill -usr1 -x $MAINPID"; - }; + serviceConfig = + let + configFile = pkgs.writeText "sxhkdrc" '' + XF86AudioPlay + playerctl play-pause + XF86AudioPause + playerctl play-pause + XF86AudioStop + playerctl stop + XF86AudioNext + playerctl next + XF86AudioPrev + playerctl previous + XF86AudioRaiseVolume + wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+ + XF86AudioLowerVolume + wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%- + XF86AudioMute + wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + Print + maim $HOME/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg + Print + shift + maim | xclip -selection clipboard -t image/png + super + Print + maim -s $HOME/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg + super + Print + shift + maim -s | xclip -selection clipboard -t image/png + super + ctrl + r + pkill -usr1 -x sxhkd + super + ctrl + l + xsecurelock + ''; + in + + { + ExecStart = "${lib.getExe pkgs.sxhkd} -c '${configFile}'"; + Restart = "always"; + RestartSec = 2; + ExecReload = "pkill -usr1 -x $MAINPID"; + }; }; picom = { wantedBy = [ "graphical-session.target" ]; partOf = [ "graphical-session.target" ]; - serviceConfig = { - ExecStart = "${lib.getExe pkgs.picom} --backend egl"; - Restart = "always"; - RestartSec = 2; - ExecReload = "pkill -usr1 -x $MAINPID"; - }; + serviceConfig.ExecStart = "${lib.getExe pkgs.picom} --backend egl"; }; }; services = { - gvfs.enable = true; displayManager.defaultSession = "none+dwm"; xserver = { enable = true; - displayManager = { - sessionCommands = '' - feh --bg-center "${self'.packages.images}/recursion.png" - numlockx - ''; - }; + displayManager.sessionCommands = '' + feh --bg-center "${self'.packages.images}/recursion.png" + numlockx + ''; windowManager.session = [ { name = "dwm"; @@ -93,35 +119,5 @@ }; }; - environment.etc."sxhkd/sxhkdrc".text = '' - XF86AudioPlay - playerctl play-pause - XF86AudioPause - playerctl play-pause - XF86AudioStop - playerctl stop - XF86AudioNext - playerctl next - XF86AudioPrev - playerctl previous - XF86AudioRaiseVolume - wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+ - XF86AudioLowerVolume - wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%- - XF86AudioMute - wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle - Print - maim $HOME/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg - Print + shift - maim | xclip -selection clipboard -t image/png - super + Print - maim -s $HOME/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg - super + Print + shift - maim -s | xclip -selection clipboard -t image/png - super + ctrl + r - pkill -usr1 -x sxhkd - super + ctrl + l - xsecurelock - ''; }; } diff --git a/nixosModules/DE/xfce.nix b/nixosModules/DE/xfce.nix index 57fafbf..fb941c8 100644 --- a/nixosModules/DE/xfce.nix +++ b/nixosModules/DE/xfce.nix @@ -8,13 +8,11 @@ config = lib.mkIf config.local.DE.xfce.enable { environment.systemPackages = [ pkgs.xfce.xfce4-whiskermenu-plugin ]; - services = { - xserver = { + services.xserver = { + enable = true; + desktopManager.xfce = { enable = true; - desktopManager.xfce = { - enable = true; - enableScreensaver = true; - }; + enableScreensaver = true; }; displayManager.defaultSession = "xfce"; }; diff --git a/nixosModules/DM/autoLogin.nix b/nixosModules/DM/autoLogin.nix deleted file mode 100644 index 26c52ac..0000000 --- a/nixosModules/DM/autoLogin.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ config, lib }: -{ - options.local.DM = { - autoLogin = lib.mkEnableOption ""; - loginUser = lib.mkOption { - type = lib.types.nullOr lib.types.str; - default = null; - }; - }; - - config = lib.mkIf config.local.DM.autoLogin { - services.displayManager = { - autoLogin = { - enable = true; - user = config.local.DM.loginUser; - }; - }; - }; -} diff --git a/nixosModules/DM/lightDM.nix b/nixosModules/DM/lightDM.nix index bf73fa7..187010a 100644 --- a/nixosModules/DM/lightDM.nix +++ b/nixosModules/DM/lightDM.nix @@ -14,7 +14,7 @@ extraConfig = "minimum-vt=1"; greeters.mini = { enable = true; - user = config.local.DM.loginUser; + inherit (config.services.displayManager.autoLogin) user; extraConfig = '' [greeter] show-password-label = false diff --git a/nixosModules/X11.nix b/nixosModules/X11.nix index 095c904..942589f 100644 --- a/nixosModules/X11.nix +++ b/nixosModules/X11.nix @@ -1,5 +1,6 @@ { pkgs, lib }: { + services.libinput.mouse.accelProfile = "flat"; services.xserver = { tty = lib.mkDefault 1; exportConfiguration = true;