2023-05-21 21:15:04 +02:00
|
|
|
{ pkgs, lib, config, ... }:
|
|
|
|
|
2023-05-24 11:32:54 +02:00
|
|
|
let mod = "Mod4";
|
2023-06-06 16:07:56 +02:00
|
|
|
cfg = config.custom.gui;
|
2023-05-24 11:32:54 +02:00
|
|
|
|
|
|
|
# Generate the workspace keybinds
|
|
|
|
genWorkspaces = { numbered, named }: with lib; (
|
|
|
|
let nums = genAttrs (map toString (range 1 (min numbered 9))) id;
|
|
|
|
genBindings = (num: key: {
|
|
|
|
"${mod}+${key}" = "workspace ${num}";
|
|
|
|
"${mod}+Shift+${key}" = "move window to workspace ${num}";
|
|
|
|
});
|
|
|
|
keybinds = mapAttrsToList genBindings (nums // named);
|
|
|
|
in mkMerge keybinds
|
|
|
|
);
|
2023-05-21 21:15:04 +02:00
|
|
|
|
2023-05-25 19:24:19 +02:00
|
|
|
sc = with pkgs; (writeScriptBin "sc" ''
|
2023-06-06 16:07:56 +02:00
|
|
|
${slurp}/bin/slurp | ${grim}/bin/grim -g - - | ${wl-clipboard}/bin/wl-copy -t image/png
|
|
|
|
'');
|
2023-05-25 19:24:19 +02:00
|
|
|
|
2023-06-06 17:14:33 +02:00
|
|
|
vol = ../../../script/vol;
|
|
|
|
|
2023-05-21 21:15:04 +02:00
|
|
|
in with lib; {
|
|
|
|
|
2023-06-06 16:07:56 +02:00
|
|
|
options.custom.gui.wm = with types; {
|
2023-05-24 11:32:54 +02:00
|
|
|
workspaces.named = mkOption {
|
|
|
|
type = attrsOf str;
|
|
|
|
default = {};
|
|
|
|
};
|
|
|
|
workspaces.numbered = mkOption {
|
|
|
|
type = int;
|
|
|
|
default = 5;
|
|
|
|
};
|
2023-05-21 21:15:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf (cfg.enable) {
|
|
|
|
|
2023-05-22 17:38:39 +02:00
|
|
|
home.packages = with pkgs; [
|
2023-05-23 17:38:19 +02:00
|
|
|
kitty
|
|
|
|
swaylock
|
2023-05-22 17:38:39 +02:00
|
|
|
wl-clipboard
|
2023-05-25 19:24:19 +02:00
|
|
|
sc
|
2023-05-22 17:38:39 +02:00
|
|
|
(writeScriptBin "c" ''
|
|
|
|
${wl-clipboard}/bin/wl-copy
|
|
|
|
'')
|
|
|
|
(writeScriptBin "p" ''
|
|
|
|
${wl-clipboard}/bin/wl-paste
|
|
|
|
'')
|
|
|
|
];
|
|
|
|
|
2023-06-06 19:54:12 +02:00
|
|
|
services.unclutter.enable = true;
|
2023-05-21 21:15:04 +02:00
|
|
|
|
|
|
|
wayland.windowManager.sway = {
|
|
|
|
# This is all required to get it to not die.
|
|
|
|
enable = true;
|
2023-06-06 16:05:51 +02:00
|
|
|
wrapperFeatures.gtk = true;
|
|
|
|
extraSessionCommands = ''
|
|
|
|
export WLR_NO_HARDWARE_CURSORS=1;
|
|
|
|
export WLR_RENDERER=vulkan;
|
|
|
|
export WLR_EGL_NO_MODIFIERS=1;
|
|
|
|
'';
|
2023-05-21 21:15:04 +02:00
|
|
|
extraOptions = [ "--unsupported-gpu" ];
|
2023-06-06 16:05:51 +02:00
|
|
|
systemdIntegration = true;
|
2023-05-21 21:15:04 +02:00
|
|
|
|
2023-05-22 17:38:39 +02:00
|
|
|
config = rec {
|
2023-05-22 00:45:36 +02:00
|
|
|
output."*".bg = "${../../data/wallpaper.jpg} fill";
|
2023-05-22 17:38:39 +02:00
|
|
|
input."type:keyboard".xkb_options = "caps:escape";
|
|
|
|
|
2023-05-23 17:38:19 +02:00
|
|
|
terminal = "kitty --single-instance";
|
2023-06-06 19:54:12 +02:00
|
|
|
bars = [];
|
2023-05-22 17:38:39 +02:00
|
|
|
|
|
|
|
# Directional keys
|
2023-05-24 11:32:54 +02:00
|
|
|
modifier = mod;
|
2023-05-22 17:38:39 +02:00
|
|
|
fonts = {
|
|
|
|
names = [ "Fira Code" ];
|
|
|
|
size = 8.0;
|
|
|
|
};
|
|
|
|
|
2023-05-24 11:56:03 +02:00
|
|
|
keybindings = mkMerge [
|
2023-06-06 16:07:56 +02:00
|
|
|
(genWorkspaces { inherit (cfg.wm.workspaces) numbered named; })
|
2023-05-24 11:56:03 +02:00
|
|
|
{
|
|
|
|
"${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}+a" = "split v";
|
|
|
|
"${mod}+s" = "split h";
|
|
|
|
"${mod}+f" = "fullscreen toggle";
|
|
|
|
|
|
|
|
"${mod}+Alt+a" = "layout toggle stacking splitv";
|
|
|
|
"${mod}+Alt+s" = "layout toggle tabbed splith";
|
|
|
|
|
2023-05-23 17:38:19 +02:00
|
|
|
"${mod}+q" = "exec ${pkgs.foot}/bin/foot";
|
|
|
|
"${mod}+Return" = "exec ${terminal}";
|
|
|
|
"${mod}+Escape" = "exec swaylock";
|
2023-06-06 16:05:51 +02:00
|
|
|
"${mod}+Tab" = "exec ${pkgs.firefox-wayland}/bin/firefox";
|
|
|
|
"${mod}+Alt+Tab" = "exec ${pkgs.google-chrome}/bin/google-chrome-stable --ozone-platform-hint=auto --enable-features=VaapiVideoDecoder,VaapiVideoEncoder";
|
2023-05-24 11:56:03 +02:00
|
|
|
|
|
|
|
"${mod}+Backspace" = "mode kill";
|
2023-06-06 17:14:33 +02:00
|
|
|
|
|
|
|
"XF86AudioRaiseVolume" = "exec ${vol} raise";
|
|
|
|
"XF86AudioLowerVolume" = "exec ${vol} lower";
|
|
|
|
"XF86AudioMute" = "exec ${vol} toggle";
|
2023-05-24 11:56:03 +02:00
|
|
|
}
|
|
|
|
];
|
2023-05-22 17:38:39 +02:00
|
|
|
|
|
|
|
modes."kill" = {
|
|
|
|
Backspace = "kill; mode default";
|
|
|
|
Escape = "mode default";
|
|
|
|
};
|
|
|
|
|
2023-06-06 16:07:56 +02:00
|
|
|
window.titlebar = false;
|
2023-05-22 00:45:36 +02:00
|
|
|
};
|
2023-05-21 21:15:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|