2022-10-12 16:58:38 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.home-manager.users.mainUser.xsession.windowManager.i3;
|
|
|
|
colorTheme =
|
|
|
|
let
|
|
|
|
theme = (import ../../../library/colorThemes.nix).solarized.light.hex;
|
|
|
|
in
|
|
|
|
theme // {
|
2022-10-12 18:27:33 +02:00
|
|
|
foreground = theme.base3;
|
2022-10-12 16:58:38 +02:00
|
|
|
background = theme.base03;
|
|
|
|
};
|
|
|
|
|
2022-10-21 08:38:19 +02:00
|
|
|
# switch to named workspaces
|
|
|
|
i3-wk-switch = pkgs.i3-wk-switch.overrideAttrs (old: {
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "tmfink";
|
|
|
|
repo = "i3-wk-switch";
|
|
|
|
rev = "5f43bb8cbe7938eff476fc534b61c8fb6a700c8f";
|
|
|
|
sha256 = "sha256-DOBPI/wO+S8a6EzWJeVGODXeSixFl7SHTtHAq5DG8GU=";
|
|
|
|
};
|
|
|
|
});
|
2022-10-18 09:32:28 +02:00
|
|
|
|
|
|
|
backgroundCommand = pkgs.writers.writeDash "background" ''
|
|
|
|
${pkgs.xorg.xrandr}/bin/xrandr | grep " connected" | \
|
|
|
|
${pkgs.gnused}/bin/sed -E "s/primary //" | \
|
|
|
|
${pkgs.coreutils-full}/bin/cut -d' ' -f 3 | \
|
|
|
|
${pkgs.gnused}/bin/sed -E 's/\+.*$//g' | \
|
|
|
|
${pkgs.coreutils-full}/bin/sort -r | \
|
|
|
|
${pkgs.coreutils-full}/bin/head -n 1 | \
|
|
|
|
${pkgs.gawk}/bin/awk -F 'x' '{print "--width="$1" --height="$2}' | \
|
|
|
|
${pkgs.findutils}/bin/xargs \
|
|
|
|
${pkgs.polygon-art.polygon-art}/bin/rings \
|
|
|
|
/dev/shm/background.png && \
|
|
|
|
${pkgs.feh}/bin/feh --bg-scale /dev/shm/background.png
|
|
|
|
'';
|
|
|
|
|
2022-10-12 16:58:38 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
home-manager.users.mainUser = {
|
|
|
|
|
2022-10-12 18:27:33 +02:00
|
|
|
programs.i3status-rust = {
|
|
|
|
enable = true;
|
|
|
|
bars = {
|
|
|
|
my = {
|
|
|
|
icons = "awesome5";
|
|
|
|
theme = "solarized-light";
|
|
|
|
# https://github.com/greshake/i3status-rust/blob/v0.22.0/doc/blocks.md
|
|
|
|
blocks = [
|
|
|
|
{
|
|
|
|
block = "cpu";
|
|
|
|
interval = 1;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
block = "memory";
|
|
|
|
display_type = "memory";
|
|
|
|
format_mem = "{mem_used_percents}";
|
|
|
|
format_swap = "{swap_used_percents}";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
block = "load";
|
|
|
|
interval = 1;
|
|
|
|
format = "{1m}";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
block = "battery";
|
|
|
|
interval = 10;
|
|
|
|
format = "{percentage} {time}";
|
|
|
|
}
|
|
|
|
{ block = "uptime"; }
|
|
|
|
{
|
|
|
|
block = "time";
|
|
|
|
interval = 60;
|
|
|
|
format = "%Y-%m-%d %R";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
2022-10-12 16:58:38 +02:00
|
|
|
|
|
|
|
xsession.windowManager.i3 = {
|
|
|
|
enable = true;
|
2022-10-12 19:48:04 +02:00
|
|
|
extraConfig = ''
|
|
|
|
default_border pixel
|
|
|
|
'';
|
2022-10-12 16:58:38 +02:00
|
|
|
config = {
|
|
|
|
modifier = "Mod4";
|
2022-10-12 18:27:33 +02:00
|
|
|
startup =
|
|
|
|
let
|
|
|
|
height = config.configuration.desktop.height;
|
|
|
|
width = config.configuration.desktop.width;
|
|
|
|
in
|
|
|
|
[
|
|
|
|
{ command = "${pkgs.albert}/bin/albert"; always = true; }
|
2022-10-19 09:41:25 +02:00
|
|
|
#{
|
|
|
|
# command = "${pkgs.polygon-art.polygon-art}/bin/rings --height ${toString height} --width ${toString width} /dev/shm/background.png && ${pkgs.feh}/bin/feh --bg-scale /dev/shm/background.png";
|
|
|
|
# always = true;
|
|
|
|
#}
|
|
|
|
{ command = toString backgroundCommand; always = true; }
|
|
|
|
#{ command = "${pkgs.flameshot}/bin/flameshot"; always = true; }
|
2022-10-12 18:27:33 +02:00
|
|
|
# { command = "systemctl --user restart polybar"; always = true; notification = false; }
|
|
|
|
];
|
2022-10-13 07:43:48 +02:00
|
|
|
fonts = {
|
|
|
|
names = [ "Terminus" ];
|
|
|
|
size = 9.0;
|
|
|
|
};
|
2022-10-12 16:58:38 +02:00
|
|
|
bars =
|
2022-10-13 08:07:31 +02:00
|
|
|
with colorTheme;
|
|
|
|
let
|
|
|
|
selected = blue;
|
|
|
|
in
|
2022-10-12 16:58:38 +02:00
|
|
|
[{
|
|
|
|
mode = "hide";
|
|
|
|
hiddenState = "hide";
|
2022-10-13 08:07:31 +02:00
|
|
|
position = "top";
|
2022-10-12 16:58:38 +02:00
|
|
|
workspaceButtons = true;
|
|
|
|
workspaceNumbers = true;
|
2022-10-12 18:27:33 +02:00
|
|
|
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${config.users.users.mainUser.home}/.config/i3status-rust/config-my.toml";
|
2023-01-07 16:41:03 +01:00
|
|
|
#fonts = [ "Terminus" ];
|
|
|
|
fonts = {
|
|
|
|
names = [ "Terminus" ];
|
|
|
|
size = 9.0;
|
|
|
|
};
|
2022-10-12 16:58:38 +02:00
|
|
|
trayOutput = "primary";
|
|
|
|
colors = {
|
2022-10-13 08:07:31 +02:00
|
|
|
background = background;
|
|
|
|
statusline = background;
|
|
|
|
separator = background;
|
2022-10-12 16:58:38 +02:00
|
|
|
focusedWorkspace = {
|
2022-10-13 08:07:31 +02:00
|
|
|
border = selected;
|
|
|
|
background = base02;
|
|
|
|
text = foreground;
|
2022-10-12 16:58:38 +02:00
|
|
|
};
|
|
|
|
activeWorkspace = {
|
2022-10-13 08:07:31 +02:00
|
|
|
border = background;
|
|
|
|
background = base02;
|
|
|
|
text = foreground;
|
2022-10-12 16:58:38 +02:00
|
|
|
};
|
|
|
|
inactiveWorkspace = {
|
2022-10-13 08:07:31 +02:00
|
|
|
border = background;
|
|
|
|
background = base02;
|
|
|
|
text = foreground;
|
2022-10-12 16:58:38 +02:00
|
|
|
};
|
|
|
|
urgentWorkspace = {
|
2022-10-13 08:07:31 +02:00
|
|
|
border = red;
|
|
|
|
background = base02;
|
|
|
|
text = foreground;
|
2022-10-12 16:58:38 +02:00
|
|
|
};
|
|
|
|
bindingMode = {
|
2022-10-13 08:07:31 +02:00
|
|
|
border = red;
|
|
|
|
background = red;
|
|
|
|
text = background;
|
2022-10-12 16:58:38 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}];
|
2022-10-13 07:43:48 +02:00
|
|
|
colors = with colorTheme; {
|
|
|
|
background = background;
|
|
|
|
focused = {
|
|
|
|
background = blue;
|
|
|
|
border = blue;
|
|
|
|
childBorder = blue;
|
|
|
|
indicator = blue;
|
|
|
|
text = foreground;
|
|
|
|
};
|
|
|
|
focusedInactive = {
|
|
|
|
background = base01;
|
|
|
|
border = base01;
|
|
|
|
childBorder = base02;
|
|
|
|
indicator = base02;
|
|
|
|
text = foreground;
|
|
|
|
};
|
|
|
|
unfocused = {
|
|
|
|
background = base02;
|
|
|
|
border = base02;
|
|
|
|
childBorder = base02;
|
|
|
|
indicator = base02;
|
|
|
|
text = foreground;
|
|
|
|
};
|
|
|
|
urgent = {
|
|
|
|
background = orange;
|
|
|
|
border = orange;
|
|
|
|
childBorder = background;
|
|
|
|
indicator = background;
|
|
|
|
text = foreground;
|
|
|
|
};
|
|
|
|
};
|
2022-10-12 16:58:38 +02:00
|
|
|
keybindings = {
|
2022-10-19 09:41:25 +02:00
|
|
|
"Print" = "exec ${pkgs.flameshot}/bin/flameshot gui -c -p /share/";
|
2022-10-12 16:58:38 +02:00
|
|
|
"${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}";
|
2022-10-12 19:48:04 +02:00
|
|
|
"${cfg.config.modifier}+Shift+q" = "exit";
|
|
|
|
"${cfg.config.modifier}+q" = "kill";
|
2022-10-12 16:58:38 +02:00
|
|
|
|
|
|
|
"${cfg.config.modifier}+Left" = "focus left";
|
|
|
|
"${cfg.config.modifier}+Down" = "focus down";
|
|
|
|
"${cfg.config.modifier}+Up" = "focus up";
|
|
|
|
"${cfg.config.modifier}+Right" = "focus right";
|
|
|
|
"${cfg.config.modifier}+j" = "focus next";
|
|
|
|
"${cfg.config.modifier}+k" = "focus prev";
|
|
|
|
|
|
|
|
"${cfg.config.modifier}+Shift+Left" = "move left";
|
|
|
|
"${cfg.config.modifier}+Shift+Down" = "move down";
|
|
|
|
"${cfg.config.modifier}+Shift+Up" = "move up";
|
|
|
|
"${cfg.config.modifier}+Shift+Right" = "move right";
|
|
|
|
|
|
|
|
"${cfg.config.modifier}+h" = "split h";
|
|
|
|
"${cfg.config.modifier}+v" = "split v";
|
|
|
|
"${cfg.config.modifier}+f" = "fullscreen toggle";
|
|
|
|
|
|
|
|
"${cfg.config.modifier}+s" = "layout stacking";
|
|
|
|
"${cfg.config.modifier}+w" = "layout tabbed";
|
|
|
|
"${cfg.config.modifier}+e" = "layout toggle split";
|
|
|
|
|
2022-10-19 09:41:25 +02:00
|
|
|
"${cfg.config.modifier}+t" = "floating toggle";
|
2022-10-12 16:58:38 +02:00
|
|
|
#"${cfg.config.modifier}+space" = "focus mode_toggle";
|
|
|
|
|
2022-10-18 09:32:28 +02:00
|
|
|
"${cfg.config.modifier}+b" = "exec ${backgroundCommand}";
|
|
|
|
|
2022-10-13 11:45:50 +02:00
|
|
|
"${cfg.config.modifier}+p" = "focus parent";
|
2022-10-12 16:58:38 +02:00
|
|
|
|
|
|
|
"${cfg.config.modifier}+Shift+minus" = "move scratchpad";
|
|
|
|
"${cfg.config.modifier}+minus" = "scratchpad show";
|
|
|
|
|
2022-10-21 08:38:19 +02:00
|
|
|
"${cfg.config.modifier}+1" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 1";
|
|
|
|
"${cfg.config.modifier}+2" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 2";
|
|
|
|
"${cfg.config.modifier}+3" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 3";
|
|
|
|
"${cfg.config.modifier}+4" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 4";
|
|
|
|
"${cfg.config.modifier}+5" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 5";
|
|
|
|
"${cfg.config.modifier}+6" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 6";
|
|
|
|
"${cfg.config.modifier}+7" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 7";
|
|
|
|
"${cfg.config.modifier}+8" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 8";
|
|
|
|
"${cfg.config.modifier}+9" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 9";
|
|
|
|
"${cfg.config.modifier}+0" = "exec --no-startup-id ${i3-wk-switch}/bin/i3-wk-switch 10";
|
2022-10-12 16:58:38 +02:00
|
|
|
|
|
|
|
"${cfg.config.modifier}+Shift+1" = "move container to workspace number 1";
|
|
|
|
"${cfg.config.modifier}+Shift+2" = "move container to workspace number 2";
|
|
|
|
"${cfg.config.modifier}+Shift+3" = "move container to workspace number 3";
|
|
|
|
"${cfg.config.modifier}+Shift+4" = "move container to workspace number 4";
|
|
|
|
"${cfg.config.modifier}+Shift+5" = "move container to workspace number 5";
|
|
|
|
"${cfg.config.modifier}+Shift+6" = "move container to workspace number 6";
|
|
|
|
"${cfg.config.modifier}+Shift+7" = "move container to workspace number 7";
|
|
|
|
"${cfg.config.modifier}+Shift+8" = "move container to workspace number 8";
|
|
|
|
"${cfg.config.modifier}+Shift+9" = "move container to workspace number 9";
|
|
|
|
"${cfg.config.modifier}+Shift+0" = "move container to workspace number 10";
|
|
|
|
|
2022-10-13 08:07:31 +02:00
|
|
|
"${cfg.config.modifier}+Escape" = "workspace back_and_forth";
|
|
|
|
|
|
|
|
# rename workspace
|
|
|
|
"${cfg.config.modifier}+n" = ''
|
|
|
|
exec i3-input -F 'rename workspace to "%s"' -P 'New name for this workspace: '
|
|
|
|
'';
|
|
|
|
|
2022-10-13 11:45:50 +02:00
|
|
|
"${cfg.config.modifier}+grave" =
|
|
|
|
let
|
|
|
|
script = pkgs.writers.writeBash "select-workspace" ''
|
|
|
|
set -e
|
|
|
|
set -o pipefail
|
|
|
|
${pkgs.i3}/bin/i3-msg -t get_workspaces | \
|
|
|
|
${pkgs.jq}/bin/jq --raw-output '.[] | .name' | \
|
|
|
|
${pkgs.rofi}/bin/rofi -dmenu -p 'Select Workspace' | \
|
|
|
|
while read line
|
|
|
|
do
|
2022-10-21 08:38:19 +02:00
|
|
|
${i3-wk-switch}/bin/i3-wk-switch "$line"
|
2022-10-13 11:45:50 +02:00
|
|
|
done
|
|
|
|
'';
|
|
|
|
in
|
|
|
|
"exec ${script}";
|
|
|
|
|
2022-10-12 16:58:38 +02:00
|
|
|
"${cfg.config.modifier}+Shift+c" = "reload";
|
|
|
|
"${cfg.config.modifier}+Shift+r" = "restart";
|
|
|
|
"${cfg.config.modifier}+Shift+e" = "exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
|
|
|
|
|
|
|
|
"${cfg.config.modifier}+r" = "mode resize";
|
|
|
|
|
2022-10-22 15:01:11 +02:00
|
|
|
# multiple monitors
|
|
|
|
# autorandr --save docked # to save setup
|
|
|
|
# autorandr --save undocked # to save setup
|
|
|
|
# autorandr --change # automatically detects the setup
|
|
|
|
"${cfg.config.modifier}+BackSpace" =
|
|
|
|
let
|
|
|
|
xmodmapConfig = pkgs.writeText "xmodmap" ''
|
|
|
|
!
|
|
|
|
! Swap Caps_Lock and Control_L
|
|
|
|
!
|
|
|
|
|
|
|
|
! replace capslock keys with Escape Keys
|
|
|
|
! remove Lock = Caps_Lock
|
|
|
|
clear Lock
|
|
|
|
add Lock = Scroll_Lock
|
|
|
|
|
|
|
|
keysym Caps_Lock = Escape
|
|
|
|
|
|
|
|
! Set Right function Key to Windows-key
|
|
|
|
keycode 135 = Super_R NoSymbol Super_R NoSymbol Super_R
|
|
|
|
|
|
|
|
! Map umlauts to RIGHT ALT + <key>
|
|
|
|
keycode 108 = Mode_switch
|
|
|
|
keysym e = e E EuroSign
|
|
|
|
keysym c = c C cent
|
|
|
|
keysym a = a A adiaeresis Adiaeresis
|
|
|
|
keysym o = o O odiaeresis Odiaeresis
|
|
|
|
keysym u = u U udiaeresis Udiaeresis
|
|
|
|
keysym s = s S ssharp
|
|
|
|
'';
|
|
|
|
script = pkgs.writers.writeBash "autorandr" ''
|
|
|
|
${pkgs.autorandr}/bin/autorandr --change
|
|
|
|
${pkgs.xorg.xmodmap}/bin/xmodmap ${xmodmapConfig}
|
|
|
|
${backgroundCommand}
|
|
|
|
'';
|
|
|
|
in
|
|
|
|
"exec ${toString script}";
|
|
|
|
|
2022-10-12 21:21:52 +02:00
|
|
|
# like vimperator
|
2022-10-13 08:07:31 +02:00
|
|
|
|
2022-10-13 11:45:50 +02:00
|
|
|
"${cfg.config.modifier}+a" = "exec ${pkgs.i3-easyfocus}/bin/i3-easyfocus";
|
2022-10-13 08:07:31 +02:00
|
|
|
|
2022-10-12 16:58:38 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
2022-10-13 07:43:48 +02:00
|
|
|
|
2022-10-12 16:58:38 +02:00
|
|
|
};
|
|
|
|
}
|