diff options
| author | Arpit Chakladar <arpitchakladar@proton.me> | 2026-03-13 20:18:32 +0530 |
|---|---|---|
| committer | Arpit Chakladar <arpitchakladar@proton.me> | 2026-03-13 20:18:32 +0530 |
| commit | 9bdba2ca39d7356f67c2f8f8c13e0f6a973c460b (patch) | |
| tree | 09effa198aedae0281bb7432ffedddf48679596c /modules/desktop | |
| parent | e0c724f14042bd90b9eb5687a351c9945b74fc9b (diff) | |
| download | home-manager-config-9bdba2ca39d7356f67c2f8f8c13e0f6a973c460b.tar.gz home-manager-config-9bdba2ca39d7356f67c2f8f8c13e0f6a973c460b.zip | |
Using i3 instead of bspwm
Diffstat (limited to 'modules/desktop')
| -rw-r--r-- | modules/desktop/bspwm/default.nix | 54 | ||||
| -rw-r--r-- | modules/desktop/default.nix | 5 | ||||
| -rw-r--r-- | modules/desktop/i3/default.nix | 93 | ||||
| -rw-r--r-- | modules/desktop/i3/keybindings.nix | 75 | ||||
| -rw-r--r-- | modules/desktop/polybar/bar/main.nix | 4 | ||||
| -rw-r--r-- | modules/desktop/polybar/default.nix | 1 | ||||
| -rw-r--r-- | modules/desktop/polybar/module/default.nix | 2 | ||||
| -rw-r--r-- | modules/desktop/polybar/module/i3.nix (renamed from modules/desktop/polybar/module/bspwm.nix) | 5 | ||||
| -rw-r--r-- | modules/desktop/xremap/default.nix | 29 | ||||
| -rw-r--r-- | modules/desktop/xremap/keybindings/brightnessctl.nix | 18 | ||||
| -rw-r--r-- | modules/desktop/xremap/keybindings/bspwm.nix | 273 | ||||
| -rw-r--r-- | modules/desktop/xremap/keybindings/kitty.nix | 30 | ||||
| -rw-r--r-- | modules/desktop/xremap/keybindings/maim.nix | 19 | ||||
| -rw-r--r-- | modules/desktop/xremap/keybindings/pamixer.nix | 26 | ||||
| -rw-r--r-- | modules/desktop/xremap/keybindings/playerctl.nix | 12 | ||||
| -rw-r--r-- | modules/desktop/xremap/keybindings/rofi.nix | 12 |
16 files changed, 178 insertions, 480 deletions
diff --git a/modules/desktop/bspwm/default.nix b/modules/desktop/bspwm/default.nix deleted file mode 100644 index 19fdf2a..0000000 --- a/modules/desktop/bspwm/default.nix +++ /dev/null @@ -1,54 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: - -{ - config = lib.mkIf config.desktop.enable { - xsession.windowManager.bspwm.enable = true; - - xsession.windowManager.bspwm.settings = with config.scheme.withHashtag; { - window_gap = 10; - split_ratio = 0.5; - single_monocle = true; - borderless_monocle = false; - gapless_monocle = false; - focus_follows_pointer = true; - pointer_follows_focus = false; - pointer_motion_interval = 40; - pointer_modifier = "mod4"; - pointer_action1 = "resize_side"; - pointer_action2 = "move"; - pointer_action3 = "resize_corner"; - normal_border_color = base02; - active_border_color = base02; - focused_border_color = base03; - }; - - xsession.windowManager.bspwm.rules = { - "floating-termial" = { - state = "floating"; - sticky = true; - rectangle = "1000x600+0+0"; - center = true; - follow = true; - }; - }; - - xsession.windowManager.bspwm.extraConfig = '' - for monitor in $(xrandr -q | grep -w 'connected' | cut -d' ' -f1); do - bspc monitor "$monitor" -d '1' '2' '3' '4' '5' '6' - done - - ${config.services.polybar.script} - ${ - if config.tools.feh.enable then - "${pkgs.feh}/bin/feh --bg-scale ${../../../assets/skeleton-mage.png}" - else - "xsetroot -solid \"${config.scheme.withHashtag.base00}\"" - } - ''; - }; -} diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 74efff8..8af472a 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -7,10 +7,9 @@ { imports = [ - ./bspwm + ./i3 ./gtk ./polybar - ./xremap ]; options.desktop = { @@ -29,7 +28,7 @@ [ -f ~/.profile ] && . ~/.profile [ -f ~/.xsession ] && . ~/.xsession - exec ${pkgs.bspwm}/bin/bspwm + exec ${config.xsession.windowManager.i3.package}/bin/i3 ''; executable = true; }; diff --git a/modules/desktop/i3/default.nix b/modules/desktop/i3/default.nix new file mode 100644 index 0000000..e24f95b --- /dev/null +++ b/modules/desktop/i3/default.nix @@ -0,0 +1,93 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + config = lib.mkIf config.desktop.enable { + xsession.windowManager.i3.enable = true; + + xsession.windowManager.i3.config = with config.scheme.withHashtag; { + modifier = "Mod4"; # Super + + bars = [ ]; + + gaps = { + inner = 10; + outer = 0; + }; + + window = { + border = 1; + titlebar = false; + }; + + colors = { + focused = { + border = base03; + background = base03; + text = base07; + indicator = base03; + childBorder = base03; + }; + focusedInactive = { + border = base02; + background = base02; + text = base05; + indicator = base02; + childBorder = base02; + }; + unfocused = { + border = base02; + background = base02; + text = base05; + indicator = base02; + childBorder = base02; + }; + }; + + defaultWorkspace = "workspace number 1"; + + window.commands = [ + { + command = "floating enable, sticky enable, resize set 1000 600, move position center"; + criteria = { + class = "floating-termial"; + }; + } + ]; + + focus.followMouse = true; + + startup = [ + # { + # command = "${config.services.polybar.script}"; + # always = true; + # notification = false; + # } + { + command = "xrandr -q | grep -w 'connected' | cut -d' ' -f1 | xargs -I{} i3-msg \"workspace 1 output {}\""; + always = false; + notification = false; + } + { + command = + if config.tools.feh.enable then + "${pkgs.feh}/bin/feh --bg-scale ${../../../assets/skeleton-mage.png}" + else + "xsetroot -solid \"${config.scheme.withHashtag.base00}\""; + always = true; + notification = false; + } + ]; + + keybindings = lib.mkOptionDefault (import ./keybindings.nix { inherit pkgs lib; }); + }; + + xsession.windowManager.i3.extraConfig = '' + exec_always --no-startup-id xrandr -q | grep -w 'connected' | cut -d' ' -f1 | xargs -I{} i3-msg "workspace 1 output {}" + ''; + }; +} diff --git a/modules/desktop/i3/keybindings.nix b/modules/desktop/i3/keybindings.nix new file mode 100644 index 0000000..e61c1b5 --- /dev/null +++ b/modules/desktop/i3/keybindings.nix @@ -0,0 +1,75 @@ +{ pkgs, lib }: + +let + mod = "Mod4"; +in +{ + # --- General Applications --- + "${mod}+r" = "exec rofi -show drun"; + "${mod}+t" = "exec ${pkgs.kitty}/bin/kitty"; + "${mod}+f" = "exec kitty --title 'File Manager' --class floating-termial -e nnn"; + "${mod}+s" = "exec kitty --title 'Keybindings' --class floating-termial -e keybindings.sh"; + "${mod}+q" = "kill"; + + # --- Media / Hardware Keys --- + "XF86MonBrightnessDown" = "exec brightnessctl set 5%-"; + "XF86MonBrightnessUp" = "exec brightnessctl set +5%"; + "XF86AudioLowerVolume" = "exec pamixer --decrease 5"; + "XF86AudioRaiseVolume" = "exec pamixer --increase 5"; + "XF86AudioMute" = "exec pamixer --toggle-mute"; + "XF86AudioPlay" = "exec playerctl play-pause"; + + # --- Window Management (Vim-style) --- + # Focus + "${mod}+h" = "focus left"; + "${mod}+j" = "focus down"; + "${mod}+k" = "focus up"; + "${mod}+l" = "focus right"; + + # Move/Swap + "${mod}+Shift+h" = "move left"; + "${mod}+Shift+j" = "move down"; + "${mod}+Shift+k" = "move up"; + "${mod}+Shift+l" = "move right"; + + # Resize + "${mod}+Control+h" = "resize shrink width 20 px or 20 ppt"; + "${mod}+Control+j" = "resize grow height 20 px or 20 ppt"; + "${mod}+Control+k" = "resize shrink height 20 px or 20 ppt"; + "${mod}+Control+l" = "resize grow width 20 px or 20 ppt"; + + # Layout Modes + "${mod}+n" = "layout tiling"; # Best approx for 'tiled' + "${mod}+d" = "floating toggle"; + "${mod}+m" = "fullscreen toggle"; + + # --- Workspaces --- + # Switch to workspace + "${mod}+1" = "workspace number 1"; + "${mod}+2" = "workspace number 2"; + "${mod}+3" = "workspace number 3"; + "${mod}+4" = "workspace number 4"; + "${mod}+5" = "workspace number 5"; + "${mod}+6" = "workspace number 6"; + "${mod}+7" = "workspace number 7"; + "${mod}+8" = "workspace number 8"; + "${mod}+9" = "workspace number 9"; + "${mod}+0" = "workspace number 10"; + + # Move window to workspace + "${mod}+Shift+1" = "move container to workspace number 1; workspace number 1"; + "${mod}+Shift+2" = "move container to workspace number 2; workspace number 2"; + "${mod}+Shift+3" = "move container to workspace number 3; workspace number 3"; + "${mod}+Shift+4" = "move container to workspace number 4; workspace number 4"; + "${mod}+Shift+5" = "move container to workspace number 5; workspace number 5"; + "${mod}+Shift+6" = "move container to workspace number 6; workspace number 6"; + "${mod}+Shift+7" = "move container to workspace number 7; workspace number 7"; + "${mod}+Shift+8" = "move container to workspace number 8; workspace number 8"; + "${mod}+Shift+9" = "move container to workspace number 9; workspace number 9"; + "${mod}+Shift+0" = "move container to workspace number 10; workspace number 10"; + + # --- Screenshots --- + "${mod}+p" = "exec \"maim -s | xclip -selection clipboard -t image/png\""; + "${mod}+Shift+p" = + "exec \"mkdir -p ~/Pictures/Screenshots && maim -s ~/Pictures/Screenshots/screenshot-$(date +%Y%m%d-%H%M%S).png\""; +} diff --git a/modules/desktop/polybar/bar/main.nix b/modules/desktop/polybar/bar/main.nix index 8b52fab..983d8eb 100644 --- a/modules/desktop/polybar/bar/main.nix +++ b/modules/desktop/polybar/bar/main.nix @@ -9,7 +9,7 @@ in fixed-center = false; height = 35; override-redirect = false; - wm-restack = "bspwm"; + wm-restack = "i3"; enable-ipc = true; border-top-size = 1; @@ -34,7 +34,7 @@ in font-1 = "${config.fonts.normal}:weight=Bold:pixelsize=${largerFontSize};3"; font-2 = "${config.fonts.normal}:style=Light:pixelsize=${largerFontSize};2"; - modules-left = "bspwm separator"; + modules-left = "i3 separator"; modules-center = "xwindow"; modules-right = "separator volume separator battery separator wifi wifi-separator ethernet ethernet-separator time separator memory separator cpu separator date"; } diff --git a/modules/desktop/polybar/default.nix b/modules/desktop/polybar/default.nix index 9aeb772..b46fc17 100644 --- a/modules/desktop/polybar/default.nix +++ b/modules/desktop/polybar/default.nix @@ -11,6 +11,7 @@ services.polybar.package = ( pkgs.polybar.override { pulseSupport = true; + i3Support = true; } ); services.polybar.script = "${config.services.polybar.package}/bin/polybar main &"; diff --git a/modules/desktop/polybar/module/default.nix b/modules/desktop/polybar/module/default.nix index 57854ca..05f6946 100644 --- a/modules/desktop/polybar/module/default.nix +++ b/modules/desktop/polybar/module/default.nix @@ -2,11 +2,11 @@ { "module/battery" = import ./battery.nix { inherit config; }; - "module/bspwm" = import ./bspwm.nix { inherit config; }; "module/cpu" = import ./cpu.nix { inherit config; }; "module/date" = import ./date.nix { inherit config; }; "module/ethernet-separator" = import ./ethernet-separator.nix { inherit config; }; "module/ethernet" = import ./ethernet.nix { inherit config; }; + "module/i3" = import ./i3.nix { inherit config; }; "module/memory" = import ./memory.nix { inherit config; }; "module/separator" = import ./separator.nix { inherit config; }; "module/time" = import ./time.nix { inherit config; }; diff --git a/modules/desktop/polybar/module/bspwm.nix b/modules/desktop/polybar/module/i3.nix index a760acf..ac235f1 100644 --- a/modules/desktop/polybar/module/bspwm.nix +++ b/modules/desktop/polybar/module/i3.nix @@ -2,7 +2,7 @@ with config.scheme.withHashtag; { - type = "internal/bspwm"; + type = "internal/i3"; label-focused = "%index%"; label-focused-underline = "${base0D}"; @@ -18,4 +18,7 @@ with config.scheme.withHashtag; label-empty = "%index%"; label-empty-foreground = "${base03}"; label-empty-padding = 1; + + pin-workspaces = true; + index-sort = true; } diff --git a/modules/desktop/xremap/default.nix b/modules/desktop/xremap/default.nix deleted file mode 100644 index 82976d0..0000000 --- a/modules/desktop/xremap/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: - -{ - config = lib.mkIf config.desktop.enable { - services.xremap = { - enable = true; - withX11 = true; - config.keymap = [ - { - name = "Global Shortcuts"; - remap = lib.mkMerge [ - # (import ./keybindings/brightnessctl.nix { inherit pkgs; }) - (import ./keybindings/bspwm.nix { inherit pkgs; }) - (import ./keybindings/kitty.nix { inherit pkgs; }) - (import ./keybindings/maim.nix { inherit pkgs; }) - # (import ./keybindings/pamixer.nix { inherit pkgs; }) - # (import ./keybindings/playerctl.nix { inherit pkgs; }) - (import ./keybindings/rofi.nix { inherit pkgs; }) - ]; - } - ]; - }; - }; -} diff --git a/modules/desktop/xremap/keybindings/brightnessctl.nix b/modules/desktop/xremap/keybindings/brightnessctl.nix deleted file mode 100644 index b2f39cb..0000000 --- a/modules/desktop/xremap/keybindings/brightnessctl.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ pkgs }: - -{ - "XF86MonBrightnessDown" = { - launch = [ - "${pkgs.brightnessctl}/bin/brightnessctl" - "set" - "5%-" - ]; - }; - "XF86MonBrightnessUp" = { - launch = [ - "${pkgs.brightnessctl}/bin/brightnessctl" - "set" - "+5%" - ]; - }; -} diff --git a/modules/desktop/xremap/keybindings/bspwm.nix b/modules/desktop/xremap/keybindings/bspwm.nix deleted file mode 100644 index 1d4a347..0000000 --- a/modules/desktop/xremap/keybindings/bspwm.nix +++ /dev/null @@ -1,273 +0,0 @@ -{ pkgs }: - -{ - - "super-q" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-c" - ]; - }; - - # Window States - "super-n" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "focused" - "-t" - "tiled" - ]; - }; - "super-d" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "focused" - "-t" - "floating" - ]; - }; - "super-m" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "focused" - "-t" - "fullscreen" - ]; - }; - - # Navigation (Manual expansion of {h,j,k,l}) - "super-h" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-f" - "west" - ]; - }; - "super-j" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-f" - "south" - ]; - }; - "super-k" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-f" - "north" - ]; - }; - "super-l" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-f" - "east" - ]; - }; - - # Swap Windows - "super-shift-h" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-s" - "west" - ]; - }; - "super-shift-j" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-s" - "south" - ]; - }; - "super-shift-k" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-s" - "north" - ]; - }; - "super-shift-l" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-s" - "east" - ]; - }; - - # Desktop Navigation (1-9 and 0 for 10) - "super-1" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "desktop" - "-f" - "1" - ]; - }; - "super-2" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "desktop" - "-f" - "2" - ]; - }; - "super-3" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "desktop" - "-f" - "3" - ]; - }; - "super-4" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "desktop" - "-f" - "4" - ]; - }; - "super-5" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "desktop" - "-f" - "5" - ]; - }; - "super-6" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "desktop" - "-f" - "6" - ]; - }; - "super-7" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "desktop" - "-f" - "7" - ]; - }; - "super-8" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "desktop" - "-f" - "8" - ]; - }; - "super-9" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "desktop" - "-f" - "9" - ]; - }; - "super-0" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "desktop" - "-f" - "10" - ]; - }; - - # Move focused window to Desktop (Optional but common) - "super-shift-1" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-d" - "1" - ]; - }; - "super-shift-2" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-d" - "2" - ]; - }; - "super-shift-3" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-d" - "3" - ]; - }; - "super-shift-4" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-d" - "4" - ]; - }; - "super-shift-5" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-d" - "5" - ]; - }; - "super-shift-6" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-d" - "6" - ]; - }; - "super-shift-7" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-d" - "7" - ]; - }; - "super-shift-8" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-d" - "8" - ]; - }; - "super-shift-9" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-d" - "9" - ]; - }; - "super-shift-0" = { - launch = [ - "${pkgs.bspwm}/bin/bspc" - "node" - "-d" - "10" - ]; - }; -} diff --git a/modules/desktop/xremap/keybindings/kitty.nix b/modules/desktop/xremap/keybindings/kitty.nix deleted file mode 100644 index fd3ea1a..0000000 --- a/modules/desktop/xremap/keybindings/kitty.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ pkgs }: - -{ - - "super-t" = { - launch = [ "${pkgs.kitty}/bin/kitty" ]; - }; - "super-f" = { - launch = [ - "${pkgs.kitty}/bin/kitty" - "--title" - "File Manager" - "--class" - "floating-terminal" - "-e" - "nnn" - ]; - }; - "super-s" = { - launch = [ - "${pkgs.kitty}/bin/kitty" - "--title" - "Keybindings" - "--class" - "floating-terminal" - "-e" - "keybindings.sh" - ]; - }; -} diff --git a/modules/desktop/xremap/keybindings/maim.nix b/modules/desktop/xremap/keybindings/maim.nix deleted file mode 100644 index f587e65..0000000 --- a/modules/desktop/xremap/keybindings/maim.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ pkgs }: - -{ - - "super-p" = { - launch = [ - "sh" - "-c" - "${pkgs.maim}/bin/maim -s | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png" - ]; - }; - "super-shift-p" = { - launch = [ - "sh" - "-c" - "mkdir -p ~/Pictures/Screenshots && ${pkgs.maim}/bin/maim -s ~/Pictures/Screenshots/screenshot-$(date +%Y%m%d-%H%M%S).png" - ]; - }; -} diff --git a/modules/desktop/xremap/keybindings/pamixer.nix b/modules/desktop/xremap/keybindings/pamixer.nix deleted file mode 100644 index 9e0d3c0..0000000 --- a/modules/desktop/xremap/keybindings/pamixer.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ pkgs }: - -{ - - "XF86AudioLowerVolume" = { - launch = [ - "sh" - "-c" - "${pkgs.pamixer}/bin/pamixer --decrease 5" - ]; - }; - "XF86AudioRaiseVolume" = { - launch = [ - "sh" - "-c" - "${pkgs.pamixer}/bin/pamixer --increase 5" - ]; - }; - "XF86AudioMute" = { - launch = [ - "sh" - "-c" - "${pkgs.pamixer}/bin/pamixer --toggle-mute" - ]; - }; -} diff --git a/modules/desktop/xremap/keybindings/playerctl.nix b/modules/desktop/xremap/keybindings/playerctl.nix deleted file mode 100644 index 4bc52cb..0000000 --- a/modules/desktop/xremap/keybindings/playerctl.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ pkgs }: - -{ - - "XF86AudioPlay" = { - launch = [ - "sh" - "-c" - "${pkgs.playerctl}/bin/playerctl play-pause" - ]; - }; -} diff --git a/modules/desktop/xremap/keybindings/rofi.nix b/modules/desktop/xremap/keybindings/rofi.nix deleted file mode 100644 index 5ed820a..0000000 --- a/modules/desktop/xremap/keybindings/rofi.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ pkgs }: - -{ - # Application Launchers - "super-r" = { - launch = [ - "${pkgs.zsh}/bin/zsh" - "-c" - "${pkgs.rofi}/bin/rofi -show drun" - ]; - }; -} |
