{ config, pkgs, lib, ... }: let # define some constants mod = "Mod4"; alt = "Mod1"; in { imports = [ ./swaylock.nix ./swayidle.nix ./gammastep.nix ]; # enable clipboard history services.cliphist.enable = true; # define cursor, also fixes tiny cursor on hidpi home.pointerCursor = { name = "Adwaita"; package = pkgs.adwaita-icon-theme; size = 24; x11 = { enable = true; defaultCursor = "Adwaita"; }; }; # configure sway wayland.windowManager.sway = { enable = true; systemd.enable = true; wrapperFeatures.gtk = true; config = rec { modifier = mod; terminal = "alacritty"; startup = [ { command = "blueman-applet";} ]; defaultWorkspace = "1"; bars = []; fonts = { names = [ "MesloLGS NF" ]; size = 11.0; }; input = { "type:touchpad" = { tap = "enabled"; dwt = "enabled"; click_method = "clickfinger"; natural_scroll = "enabled"; tap_button_map = "lrm"; }; "*" = { xkb_layout = "us"; xkb_variant = "intl"; }; }; gaps = { inner = 8; outer = -4; smartGaps = true; smartBorders = "on"; }; keybindings = lib.mkOptionDefault { "${mod}+Return" = "exec alacritty"; "${mod}+Ctrl+Return" = "exec alacritty zellij"; "${mod}+Shift+Return" = "exec rofi -show combi"; "${mod}+Ctrl+l" = "exec swaylock"; "${mod}+Shift+r" = "reload"; "${mod}+Ctrl+Shift+Alt+s" = "exec systemctl suspend"; "${mod}+Ctrl+Shift+Alt+h" = "exec systemctl hibernate"; "XF86AudioLowerVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"; "XF86AudioRaiseVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"; "XF86AudioMute" = "exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; "${mod}+XF86AudioMute" = "exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; "XF86AudioPlay" = "exec playerctl play-pause"; "XF86AudioNext" = "exec playerctl next"; "XF86AudioPrev" = "exec playerctl previous"; "${mod}+XF86AudioRaiseVolume" = "exec playerctl next"; "${mod}+XF86AudioLowerVolume" = "exec playerctl previous"; "XF86MonBrightnessUp" = "exec light -A 5; notify-send 'Brightness set to $(light)'"; "XF86MonBrightnessDown" = "exec light -U 5; notify-send 'Brightness set to $(light)'"; "${mod}+XF86MonBrightnessDown" = "exec light -S 0.2; notify-send 'Brightness set to min'"; "${mod}+XF86MonBrightnessUp" = "exec light -S 100; notify-send 'Brightness set to max'"; "XF86Calculator" = "exec qalculate-gtk"; "${mod}+Shift+c" = "kill"; "${mod}+u" = "border none"; "${mod}+y" = "border pixel 1"; "${mod}+n" = "border normal"; "${mod}+Shift+n" = "border none"; "${mod}+h" = "focus left"; "${mod}+j" = "focus down"; "${mod}+k" = "focus up"; "${mod}+l" = "focus right"; "${mod}+Left" = "focus left"; "${mod}+Down" = "focus down"; "${mod}+Up" = "focus up"; "${mod}+Right" = "focus right"; "${mod}+Shift+h" = "move left"; "${mod}+Shift+j" = "move down"; "${mod}+Shift+k" = "move up"; "${mod}+Shift+l" = "move right"; "${mod}+Shift+Left" = "move left"; "${mod}+Shift+Down" = "move down"; "${mod}+Shift+Up" = "move up"; "${mod}+Shift+Right" = "move right"; "${mod}+b" = "workspace back_and_forth"; "${mod}+Shift+b" = "move container to workspace back_and_forth; workspace back_and_forth"; "${mod}+Ctrl+Right" = "workspace next"; "${mod}+Ctrl+Left" = "workspace prev"; "${mod}+Shift+minus" = "move scratchpad"; "${mod}+minus" = "scratchpad show"; "${mod}+z" = "split h; exec notify-send 'Tile horizontally'"; "${mod}+v" = "split v; exec notify-send 'Tile vertically'"; "${mod}+q" = "split toggle"; "${mod}+f" = "fullscreen toggle"; "${mod}+s" = "layout stacking"; "${mod}+w" = "layout tabbed"; "${mod}+e" = "layout toggle split"; "${mod}+Shift+space" = "floating toggle"; "${mod}+space" = "focus mode_toggle"; "${mod}+Shift+s" = "sticky toggle"; "${mod}+a" = "focus parent"; } // builtins.listToAttrs (builtins.concatMap (n: let # create keybindings for workspaces key = toString (n + 1); in [ { name = "${mod}+${key}"; value = "workspace ${key}"; } { name = "${mod}+Ctrl+${key}"; value = "move container to workspace ${key}"; } { name = "${mod}+Shift+${key}"; value = "move container to workspace ${key}; workspace ${key}"; } ]) (lib.range 0 8)); assigns = { "2: web" = [{ class = "^Brave$"; }]; "9: mail" = [{ class = "Thunderbird"; }]; }; modes = { resize = { "h" = "resize shrink width 4 px or 4 ppt"; "j" = "resize grow height 4 px or 4 ppt"; "k" = "resize shrink height 4 px or 4 ppt"; "l" = "resize grow width 4 px or 4 ppt"; "Left" = "resize shrink width 10 px or 10 ppt"; "Down" = "resize grow height 10 px or 10 ppt"; "Up" = "resize shrink height 10 px or 10 ppt"; "Right" = "resize grow width 10 px or 10 ppt"; "Return" = "mode default"; "Escape" = "mode default"; }; }; colors = { focused = { border = "#ff8800"; background = "#2F3D44"; text = "#FF8800"; indicator = "#FDF6E3"; childBorder = "#ff8800"; }; focusedInactive = { border = "#333333"; background = "#222222"; text = "#444444"; indicator = "#454948"; childBorder = "#222222"; }; unfocused = { border = "#2F3D44"; background = "#2F3D44"; text = "#FF8800"; indicator = "#454948"; childBorder = "#222222"; }; urgent = { border = "#CB4B16"; background = "#FDF6E3"; text = "#FF8800"; indicator = "#268BD2"; childBorder = "#222222"; }; placeholder = { border = "#000000"; background = "#0c0c0c"; text = "#ffffff"; indicator = "#000000"; childBorder = "#222222"; }; background = "#2B2C2B"; }; }; extraConfig = '' default_border pixel 1 floating_modifier ${mod} # === Floating Windows === for_window [title="alsamixer"] floating enable border pixel 1 for_window [title="Qalculate!"] floating enable border normal for_window [class="Psensor"] floating enable border normal for_window [title="lxrandr"] floating enable border normal for_window [class="Blueman-manager"] floating enable border normal for_window [class="GParted"] floating enable border normal for_window [class="pavucontrol"] floating enable for_window [class="Volume Control"] floating enable for_window [class="(?i)VirtualBox"] floating enable border normal ''; }; }