nix: Reformat

This commit is contained in:
Geoffrey Frogeye 2023-11-05 21:32:31 +01:00
parent 832ce41b8e
commit dff024a291
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
2 changed files with 409 additions and 402 deletions

View file

@ -1,6 +1,5 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
{ {
home.stateVersion = "23.05";
programs = { programs = {
home-manager.enable = true; home-manager.enable = true;
@ -53,83 +52,85 @@
fzf.enable = true; fzf.enable = true;
# TODO highlight or bat # TODO highlight or bat
}; };
home = {
stateVersion = "23.05";
packages = with pkgs; [
# dotfiles dependencies
coreutils
bash
gnugrep
gnused
gnutar
openssl
git
wget
curl
python3Packages.pip
ansible # TODO Reevaluate
home.packages = with pkgs; [ # shell
# dotfiles dependencies zsh-completions
coreutils nix-zsh-completions
bash zsh-history-substring-search
gnugrep antigen # TODO Reevaluate
gnused powerline-go
gnutar
openssl
git
wget
curl
python3Packages.pip
ansible # TODO Reevaluate
# shell # terminal essentials
zsh-completions moreutils
nix-zsh-completions man
zsh-history-substring-search visidata
antigen # TODO Reevaluate nodePackages.insect
powerline-go translate-shell
unzip
unrar
p7zip
# terminal essentials # remote
moreutils openssh
man rsync
visidata borgbackup
nodePackages.insect
translate-shell
unzip
unrar
p7zip
# remote # cleanup
openssh ncdu
rsync jdupes
borgbackup duperemove
optipng
libjpeg
# FIXME reflac not available (but also a dumb shell script)
# cleanup # local monitoring
ncdu htop
jdupes iotop
duperemove iftop
optipng lsof
libjpeg strace
# FIXME reflac not available (but also a dumb shell script) pv
progress
speedtest-cli
# local monitoring # multimedia toolbox
htop ffmpeg
iotop sox
iftop imagemagick
lsof
strace
pv
progress
speedtest-cli
# multimedia toolbox # password
ffmpeg pass
sox pwgen
imagemagick
# password # Mail
pass isync
pwgen msmtp
notmuch
neomutt
lynx
# Mail # Organisation
isync vdirsyncer
msmtp khard
notmuch khal
neomutt todoman
lynx syncthing
# Organisation ];
vdirsyncer };
khard
khal
todoman
syncthing
];
} }

View file

@ -1,40 +1,42 @@
{ pkgs, config, lib, ... }: { pkgs, config, lib, ... }:
{ {
xsession.windowManager.i3 = { xsession = {
enable = true; windowManager = {
config = i3 = {
let enable = true;
# lockColors = with config.lib.stylix.colors.withHashtag; { a = base00; b = base01; d = base00; }; # Black or White, depending on current theme config =
# lockColors = with config.lib.stylix.colors.withHashtag; { a = base0A; b = base0B; d = base00; }; # Green + Yellow let
lockColors = { a = "#82a401"; b = "#466c01"; d = "#648901"; }; # Old # lockColors = with config.lib.stylix.colors.withHashtag; { a = base00; b = base01; d = base00; }; # Black or White, depending on current theme
lockSvg = pkgs.writeText "lock.svg" "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\" height=\"50\" width=\"50\"><path fill=\"${lockColors.a}\" d=\"M0 50h50V0H0z\"/><path d=\"M0 0l50 50H25L0 25zm50 0v25L25 0z\" fill=\"${lockColors.d}\"/></svg>"; # lockColors = with config.lib.stylix.colors.withHashtag; { a = base0A; b = base0B; d = base00; }; # Green + Yellow
lockPng = pkgs.runCommand "lock.png" { } "${pkgs.imagemagick}/bin/convert ${lockSvg} $out"; lockColors = { a = "#82a401"; b = "#466c01"; d = "#648901"; }; # Old
locker = pkgs.writeShellScript "i3-locker" lockSvg = pkgs.writeText "lock.svg" "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\" height=\"50\" width=\"50\"><path fill=\"${lockColors.a}\" d=\"M0 50h50V0H0z\"/><path d=\"M0 0l50 50H25L0 25zm50 0v25L25 0z\" fill=\"${lockColors.d}\"/></svg>";
'' lockPng = pkgs.runCommand "lock.png" { } "${pkgs.imagemagick}/bin/convert ${lockSvg} $out";
# Remove SSH and GPG keys from keystores locker = pkgs.writeShellScript "i3-locker"
${pkgs.openssh}/bin/ssh-add -D ''
echo RELOADAGENT | ${pkgs.gnupg}/bin/gpg-connect-agent # Remove SSH and GPG keys from keystores
${pkgs.coreutils}/bin/rm -rf "/tmp/cached_pass_$UID" ${pkgs.openssh}/bin/ssh-add -D
echo RELOADAGENT | ${pkgs.gnupg}/bin/gpg-connect-agent
${pkgs.coreutils}/bin/rm -rf "/tmp/cached_pass_$UID"
${pkgs.lightdm}/bin/dm-tool lock ${pkgs.lightdm}/bin/dm-tool lock
# TODO Does that work for all DMs? # TODO Does that work for all DMs?
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
if [ -d ${config.xdg.cacheHome}/lockpatterns ] if [ -d ${config.xdg.cacheHome}/lockpatterns ]
then then
pattern=$(${pkgs.findutils} ${config.xdg.cacheHome}/lockpatterns | sort -R | head -1) pattern=$(${pkgs.findutils} ${config.xdg.cacheHome}/lockpatterns | sort -R | head -1)
else else
pattern=${lockPng} pattern=${lockPng}
fi
revert() {
${pkgs.xorg.xset}/bin/xset dpms 0 0 0
}
trap revert SIGHUP SIGINT SIGTERM
${pkgs.xorg.xset}/bin/xset dpms 5 5 5
${pkgs.i3lock}/bin/i3lock --nofork --color ${builtins.substring 1 6 lockColors.d} --image=$pattern --tiling --ignore-empty-password
revert
fi fi
revert() { '';
${pkgs.xorg.xset}/bin/xset dpms 0 0 0 focus = "exec ${ pkgs.writeShellScript "i3-focus-window"
}
trap revert SIGHUP SIGINT SIGTERM
${pkgs.xorg.xset}/bin/xset dpms 5 5 5
${pkgs.i3lock}/bin/i3lock --nofork --color ${builtins.substring 1 6 lockColors.d} --image=$pattern --tiling --ignore-empty-password
revert
fi
'';
focus = "exec ${ pkgs.writeShellScript "i3-focus-window"
'' ''
WINDOW=`${pkgs.xdotool}/bin/xdotool getwindowfocus` WINDOW=`${pkgs.xdotool}/bin/xdotool getwindowfocus`
eval `${pkgs.xdotool}/bin/xdotool getwindowgeometry --shell $WINDOW` # this brings in variables WIDTH and HEIGHT eval `${pkgs.xdotool}/bin/xdotool getwindowgeometry --shell $WINDOW` # this brings in variables WIDTH and HEIGHT
@ -43,284 +45,286 @@
${pkgs.xdotool}/bin/xdotool mousemove -window $WINDOW $TX $TY ${pkgs.xdotool}/bin/xdotool mousemove -window $WINDOW $TX $TY
'' ''
}"; }";
mode_system = "[L] Vérouillage [E] Déconnexion [S] Veille [H] Hibernation [R] Redémarrage [P] Extinction"; mode_system = "[L] Vérouillage [E] Déconnexion [S] Veille [H] Hibernation [R] Redémarrage [P] Extinction";
mode_resize = "Resize"; mode_resize = "Resize";
mode_pres_main = "Presentation (main display)"; mode_pres_main = "Presentation (main display)";
mode_pres_sec = "Presentation (secondary display)"; mode_pres_sec = "Presentation (secondary display)";
mode_screen = "Screen setup [A] Auto [L] Load [S] Save [R] Remove [D] Default"; mode_screen = "Screen setup [A] Auto [L] Load [S] Save [R] Remove [D] Default";
mode_temp = "Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue"; mode_temp = "Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue";
in
{
modifier = "Mod1"; # FIXME Mod1 for VM, Mod4 for not VM
terminal = "alacritty";
# bars = []; # FIXME lemonbar
colors = let ignore = "#ff00ff"; in
with config.lib.stylix.colors.withHashtag; lib.mkForce {
focused = { border = base0B; background = base0B; text = base00; indicator = base00; childBorder = base0B; };
focusedInactive = { border = base02; background = base02; text = base05; indicator = base02; childBorder = base02; };
unfocused = { border = base05; background = base04; text = base00; indicator = base04; childBorder = base00; };
urgent = { border = base0F; background = base08; text = base00; indicator = base08; childBorder = base0F; };
placeholder = { border = ignore; background = base00; text = base05; indicator = ignore; childBorder = base00; };
background = base07;
# I set the color of the active tab as the the background color of the terminal so they merge together.
};
focus.followMouse = false;
keybindings =
let
mod = config.xsession.windowManager.i3.config.modifier;
rofi = "exec --no-startup-id ${config.programs.rofi.package}/bin/rofi";
pactl = "exec ${pkgs.pulseaudio}/bin/pactl"; # TODO Use NixOS package if using NixOS
scrot = "${pkgs.scrot}/bin/scrot --exec '${pkgs.coreutils}/bin/mv $f ~/Screenshots/ && ${pkgs.optipng}/bin/optipng ~/Screenshots/$f'";
# TODO nix path and create directory?
in in
{ {
# Compatibility layer for people coming from other backgrounds modifier = "Mod1"; # FIXME Mod1 for VM, Mod4 for not VM
# "Mod1+Tab" = "${rofi} -modi window -show window"; # FIXME When no longer using a VM terminal = "alacritty";
"Mod1+F2" = "${rofi} -modi drun -show drun"; # bars = []; # FIXME lemonbar
# "Mod1+F4" = "kill"; # FIXME When no longer using a VM colors = let ignore = "#ff00ff"; in
# kill focused window with config.lib.stylix.colors.withHashtag; lib.mkForce {
"${mod}+z" = "kill"; focused = { border = base0B; background = base0B; text = base00; indicator = base00; childBorder = base0B; };
button2 = "kill"; focusedInactive = { border = base02; background = base02; text = base05; indicator = base02; childBorder = base02; };
# Rofi unfocused = { border = base05; background = base04; text = base00; indicator = base04; childBorder = base00; };
"${mod}+c" = "exec --no-startup-id ${pkgs.rofi-pass}/bin/rofi-pass --last-used"; urgent = { border = base0F; background = base08; text = base00; indicator = base08; childBorder = base0F; };
# TODO Try autopass.cr placeholder = { border = ignore; background = base00; text = base05; indicator = ignore; childBorder = base00; };
# 23.11 config.programs.rofi.pass.package background = base07;
"${mod}+i" = "exec --no-startup-id ${pkgs.rofimoji}/bin/rofimoji"; # I set the color of the active tab as the the background color of the terminal so they merge together.
"${mod}+plus" = "${rofi} -modi ssh -show ssh"; };
"${mod}+ù" = "${rofi} -modi ssh -show ssh -ssh-command '{terminal} -e {ssh-client} {host} -t \"sudo -s -E\"'"; focus.followMouse = false;
# TODO In which keyboard layout? keybindings =
"${mod}+Tab" = "${rofi} -modi window -show window"; let
# start program launcher mod = config.xsession.windowManager.i3.config.modifier;
"${mod}+d" = "${rofi} -modi run -show run"; rofi = "exec --no-startup-id ${config.programs.rofi.package}/bin/rofi";
"${mod}+Shift+d" = "${rofi} -modi drun -show drun"; pactl = "exec ${pkgs.pulseaudio}/bin/pactl"; # TODO Use NixOS package if using NixOS
# Start Applications scrot = "${pkgs.scrot}/bin/scrot --exec '${pkgs.coreutils}/bin/mv $f ~/Screenshots/ && ${pkgs.optipng}/bin/optipng ~/Screenshots/$f'";
"${mod}+Return" = "exec ${ # TODO nix path and create directory?
in
{
# Compatibility layer for people coming from other backgrounds
# "Mod1+Tab" = "${rofi} -modi window -show window"; # FIXME When no longer using a VM
"Mod1+F2" = "${rofi} -modi drun -show drun";
# "Mod1+F4" = "kill"; # FIXME When no longer using a VM
# kill focused window
"${mod}+z" = "kill";
button2 = "kill";
# Rofi
"${mod}+c" = "exec --no-startup-id ${pkgs.rofi-pass}/bin/rofi-pass --last-used";
# TODO Try autopass.cr
# 23.11 config.programs.rofi.pass.package
"${mod}+i" = "exec --no-startup-id ${pkgs.rofimoji}/bin/rofimoji";
"${mod}+plus" = "${rofi} -modi ssh -show ssh";
"${mod}+ù" = "${rofi} -modi ssh -show ssh -ssh-command '{terminal} -e {ssh-client} {host} -t \"sudo -s -E\"'";
# TODO In which keyboard layout?
"${mod}+Tab" = "${rofi} -modi window -show window";
# start program launcher
"${mod}+d" = "${rofi} -modi run -show run";
"${mod}+Shift+d" = "${rofi} -modi drun -show drun";
# Start Applications
"${mod}+Return" = "exec ${
pkgs.writeShellScript "terminal" "${config.programs.alacritty.package}/bin/alacritty msg create-window || exec ${config.programs.alacritty.package}/bin/alacritty -e zsh" pkgs.writeShellScript "terminal" "${config.programs.alacritty.package}/bin/alacritty msg create-window || exec ${config.programs.alacritty.package}/bin/alacritty -e zsh"
# -e zsh is for systems where I can't configure my user's shell # -e zsh is for systems where I can't configure my user's shell
# TODO Is a shell script even required? # TODO Is a shell script even required?
}"; }";
"${mod}+Shift+Return" = "exec ${config.programs.urxvt.package}/bin/urxvt"; "${mod}+Shift+Return" = "exec ${config.programs.urxvt.package}/bin/urxvt";
"${mod}+p" = "exec ${pkgs.xfce.thunar}/bin/tunar"; "${mod}+p" = "exec ${pkgs.xfce.thunar}/bin/tunar";
"${mod}+m" = "exec ${config.programs.qutebrowser.package}/bin/qutebrowser --override-restore --backend=webengine"; "${mod}+m" = "exec ${config.programs.qutebrowser.package}/bin/qutebrowser --override-restore --backend=webengine";
# TODO --backend not useful anymore # TODO --backend not useful anymore
# Volume control # Volume control
"XF86AudioRaiseVolume" = "${pactl} set-sink-mute @DEFAULT_SINK@ false; ${pactl} set-sink-volume @DEFAULT_SINK@ +5%"; "XF86AudioRaiseVolume" = "${pactl} set-sink-mute @DEFAULT_SINK@ false; ${pactl} set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" = "${pactl} set-sink-mute @DEFAULT_SINK@ false; ${pactl} set-sink-volume @DEFAULT_SINK@ -5%"; "XF86AudioLowerVolume" = "${pactl} set-sink-mute @DEFAULT_SINK@ false; ${pactl} set-sink-volume @DEFAULT_SINK@ -5%";
"XF86AudioMute" = "${pactl} set-sink-mute @DEFAULT_SINK@ true"; "XF86AudioMute" = "${pactl} set-sink-mute @DEFAULT_SINK@ true";
"${mod}+F7" = "${pactl} suspend-sink @DEFAULT_SINK@ 1; ${pactl} suspend-sink @DEFAULT_SINK@ 0"; # Re-synchronize bluetooth headset "${mod}+F7" = "${pactl} suspend-sink @DEFAULT_SINK@ 1; ${pactl} suspend-sink @DEFAULT_SINK@ 0"; # Re-synchronize bluetooth headset
"${mod}+F11" = "exec ${pkgs.pavucontrol}/bin/pavucontrol"; "${mod}+F11" = "exec ${pkgs.pavucontrol}/bin/pavucontrol";
"${mod}+F12" = "exec ${pkgs.pavucontrol}/bin/pavucontrol"; "${mod}+F12" = "exec ${pkgs.pavucontrol}/bin/pavucontrol";
# TODO Find pacmixer? # TODO Find pacmixer?
# Media control # Media control
"XF86AudioPrev" = "exec ${pkgs.mpc-cli}/bin/mpc prev"; "XF86AudioPrev" = "exec ${pkgs.mpc-cli}/bin/mpc prev";
"XF86AudioPlay" = "exec ${pkgs.mpc-cli}/bin/mpc toggle"; "XF86AudioPlay" = "exec ${pkgs.mpc-cli}/bin/mpc toggle";
"XF86AudioNext" = "exec ${pkgs.mpc-cli}/bin/mpc next"; "XF86AudioNext" = "exec ${pkgs.mpc-cli}/bin/mpc next";
# Misc # Misc
"${mod}+F10" = "exec ${ pkgs.writeShellScript "show-keyboard-layout" "${mod}+F10" = "exec ${ pkgs.writeShellScript "show-keyboard-layout"
'' ''
layout=`${pkgs.xorg.setxkbmap}/bin/setxkbmap -query | ${pkgs.gnugrep}/bin/grep ^layout: | ${pkgs.gawk}/bin/awk '{ print $2 }'` layout=`${pkgs.xorg.setxkbmap}/bin/setxkbmap -query | ${pkgs.gnugrep}/bin/grep ^layout: | ${pkgs.gawk}/bin/awk '{ print $2 }'`
${pkgs.libgnomekbd}/bin/gkbd-keyboard-display -l $layout ${pkgs.libgnomekbd}/bin/gkbd-keyboard-display -l $layout
'' ''
}"; }";
# Screenshots # Screenshots
"Print" = "exec ${scrot} --focused"; "Print" = "exec ${scrot} --focused";
"${mod}+Print" = "exec ${scrot}"; # FIXME Doesn't work at least in the VM "${mod}+Print" = "exec ${scrot}"; # FIXME Doesn't work at least in the VM
"Ctrl+Print" = "exec ${pkgs.coreutils}/bin/sleep 1 && ${scrot} --select"; "Ctrl+Print" = "exec ${pkgs.coreutils}/bin/sleep 1 && ${scrot} --select";
# TODO Try using bindsym --release instead of sleep # TODO Try using bindsym --release instead of sleep
# change focus # change focus
"${mod}+h" = "focus left; ${focus}"; "${mod}+h" = "focus left; ${focus}";
"${mod}+j" = "focus down; ${focus}"; "${mod}+j" = "focus down; ${focus}";
"${mod}+k" = "focus up; ${focus}"; "${mod}+k" = "focus up; ${focus}";
"${mod}+l" = "focus right; ${focus}"; "${mod}+l" = "focus right; ${focus}";
# move focused window # move focused window
"${mod}+Shift+h" = "move left; ${focus}"; "${mod}+Shift+h" = "move left; ${focus}";
"${mod}+Shift+j" = "move down; ${focus}"; "${mod}+Shift+j" = "move down; ${focus}";
"${mod}+Shift+k" = "move up; ${focus}"; "${mod}+Shift+k" = "move up; ${focus}";
"${mod}+Shift+l" = "move right; ${focus}"; "${mod}+Shift+l" = "move right; ${focus}";
# workspace back and forth (with/without active container) # workspace back and forth (with/without active container)
"${mod}+b" = "workspace back_and_forth; ${focus}"; "${mod}+b" = "workspace back_and_forth; ${focus}";
"${mod}+Shift+b" = "move container to workspace back_and_forth; workspace back_and_forth; ${focus}"; "${mod}+Shift+b" = "move container to workspace back_and_forth; workspace back_and_forth; ${focus}";
# Change container layout # Change container layout
"${mod}+g" = "split h; ${focus}"; "${mod}+g" = "split h; ${focus}";
"${mod}+v" = "split v; ${focus}"; "${mod}+v" = "split v; ${focus}";
"${mod}+f" = "fullscreen toggle; ${focus}"; "${mod}+f" = "fullscreen toggle; ${focus}";
"${mod}+s" = "layout stacking; ${focus}"; "${mod}+s" = "layout stacking; ${focus}";
"${mod}+w" = "layout tabbed; ${focus}"; "${mod}+w" = "layout tabbed; ${focus}";
"${mod}+e" = "layout toggle split; ${focus}"; "${mod}+e" = "layout toggle split; ${focus}";
"${mod}+Shift+space" = "floating toggle; ${focus}"; "${mod}+Shift+space" = "floating toggle; ${focus}";
# Focus container # Focus container
"${mod}+space" = "focus mode_toggle; ${focus}"; "${mod}+space" = "focus mode_toggle; ${focus}";
"${mod}+a" = "focus parent; ${focus}"; "${mod}+a" = "focus parent; ${focus}";
"${mod}+q" = "focus child; ${focus}"; "${mod}+q" = "focus child; ${focus}";
# Switch to workspace # Switch to workspace
"${mod}+1" = "workspace 1; ${focus}"; "${mod}+1" = "workspace 1; ${focus}";
"${mod}+2" = "workspace 2; ${focus}"; "${mod}+2" = "workspace 2; ${focus}";
"${mod}+3" = "workspace 3; ${focus}"; "${mod}+3" = "workspace 3; ${focus}";
"${mod}+4" = "workspace 4; ${focus}"; "${mod}+4" = "workspace 4; ${focus}";
"${mod}+5" = "workspace 5; ${focus}"; "${mod}+5" = "workspace 5; ${focus}";
"${mod}+6" = "workspace 6; ${focus}"; "${mod}+6" = "workspace 6; ${focus}";
"${mod}+7" = "workspace 7; ${focus}"; "${mod}+7" = "workspace 7; ${focus}";
"${mod}+8" = "workspace 8; ${focus}"; "${mod}+8" = "workspace 8; ${focus}";
"${mod}+9" = "workspace 9; ${focus}"; "${mod}+9" = "workspace 9; ${focus}";
"${mod}+0" = "workspace 10; ${focus}"; "${mod}+0" = "workspace 10; ${focus}";
# TODO Prevent repetitions, see workspace assignation for example # TODO Prevent repetitions, see workspace assignation for example
#navigate workspaces next / previous #navigate workspaces next / previous
"${mod}+Ctrl+h" = "workspace prev_on_output; ${focus}"; "${mod}+Ctrl+h" = "workspace prev_on_output; ${focus}";
"${mod}+Ctrl+l" = "workspace next_on_output; ${focus}"; "${mod}+Ctrl+l" = "workspace next_on_output; ${focus}";
"${mod}+Ctrl+j" = "workspace prev; ${focus}"; "${mod}+Ctrl+j" = "workspace prev; ${focus}";
"${mod}+Ctrl+k" = "workspace next; ${focus}"; "${mod}+Ctrl+k" = "workspace next; ${focus}";
# Move to workspace next / previous with focused container # Move to workspace next / previous with focused container
"${mod}+Ctrl+Shift+h" = "move container to workspace prev_on_output; workspace prev_on_output; ${focus}"; "${mod}+Ctrl+Shift+h" = "move container to workspace prev_on_output; workspace prev_on_output; ${focus}";
"${mod}+Ctrl+Shift+l" = "move container to workspace next_on_output; workspace next_on_output; ${focus}"; "${mod}+Ctrl+Shift+l" = "move container to workspace next_on_output; workspace next_on_output; ${focus}";
"${mod}+Ctrl+Shift+j" = "move container to workspace prev; workspace prev; ${focus}"; "${mod}+Ctrl+Shift+j" = "move container to workspace prev; workspace prev; ${focus}";
"${mod}+Ctrl+Shift+k" = "move container to workspace next; workspace next; ${focus}"; "${mod}+Ctrl+Shift+k" = "move container to workspace next; workspace next; ${focus}";
# move focused container to workspace # move focused container to workspace
"${mod}+ctrl+1" = "move container to workspace 1; ${focus}"; "${mod}+ctrl+1" = "move container to workspace 1; ${focus}";
"${mod}+ctrl+2" = "move container to workspace 2; ${focus}"; "${mod}+ctrl+2" = "move container to workspace 2; ${focus}";
"${mod}+ctrl+3" = "move container to workspace 3; ${focus}"; "${mod}+ctrl+3" = "move container to workspace 3; ${focus}";
"${mod}+ctrl+4" = "move container to workspace 4; ${focus}"; "${mod}+ctrl+4" = "move container to workspace 4; ${focus}";
"${mod}+ctrl+5" = "move container to workspace 5; ${focus}"; "${mod}+ctrl+5" = "move container to workspace 5; ${focus}";
"${mod}+ctrl+6" = "move container to workspace 6; ${focus}"; "${mod}+ctrl+6" = "move container to workspace 6; ${focus}";
"${mod}+ctrl+7" = "move container to workspace 7; ${focus}"; "${mod}+ctrl+7" = "move container to workspace 7; ${focus}";
"${mod}+ctrl+8" = "move container to workspace 8; ${focus}"; "${mod}+ctrl+8" = "move container to workspace 8; ${focus}";
"${mod}+ctrl+9" = "move container to workspace 9; ${focus}"; "${mod}+ctrl+9" = "move container to workspace 9; ${focus}";
"${mod}+ctrl+0" = "move container to workspace 10; ${focus}"; "${mod}+ctrl+0" = "move container to workspace 10; ${focus}";
# move to workspace with focused container # move to workspace with focused container
"${mod}+shift+1" = "move container to workspace 1; workspace 1; ${focus}"; "${mod}+shift+1" = "move container to workspace 1; workspace 1; ${focus}";
"${mod}+shift+2" = "move container to workspace 2; workspace 2; ${focus}"; "${mod}+shift+2" = "move container to workspace 2; workspace 2; ${focus}";
"${mod}+shift+3" = "move container to workspace 3; workspace 3; ${focus}"; "${mod}+shift+3" = "move container to workspace 3; workspace 3; ${focus}";
"${mod}+shift+4" = "move container to workspace 4; workspace 4; ${focus}"; "${mod}+shift+4" = "move container to workspace 4; workspace 4; ${focus}";
"${mod}+shift+5" = "move container to workspace 5; workspace 5; ${focus}"; "${mod}+shift+5" = "move container to workspace 5; workspace 5; ${focus}";
"${mod}+shift+6" = "move container to workspace 6; workspace 6; ${focus}"; "${mod}+shift+6" = "move container to workspace 6; workspace 6; ${focus}";
"${mod}+shift+7" = "move container to workspace 7; workspace 7; ${focus}"; "${mod}+shift+7" = "move container to workspace 7; workspace 7; ${focus}";
"${mod}+shift+8" = "move container to workspace 8; workspace 8; ${focus}"; "${mod}+shift+8" = "move container to workspace 8; workspace 8; ${focus}";
"${mod}+shift+9" = "move container to workspace 9; workspace 9; ${focus}"; "${mod}+shift+9" = "move container to workspace 9; workspace 9; ${focus}";
"${mod}+shift+0" = "move container to workspace 10; workspace 10; ${focus}"; "${mod}+shift+0" = "move container to workspace 10; workspace 10; ${focus}";
# move workspaces to screen (arrow keys) # move workspaces to screen (arrow keys)
"${mod}+ctrl+shift+Right" = "move workspace to output right; ${focus}"; "${mod}+ctrl+shift+Right" = "move workspace to output right; ${focus}";
"${mod}+ctrl+shift+Left" = "move workspace to output left; ${focus}"; "${mod}+ctrl+shift+Left" = "move workspace to output left; ${focus}";
"${mod}+Ctrl+Shift+Up" = "move workspace to output above; ${focus}"; "${mod}+Ctrl+Shift+Up" = "move workspace to output above; ${focus}";
"${mod}+Ctrl+Shift+Down" = "move workspace to output below; ${focus}"; "${mod}+Ctrl+Shift+Down" = "move workspace to output below; ${focus}";
# i3 control # i3 control
"${mod}+Shift+c" = "reload"; "${mod}+Shift+c" = "reload";
"${mod}+Shift+r" = "restart"; "${mod}+Shift+r" = "restart";
"${mod}+Shift+e" = "exit"; "${mod}+Shift+e" = "exit";
# Screen off commands # Screen off commands
"${mod}+F1" = "exec --no-startup-id ${pkgs.bash}/bin/sh -c \"${pkgs.coreutils}/bin/sleep .25 && ${pkgs.xorg.xset}/bin/xset dpms force off\""; "${mod}+F1" = "exec --no-startup-id ${pkgs.bash}/bin/sh -c \"${pkgs.coreutils}/bin/sleep .25 && ${pkgs.xorg.xset}/bin/xset dpms force off\"";
# TODO --release? # TODO --release?
"${mod}+F4" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -disable"; "${mod}+F4" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -disable";
"${mod}+F5" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -enable"; "${mod}+F5" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -enable";
# Modes # Modes
"${mod}+Escape" = "mode ${mode_system}"; "${mod}+Escape" = "mode ${mode_system}";
"${mod}+r" = "mode ${mode_resize}"; "${mod}+r" = "mode ${mode_resize}";
"${mod}+Shift+p" = "mode ${mode_pres_main}"; "${mod}+Shift+p" = "mode ${mode_pres_main}";
"${mod}+t" = "mode ${mode_screen}"; "${mod}+t" = "mode ${mode_screen}";
"${mod}+y" = "mode ${mode_temp}"; "${mod}+y" = "mode ${mode_temp}";
}; };
modes = let return_bindings = { modes = let return_bindings = {
"Return" = "mode default";
"Escape" = "mode default";
}; in
{
"${mode_system}" = {
"l" = "exec --no-startup-id exec ${locker}, mode default";
"e" = "exit, mode default";
"s" = "exec --no-startup-id exec ${locker} & ${pkgs.systemd}/bin/systemctl suspend, mode default";
"h" = "exec --no-startup-id exec ${locker} & ${pkgs.systemd}/bin/systemctl hibernate, mode default";
"r" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl reboot, mode default";
"p" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl poweroff -i, mode default";
} // return_bindings;
"${mode_resize}" = {
"h" = "resize shrink width 10 px or 10 ppt; ${focus}";
"j" = "resize grow height 10 px or 10 ppt; ${focus}";
"k" = "resize shrink height 10 px or 10 ppt; ${focus}";
"l" = "resize grow width 10 px or 10 ppt; ${focus}";
} // return_bindings;
"${mode_pres_main}" = {
"b" = "workspace 3, workspace 4, mode ${mode_pres_sec}";
"q" = "mode default";
"Return" = "mode default"; "Return" = "mode default";
}; "Escape" = "mode default";
"${mode_pres_sec}" = { }; in
"b" = "workspace 1, workspace 2, mode ${mode_pres_main}";
"q" = "mode default";
"Return" = "mode default";
};
"${mode_screen}" =
let
builtin_configs = [ "off" "common" "clone-largest" "horizontal" "vertical" "horizontal-reverse" "vertical-reverse" ];
autorandrmenu = { title, option, builtin ? false }: pkgs.writeShellScript "autorandrmenu"
''
shopt -s nullglob globstar
profiles="${if builtin then lib.strings.concatLines builtin_configs else ""}$(${pkgs.autorandr}/bin/autorandr | ${pkgs.gawk}/bin/awk '{ print $1 }')"
profile="$(echo "$profiles" | ${config.programs.rofi.package}/bin/rofi -dmenu -p "${title}")"
[[ -n "$profile" ]] || exit
${pkgs.autorandr}/bin/autorandr ${option} "$profile"
'';
in
{ {
"a" = "exec ${pkgs.autorandr}/bin/autorandr --change --force, mode default"; "${mode_system}" = {
"l" = "exec ${autorandrmenu {title="Load profile"; option="--load"; builtin = true;}}, mode default"; "l" = "exec --no-startup-id exec ${locker}, mode default";
"s" = "exec ${autorandrmenu {title="Save profile"; option="--save";}}, mode default"; "e" = "exit, mode default";
"r" = "exec ${autorandrmenu {title="Remove profile"; option="--remove";}}, mode default"; "s" = "exec --no-startup-id exec ${locker} & ${pkgs.systemd}/bin/systemctl suspend, mode default";
"d" = "exec ${autorandrmenu {title="Default profile"; option="--default"; builtin = true;}}, mode default"; "h" = "exec --no-startup-id exec ${locker} & ${pkgs.systemd}/bin/systemctl hibernate, mode default";
} // return_bindings; "r" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl reboot, mode default";
"${mode_temp}" = { "p" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl poweroff -i, mode default";
"r" = "exec ${pkgs.sct}/bin/sct 1000"; } // return_bindings;
"d" = "exec ${pkgs.sct}/bin/sct 2000"; "${mode_resize}" = {
"c" = "exec ${pkgs.sct}/bin/sct 4500"; "h" = "resize shrink width 10 px or 10 ppt; ${focus}";
"o" = "exec ${pkgs.sct}/bin/sct"; "j" = "resize grow height 10 px or 10 ppt; ${focus}";
"a" = "exec ${pkgs.sct}/bin/sct 8000"; "k" = "resize shrink height 10 px or 10 ppt; ${focus}";
"b" = "exec ${pkgs.sct}/bin/sct 10000"; "l" = "resize grow width 10 px or 10 ppt; ${focus}";
} // return_bindings; } // return_bindings;
}; "${mode_pres_main}" = {
window = { "b" = "workspace 3, workspace 4, mode ${mode_pres_sec}";
hideEdgeBorders = "both"; "q" = "mode default";
titlebar = false; # So that single-container screens are basically almost fullscreen "Return" = "mode default";
commands = [ };
# Open specific applications in floating mode "${mode_pres_sec}" = {
{ criteria = { class = "Firefox"; }; command = "layout tabbed"; } # Doesn't seem to work anymore "b" = "workspace 1, workspace 2, mode ${mode_pres_main}";
{ criteria = { class = "qutebrowser"; }; command = "layout tabbed"; } "q" = "mode default";
{ criteria = { title = "^pdfpc.*"; window_role = "presenter"; }; command = "move to output left, fullscreen"; } "Return" = "mode default";
{ criteria = { title = "^pdfpc.*"; window_role = "presentation"; }; command = "move to output right, fullscreen"; } };
# switch to workspace with urgent window automatically "${mode_screen}" =
{ criteria = { urgent = "latest"; }; command = "focus"; } let
]; builtin_configs = [ "off" "common" "clone-largest" "horizontal" "vertical" "horizontal-reverse" "vertical-reverse" ];
}; autorandrmenu = { title, option, builtin ? false }: pkgs.writeShellScript "autorandrmenu"
floating = { ''
criteria = [ shopt -s nullglob globstar
{ title = "pacmixer"; } profiles="${if builtin then lib.strings.concatLines builtin_configs else ""}$(${pkgs.autorandr}/bin/autorandr | ${pkgs.gawk}/bin/awk '{ print $1 }')"
{ window_role = "pop-up"; } profile="$(echo "$profiles" | ${config.programs.rofi.package}/bin/rofi -dmenu -p "${title}")"
{ window_role = "task_dialog"; } [[ -n "$profile" ]] || exit
]; ${pkgs.autorandr}/bin/autorandr ${option} "$profile"
}; '';
startup = [ in
# Lock screen after 10 minutes {
{ notification = false; command = "${pkgs.xautolock}/bin/xautolock -time 10 -locker '${pkgs.xorg.xset}/bin/xset dpms force standby' -killtime 1 -killer ${locker}"; } "a" = "exec ${pkgs.autorandr}/bin/autorandr --change --force, mode default";
{ "l" = "exec ${autorandrmenu {title="Load profile"; option="--load"; builtin = true;}}, mode default";
notification = false; "s" = "exec ${autorandrmenu {title="Save profile"; option="--save";}}, mode default";
command = "${pkgs.writeShellApplication { "r" = "exec ${autorandrmenu {title="Remove profile"; option="--remove";}}, mode default";
"d" = "exec ${autorandrmenu {title="Default profile"; option="--default"; builtin = true;}}, mode default";
} // return_bindings;
"${mode_temp}" = {
"r" = "exec ${pkgs.sct}/bin/sct 1000";
"d" = "exec ${pkgs.sct}/bin/sct 2000";
"c" = "exec ${pkgs.sct}/bin/sct 4500";
"o" = "exec ${pkgs.sct}/bin/sct";
"a" = "exec ${pkgs.sct}/bin/sct 8000";
"b" = "exec ${pkgs.sct}/bin/sct 10000";
} // return_bindings;
};
window = {
hideEdgeBorders = "both";
titlebar = false; # So that single-container screens are basically almost fullscreen
commands = [
# Open specific applications in floating mode
{ criteria = { class = "Firefox"; }; command = "layout tabbed"; } # Doesn't seem to work anymore
{ criteria = { class = "qutebrowser"; }; command = "layout tabbed"; }
{ criteria = { title = "^pdfpc.*"; window_role = "presenter"; }; command = "move to output left, fullscreen"; }
{ criteria = { title = "^pdfpc.*"; window_role = "presentation"; }; command = "move to output right, fullscreen"; }
# switch to workspace with urgent window automatically
{ criteria = { urgent = "latest"; }; command = "focus"; }
];
};
floating = {
criteria = [
{ title = "pacmixer"; }
{ window_role = "pop-up"; }
{ window_role = "task_dialog"; }
];
};
startup = [
# Lock screen after 10 minutes
{ notification = false; command = "${pkgs.xautolock}/bin/xautolock -time 10 -locker '${pkgs.xorg.xset}/bin/xset dpms force standby' -killtime 1 -killer ${locker}"; }
{
notification = false;
command = "${pkgs.writeShellApplication {
name = "batteryNotify"; name = "batteryNotify";
runtimeInputs = with pkgs; [coreutils libnotify]; runtimeInputs = with pkgs; [coreutils libnotify];
text = builtins.readFile ./batteryNotify.sh; text = builtins.readFile ./batteryNotify.sh;
# TODO Use batsignal instead? # TODO Use batsignal instead?
# TODO Only on computers with battery # TODO Only on computers with battery
}}/bin/batteryNotify"; }}/bin/batteryNotify";
} }
# TODO There's a services.screen-locker.xautolock but not sure it can match the above command # TODO There's a services.screen-locker.xautolock but not sure it can match the above command
]; ];
workspaceLayout = "tabbed"; workspaceLayout = "tabbed";
focus.mouseWarping = true; # i3 only supports warping to workspace, hence ${focus} focus.mouseWarping = true; # i3 only supports warping to workspace, hence ${focus}
workspaceOutputAssign = workspaceOutputAssign =
let let
x11_screens = [ "HDMI-1-0" "eDP1" ]; # FIXME Per computer thing x11_screens = [ "HDMI-1-0" "eDP1" ]; # FIXME Per computer thing
workspaces = map (i: { name = toString i; key = toString (lib.mod i 10); }) (lib.lists.range 1 10); workspaces = map (i: { name = toString i; key = toString (lib.mod i 10); }) (lib.lists.range 1 10);
forEachWorkspace = f: map (w: f { w = w; workspace = ((builtins.elemAt workspaces w)); }) (lib.lists.range 0 ((builtins.length workspaces) - 1)); forEachWorkspace = f: map (w: f { w = w; workspace = ((builtins.elemAt workspaces w)); }) (lib.lists.range 0 ((builtins.length workspaces) - 1));
in in
forEachWorkspace ({ w, workspace }: { output = builtins.elemAt x11_screens (lib.mod w (builtins.length x11_screens)); workspace = workspace.name; }); forEachWorkspace ({ w, workspace }: { output = builtins.elemAt x11_screens (lib.mod w (builtins.length x11_screens)); workspace = workspace.name; });
};
}; };
};
numlock.enable = true; # FIXME Only on computers with a separate one
}; };
xsession.numlock.enable = true; # FIXME Only on computers with a separate one
programs = { programs = {
# Browser # Browser
@ -432,55 +436,57 @@
autorandr.enable = true; autorandr.enable = true;
}; };
home.packages = with pkgs; [ home = {
# remote packages = with pkgs; [
tigervnc # remote
tigervnc
# music # music
mpc-cli mpc-cli
ashuffle ashuffle
vimpc vimpc
# multimedia common # multimedia common
gimp gimp
inkscape inkscape
mpv mpv
mpvScripts.thumbnail mpvScripts.thumbnail
libreoffice libreoffice
# data management # data management
freefilesync freefilesync
# browsers # browsers
firefox firefox
# fonts # fonts
dejavu_fonts dejavu_fonts
twemoji-color-font twemoji-color-font
gnome.gedit gnome.gedit
feh feh
zathura zathura
zbar zbar
zathura zathura
meld meld
python3Packages.magic python3Packages.magic
yubikey-touch-detector yubikey-touch-detector
# x11-exclusive # x11-exclusive
numlockx numlockx
# TODO urxvt-resize-font-git # TODO urxvt-resize-font-git
simplescreenrecorder simplescreenrecorder
trayer trayer
xclip xclip
lemonbar-xft lemonbar-xft
keynav keynav
xorg.xinit xorg.xinit
xorg.xbacklight xorg.xbacklight
# organisation # organisation
pass pass
thunderbird thunderbird
]; ];
};
} }