diff options
| author | brustybee <bee@4d2.org> | 2026-03-11 10:38:51 +0530 |
|---|---|---|
| committer | brustybee <bee@4d2.org> | 2026-03-11 10:38:51 +0530 |
| commit | 6d8eec22cddf0be0c190fb06c88f9fd9e3838757 (patch) | |
| tree | 8d75504041c3a555a01f19002428c75fba190ef4 | |
| parent | 870745197024128e29c4f461a0e09d36dcf348bb (diff) | |
Add dwm
| -rw-r--r-- | common/modules/default.nix | 1 | ||||
| -rw-r--r-- | common/modules/dwm/default.nix | 171 | ||||
| -rw-r--r-- | common/modules/dwm/picom.nix | 58 | ||||
| -rw-r--r-- | common/modules/mango/default.nix | 1 | ||||
| -rw-r--r-- | common/modules/matugen/default.nix | 2 | ||||
| -rw-r--r-- | common/programs/rofi.nix | 2 | ||||
| -rw-r--r-- | flake.lock | 21 | ||||
| -rw-r--r-- | flake.nix | 5 | ||||
| -rw-r--r-- | hosts/nixios/default.nix | 8 | ||||
| -rw-r--r-- | users/bee/default.nix | 11 |
10 files changed, 277 insertions, 3 deletions
diff --git a/common/modules/default.nix b/common/modules/default.nix index bbf3bd9..377ebb1 100644 --- a/common/modules/default.nix +++ b/common/modules/default.nix @@ -10,6 +10,7 @@ let }; modules = { mango = import ./mango args; + dwm = import ./dwm 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 new file mode 100644 index 0000000..4ce4b29 --- /dev/null +++ b/common/modules/dwm/default.nix @@ -0,0 +1,171 @@ +{ + 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 = { + startx.enable = true; + }; + 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 + + dbus-update-activation-environment --systemd --all + systemctl --user import-environment DISPLAY XAUTHORITY + + gnome-keyring-daemon --start --components=secrets,ssh,pkcs11 & + ${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1 & + + if [ -f ~/.fehbg ]; then + sh ~/.fehbg + fi + [ -f ~/.Xresources ] && xrdb -merge ~/.Xresources + + dunst & + clipcatd & + + ${lib.optionalString (cfg.picom.enable) '' + systemctl --user restart picom.service + ''} + ''; + }; + + services.clipcat = { + enable = cfg.enable; + 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 $(cat /tmp/brightness_prev || echo 100%)"; + } + { + delay = 900; + command = "systemctl suspend"; + canceller = ""; + } + ]; + }; + + 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 new file mode 100644 index 0000000..962d3ea --- /dev/null +++ b/common/modules/dwm/picom.nix @@ -0,0 +1,58 @@ +{ config, lib, ... }: +let + cfg = config.beeMods.dwm.picom; +in +{ + services.picom = { + enable = cfg.enable; + backend = "glx"; + vSync = true; + + activeOpacity = if cfg.window.blur.enable then 0.87 else cfg.window.opacity.active; + inactiveOpacity = if cfg.window.blur.enable then 0.87 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 = lib.mkIf cfg.enable { + Unit = { + ConditionEnvironment = "XDG_SESSION_TYPE=x11"; + }; + }; +} diff --git a/common/modules/mango/default.nix b/common/modules/mango/default.nix index e9f6f24..7849a03 100644 --- a/common/modules/mango/default.nix +++ b/common/modules/mango/default.nix @@ -410,6 +410,7 @@ in else { programs.mango.enable = true; + security.pam.services.swaylock = { }; } ); } diff --git a/common/modules/matugen/default.nix b/common/modules/matugen/default.nix index 2d1cdc8..5a16265 100644 --- a/common/modules/matugen/default.nix +++ b/common/modules/matugen/default.nix @@ -134,7 +134,7 @@ in ''} - ${lib.optionalString config.beeMods.mango.enable '' + ${lib.optionalString config.beeMods.dwm.enable '' [templates.Xresources] input_path = "~/.config/matugen/templates/colors-xresources" output_path = "~/.config/wallust/templates/colors-xresources" diff --git a/common/programs/rofi.nix b/common/programs/rofi.nix index 5e785c3..ce335dc 100644 --- a/common/programs/rofi.nix +++ b/common/programs/rofi.nix @@ -54,10 +54,10 @@ fi matugen image "$FULL_PATH" --source-color-index 0 2>/dev/null && wallust -q -s run "$FULL_PATH" 2>/dev/null - sh ~/.config/sequences if [ -z "$WAYLAND_DISPLAY" ] && [ -n "$DISPLAY" ]; then xrdb -merge "$HOME/.Xresources" fi + sh ~/.config/sequences fi '') ]; @@ -278,6 +278,26 @@ "type": "github" } }, + "mydwm": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1773151208, + "narHash": "sha256-8Odt8HdtpYFdn9ag1QRVRH9sL6gSShnth4J8aaAE5ms=", + "ref": "refs/heads/main", + "rev": "3fcff74a65ee87715b09edeff21f796dba654833", + "revCount": 2, + "type": "git", + "url": "https://codeberg.org/brustybee/mydwm" + }, + "original": { + "type": "git", + "url": "https://codeberg.org/brustybee/mydwm" + } + }, "neovim-nightly-overlay": { "inputs": { "flake-parts": "flake-parts", @@ -583,6 +603,7 @@ "flake-parts": "flake-parts_4", "home-manager": "home-manager", "mango": "mango", + "mydwm": "mydwm", "nixpkgs": "nixpkgs_5", "sops-nix": "sops-nix", "zen-browser": "zen-browser" @@ -28,6 +28,11 @@ url = "github:youwen5/zen-browser-flake"; inputs.nixpkgs.follows = "nixpkgs"; }; + mydwm = { + # url = "git+https://codeberg.org/brustybee/mydwm"; + url = "git+file:/home/bee/mydwm"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = diff --git a/hosts/nixios/default.nix b/hosts/nixios/default.nix index 1eb9a86..ca3a6b3 100644 --- a/hosts/nixios/default.nix +++ b/hosts/nixios/default.nix @@ -17,6 +17,12 @@ beeMods ]; + services.logind = { + lidSwitch = "suspend"; + lidSwitchExternalPower = "suspend"; + # settings.Login.LidSwitchIgnoreInhibited = "no"; + }; + # REMOVE LATER virtualisation.vmVariant = { users.users.${user}.password = "1"; @@ -34,10 +40,10 @@ boot.kernelPackages = pkgs.linuxPackages_zen; programs.dconf.enable = true; - security.pam.services.swaylock = { }; beeMods = { mango.enable = true; + dwm.enable = true; }; xdg.portal = lib.mkForce { diff --git a/users/bee/default.nix b/users/bee/default.nix index 64384c6..168613a 100644 --- a/users/bee/default.nix +++ b/users/bee/default.nix @@ -25,6 +25,17 @@ shadows = true; }; }; + dwm = { + enable = true; + picom = { + enable = true; + window = { + blur.enable = true; + blur.strength = 6; + blur.size = 10; + }; + }; + }; mango.waybar = true; beeVim.enable = true; matugen.enable = true; |
