From 9dc9105e10ed6d809f950de5b1660c5548e8dd1f Mon Sep 17 00:00:00 2001 From: Quentin Boyer Date: Sun, 10 Apr 2022 10:58:15 +0200 Subject: [PATCH] merge i3 and sway configuration (i3 implementation) --- wm/default.nix | 310 ++++++++++++++-------------------------- wm/i3.nix | 139 ++++++++++++++++++ wm/i3like.nix | 173 ++++++++++++++++++++++ wm/sway.nix | 257 +++++++++++++++++++++++++++++++++ wm/terminal/default.nix | 4 + wm/terminal/foot.nix | 3 +- wm/terminal/kitty.nix | 5 +- 7 files changed, 684 insertions(+), 207 deletions(-) create mode 100644 wm/i3.nix create mode 100644 wm/i3like.nix create mode 100644 wm/sway.nix diff --git a/wm/default.nix b/wm/default.nix index c29f41d..17fab2f 100644 --- a/wm/default.nix +++ b/wm/default.nix @@ -1,11 +1,7 @@ { config, lib, pkgs, ... }: { - imports = [ ./terminal ]; - - home.packages = with pkgs; [ - sway - ]; + imports = [ ./terminal ./i3like.nix ]; gtk = { enable = true; @@ -14,19 +10,13 @@ }; theme = { package = pkgs.gnome.gnome-themes-extra; - name = "Adwaita"; + name = "Adwaita dark"; }; }; - home.sessionVariables = { - MOZ_ENABLE_WAYLAND = "1"; - XDG_CURRENT_DESKTOP = "sway"; - LIBSEAT_BACKEND = "logind"; - }; - terminal = { enable = true; - kind = "foot"; + kind = "kitty"; colors = { background = "000000"; @@ -51,207 +41,119 @@ }; font = { family = "Hack Nerd Font Mono"; - size = 7; + size = 10; }; }; - programs = { - mako = { + wm = let mod = config.wm.modifier; in + { enable = true; - font = "hack nerd font 10"; - margin = "20,20,5,5"; - ignoreTimeout = true; - defaultTimeout = 7000; - }; - - waybar = { - enable = true; - style = builtins.readFile ./waybar.css; - settings = [ - { - layer = "top"; - position = "bottom"; - modules-left = [ - "network#wifi" - "sway/workspaces" - "sway/mode" - ]; - modules-center = [ "sway/window" ]; - modules-right = [ - "cpu" - "memory" - "disk#home" - "disk#root" - "battery" - "clock" - "tray" - ]; - modules = { - "sway/workspaces" = { - persistent_workspaces = { - "" = [ ]; - "" = [ ]; - "1:" = [ ]; - }; - numeric-first = true; - }; - "network#wifi" = { - interface = "wlp1s0"; - format-wifi = "{essid} ({signalStrength}%) "; - }; - cpu = { - format = "﬙ {load}"; - }; - memory = { - format = " {used:.0f}G/{total:.0f}G"; - }; - "sway/window" = { - max-length = 50; - }; - "disk#home" = { - path = "/home"; - format = " {free}"; - }; - "disk#root" = { - path = "/"; - format = " {percentage_free}%"; - }; - "battery" = { - format = "{capacity}% {icon}"; - format-icons = [ "" "" "" "" "" ]; - }; - "clock" = { - format-alt = "{:%a, %d. %b %H:%M}"; - }; - }; - } - ]; - }; - }; - - wayland.windowManager.sway = { - enable = true; - config = { + kind = "i3"; modifier = "Mod4"; - bars = [{ - command = "waybar"; - }]; - input = - let - inputs = config.extraInfo.inputs; - inputsCfg = [ - (if inputs.keyboard != null then { - name = inputs.keyboard; - value = - { - xkb_layout = "us"; - xkb_variant = "dvp"; - xkb_options = "compose:102"; - }; - } else null) - (if inputs.touchpad != null then { - name = inputs.touchpad; - value = { dwt = "disable"; }; - } else null) - ]; - in - builtins.listToAttrs inputsCfg; - fonts = { - names = [ "Hack Nerd Font" ]; + font = { + name = "Hack Nerd Font"; style = "Regular"; - size = 13.0; + size = 12.0; }; - window = { - titlebar = true; - }; - startup = [ - { command = "systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK"; } - { command = "hash dbus-update-activation-environment 2>/dev/null && dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK"; } - { command = "${pkgs.mako}/bin/mako"; } - { command = "wdumpkeys >> ~/.keydump"; } - ]; - menu = "${pkgs.wofi}/bin/wofi --show drun,run --allow-images"; - keybindings = - let - mod = config.wayland.windowManager.sway.config.modifier; - menu = config.wayland.windowManager.sway.config.menu; - terminal = config.wayland.windowManager.sway.config.terminal; - ws1 = "1:"; - ws2 = "2:"; - ws3 = "3"; - ws4 = "4:"; - ws5 = "5"; - ws6 = "6"; - ws7 = "7"; - ws8 = "8"; - ws9 = ""; - ws10 = ""; - in - { - "Print" = "exec ${pkgs.grim}/bin/grim -g \"$(${pkgs.slurp}/bin/slurp)\" - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png"; - "${mod}+Shift+semicolon" = "kill"; - "${mod}+e" = "exec ${menu}"; - "${mod}+Return" = "exec ${terminal}"; - "${mod}+Shift+e" = - "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'"; - "XF86AudioMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute 50 toggle"; - - "${mod}+u" = "fullscreen toggle"; - "${mod}+comma" = "layout tabbed"; - "${mod}+p" = "mode resize"; - - "${mod}+h" = "focus left"; - "${mod}+t" = "focus down"; - "${mod}+n" = "focus up"; - "${mod}+s" = "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+T" = "move down"; - "${mod}+Shift+N" = "move up"; - "${mod}+Shift+S" = "move right"; - "${mod}+Shift+Left" = "move left"; - "${mod}+Shift+Down" = "move down"; - "${mod}+Shift+Up" = "move up"; - "${mod}+Shift+Right" = "move right"; - - # Workspaces - "${mod}+ampersand" = "workspace ${ws1}"; - "${mod}+bracketleft" = "workspace ${ws2}"; - "${mod}+braceleft" = "workspace ${ws3}"; - "${mod}+braceright" = "workspace ${ws4}"; - "${mod}+parenleft" = "workspace ${ws5}"; - "${mod}+equal" = "workspace ${ws6}"; - "${mod}+asterisk" = "workspace ${ws7}"; - "${mod}+parenright" = "workspace ${ws8}"; - "${mod}+w" = "workspace ${ws9}"; - "${mod}+m" = "workspace ${ws10}"; - "${mod}+Shift+ampersand" = "move container to workspace ${ws1}"; - "${mod}+Shift+bracketleft" = "move container to workspace ${ws2}"; - "${mod}+Shift+braceleft" = "move container to workspace ${ws3}"; - "${mod}+Shift+braceright" = "move container to workspace ${ws4}"; - "${mod}+Shift+parenleft" = "move container to workspace ${ws5}"; - "${mod}+Shift+equal" = "move container to workspace ${ws6}"; - "${mod}+Shift+asterisk" = "move container to workspace ${ws7}"; - "${mod}+Shift+parenright" = "move container to workspace ${ws8}"; - "${mod}+Shift+w" = "move container to workspace ${ws9}"; - "${mod}+Shift+m" = "move container to workspace ${ws10}"; - - "${mod}+Shift+J" = "reload"; - "${mod}+Shift+p" = "restart"; - "${mod}+Shift+l" = "exec ${pkgs.swaylock-fancy}/bin/swaylock-fancy"; + bar = { + font = { + name = "Hack Nerd Font Mono"; + style = "Regular"; + size = 11.0; }; - }; + }; - }; + printScreen = { + enable = true; + keybind = "Print"; + }; - home.file = { - ".config/wofi/" = { - source = ./wofi; - recursive = true; + menu = { + enable = true; + keybind = "${mod}+e"; + }; + + exit = { + enable = true; + keybind = "${mod}+Shift+e"; + }; + + notifications = { + enable = true; + font = "hack nerd font 10"; + defaultTimeout = 7000; + }; + + startup = [ + { command = "signal-desktop"; } + { command = "discord"; } + { command = "firefox"; } + { command = "element-desktop"; } + { command = "thunderbird"; } + ]; + + workspaces = { + moveModifier = "Shift"; + definitions = { + "1:" = { key = "ampersand"; }; + "2:" = { key = "bracketleft"; output = "DP-0"; }; + "3:" = { key = "braceleft"; }; + "4" = { key = "braceright"; }; + "5" = { key = "parenleft"; }; + "6" = { key = "equal"; }; + "7" = { key = "asterisk"; }; + "" = { + key = "parenright"; + output = "HDMI-0"; + assign = [ "Spotify" ]; + }; + "" = { + key = "w"; + output = "HDMI-0"; + assign = [ + "Element" + "Signal" + "Discord" + ]; + }; + "" = { + key = "m"; + output = "HDMI-0"; + assign = [ "Thunderbird" ]; + }; + }; + }; + + keybindings = { + # Media Keys + "XF86AudioRaiseVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ '+10%'"; + "XF86AudioLowerVolume" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume @DEFAULT_SINK@ '-10%'"; + "XF86AudioMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle"; + "XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl -p spotify play-pause"; + "XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl -p spotify next"; + "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl -p spotify previous"; + + # Focus + "${mod}+Left" = "focus left"; + "${mod}+Right" = "focus right"; + "${mod}+Down" = "focus down"; + "${mod}+Up" = "focus up"; + "${mod}+Shift+Left" = "move left"; + "${mod}+Shift+Right" = "move right"; + "${mod}+Shift+Down" = "move down"; + "${mod}+Shift+Up" = "move up"; + + # Layout + "${mod}+u" = "fullscreen toggle"; + "${mod}+comma" = "layout tabbed"; + + # Misc + "${mod}+Shift+colon" = "kill"; + "${mod}+Shift+J" = "reload"; + "${mod}+Return" = "exec ${config.terminal.command}"; + "${mod}+p" = "mode resize"; + "${mod}+Shift+P" = "restart"; + }; }; - }; } diff --git a/wm/i3.nix b/wm/i3.nix new file mode 100644 index 0000000..b671a4f --- /dev/null +++ b/wm/i3.nix @@ -0,0 +1,139 @@ +{ config, lib, pkgs, ... }: + +with builtins; +with lib; +let + cfg = config.wm; + + addKeyIf = cond: keybinds: newkey: if cond then newkey // keybinds else keybinds; + keybindSolo = keys: submod: addKeyIf submod.enable keys { + "${submod.keybind}" = "exec ${submod.command}"; + }; + keydefs = [ cfg.printScreen cfg.menu cfg.exit ]; + keybindingsKeydef = foldl' keybindSolo cfg.keybindings keydefs; + + mod = cfg.modifier; + ws_def = cfg.workspaces.definitions; + get_ws = ws: getAttr ws ws_def; + workspaceFmt = name: + let key = (get_ws name).key; in + { + "${mod}+${key}" = "workspace ${name}"; + "${mod}+${cfg.workspaces.moveModifier}+${key}" = "move container to workspace ${name}"; + }; + + keybindings = (foldl' (x: y: x // y) { } (map workspaceFmt (attrNames ws_def))) + // keybindingsKeydef; + + workspaceAssign = name: + { + workspace = name; + output = (get_ws name).output; + }; + + workspaceOutputAssign = map workspaceAssign (filter (ws: (get_ws ws).output != null) (attrNames ws_def)); + + classAssign = name: { + "${name}" = map (app: { class = "${app}"; }) ((get_ws name).assign); + }; + assigns = foldl' (x: y: x // y) { } (map classAssign (attrNames ws_def)); + + startupNotifications = + if cfg.notifications.enable then [{ + command = "${config.services.dunst.package}/bin/dunst"; + notification = false; + always = true; + }] else [ ]; + + startup = startupNotifications ++ cfg.startup; +in +{ + config = mkIf (cfg.enable && cfg.kind == "i3") { + programs = { + i3status-rust = { + enable = true; + bars.bottom = { + blocks = [ + { + block = "disk_space"; + path = "/"; + info_type = "used"; + unit = "GB"; + alert = 90; + warning = 80; + format = ":{used}/{total}"; + } + { + block = "disk_space"; + path = "/home"; + info_type = "used"; + unit = "GB"; + alert = 90; + warning = 80; + format = ":{used}/{total}"; + } + { + block = "load"; + format = ":{1m}"; + } + { + block = "nvidia_gpu"; + label = "1050 Ti"; + show_memory = true; + show_temperature = true; + } + { + block = "sound"; + driver = "pulseaudio"; + } + { + block = "music"; + player = "spotify"; + format = "{combo}"; + } + { + block = "time"; + } + ]; + }; + }; + }; + + services.dunst = mkIf cfg.notifications.enable { + enable = true; + settings = { + global = { + timeout = "${toString cfg.notifications.defaultTimeout}ms"; + font = cfg.notifications.font; + }; + }; + }; + + wm.printScreen.command = mkDefault "${pkgs.maim}/bin/maim -s | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png"; + wm.menu.command = mkDefault "${pkgs.rofi}/bin/rofi -modi drun#run#ssh -show drun"; + wm.exit.command = mkDefault "\"i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'\""; + + xsession = { + enable = true; + windowManager.i3 = { + enable = true; + config = let mkFont = mod: { + names = [ mod.name ]; + style = mod.style; + size = mod.size; + }; in + { + inherit keybindings startup workspaceOutputAssign assigns; + fonts = mkFont cfg.font; + modifier = cfg.modifier; + bars = [{ + fonts = mkFont cfg.bar.font; + statusCommand = "${config.programs.i3status-rust.package}/bin/i3status-rs ${config.home.homeDirectory}/.config/i3status-rust/config-bottom.toml"; + }]; + }; + }; + scriptPath = ".hm-xsession"; + }; + + }; +} diff --git a/wm/i3like.nix b/wm/i3like.nix new file mode 100644 index 0000000..459bc10 --- /dev/null +++ b/wm/i3like.nix @@ -0,0 +1,173 @@ +{ config, lib, pkgs, ... }: + +with builtins; +with lib; +{ + imports = [ ./i3.nix ]; + + options = { + wm = { + enable = mkOption { + type = types.bool; + default = false; + description = "Manage window Manager"; + }; + kind = mkOption { + type = types.enum [ "i3" "sway" ]; + default = "sway"; + description = "WM to use"; + }; + modifier = mkOption { + type = types.str; + description = "modifier key to use"; + }; + + font = { + name = mkOption { + type = types.str; + description = "Font to use"; + }; + style = mkOption { + type = types.str; + description = "Font style"; + }; + size = mkOption { + type = types.float; + description = "Font size"; + }; + }; + + bar = { + font = { + name = mkOption { + type = types.str; + description = "Font to use for the bar"; + }; + style = mkOption { + type = types.str; + description = "Font style for the bar"; + }; + size = mkOption { + type = types.float; + description = "Font size for the bar"; + }; + }; + }; + + printScreen = { + enable = mkOption { + type = types.bool; + description = "Enable PrintScreen functionality"; + default = false; + }; + keybind = mkOption { + type = types.str; + description = "PrintScreen key"; + }; + command = mkOption { + type = types.str; + description = "Print screen command"; + }; + }; + + menu = { + enable = mkOption { + type = types.bool; + default = false; + description = "Enable menu"; + }; + keybind = mkOption { + type = types.str; + description = "Menu keybind"; + }; + command = mkOption { + type = types.str; + description = "Command to launch the menu"; + }; + }; + + exit = { + enable = mkOption { + type = types.bool; + default = false; + description = "Enable exit keybind"; + }; + keybind = mkOption { + type = types.str; + description = "Menu keybind"; + }; + command = mkOption { + type = types.str; + description = "Command to exit the WM"; + }; + }; + + notifications = { + enable = mkOption { + type = types.bool; + default = false; + description = "Enable notifications"; + }; + font = mkOption { + type = types.str; + description = "Font + Size"; + }; + defaultTimeout = mkOption { + type = types.int; + description = "Default timeout for notifications (in ms)"; + }; + }; + + startup = mkOption { + type = types.listOf (types.submodule { + options = { + command = mkOption { + type = types.str; + description = "Command that will be executed on startup."; + }; + + always = mkOption { + type = types.bool; + default = false; + description = "Whether to run command on each ${moduleName} restart."; + }; + }; + }); + }; + + workspaces = { + definitions = mkOption { + type = types.attrsOf (types.submodule { + options = { + key = mkOption { + type = types.str; + description = "Keybind for the workspace"; + }; + output = mkOption { + type = types.nullOr types.str; + description = "Assign workspace to output"; + default = null; + }; + assign = mkOption { + type = types.listOf types.str; + description = "Assign class elements"; + default = [ ]; + }; + }; + }); + description = "Workspace descriptions"; + default = { }; + }; + moveModifier = mkOption { + type = types.str; + description = "Modifier key to move windows to workspaces"; + }; + }; + + keybindings = mkOption { + type = types.attrsOf (types.nullOr types.str); + description = "keybindings"; + }; + }; + }; +} diff --git a/wm/sway.nix b/wm/sway.nix new file mode 100644 index 0000000..c29f41d --- /dev/null +++ b/wm/sway.nix @@ -0,0 +1,257 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ ./terminal ]; + + home.packages = with pkgs; [ + sway + ]; + + gtk = { + enable = true; + font = { + name = "DejaVu Sans"; + }; + theme = { + package = pkgs.gnome.gnome-themes-extra; + name = "Adwaita"; + }; + }; + + home.sessionVariables = { + MOZ_ENABLE_WAYLAND = "1"; + XDG_CURRENT_DESKTOP = "sway"; + LIBSEAT_BACKEND = "logind"; + }; + + terminal = { + enable = true; + kind = "foot"; + + colors = { + background = "000000"; + foreground = "ffffff"; + + black = { + normal = "000000"; + bright = "545454"; + }; + red = { normal = "ff5555"; }; + green = { normal = "55ff55"; }; + yellow = { normal = "ffff55"; }; + blue = { normal = "5555ff"; }; + magenta = { normal = "ff55ff"; }; + cyan = { normal = "55ffff"; }; + white = { + normal = "bbbbbb"; + bright = "ffffff"; + }; + + selectionForeground = "000000"; + }; + font = { + family = "Hack Nerd Font Mono"; + size = 7; + }; + }; + + programs = { + mako = { + enable = true; + font = "hack nerd font 10"; + margin = "20,20,5,5"; + ignoreTimeout = true; + defaultTimeout = 7000; + }; + + waybar = { + enable = true; + style = builtins.readFile ./waybar.css; + settings = [ + { + layer = "top"; + position = "bottom"; + modules-left = [ + "network#wifi" + "sway/workspaces" + "sway/mode" + ]; + modules-center = [ "sway/window" ]; + modules-right = [ + "cpu" + "memory" + "disk#home" + "disk#root" + "battery" + "clock" + "tray" + ]; + modules = { + "sway/workspaces" = { + persistent_workspaces = { + "" = [ ]; + "" = [ ]; + "1:" = [ ]; + }; + numeric-first = true; + }; + "network#wifi" = { + interface = "wlp1s0"; + format-wifi = "{essid} ({signalStrength}%) "; + }; + cpu = { + format = "﬙ {load}"; + }; + memory = { + format = " {used:.0f}G/{total:.0f}G"; + }; + "sway/window" = { + max-length = 50; + }; + "disk#home" = { + path = "/home"; + format = " {free}"; + }; + "disk#root" = { + path = "/"; + format = " {percentage_free}%"; + }; + "battery" = { + format = "{capacity}% {icon}"; + format-icons = [ "" "" "" "" "" ]; + }; + "clock" = { + format-alt = "{:%a, %d. %b %H:%M}"; + }; + }; + } + ]; + }; + }; + + wayland.windowManager.sway = { + enable = true; + config = { + modifier = "Mod4"; + bars = [{ + command = "waybar"; + }]; + input = + let + inputs = config.extraInfo.inputs; + inputsCfg = [ + (if inputs.keyboard != null then { + name = inputs.keyboard; + value = + { + xkb_layout = "us"; + xkb_variant = "dvp"; + xkb_options = "compose:102"; + }; + + } else null) + (if inputs.touchpad != null then { + name = inputs.touchpad; + value = { dwt = "disable"; }; + } else null) + ]; + in + builtins.listToAttrs inputsCfg; + fonts = { + names = [ "Hack Nerd Font" ]; + style = "Regular"; + size = 13.0; + }; + window = { + titlebar = true; + }; + startup = [ + { command = "systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK"; } + { command = "hash dbus-update-activation-environment 2>/dev/null && dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK"; } + { command = "${pkgs.mako}/bin/mako"; } + { command = "wdumpkeys >> ~/.keydump"; } + ]; + menu = "${pkgs.wofi}/bin/wofi --show drun,run --allow-images"; + keybindings = + let + mod = config.wayland.windowManager.sway.config.modifier; + menu = config.wayland.windowManager.sway.config.menu; + terminal = config.wayland.windowManager.sway.config.terminal; + ws1 = "1:"; + ws2 = "2:"; + ws3 = "3"; + ws4 = "4:"; + ws5 = "5"; + ws6 = "6"; + ws7 = "7"; + ws8 = "8"; + ws9 = ""; + ws10 = ""; + in + { + "Print" = "exec ${pkgs.grim}/bin/grim -g \"$(${pkgs.slurp}/bin/slurp)\" - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png"; + "${mod}+Shift+semicolon" = "kill"; + "${mod}+e" = "exec ${menu}"; + "${mod}+Return" = "exec ${terminal}"; + "${mod}+Shift+e" = + "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'"; + "XF86AudioMute" = "exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute 50 toggle"; + + "${mod}+u" = "fullscreen toggle"; + "${mod}+comma" = "layout tabbed"; + "${mod}+p" = "mode resize"; + + "${mod}+h" = "focus left"; + "${mod}+t" = "focus down"; + "${mod}+n" = "focus up"; + "${mod}+s" = "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+T" = "move down"; + "${mod}+Shift+N" = "move up"; + "${mod}+Shift+S" = "move right"; + "${mod}+Shift+Left" = "move left"; + "${mod}+Shift+Down" = "move down"; + "${mod}+Shift+Up" = "move up"; + "${mod}+Shift+Right" = "move right"; + + # Workspaces + "${mod}+ampersand" = "workspace ${ws1}"; + "${mod}+bracketleft" = "workspace ${ws2}"; + "${mod}+braceleft" = "workspace ${ws3}"; + "${mod}+braceright" = "workspace ${ws4}"; + "${mod}+parenleft" = "workspace ${ws5}"; + "${mod}+equal" = "workspace ${ws6}"; + "${mod}+asterisk" = "workspace ${ws7}"; + "${mod}+parenright" = "workspace ${ws8}"; + "${mod}+w" = "workspace ${ws9}"; + "${mod}+m" = "workspace ${ws10}"; + "${mod}+Shift+ampersand" = "move container to workspace ${ws1}"; + "${mod}+Shift+bracketleft" = "move container to workspace ${ws2}"; + "${mod}+Shift+braceleft" = "move container to workspace ${ws3}"; + "${mod}+Shift+braceright" = "move container to workspace ${ws4}"; + "${mod}+Shift+parenleft" = "move container to workspace ${ws5}"; + "${mod}+Shift+equal" = "move container to workspace ${ws6}"; + "${mod}+Shift+asterisk" = "move container to workspace ${ws7}"; + "${mod}+Shift+parenright" = "move container to workspace ${ws8}"; + "${mod}+Shift+w" = "move container to workspace ${ws9}"; + "${mod}+Shift+m" = "move container to workspace ${ws10}"; + + "${mod}+Shift+J" = "reload"; + "${mod}+Shift+p" = "restart"; + "${mod}+Shift+l" = "exec ${pkgs.swaylock-fancy}/bin/swaylock-fancy"; + }; + }; + + }; + + home.file = { + ".config/wofi/" = { + source = ./wofi; + recursive = true; + }; + }; +} diff --git a/wm/terminal/default.nix b/wm/terminal/default.nix index 5fb98ad..9c1c8f4 100644 --- a/wm/terminal/default.nix +++ b/wm/terminal/default.nix @@ -27,6 +27,10 @@ in default = "foot"; description = "The terminal to be used"; }; + command = mkOption { + type = types.str; + description = "The command used to launch the terminal"; + }; colors = { background = mkColor; foreground = mkColor; diff --git a/wm/terminal/foot.nix b/wm/terminal/foot.nix index 5990789..b440d96 100644 --- a/wm/terminal/foot.nix +++ b/wm/terminal/foot.nix @@ -10,6 +10,7 @@ in { config = mkIf (cfg.enable && cfg.kind == "foot") { + terminal.command = mkDefault "${pkgs.foot}/bin/foot"; programs.foot = { enable = true; settings = { @@ -54,6 +55,6 @@ in }; }; }; - wayland.windowManager.sway.config.terminal = "${pkgs.foot}/bin/foot"; + wayland.windowManager.sway.config.terminal = "${config.terminal.command}"; }; } diff --git a/wm/terminal/kitty.nix b/wm/terminal/kitty.nix index 895a9c8..bdb038f 100644 --- a/wm/terminal/kitty.nix +++ b/wm/terminal/kitty.nix @@ -10,6 +10,7 @@ in { config = mkIf (cfg.enable && cfg.kind == "kitty") { + terminal.command = mkDefault "${pkgs.kitty}/bin/kitty"; programs.kitty = { enable = true; font = { @@ -53,7 +54,7 @@ in selection_foreground = colorCfg cCfg.selectionForeground; }; }; - wayland.windowManager.sway.config.terminal = "${pkgs.kitty}/bin/kitty"; - xsession.windowManager.i3.config.terminal = "${pkgs.kitty}/bin/kitty"; + wayland.windowManager.sway.config.terminal = "${config.terminal.command}"; + xsession.windowManager.i3.config.terminal = "${config.terminal.command}"; }; }