diff options
Diffstat (limited to 'modules/user/desktop/window-managers/sway.nix')
| -rw-r--r-- | modules/user/desktop/window-managers/sway.nix | 222 |
1 files changed, 222 insertions, 0 deletions
diff --git a/modules/user/desktop/window-managers/sway.nix b/modules/user/desktop/window-managers/sway.nix new file mode 100644 index 0000000..5b82ff2 --- /dev/null +++ b/modules/user/desktop/window-managers/sway.nix @@ -0,0 +1,222 @@ +{ + config, + lib, + options, + pkgs, + ... +}: +{ + options.desktop.windowManager = lib.mkOption { type = with lib.types; nullOr (enum [ "sway" ]); }; + config = { + desktop.components.waybar.enable = lib.mkDefault (config.desktop.windowManager == "sway"); + home.packages = with pkgs; [ + grim + rose-pine-cursor + slurp + ]; + + programs = { + swaylock = { + enable = lib.mkDefault (config.desktop.windowManager == "sway"); + settings = { + color = "000000"; + no-unlock-indicator = true; + }; + }; + + }; + + wayland.windowManager.sway = + if (config.desktop.windowManager == "sway") then + { + enable = lib.mkForce true; + package = null; # use the nixos module + config = { + bars = [ ]; + bindswitches = { + "lid:off" = { + action = "output eDP-1 power on"; + locked = true; + }; + + "lid:on" = { + action = "output eDP-1 power off"; + locked = true; + }; + }; + + colors = # catppuccin mocha + let + accent = if (config.desktop.accent == "pink") then pink else blue; + base = "#1e1e2e"; + blue = "#89b4fa"; + flamingo = "#f2cdcd"; + indicator = if (config.desktop.accent == "pink") then flamingo else teal; + nothing = "#00000000"; + pink = "#f5c2e7"; + red = "#f38ba8"; + surface1 = "#45475a"; + teal = "#94e2d5"; + text = "#cdd6f4"; + in + { + focused = { + background = "${accent}"; + border = "${accent}"; + childBorder = "${accent}"; + indicator = "${indicator}"; + text = "${base}"; + }; + + focusedInactive = { + background = "${surface1}"; + border = "${surface1}"; + childBorder = "${nothing}"; + indicator = "${nothing}"; + text = "${text}"; + }; + + unfocused = { + background = "${base}"; + border = "${base}"; + childBorder = "${nothing}"; + indicator = "${nothing}"; + text = "${text}"; + }; + + urgent = { + background = "${red}"; + border = "${red}"; + childBorder = "${red}"; + indicator = "${red}"; + text = "${base}"; + }; + }; + + floating.titlebar = false; + focus.followMouse = false; + fonts = { + names = [ "Fira Code" ]; + size = 8.0; + }; + + gaps = { + inner = 4; + outer = 8; + }; + + input = { + "*" = { + accel_profile = "flat"; + }; + + "type:touchpad" = { + drag = "enabled"; + dwt = "enabled"; + natural_scroll = "enabled"; + tap = "enabled"; + }; + }; + + keybindings = + let + mod = config.wayland.windowManager.sway.config.modifier; + in + { + "${mod}+Return" = "exec foot"; + "${mod}+Q" = "kill"; + "${mod}+Alt+Q" = "exit"; + "${mod}+V" = "splitt"; + "${mod}+H" = "focus left"; + "${mod}+J" = "focus down"; + "${mod}+K" = "focus up"; + "${mod}+L" = "focus right"; + "${mod}+Shift+H" = "move left"; + "${mod}+Shift+J" = "move down"; + "${mod}+Shift+K" = "move up"; + "${mod}+Shift+L" = "move right"; + "${mod}+Minus" = "resize shrink width 5"; + "${mod}+Shift+Equal" = "resize grow height 5"; + "${mod}+Shift+Minus" = "resize shrink height 5"; + "${mod}+Equal" = "resize grow width 5"; + "${mod}+1" = "workspace 1"; + "${mod}+2" = "workspace 2"; + "${mod}+3" = "workspace 3"; + "${mod}+4" = "workspace 4"; + "${mod}+5" = "workspace 5"; + "${mod}+6" = "workspace 6"; + "${mod}+7" = "workspace 7"; + "${mod}+8" = "workspace 8"; + "${mod}+9" = "workspace 9"; + "${mod}+Shift+1" = "move workspace 1"; + "${mod}+Shift+2" = "move workspace 2"; + "${mod}+Shift+3" = "move workspace 3"; + "${mod}+Shift+4" = "move workspace 4"; + "${mod}+Shift+5" = "move workspace 5"; + "${mod}+Shift+6" = "move workspace 6"; + "${mod}+Shift+7" = "move workspace 7"; + "${mod}+Shift+8" = "move workspace 8"; + "${mod}+Shift+9" = "move workspace 9"; + "${mod}+F" = "floating toggle"; + "${mod}+G" = "layout toggle split tabbed"; + "${mod}+R" = "exec fuzzel"; + "${mod}+Shift+S" = "exec grim -g \"$(slurp)\" ~/Pictures/screenshot.png"; + "${mod}+Alt+L" = "exec swaylock"; + "XF86AudioRaiseVolume" = "exec wpctl set-volume @DEFAULT_SINK@ 5%+ -l 1"; + "XF86AudioLowerVolume" = "exec wpctl set-volume @DEFAULT_SINK@ 5%- -l 1"; + "XF86AudioMute" = "exec wpctl set-mute @DEFAULT_SINK@ toggle"; + "XF86MonBrightnessUp" = "exec brightnessctl --class=backlight s +10%"; + "XF86MonBrightnessDown" = "exec brightnessctl --class=backlight s 10%-"; + "Shift+XF86MonBrightnessUp" = "exec brightnessctl --device=chromeos::kbd_backlight s +10%"; + "Shift+XF86MonBrightnessDown" = "exec brightnessctl --device=chromeos::kbd_backlight s 10%-"; + "XF86RFKill" = "exec rfkill toggle 1"; + }; + + modes = { }; + modifier = "Mod4"; + output = { + "eDP-1" = { + background = "~/Pictures/wallpaper.jpg fill"; + mode = "2256x1504@60Hz"; + position = "0 0"; + scale = "1.5"; + }; + + "DP-1" = { + background = "~/Pictures/wallpaper.jpg fill"; + mode = "1920x1080@165Hz"; + position = "0 0"; + }; + + "DP-2" = { + background = "~/Pictures/wallpaper.jpg fill"; + mode = "1920x1080@75Hz"; + position = "1920 0"; + }; + }; + + window.titlebar = false; + workspaceOutputAssign = [ + { + output = [ + "DP-1" + "eDP-1" + ]; + + workspace = "1"; + } + { + output = "DP-2"; + workspace = "2"; + } + ]; + }; + + extraConfig = '' + exec waybar + ''; + } + else + { }; + }; +} |
