2022-01-10 09:53:42 +01:00
|
|
|
{ pkgs, config, lib, ... }:
|
|
|
|
|
2022-01-10 19:25:34 +01:00
|
|
|
let theme = (import ../../colors.nix)."dark".hex;
|
2022-01-10 09:53:42 +01:00
|
|
|
|
|
|
|
# Keybinds that launch an application.
|
|
|
|
launchers = ({ browser }: mod: {
|
|
|
|
"${mod}+Tab" = "exec ${browser}";
|
|
|
|
});
|
|
|
|
|
|
|
|
# Keybinds generated from a set of workspaces.
|
|
|
|
workspace = ({ numbered ? 0, named ? {} }: mod: with lib;
|
|
|
|
let nums = genAttrs (map toString (range 1 numbered)) id;
|
|
|
|
workspaces = named // nums;
|
|
|
|
genBinds = (n: k: {
|
|
|
|
|
|
|
|
# Focus the workspace
|
|
|
|
"${mod}+${k}" = "workspace ${n}";
|
|
|
|
|
|
|
|
# Move a window to the workspace
|
|
|
|
"${mod}+Shift+${k}" = "move window to workspace ${n}";
|
|
|
|
|
|
|
|
});
|
|
|
|
keybinds = mapAttrsToList genBinds workspaces; in
|
|
|
|
mkMerge (keybinds)
|
|
|
|
);
|
|
|
|
|
|
|
|
# Layout manipulation keybinds.
|
|
|
|
layout = (mod: {
|
|
|
|
|
|
|
|
"${mod}+A" = "split v";
|
|
|
|
"${mod}+S" = "split h";
|
|
|
|
|
|
|
|
"${mod}+F" = "fullscreen toggle";
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
# Directional keys are used for basic navigation.
|
|
|
|
directional = ({ left, right, up, down }: mod: {
|
|
|
|
|
|
|
|
# Change window focus
|
|
|
|
"${mod}+${left}" = "focus left";
|
|
|
|
"${mod}+${down}" = "focus down";
|
|
|
|
"${mod}+${up}" = "focus up";
|
|
|
|
"${mod}+${right}" = "focus right";
|
|
|
|
|
|
|
|
# Move windows
|
|
|
|
"${mod}+Shift+${left}" = "move left";
|
|
|
|
"${mod}+Shift+${down}" = "move down";
|
|
|
|
"${mod}+Shift+${up}" = "move up";
|
|
|
|
"${mod}+Shift+${right}" = "move right";
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
# Media controls.
|
|
|
|
media = ({ mpc ? null }: mod:
|
|
|
|
if (mpc != null)
|
|
|
|
then (let cmd = "${mpc}/bin/${mpc.pname}"; in {
|
|
|
|
"${mod}+comma" = "exec ${cmd} prev";
|
|
|
|
"${mod}+period" = "exec ${cmd} next";
|
|
|
|
"${mod}+slash" = "exec ${cmd} toggle";
|
|
|
|
})
|
|
|
|
else {}
|
|
|
|
);
|
|
|
|
|
|
|
|
# Utility scripts and such.
|
|
|
|
scripts = (mod: {}); in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
services.xserver = {
|
|
|
|
enable = true;
|
|
|
|
windowManager.i3 = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.i3; #-gaps;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
home-manager.users."riley" =
|
|
|
|
let browser = pkgs.google-chrome;
|
|
|
|
term = pkgs.alacritty; in
|
|
|
|
{
|
|
|
|
|
|
|
|
home.packages = with pkgs; [
|
|
|
|
|
|
|
|
tdesktop
|
|
|
|
|
|
|
|
xclip
|
|
|
|
|
|
|
|
# Paste from clipboard
|
|
|
|
(writeShellApplication {
|
|
|
|
name = "xc.p";
|
|
|
|
runtimeInputs = [ xclip ];
|
|
|
|
text = "xclip -sel clip -o";
|
|
|
|
})
|
|
|
|
|
|
|
|
# Copy to clipboard
|
|
|
|
(writeShellApplication {
|
|
|
|
name = "xc.c";
|
|
|
|
runtimeInputs = [ xclip ];
|
|
|
|
text = "xclip -sel clip -i";
|
|
|
|
})
|
|
|
|
|
|
|
|
# Copy to clipboard with given mime type
|
|
|
|
(writeShellApplication {
|
|
|
|
name = "xc.t";
|
|
|
|
runtimeInputs = [ xclip ];
|
|
|
|
text = "xclip -sel clip -t \"$1\" -i";
|
|
|
|
})
|
|
|
|
|
|
|
|
] ++ [
|
|
|
|
term
|
|
|
|
browser
|
|
|
|
];
|
|
|
|
|
|
|
|
xsession.windowManager.i3 = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
package = pkgs.i3;
|
|
|
|
|
|
|
|
config = with lib; (rec {
|
|
|
|
|
|
|
|
modifier = "Mod4";
|
|
|
|
terminal = "${term}/bin/${term.pname}";
|
|
|
|
|
|
|
|
# Apply the modifier key to each of the keybinding generator functions
|
|
|
|
# and merge the resulting sets.
|
|
|
|
keybindings = let mod = modifier; in mkMerge (map (f: f (mod)) [
|
|
|
|
(mod: {
|
|
|
|
"${mod}+Return" = "exec ${terminal}";
|
|
|
|
"${mod}+BackSpace" = "kill";
|
|
|
|
})
|
|
|
|
(directional {
|
|
|
|
left = "H";
|
|
|
|
right = "L";
|
|
|
|
down = "J";
|
|
|
|
up = "K";
|
|
|
|
})
|
|
|
|
(workspace {
|
|
|
|
numbered = 5;
|
|
|
|
named = {
|
|
|
|
"dev" = "0";
|
|
|
|
"doc" = "minus";
|
|
|
|
"net" = "equal";
|
|
|
|
};
|
|
|
|
})
|
|
|
|
(launchers {
|
|
|
|
browser = "google-chrome-stable";
|
|
|
|
})
|
|
|
|
layout
|
|
|
|
(media {
|
|
|
|
mpc = pkgs.mpc_cli;
|
|
|
|
})
|
|
|
|
scripts
|
|
|
|
]);
|
|
|
|
|
|
|
|
colors = {
|
|
|
|
focused = rec {
|
2022-01-10 19:25:34 +01:00
|
|
|
background = theme.background.normal;
|
|
|
|
text = theme."red".bright;
|
2022-01-10 09:53:42 +01:00
|
|
|
border = background;
|
|
|
|
childBorder = border;
|
|
|
|
indicator = border;
|
|
|
|
};
|
|
|
|
unfocused = rec {
|
2022-01-10 19:25:34 +01:00
|
|
|
background = theme.background.normal;
|
|
|
|
text = theme.foreground.slight;
|
2022-01-10 09:53:42 +01:00
|
|
|
border = background;
|
|
|
|
childBorder = border;
|
|
|
|
indicator = border;
|
|
|
|
};
|
|
|
|
focusedInactive = colors.unfocused;
|
|
|
|
};
|
|
|
|
|
|
|
|
window = {
|
|
|
|
border = 2;
|
|
|
|
commands = [
|
|
|
|
{ command = "border pixel 2"; criteria = { class = ".*"; }; }
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
fonts = {
|
|
|
|
names = [ "Source Sans 3" ];
|
|
|
|
style = "Semibold";
|
|
|
|
size = 10.0;
|
|
|
|
};
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|