diff options
| author | brustybee <bee@4d2.org> | 2026-03-11 13:48:40 +0530 |
|---|---|---|
| committer | brustybee <bee@4d2.org> | 2026-03-11 13:48:40 +0530 |
| commit | 83f0f303a95277171b5f0d059959af9f4116cdb1 (patch) | |
| tree | 483f5eb7b623290977154e367dc4cde9d72a5dc1 | |
| parent | 6d8eec22cddf0be0c190fb06c88f9fd9e3838757 (diff) | |
add swaylock and swayidle and avoid x11 and wayland services clash
| -rw-r--r-- | common/modules/dwm/default.nix | 39 | ||||
| -rw-r--r-- | common/modules/mango/default.nix | 17 | ||||
| -rw-r--r-- | common/modules/mango/swayidleNdLock.nix | 53 | ||||
| -rw-r--r-- | common/modules/mango/waybar.nix | 9 | ||||
| -rw-r--r-- | common/modules/matugen/default.nix | 2 | ||||
| -rw-r--r-- | common/modules/matugen/templates/matugen-swaylock.nix | 8 | ||||
| -rw-r--r-- | hosts/nixios/default.nix | 2 | ||||
| -rw-r--r-- | users/bee/default.nix | 4 |
8 files changed, 119 insertions, 15 deletions
diff --git a/common/modules/dwm/default.nix b/common/modules/dwm/default.nix index 4ce4b29..0236f1d 100644 --- a/common/modules/dwm/default.nix +++ b/common/modules/dwm/default.nix @@ -96,8 +96,19 @@ in dunst & clipcatd & - ${lib.optionalString (cfg.picom.enable) '' - systemctl --user restart picom.service + ${lib.optionalString (!cfg.picom.enable) '' + xrandr --output eDP --set TearFree on + ''} + + systemctl --user restart xidlehook.service + systemctl --user restart xautolock-session.service + systemctl --user restart xss-lock.service + systemctl --user restart clipcat.service + ${lib.optionalString (config.beeMods.mango.waybar) '' + systemctl --user stop waybar.service + ''} + ${lib.optionalString (config.beeMods.mango.enable) '' + systemctl --user stop swayidle.service ''} ''; }; @@ -151,6 +162,30 @@ in ]; }; + 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" ''; diff --git a/common/modules/mango/default.nix b/common/modules/mango/default.nix index 7849a03..4939824 100644 --- a/common/modules/mango/default.nix +++ b/common/modules/mango/default.nix @@ -44,6 +44,7 @@ in inputs.mango.hmModules.mango ./waybar.nix ./scripts.nix + ./swayidleNdLock.nix ] else [ @@ -258,7 +259,7 @@ in # bind=SUPER,v,spawn,clipvault list | rofi -dmenu -display-columns 2 | clipvault get | wl-copy bind=SUPER,a,spawn,rofi -show drun bind=SUPER,period,spawn,rofi -show emoji -modi emoji - bind=ALT,F4,spawn,wlogout -C ~/.config/wlogout/style.css -l ~/.config/wlogout/layout -b 6 --protocol layer-shell + bind=ALT,F4,spawn,rofi -show power-menu -modi power-menu:rofi-power-menu bind=SUPER,y,spawn,wall-picker bind=SUPER,F12,spawn,gnome-calculator @@ -394,11 +395,19 @@ in autostart_sh = '' wl-clip-persist --clipboard regular & ${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1 & - ${lib.optionalString (config.services.picom.enable) '' - systemctl --user stop picom.service - ''} gnome-keyring-daemon --start --components=secrets,ssh,pkcs11 & swww-daemon -q & + + ${lib.optionalString (config.beeMods.dwm.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) '' + systemctl --user stop picom.service + ''} ''; }; home.packages = with pkgs; [ diff --git a/common/modules/mango/swayidleNdLock.nix b/common/modules/mango/swayidleNdLock.nix new file mode 100644 index 0000000..959ea45 --- /dev/null +++ b/common/modules/mango/swayidleNdLock.nix @@ -0,0 +1,53 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.beeMods.mango; + swaylock_cmd = "${pkgs.swaylock}/bin/swaylock -f -C ~/.config/swaylock/swaylock-colors"; +in +{ + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + wlopm + swaylock + ]; + + services.swayidle = { + enable = true; + systemdTarget = "mango-session.target"; + + events = { + "before-sleep" = swaylock_cmd; + "lock" = swaylock_cmd; + }; + + timeouts = [ + # dim screen at 4:30 + { + timeout = 270; + command = "${pkgs.brightnessctl}/bin/brightnessctl g > /tmp/brightness_prev && ${pkgs.brightnessctl}/bin/brightnessctl set 10%"; + resumeCommand = "${pkgs.brightnessctl}/bin/brightnessctl set $(cat /tmp/brightness_prev || echo 100%)"; + } + # Lock at 5:00 + { + timeout = 300; + command = swaylock_cmd; + } + # Screen off at 10:00 + { + timeout = 600; + command = "${pkgs.wlopm}/bin/wlopm --off '*'"; + resumeCommand = "${pkgs.wlopm}/bin/wlopm --on '*'"; + } + # suspend at 15:00 + { + timeout = 900; + command = "systemctl suspend"; + } + ]; + }; + }; +} diff --git a/common/modules/mango/waybar.nix b/common/modules/mango/waybar.nix index 8ff9996..83f9d9c 100644 --- a/common/modules/mango/waybar.nix +++ b/common/modules/mango/waybar.nix @@ -1,4 +1,9 @@ -{ pkgs, config, ... }: +{ + pkgs, + config, + lib, + ... +}: let screenshot = pkgs.writeShellScript "screenshot" '' GEOM=$(${pkgs.slurp}/bin/slurp -b '#2E2A1E55' -c '#fb751bff') || exit @@ -184,7 +189,7 @@ in "custom/power" = { format = ""; tooltip = false; - on-click = "wlogout -C ~/.config/wlogout/style.css -l ~/.config/wlogout/layout -b 6 --protocol layer-shell"; + on-click = "rofi -show power-menu -modi power-menu:rofi-power-menu"; }; power-profiles-daemon = { diff --git a/common/modules/matugen/default.nix b/common/modules/matugen/default.nix index 5a16265..f52414c 100644 --- a/common/modules/matugen/default.nix +++ b/common/modules/matugen/default.nix @@ -108,7 +108,7 @@ in output_path = '~/.config/zathura/matugen' ''} - ${lib.optionalString config.programs.swaylock.enable '' + ${lib.optionalString config.beeMods.mango.enable '' [templates.swaylock] input_path = '~/.config/matugen/templates/swaylock-colors' output_path = '~/.config/swaylock/swaylock-colors' diff --git a/common/modules/matugen/templates/matugen-swaylock.nix b/common/modules/matugen/templates/matugen-swaylock.nix index 19514cf..723c94e 100644 --- a/common/modules/matugen/templates/matugen-swaylock.nix +++ b/common/modules/matugen/templates/matugen-swaylock.nix @@ -5,14 +5,14 @@ ... }: { - config = lib.mkIf config.programs.swaylock.enable { + config = lib.mkIf config.beeMods.mango.enable { xdg.configFile."matugen/templates/swaylock-colors" = { text = '' - # --- Swaylock Config (Moved from Nix settings) --- show-failed-attempts - indicator-radius=100 - indicator-thickness=7 + indicator-radius=70 + indicator-thickness=9 line-uses-inside + image={{image}} # --- Base Colors --- color={{colors.background.default.hex}} diff --git a/hosts/nixios/default.nix b/hosts/nixios/default.nix index ca3a6b3..3b80350 100644 --- a/hosts/nixios/default.nix +++ b/hosts/nixios/default.nix @@ -20,7 +20,7 @@ services.logind = { lidSwitch = "suspend"; lidSwitchExternalPower = "suspend"; - # settings.Login.LidSwitchIgnoreInhibited = "no"; + settings.Login.LidSwitchIgnoreInhibited = "no"; }; # REMOVE LATER diff --git a/users/bee/default.nix b/users/bee/default.nix index 168613a..bd7edf5 100644 --- a/users/bee/default.nix +++ b/users/bee/default.nix @@ -20,8 +20,11 @@ mango = { enable = true; animations = true; + waybar = true; window = { blur.enable = true; + blur.radius = 10; + blur.passes = 2; shadows = true; }; }; @@ -36,7 +39,6 @@ }; }; }; - mango.waybar = true; beeVim.enable = true; matugen.enable = true; terminal = { |
