1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
Files
niveum/configs/i3.nix

174 lines
6.3 KiB
Nix
Raw Normal View History

2019-04-19 03:11:51 +02:00
{ config, pkgs, lib, ... }:
let
2019-04-19 15:02:05 +02:00
new-workspace = pkgs.unstable.writers.writeDash "new-workspace" ''
2019-04-19 03:11:51 +02:00
i3-msg workspace $(($(i3-msg -t get_workspaces | tr , '\n' | grep '"num":' | cut -d : -f 2 | sort -rn | head -1) + 1))
'';
2019-04-19 15:02:05 +02:00
move-to-new-workspace = pkgs.unstable.writers.writeDash "new-workspace" ''
2019-04-19 03:11:51 +02:00
i3-msg move container to workspace $(($(i3-msg -t get_workspaces | tr , '\n' | grep '"num":' | cut -d : -f 2 | sort -rn | head -1) + 1))
'';
2019-04-19 15:02:05 +02:00
in with config.niveum; {
2019-04-19 03:11:51 +02:00
services.xserver = {
windowManager.default = "i3";
2020-04-10 14:52:28 +02:00
windowManager.i3 = {
enable = true;
package = pkgs.i3-gaps;
};
2019-04-19 03:11:51 +02:00
};
home-manager.users.me.xsession.windowManager.i3 = {
enable = true;
config = rec {
fonts = [ "Monospace ${toString config.niveum.fonts.size}" ];
2019-04-19 03:11:51 +02:00
modifier = "Mod4";
window = {
titlebar = false;
border = 1;
hideEdgeBorders = "smart";
2020-04-10 14:52:28 +02:00
commands = [
2020-04-18 17:58:14 +02:00
{
criteria = { class = "floating"; };
command = "floating enable";
}
2020-04-10 14:52:28 +02:00
{
2020-04-10 15:06:15 +02:00
criteria = { class = "fzfmenu"; };
command = "floating enable";
}
{
criteria = { class = "mpv"; };
command = lib.strings.concatStringsSep ", " [
"floating enable"
"sticky enable"
"fullscreen disable"
"resize set 640 480"
"move position mouse"
];
2020-04-10 14:52:28 +02:00
}
];
};
gaps.inner = 8;
2019-04-19 03:11:51 +02:00
floating = {
titlebar = false;
border = 1;
};
colors =
2019-04-19 15:02:05 +02:00
let scheme = { background = colours.background; text = colours.foreground; };
in rec {
2019-04-19 03:11:51 +02:00
focused = scheme // {
2020-04-10 14:52:28 +02:00
border = colours.foreground;
indicator = colours.foreground;
childBorder = colours.foreground;
};
unfocused = scheme // {
2019-04-19 15:02:05 +02:00
border = colours.background;
indicator = colours.background;
childBorder = colours.background;
2019-04-19 03:11:51 +02:00
};
2020-04-10 16:18:20 +02:00
focusedInactive = unfocused;
2019-04-19 03:11:51 +02:00
urgent = scheme // {
2019-04-19 15:02:05 +02:00
border = colours.red.bright;
indicator = colours.red.bright;
childBorder = colours.red.bright;
2019-04-19 03:11:51 +02:00
};
placeholder = scheme // {
2019-04-19 15:02:05 +02:00
border = colours.green.bright;
indicator = colours.green.bright;
childBorder = colours.green.bright;
2019-04-19 03:11:51 +02:00
};
};
bars = [{
workspaceButtons = false;
fonts = [ "Monospace ${toString (config.niveum.fonts.size - 1)}" ];
2019-04-19 03:11:51 +02:00
mode = "hide";
2019-04-19 15:02:05 +02:00
colors = rec {
background = colours.background;
separator = background;
statusline = colours.foreground;
2019-04-19 03:11:51 +02:00
bindingMode = {
2019-04-19 15:02:05 +02:00
background = colours.red.bright;
border = colours.background;
text = colours.foreground;
2019-04-19 03:11:51 +02:00
};
};
2019-11-05 21:59:51 +01:00
statusCommand = "${pkgs.unstable.i3status-rust}/bin/i3status-rs ${
pkgs.writeTOML (import <niveum/dot/i3status-rust.nix> {
2019-09-25 10:12:01 +02:00
wifi-interface = networkInterfaces.wireless;
batteryBlock = batteryBlocks.default;
inherit (config.niveum) colours;
2020-04-15 00:08:44 +02:00
inherit pkgs;
2019-11-05 21:59:51 +01:00
})
}";
2019-04-19 03:11:51 +02:00
}];
keybindings = {
"${modifier}+Shift+h" = "move left";
"${modifier}+Shift+j" = "move down";
"${modifier}+Shift+k" = "move up";
"${modifier}+Shift+l" = "move right";
"${modifier}+h" = "focus left";
"${modifier}+j" = "focus down";
"${modifier}+k" = "focus up";
"${modifier}+l" = "focus right";
2019-04-22 22:40:41 +02:00
"${modifier}+Shift+b" = "move window to workspace prev";
2019-04-19 03:11:51 +02:00
"${modifier}+Shift+n" = "move window to workspace next";
"${modifier}+Shift+x" = "exec --no-startup-id ${move-to-new-workspace}";
"${modifier}+b" = "workspace prev";
"${modifier}+n" = "workspace next";
"${modifier}+x" = "exec --no-startup-id ${new-workspace}";
"${modifier}+Shift+c" = "reload";
2019-04-19 03:11:51 +02:00
"${modifier}+Shift+q" = "kill";
"${modifier}+Shift+r" = "restart";
"${modifier}+Shift+s" = "sticky toggle";
"${modifier}+Shift+z" = "floating toggle";
2019-04-22 22:40:41 +02:00
"${modifier}+c" = "split h";
2019-04-19 03:11:51 +02:00
"${modifier}+e" = "layout toggle split";
"${modifier}+f" = "fullscreen toggle";
"${modifier}+r" = "mode resize";
"${modifier}+s" = "layout stacking";
"${modifier}+v" = "split v";
"${modifier}+w" = "layout tabbed";
"${modifier}+Return" = "exec i3-sensible-terminal";
"${modifier}+Shift+y" = "exec ${pkgs.qutebrowser}/bin/qutebrowser";
"${modifier}+t" = "exec ${applications.fileManager}";
"${modifier}+y" = "exec x-www-browser";
"${modifier}+Shift+w" = "exec ${pkgs.xautolock}/bin/xautolock -locknow";
"${modifier}+a" = "exec --no-startup-id ${pkgs.rofi}/bin/rofi -display-window -show window";
"${modifier}+d" = "exec --no-startup-id ${pkgs.dmenu}/bin/dmenu_run";
"${modifier}+Shift+d" = "exec ${pkgs.writers.writeDash "notemenu" ''
set -efu
PATH=$PATH:${lib.makeBinPath [ pkgs.dmenu pkgs.findutils ]}
cd ~/notes
find . -maxdepth 1 -type f | dmenu -i -l 20 | xargs i3-sensible-terminal -e "$EDITOR"
''}";
"${modifier}+p" = "exec --no-startup-id ${pkgs.pass}/bin/passmenu -l 5";
"${modifier}+u" = "exec ${pkgs.scripts.emoji-menu}/bin/emoji-menu";
2019-04-21 08:32:19 +02:00
"XF86AudioLowerVolume" = "exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -d 5";
"XF86AudioMute" = "exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -t";
"XF86AudioRaiseVolume" = "exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -i 5";
2020-04-18 17:58:14 +02:00
"XF86Calculator" = "exec ${pkgs.st}/bin/st -c floating -e ${pkgs.bc}/bin/bc";
2019-09-24 23:32:06 +02:00
"XF86ScreenSaver" = "exec ${pkgs.xautolock}/bin/xautolock -locknow";
2019-09-25 10:12:39 +02:00
"XF86Display" = "exec ${pkgs.xcalib}/bin/xcalib -invert -alter";
# key names detected with xorg.xev:
2019-09-24 23:32:06 +02:00
# XF86WakeUp (fn twice)
# XF86Battery (fn f3)
# XF86Sleep (fn f4) - actually suspends
# XF86WLAN
# XF86WebCam (fn f6)
# XF86TouchpadToggle (fn f8)
# XF86Suspend (fn f12) - actually suspends to disk
# Num_Lock (fn Roll) - numlocks
# XF86Audio{Prev,Next,Mute,Play,Stop}
# XF86Forward
# XF86Back
# XF86Launch1 (thinkvantage)
2019-04-19 03:11:51 +02:00
};
};
};
}