From f8223622fed02aef1075d41e4dba090df81bf6c1 Mon Sep 17 00:00:00 2001 From: brustybee Date: Fri, 3 Apr 2026 18:17:46 +0530 Subject: YEP. --- common/modules/bspwm/default.nix | 179 ------------------------------- common/modules/default.nix | 3 +- common/modules/dwm/default.nix | 202 ----------------------------------- common/modules/dwm/picom.nix | 60 ----------- common/modules/mango/default.nix | 4 +- common/modules/matugen/default.nix | 7 +- common/modules/x11/bspwm/default.nix | 179 +++++++++++++++++++++++++++++++ common/modules/x11/default.nix | 172 +++++++++++++++++++++++++++++ common/modules/x11/dwm/default.nix | 65 +++++++++++ common/modules/x11/picom.nix | 63 +++++++++++ 10 files changed, 485 insertions(+), 449 deletions(-) delete mode 100644 common/modules/bspwm/default.nix delete mode 100644 common/modules/dwm/default.nix delete mode 100644 common/modules/dwm/picom.nix create mode 100644 common/modules/x11/bspwm/default.nix create mode 100644 common/modules/x11/default.nix create mode 100644 common/modules/x11/dwm/default.nix create mode 100644 common/modules/x11/picom.nix (limited to 'common') diff --git a/common/modules/bspwm/default.nix b/common/modules/bspwm/default.nix deleted file mode 100644 index e001c5d..0000000 --- a/common/modules/bspwm/default.nix +++ /dev/null @@ -1,179 +0,0 @@ -{ - homeManager, - inputs, - moduleNameSpace, - ... -}: -{ - config, - lib, - pkgs, - ... -}: -let - cfg = config.${moduleNameSpace}.bspwm; - snip = pkgs.writeShellScript "snip" '' - case $1 in - full) - ${pkgs.maim}/bin/maim | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png - ;; - selection) - ${pkgs.maim}/bin/maim -s | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png - ;; - esac - ''; - - smart-alacritty = pkgs.writeShellScript "smart-alacritty" '' - alacritty msg create-window || exec alacritty - ''; - - smart-ghostty = pkgs.writeShellScript "smart-ghostty" '' - ghostty +new-window || exec ghostty - ''; - - terminal = - if config.beeMods.terminal.default == "alacritty" then - "${smart-alacritty}" - else if config.beeMods.terminal.default == "ghostty" then - "${smart-ghostty}" - else - "st"; -in -{ - options.${moduleNameSpace}.bspwm = { - enable = lib.mkEnableOption "bspwm setup"; - }; - - config = lib.mkIf cfg.enable ( - if homeManager then - { - xsession.windowManager.bspwm = { - enable = true; - monitors = { - "eDP" = [ - "1" - "2" - "3" - "4" - "5" - "6" - "7" - "8" - "9" - ]; - }; - - rules = { - "Alacritty" = { - desktop = "^1"; - follow = true; - }; - "ghostty" = { - desktop = "^1"; - follow = true; - }; - "zen" = { - desktop = "^2"; - follow = true; - }; - "firefox" = { - desktop = "^2"; - follow = true; - }; - "vesktop" = { - desktop = "^3"; - follow = true; - }; - "discord" = { - desktop = "^3"; - follow = true; - }; - "steam" = { - desktop = "^4"; - follow = true; - }; - }; - - settings = { - border_width = 2; - window_gap = 5; - split_ratio = 0.55; - click_to_focus = "any"; - pointer_modifier = "mod4"; - pointer_action1 = "move"; - pointer_action2 = "resize_side"; - pointer_action3 = "resize_corner"; - focus_follows_pointer = true; - }; - - extraConfig = '' - [ -f ~/.config/bspwm/colors ] && . ~/.config/bspwm/colors - ''; - - startupPrograms = [ - "feh --no-fehbg --bg-fill $(rg wallpaper ~/.config/beeSettings | cut -d'=' -f2)" - "xsetroot -cursor_name left_ptr" - "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1" - "gnome-keyring-daemon --start --components=secrets,ssh,pkcs11" - "xrandr --output eDP --set TearFree on" - ]; - }; - - services.sxhkd = { - enable = true; - keybindings = { - "super + Return" = terminal; - "super + r" = "pkill -USR1 -x sxhkd; bspc wm -r"; - "super + q" = "bspc node -c"; - "super + m" = "bspc quit"; - - "super + a" = "rofi -show drun"; - "super + period" = "rofi -show emoji -modi emoji"; - "alt + F4" = "rofi -show power-menu -modi power-menu:rofi-power-menu"; - "super + y" = "beesettings wall"; - "super + comma" = "beesettings settings"; - "super + b" = "zen"; - "super + e" = "nautilus"; - "super + F12" = "gnome-calculator"; - - "Print" = "${snip} full"; - "super + Print" = "${snip} selection"; - - "super + {h,j,k,l}" = "bspc node -f {west,south,north,east}"; - "super + shift + {h,j,k,l}" = "bspc node -s {west,south,north,east}"; - "super + {Left,Down,Up,Right}" = "bspc node -v {-50 0,0 50,0 -50,50 0}"; - - "super + space" = "bspc node -t ~floating"; - "alt + f" = "bspc node -t ~fullscreen"; - "super + i" = "bspc node -g hidden=on"; - - "super + shift + i" = "bspc node any.hidden.local -g hidden=off"; - - "super + {1-9}" = "bspc desktop -f '^{1-9}'"; - "super + shift + {1-9}" = "bspc node -d '^{1-9}'"; - - "XF86AudioRaiseVolume" = "volume-control up"; - "XF86AudioLowerVolume" = "volume-control down"; - "XF86AudioMute" = "volume-control mute"; - "XF86AudioMicMute" = "mic-control toggle"; - "XF86MonBrightnessUp" = "brightness-control up"; - "XF86MonBrightnessDown" = "brightness-control down"; - - "XF86Audio{Play,Next,Prev,Stop}" = "playerctl {play-pause,next,previous,stop}"; - - "alt + h" = "bspc node -z left -50 0 || bspc node -z right -50 0"; - "alt + j" = "bspc node -z bottom 0 50 || bspc node -z top 0 50"; - "alt + k" = "bspc node -z top 0 -50 || bspc node -z bottom 0 -50"; - "alt + l" = "bspc node -z right 50 0 || bspc node -z left 50 0"; - "alt + a" = "bspc desktop -l next"; - }; - }; - } - else - { - services.xserver = { - windowManager.bspwm.enable = true; - }; - } - ); -} diff --git a/common/modules/default.nix b/common/modules/default.nix index bd9b4d6..d093757 100644 --- a/common/modules/default.nix +++ b/common/modules/default.nix @@ -10,8 +10,7 @@ let }; modules = { mango = import ./mango args; - dwm = import ./dwm args; - bspwm = import ./bspwm args; + x11 = import ./x11 args; terminal = import ./terminal args; beevim = import ./beevim args; matugen = import ./matugen args; diff --git a/common/modules/dwm/default.nix b/common/modules/dwm/default.nix deleted file mode 100644 index 8141dbf..0000000 --- a/common/modules/dwm/default.nix +++ /dev/null @@ -1,202 +0,0 @@ -{ - homeManager, - inputs, - moduleNameSpace, - ... -}: -{ - config, - lib, - pkgs, - ... -}: -let - cfg = config.${moduleNameSpace}.dwm; -in -{ - imports = lib.optionals homeManager [ ./picom.nix ]; - - options.${moduleNameSpace}.dwm = { - enable = lib.mkEnableOption "dwm setup"; - picom = { - enable = lib.mkEnableOption "enable picom compositor"; - animations = lib.mkEnableOption "enable animations"; - shadow = lib.mkEnableOption "enable shadows"; - window = { - opacity = { - active = lib.mkOption { - type = lib.types.float; - default = 1.0; - }; - inactive = lib.mkOption { - type = lib.types.float; - default = 1.0; - }; - }; - blur = { - enable = lib.mkEnableOption "Enable window blur"; - strength = lib.mkOption { - type = lib.types.int; - default = 1; - }; - size = lib.mkOption { - type = lib.types.int; - default = 10; - }; - }; - }; - }; - }; - - config = lib.mkIf cfg.enable ( - if !homeManager then - { - services.xserver = { - enable = true; - autoRepeatDelay = 300; - autoRepeatInterval = 20; - excludePackages = with pkgs; [ xterm ]; - displayManager.sessionCommands = '' - ${pkgs.systemd}/bin/systemctl --user import-environment DISPLAY XAUTHORITY XDG_SESSION_TYPE - ${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY XAUTHORITY XDG_SESSION_TYPE - ''; - windowManager.dwm = { - enable = true; - package = inputs.mydwm.packages.${pkgs.stdenv.hostPlatform.system}.default; - }; - }; - - programs.ssh.askPassword = ""; - - security.pam.services.betterlockscreen = { }; - security.pam.services.i3lock = { }; - - programs.i3lock = { - enable = true; - package = pkgs.i3lock-color; - }; - } - else - { - xdg.dataFile."dwm/autostart.sh" = { - executable = true; - text = '' - #!${pkgs.bash}/bin/bash - - gnome-keyring-daemon --start --components=secrets,ssh,pkcs11 & - ${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1 & - - feh --no-fehbg --bg-fill "$(rg wallpaper ~/.config/beeSettings | cut -d"=" -f2)" - [ -f ~/.Xresources ] && xrdb -merge ~/.Xresources - - dunst & - clipcatd & - slstatus & - ${lib.optionalString (!cfg.picom.enable) '' - xrandr --output eDP --set TearFree on - ''} - ${lib.optionalString (cfg.picom.enable) '' - systemctl --user restart picom.service - ''} - - systemctl --user restart xidlehook.service xautolock-session.service xss-lock.service clipcat.service - ${lib.optionalString (config.beeMods.mango.waybar) '' - systemctl --user stop waybar.service - ''} - ${lib.optionalString (config.beeMods.mango.enable) '' - systemctl --user stop swayidle.service - ''} - ''; - }; - - services.clipcat = { - enable = true; - daemonSettings = { - daemonize = false; - max_history = 50; - desktop_notification = { - enable = false; - }; - }; - menuSettings = { - server_endpoint = "/run/user/1000/clipcat/grpc.sock"; - finder = "rofi"; - - rofi = { - menu_length = 10; - line_length = 100; - menu_prompt = "Clipboard"; - extra_arguments = [ ]; - }; - }; - }; - - services.screen-locker = { - enable = true; - inactiveInterval = 5; - lockCmd = "${pkgs.betterlockscreen}/bin/betterlockscreen -l"; - - xss-lock.extraOptions = [ - "-n" - "--transfer-sleep-lock" - ]; - }; - - services.xidlehook = { - enable = true; - timers = [ - { - delay = 270; - command = "${pkgs.brightnessctl}/bin/brightnessctl g > /tmp/brightness_prev && ${pkgs.brightnessctl}/bin/brightnessctl set 10%"; - canceller = "${pkgs.brightnessctl}/bin/brightnessctl set $(${pkgs.coreutils}/bin/cat /tmp/brightness_prev 2>/dev/null || echo 100%)"; - } - { - delay = 900; - command = "systemctl suspend"; - canceller = ""; - } - ]; - }; - - systemd.user.services.clipcat = { - Unit = { - ConditionEnvironment = [ "XDG_SESSION_TYPE=x11" ]; - }; - - }; - systemd.user.services.xidlehook = { - Unit = { - ConditionEnvironment = [ "XDG_SESSION_TYPE=x11" ]; - }; - }; - - systemd.user.services.xautolock-session = { - Unit = { - ConditionEnvironment = [ "XDG_SESSION_TYPE=x11" ]; - }; - }; - - systemd.user.services.xss-lock = { - Unit = { - ConditionEnvironment = [ "XDG_SESSION_TYPE=x11" ]; - }; - }; - - xresources.extraConfig = lib.mkIf config.beeMods.matugen.enable '' - #include "${config.xdg.configHome}/x11/matugen.Xresources" - ''; - xresources.properties = { - "Xft.dpi" = 96; - "Xft.autohint" = 0; - "Xft.antialias" = true; - "Xft.hinting" = true; - "Xft.lcdfilter" = "lcddefault"; - "Xft.hintstyle" = "hintfull"; - "Xft.rgba" = "rgb"; - "st.font" = - "${config.beeMods.terminal.font.family}:size=${toString config.beeMods.terminal.font.size}:antialias=true:autohint=true"; - "st.borderpx" = 5; - }; - } - ); -} diff --git a/common/modules/dwm/picom.nix b/common/modules/dwm/picom.nix deleted file mode 100644 index b338df8..0000000 --- a/common/modules/dwm/picom.nix +++ /dev/null @@ -1,60 +0,0 @@ -{ config, lib, ... }: -let - cfg = config.beeMods.dwm.picom; -in -{ - config = lib.mkIf cfg.enable { - services.picom = { - enable = true; - backend = "glx"; - vSync = true; - - activeOpacity = if cfg.window.blur.enable then 0.82 else cfg.window.opacity.active; - inactiveOpacity = if cfg.window.blur.enable then 0.82 else cfg.window.opacity.inactive; - - opacityRules = [ - "100:fullscreen" - "100:_NET_WM_STATE@:32a *= '_NET_WM_STATE_FULLSCREEN'" - ]; - settings = { - blur = { - method = "dual_kawase"; - strength = cfg.window.blur.strength; - size = cfg.window.blur.size; - }; - blur-background = cfg.window.blur.enable; - blur-background-exclude = [ - "window_type = 'dock'" - "window_type = 'desktop'" - "class_g = 'slop'" - "class_g = 'dwm'" - "_GTK_FRAME_EXTENTS@" - "fullscreen" - "_NET_WM_STATE@:32a *= '_NET_WM_STATE_FULLSCREEN'" - ]; - - # xrender-sync-fence = true; - use-damage = true; - - unredir-if-possible = true; - - detect-transient = true; - detect-client-opacity = true; - mark-wmwin-focused = true; - mark-ovredir-focused = true; - detect-rounded-corners = true; - - shadow = cfg.shadow; - fading = false; - animations = cfg.animations; - }; - }; - - # systemd.user.services.picom.Install.wantedBy = lib.mkForce [ ]; - systemd.user.services.picom = { - Unit = { - ConditionEnvironment = "XDG_SESSION_TYPE=x11"; - }; - }; - }; -} diff --git a/common/modules/mango/default.nix b/common/modules/mango/default.nix index ec675aa..9ab5fc4 100644 --- a/common/modules/mango/default.nix +++ b/common/modules/mango/default.nix @@ -412,14 +412,14 @@ in awww-daemon -q & ${settings-persist} - ${lib.optionalString (config.beeMods.dwm.enable) '' + ${lib.optionalString (config.beeMods.x11.dwm.enable || config.beeMods.x11.bspwm.enable) '' systemctl --user stop xidlehook.service systemctl --user stop xautolock-session.service systemctl --user stop xss-lock.service systemctl --user stop clipcat.service ''} - ${lib.optionalString (config.beeMods.dwm.picom.enable) '' + ${lib.optionalString (config.beeMods.x11.picom.enable) '' systemctl --user stop picom.service ''} ''; diff --git a/common/modules/matugen/default.nix b/common/modules/matugen/default.nix index de39a06..a9aaaae 100644 --- a/common/modules/matugen/default.nix +++ b/common/modules/matugen/default.nix @@ -59,7 +59,7 @@ in template = "userChrome.css"; target = "~/.cache/wallust/userChrome.css"; }; - xresources = lib.mkIf config.beeMods.dwm.enable { + xresources = lib.mkIf (config.beeMods.x11.dwm.enable || config.beeMods.x11.bspwm.enable) { template = "colors-xresources"; target = "~/.config/x11/matugen.Xresources"; }; @@ -132,13 +132,12 @@ in output_path = '~/.config/yazi/theme.toml' ''} - ${lib.optionalString config.beeMods.dwm.enable '' + ${lib.optionalString (config.beeMods.x11.dwm.enable || config.beeMods.x11.bspwm.enable) '' [templates.Xresources] input_path = "~/.config/matugen/templates/colors-xresources" output_path = "~/.config/wallust/templates/colors-xresources" ''} - ${lib.optionalString config.programs.vesktop.enable '' [templates.vesktop] input_path = "~/.config/matugen/templates/vesktop.css" @@ -191,7 +190,7 @@ in '' } - ${lib.optionalString config.beeMods.bspwm.enable '' + ${lib.optionalString config.beeMods.x11.bspwm.enable '' [templates.bspwm] input_path = "~/.config/matugen/templates/bspwm-colors" output_path = "~/.config/bspwm/colors" diff --git a/common/modules/x11/bspwm/default.nix b/common/modules/x11/bspwm/default.nix new file mode 100644 index 0000000..8072fe2 --- /dev/null +++ b/common/modules/x11/bspwm/default.nix @@ -0,0 +1,179 @@ +{ + homeManager, + inputs, + moduleNameSpace, + ... +}: +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.${moduleNameSpace}.x11.bspwm; + snip = pkgs.writeShellScript "snip" '' + case $1 in + full) + ${pkgs.maim}/bin/maim | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png + ;; + selection) + ${pkgs.maim}/bin/maim -s | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png + ;; + esac + ''; + + smart-alacritty = pkgs.writeShellScript "smart-alacritty" '' + alacritty msg create-window || exec alacritty + ''; + + smart-ghostty = pkgs.writeShellScript "smart-ghostty" '' + ghostty +new-window || exec ghostty + ''; + + terminal = + if config.beeMods.terminal.default == "alacritty" then + "${smart-alacritty}" + else if config.beeMods.terminal.default == "ghostty" then + "${smart-ghostty}" + else + "st"; +in +{ + options.${moduleNameSpace}.x11.bspwm = { + enable = lib.mkEnableOption "bspwm setup"; + }; + + config = lib.mkIf cfg.enable ( + if homeManager then + { + xsession.windowManager.bspwm = { + enable = true; + monitors = { + "eDP" = [ + "1" + "2" + "3" + "4" + "5" + "6" + "7" + "8" + "9" + ]; + }; + + rules = { + "Alacritty" = { + desktop = "^1"; + follow = true; + }; + "ghostty" = { + desktop = "^1"; + follow = true; + }; + "zen" = { + desktop = "^2"; + follow = true; + }; + "firefox" = { + desktop = "^2"; + follow = true; + }; + "vesktop" = { + desktop = "^3"; + follow = true; + }; + "discord" = { + desktop = "^3"; + follow = true; + }; + "steam" = { + desktop = "^4"; + follow = true; + }; + }; + + settings = { + border_width = 2; + window_gap = 5; + split_ratio = 0.55; + click_to_focus = "any"; + pointer_modifier = "mod4"; + pointer_action1 = "move"; + pointer_action2 = "resize_side"; + pointer_action3 = "resize_corner"; + focus_follows_pointer = true; + }; + + extraConfig = lib.optionalString config.beeMods.matugen.enable '' + [ -f ~/.config/bspwm/colors ] && . ~/.config/bspwm/colors + ''; + + startupPrograms = [ + "feh --no-fehbg --bg-fill $(rg wallpaper ~/.config/beeSettings | cut -d'=' -f2)" + "xsetroot -cursor_name left_ptr" + "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1" + "gnome-keyring-daemon --start --components=secrets,ssh,pkcs11" + "xrandr --output eDP --set TearFree on" + ]; + }; + + services.sxhkd = { + enable = true; + keybindings = { + "super + Return" = terminal; + "super + r" = "pkill -USR1 -x sxhkd; bspc wm -r"; + "super + q" = "bspc node -c"; + "super + m" = "bspc quit"; + + "super + a" = "rofi -show drun"; + "super + period" = "rofi -show emoji -modi emoji"; + "alt + F4" = "rofi -show power-menu -modi power-menu:rofi-power-menu"; + "super + y" = "beesettings wall"; + "super + comma" = "beesettings settings"; + "super + b" = "zen"; + "super + e" = "nautilus"; + "super + F12" = "gnome-calculator"; + + "Print" = "${snip} full"; + "super + Print" = "${snip} selection"; + + "super + {h,j,k,l}" = "bspc node -f {west,south,north,east}"; + "super + shift + {h,j,k,l}" = "bspc node -s {west,south,north,east}"; + "super + {Left,Down,Up,Right}" = "bspc node -v {-50 0,0 50,0 -50,50 0}"; + + "super + space" = "bspc node -t ~floating"; + "alt + f" = "bspc node -t ~fullscreen"; + "super + i" = "bspc node -g hidden=on"; + + "super + shift + i" = "bspc node any.hidden.local -g hidden=off"; + + "super + {1-9}" = "bspc desktop -f '^{1-9}'"; + "super + shift + {1-9}" = "bspc node -d '^{1-9}'"; + + "XF86AudioRaiseVolume" = "volume-control up"; + "XF86AudioLowerVolume" = "volume-control down"; + "XF86AudioMute" = "volume-control mute"; + "XF86AudioMicMute" = "mic-control toggle"; + "XF86MonBrightnessUp" = "brightness-control up"; + "XF86MonBrightnessDown" = "brightness-control down"; + + "XF86Audio{Play,Next,Prev,Stop}" = "playerctl {play-pause,next,previous,stop}"; + + "alt + h" = "bspc node -z left -50 0 || bspc node -z right -50 0"; + "alt + j" = "bspc node -z bottom 0 50 || bspc node -z top 0 50"; + "alt + k" = "bspc node -z top 0 -50 || bspc node -z bottom 0 -50"; + "alt + l" = "bspc node -z right 50 0 || bspc node -z left 50 0"; + "alt + a" = "bspc desktop -l next"; + }; + }; + } + else + { + services.xserver = { + windowManager.bspwm.enable = true; + }; + } + ); +} diff --git a/common/modules/x11/default.nix b/common/modules/x11/default.nix new file mode 100644 index 0000000..b619c9a --- /dev/null +++ b/common/modules/x11/default.nix @@ -0,0 +1,172 @@ +{ + homeManager, + inputs, + moduleNameSpace, + ... +}: +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.${moduleNameSpace}.x11; + args = { + inherit inputs homeManager moduleNameSpace; + }; +in +{ + imports = [ + (import ./bspwm args) + (import ./dwm args) + (import ./picom.nix homeManager) + ]; + + options.${moduleNameSpace}.x11 = { + picom = { + enable = lib.mkEnableOption "enable picom compositor"; + animations = lib.mkEnableOption "enable animations"; + shadow = lib.mkEnableOption "enable shadows"; + window = { + opacity = { + active = lib.mkOption { + type = lib.types.float; + default = 1.0; + }; + inactive = lib.mkOption { + type = lib.types.float; + default = 1.0; + }; + }; + blur = { + enable = lib.mkEnableOption "Enable window blur"; + strength = lib.mkOption { + type = lib.types.int; + default = 1; + }; + size = lib.mkOption { + type = lib.types.int; + default = 10; + }; + }; + }; + }; + }; + + config = lib.mkIf (cfg.dwm.enable || cfg.bspwm.enable) ( + if !homeManager then + { + services.xserver = { + enable = true; + autoRepeatDelay = 300; + autoRepeatInterval = 20; + excludePackages = with pkgs; [ xterm ]; + displayManager.sessionCommands = '' + ${pkgs.systemd}/bin/systemctl --user import-environment DISPLAY XAUTHORITY XDG_SESSION_TYPE + ${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY XAUTHORITY XDG_SESSION_TYPE + ''; + }; + + programs.ssh.askPassword = ""; + security.pam.services.betterlockscreen = { }; + security.pam.services.i3lock = { }; + + programs.i3lock = { + enable = true; + package = pkgs.i3lock-color; + }; + } + else + { + services.clipcat = { + enable = true; + daemonSettings = { + daemonize = false; + max_history = 50; + desktop_notification = { + enable = false; + }; + }; + menuSettings = { + server_endpoint = "/run/user/1000/clipcat/grpc.sock"; + finder = "rofi"; + + rofi = { + menu_length = 10; + line_length = 100; + menu_prompt = "Clipboard"; + extra_arguments = [ ]; + }; + }; + }; + + services.screen-locker = { + enable = true; + inactiveInterval = 5; + lockCmd = "${pkgs.betterlockscreen}/bin/betterlockscreen -l"; + + xss-lock.extraOptions = [ + "-n" + "--transfer-sleep-lock" + ]; + }; + + services.xidlehook = { + enable = true; + timers = [ + { + delay = 270; + command = "${pkgs.brightnessctl}/bin/brightnessctl g > /tmp/brightness_prev && ${pkgs.brightnessctl}/bin/brightnessctl set 10%"; + canceller = "${pkgs.brightnessctl}/bin/brightnessctl set $(${pkgs.coreutils}/bin/cat /tmp/brightness_prev 2>/dev/null || echo 100%)"; + } + { + delay = 900; + command = "systemctl suspend"; + canceller = ""; + } + ]; + }; + + systemd.user.services.clipcat = { + Unit = { + ConditionEnvironment = [ "XDG_SESSION_TYPE=x11" ]; + }; + + }; + systemd.user.services.xidlehook = { + Unit = { + ConditionEnvironment = [ "XDG_SESSION_TYPE=x11" ]; + }; + }; + + systemd.user.services.xautolock-session = { + Unit = { + ConditionEnvironment = [ "XDG_SESSION_TYPE=x11" ]; + }; + }; + + systemd.user.services.xss-lock = { + Unit = { + ConditionEnvironment = [ "XDG_SESSION_TYPE=x11" ]; + }; + }; + + xresources.extraConfig = lib.mkIf config.beeMods.matugen.enable '' + #include "${config.xdg.configHome}/x11/matugen.Xresources" + ''; + xresources.properties = { + "Xft.dpi" = 96; + "Xft.autohint" = 0; + "Xft.antialias" = true; + "Xft.hinting" = true; + "Xft.lcdfilter" = "lcddefault"; + "Xft.hintstyle" = "hintfull"; + "Xft.rgba" = "rgb"; + "st.font" = + "${config.beeMods.terminal.font.family}:size=${toString config.beeMods.terminal.font.size}:antialias=true:autohint=true"; + "st.borderpx" = 5; + }; + } + ); +} diff --git a/common/modules/x11/dwm/default.nix b/common/modules/x11/dwm/default.nix new file mode 100644 index 0000000..8444c7f --- /dev/null +++ b/common/modules/x11/dwm/default.nix @@ -0,0 +1,65 @@ +{ + homeManager, + inputs, + moduleNameSpace, + ... +}: +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.${moduleNameSpace}.x11.dwm; +in +{ + options.${moduleNameSpace}.x11.dwm = { + enable = lib.mkEnableOption "dwm setup"; + }; + + config = lib.mkIf cfg.enable ( + if !homeManager then + { + services.xserver = { + windowManager.dwm = { + enable = true; + package = inputs.mydwm.packages.${pkgs.stdenv.hostPlatform.system}.default; + }; + }; + } + else + { + xdg.dataFile."dwm/autostart.sh" = { + executable = true; + text = '' + #!${pkgs.bash}/bin/bash + + gnome-keyring-daemon --start --components=secrets,ssh,pkcs11 & + ${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1 & + + feh --no-fehbg --bg-fill "$(rg wallpaper ~/.config/beeSettings | cut -d"=" -f2)" + [ -f ~/.Xresources ] && xrdb -merge ~/.Xresources + + dunst & + clipcatd & + slstatus & + ${lib.optionalString (!config.beeMods.x11.picom.enable) '' + xrandr --output eDP --set TearFree on + ''} + ${lib.optionalString (config.beeMods.x11.picom.enable) '' + systemctl --user restart picom.service + ''} + + systemctl --user restart xidlehook.service xautolock-session.service xss-lock.service clipcat.service + ${lib.optionalString (config.beeMods.mango.waybar) '' + systemctl --user stop waybar.service + ''} + ${lib.optionalString (config.beeMods.mango.enable) '' + systemctl --user stop swayidle.service + ''} + ''; + }; + } + ); +} diff --git a/common/modules/x11/picom.nix b/common/modules/x11/picom.nix new file mode 100644 index 0000000..c1683eb --- /dev/null +++ b/common/modules/x11/picom.nix @@ -0,0 +1,63 @@ +homeManager: +{ config, lib, ... }: +let + cfg = config.beeMods.x11.picom; +in +{ + config = lib.mkIf cfg.enable ( + lib.optionalAttrs homeManager { + services.picom = { + enable = true; + backend = "glx"; + vSync = true; + + activeOpacity = if cfg.window.blur.enable then 0.82 else cfg.window.opacity.active; + inactiveOpacity = if cfg.window.blur.enable then 0.82 else cfg.window.opacity.inactive; + + opacityRules = [ + "100:fullscreen" + "100:_NET_WM_STATE@:32a *= '_NET_WM_STATE_FULLSCREEN'" + ]; + settings = { + blur = { + method = "dual_kawase"; + strength = cfg.window.blur.strength; + size = cfg.window.blur.size; + }; + blur-background = cfg.window.blur.enable; + blur-background-exclude = [ + "window_type = 'dock'" + "window_type = 'desktop'" + "class_g = 'slop'" + "class_g = 'dwm'" + "_GTK_FRAME_EXTENTS@" + "fullscreen" + "_NET_WM_STATE@:32a *= '_NET_WM_STATE_FULLSCREEN'" + ]; + + # xrender-sync-fence = true; + use-damage = true; + + unredir-if-possible = true; + + detect-transient = true; + detect-client-opacity = true; + mark-wmwin-focused = true; + mark-ovredir-focused = true; + detect-rounded-corners = true; + + shadow = cfg.shadow; + fading = false; + animations = cfg.animations; + }; + }; + + # systemd.user.services.picom.Install.wantedBy = lib.mkForce [ ]; + systemd.user.services.picom = { + Unit = { + ConditionEnvironment = "XDG_SESSION_TYPE=x11"; + }; + }; + } + ); +} -- cgit v1.3.1