2023-08-13 10:22:51 +02:00
|
|
|
{ pkgs, nixpkgs-latest, lib, config, ... }:
|
2023-05-21 21:15:04 +02:00
|
|
|
|
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;
|
2023-06-13 14:25:09 +02:00
|
|
|
default = 8;
|
2023-05-24 11:32:54 +02:00
|
|
|
};
|
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
|
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;
|
2023-06-17 17:41:19 +02:00
|
|
|
systemd.enable = true;
|
2023-05-21 21:15:04 +02:00
|
|
|
|
2023-06-15 11:54:40 +02:00
|
|
|
extraConfig = ''
|
|
|
|
bindsym --release ${mod}+d exec ${sc}/bin/sc
|
2023-12-23 18:01:36 +01:00
|
|
|
'' + (if !config.isNixos then ''
|
2023-12-22 12:26:06 +01:00
|
|
|
exec "${(import nixpkgs-latest {}).google-chrome}/bin/google-chrome-stable --ozone-platform-hint=auto --enable-features=VaapiVideoDecoder,VaapiVideoEncoder --app=https://calendar.google.com"
|
2023-12-23 18:01:36 +01:00
|
|
|
'' else "");
|
2023-06-15 11:54:40 +02:00
|
|
|
|
2023-05-22 17:38:39 +02:00
|
|
|
config = rec {
|
2023-09-21 18:07:31 +02:00
|
|
|
output."*".bg = "${../../data/time-warp.jpg} fill";
|
|
|
|
output."eDP-1".bg = "${../../data/temporal-cleansing.png} fill";
|
2023-06-28 13:29:23 +02:00
|
|
|
input."type:keyboard".xkb_options = "caps:super";
|
2023-05-22 17:38:39 +02:00
|
|
|
|
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
|
|
|
|
2023-06-15 17:22:53 +02:00
|
|
|
gaps = {
|
|
|
|
inner = 4;
|
|
|
|
outer = 2;
|
|
|
|
};
|
|
|
|
|
|
|
|
colors = {
|
|
|
|
focused = rec {
|
|
|
|
text = "#ffffff";
|
|
|
|
border = "#7c56c4";
|
|
|
|
background = border;
|
|
|
|
childBorder = border;
|
|
|
|
indicator = border;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
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-06-15 11:54:40 +02:00
|
|
|
keybindings = let
|
|
|
|
mpc = "${pkgs.mpc-cli}/bin/mpc";
|
|
|
|
in 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";
|
|
|
|
|
2023-06-15 11:54:40 +02:00
|
|
|
"${mod}+semicolon" = "workspace prev_on_output";
|
|
|
|
"${mod}+apostrophe" = "workspace next_on_output";
|
|
|
|
|
2023-05-24 11:56:03 +02:00
|
|
|
"${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-12-22 12:26:06 +01:00
|
|
|
"${mod}+Escape" = if config.isNixos then "exec ${pkgs.swaylock}/bin/swaylock" else "exec swaylock";
|
2023-09-21 20:38:50 +02:00
|
|
|
"${mod}+Space" = "exec pkill -SIGUSR1 waybar";
|
2023-06-15 11:54:40 +02:00
|
|
|
|
|
|
|
"${mod}+Return" = "exec ${terminal}";
|
|
|
|
"${mod}+Alt+Return" = "exec ${pkgs.foot}/bin/foot";
|
|
|
|
"${mod}+Tab" = "exec ${pkgs.firefox-wayland}/bin/firefox";
|
2023-08-13 10:22:51 +02:00
|
|
|
"${mod}+Alt+Tab" = "exec ${(import nixpkgs-latest {}).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-06-15 11:54:40 +02:00
|
|
|
"XF86AudioPlay" = "exec ${mpc} toggle";
|
|
|
|
|
2023-06-28 13:29:23 +02:00
|
|
|
"${mod}+z" = "exec ${vol} lower";
|
|
|
|
"${mod}+x" = "exec ${vol} raise";
|
|
|
|
|
2023-06-15 11:54:40 +02:00
|
|
|
"${mod}+comma" = "exec ${mpc} prev";
|
|
|
|
"${mod}+period" = "exec ${mpc} next";
|
|
|
|
"${mod}+slash" = "exec ${mpc} 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
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|