Compare commits

..

No commits in common. "c51aeacd035dd55cffe8313fb1650abbdbf24d1c" and "4b8c4f29cefb5c02a849e93b5aa1dcdfd5b71840" have entirely different histories.

18 changed files with 456 additions and 268 deletions

2
config/alacritty/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
theme.yml
alacritty.yml

View file

@ -1,10 +1,7 @@
--- ---
- name: I3-reload - name: I3-reload
ansible.builtin.command: i3-msg reload ansible.builtin.command: i3-msg reload
listen: i3-reload
- name: Shell-reload - name: Shell-reload
ansible.builtin.command: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply" ansible.builtin.command: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply"
listen: shell-reload
- name: Fzf-reload - name: Fzf-reload
ansible.builtin.shell: source {{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf ansible.builtin.command: source {{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf
listen: fzf-reload

7
config/i3/ashuffle Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
while true
do
ashuffle
sleep 1
done

10
config/i3/autorandrdefaultmenu Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
shopt -s nullglob globstar
profile=$(echo -e "$(autorandr 2>&1 | cut -d' ' -f1)" | rofi -dmenu -p "Default profile" "$@")
[[ -n $profile ]] || exit
autorandr --default "$profile"

10
config/i3/autorandrloadmenu Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
shopt -s nullglob globstar
profile=$(echo -e "common\nclone-largest\nhorizontal\nvertical\n$(autorandr 2>&1 | cut -d' ' -f1)" | rofi -dmenu -p "Load profile" "$@")
[[ -n $profile ]] || exit
autorandr --load "$profile"

10
config/i3/autorandrremovemenu Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
shopt -s nullglob globstar
profile=$(echo -e "$(autorandr 2>&1 | cut -d' ' -f1)" | rofi -dmenu -p "Remove profile" "$@")
[[ -n $profile ]] || exit
autorandr --remove "$profile"

10
config/i3/autorandrsavemenu Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
shopt -s nullglob globstar
profile=$(echo -e "$(autorandr 2>&1 | cut -d' ' -f1)" | rofi -dmenu -p "Save profile" "$@")
[[ -n $profile ]] || exit
autorandr --save "$profile"

16
config/i3/aw_start Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
# TODO Make a good service out of this
cd /opt/activitywatch # Put your ActivityWatch install folder here
killall aw-server
killall aw-watcher-afk
killall aw-watcher-window
./aw-server/aw-server &
./aw-watcher-afk/aw-watcher-afk &
./aw-watcher-window/aw-watcher-window & # you can add --exclude-title here to exclude window title tracking for this session only
notify-send "ActivityWatch started" # Optional, sends a notification when ActivityWatch is started

View file

@ -62,23 +62,105 @@ for_window [ title="^pdfpc.*" window_role="presentation" ] move to output right,
# switch to workspace with urgent window automatically # switch to workspace with urgent window automatically
for_window [urgent=latest] focus for_window [urgent=latest] focus
# Set shut down, restart and locking features
set $mode_kblock Keyboard lock
mode "$mode_kblock" {
bindsym $mod+Shift+Escape mode "$mode_kblock"
}
"$mod+Shift+Escape" = "mode "$mode_kblock"";
# Set shut down, restart and locking features # Set shut down, restart and locking features
set $locker $HOME/.config/i3/lock set $locker $HOME/.config/i3/lock
set $mode_system [L] Vérouillage [E] Déconnexion [S] Veille [H] Hibernation [R] Redémarrage [P] Extinction
mode "$mode_system" {
bindsym l exec --no-startup-id $locker, mode "default"
bindsym e exit, mode "default"
bindsym s exec --no-startup-id $locker & systemctl suspend, mode "default"
bindsym h exec --no-startup-id $locker & systemctl hibernate, mode "default"
bindsym r exec --no-startup-id systemctl reboot, mode "default"
bindsym p exec --no-startup-id systemctl poweroff -i, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
"$mod+Escape" = "mode "$mode_system"";
# resize window (you can also use the mouse for that)
mode "Resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym h resize shrink width 10 px or 10 ppt; exec ~/.config/i3/focus_windows
bindsym j resize grow height 10 px or 10 ppt; exec ~/.config/i3/focus_windows
bindsym k resize shrink height 10 px or 10 ppt; exec ~/.config/i3/focus_windows
bindsym l resize grow width 10 px or 10 ppt; exec ~/.config/i3/focus_windows
## same bindings, but for the arrow keys
#bindsym Left resize shrink width 10 px or 10 ppt
#bindsym Down resize grow height 10 px or 10 ppt
#bindsym Up resize shrink height 10 px or 10 ppt
#bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
"$mod+r" = "mode "Resize"";
set $mode_pres_main "Presentation (main display)"
mode $mode_pres_main {
bindsym b workspace $WS3, workspace $WS4, mode $mode_pres_sec
# back to normal: Enter or Escape
bindsym q mode "default"
# bindsym Escape mode "default"
bindsym Return mode "default"
}
set $mode_pres_sec "Presentation (secondary display)"
mode $mode_pres_sec {
bindsym b workspace $WS2, workspace $WS1, mode $mode_pres_main
# back to normal: Enter or Escape
bindsym q mode "default"
# bindsym Escape mode "default"
bindsym Return mode "default"
}
"$mod+Shift+p" = "mode $mode_pres_main";
set $mode_screen Screen setup [A] Auto [L] Load [S] Save [R] Remove [D] Default
"$mod+t" = "mode "$mode_screen"";
mode "$mode_screen" {
bindsym a exec autorandr --change --force, mode "default"
bindsym l exec ~/.config/i3/autorandrloadmenu, mode "default"
bindsym s exec ~/.config/i3/autorandrsavemenu, mode "default"
bindsym r exec ~/.config/i3/autorandrremovemenu, mode "default"
bindsym d exec ~/.config/i3/autorandrdefaultmenu, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
# Screen temperature ("redness") setting # Screen temperature ("redness") setting
"$mod+y" = "mode "$mode_temp""; "$mod+y" = "mode "$mode_temp"";
set $mode_temp Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue set $mode_temp Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue
mode "$mode_temp" { mode "$mode_temp" {
"r" = "exec sct 1000"; bindsym r exec sct 1000
"d" = "exec sct 2000"; bindsym d exec sct 2000
"c" = "exec sct 4500"; bindsym c exec sct 4500
"o" = "exec sct"; bindsym o exec sct
"a" = "exec sct 8000"; bindsym a exec sct 8000
"b" = "exec sct 10000"; bindsym b exec sct 10000
# back to normal: Enter or Escape # back to normal: Enter or Escape
"Return" = "mode "default""; bindsym Return mode "default"
"Escape" = "mode "default""; bindsym Escape mode "default"
} }
@ -100,8 +182,10 @@ exec --no-startup-id unclutter -root # Hide mouse cursor after some time
#exec --no-startup-id dunst # Notifications (handled by systemd) #exec --no-startup-id dunst # Notifications (handled by systemd)
exec --no-startup-id keynav # Keyboard cursor controller exec --no-startup-id keynav # Keyboard cursor controller
#exec --no-startup-id mpd # Music Player Daemon (handled by systemd) #exec --no-startup-id mpd # Music Player Daemon (handled by systemd)
# exec --no-startup-id ~/.config/i3/ashuffle # MPD Auto-refill
exec --no-startup-id autorandr --change --force # Screen configuration and everything that depends on it exec --no-startup-id autorandr --change --force # Screen configuration and everything that depends on it
{% if has_battery %} {% if has_battery %}
exec --no-startup-id ~/.config/i3/batteryNotify -d # Battery state notification exec --no-startup-id ~/.config/i3/batteryNotify -d # Battery state notification
{% endif %} {% endif %}
# exec --no-startup-id ~/.config/i3/aw_start # Activity tracker

2
config/i3/dmenu_cmd Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
dmenu -fn 'DejaVu Sans Mono-10' -nb '#48483e' -nf '#f1ebeb' -sb '#8fc029' -sf '#272822' -i -l 8 -f "$@"

15
config/i3/dmenu_run Executable file
View file

@ -0,0 +1,15 @@
#!/bin/sh
cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
if [ -d "$cachedir" ]; then
cache=$cachedir/dmenu_run
else
cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~
fi
(
IFS=:
if stest -dqr -n "$cache" $PATH; then
stest -flx $PATH | sort -u | tee "$cache" | $HOME/.config/i3/dmenu_cmd -p 'Run' "$@"
else
$HOME/.config/i3/dmenu_cmd -p 'Run' "$@" < "$cache"
fi
) | ${SHELL:-"/bin/sh"} &

24
config/i3/lock Executable file
View file

@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Remove SSH and GPG keys from keystores
ssh-add -D
echo RELOADAGENT | gpg-connect-agent
rm -rf "/tmp/cached_pass_$UID"
dm-tool lock
if [ $? -ne 0 ]; then
if [ -d ~/.cache/lockpatterns ]
then
pattern=$(find ~/.cache/lockpatterns/ | sort -R | head -1)
else
pattern=$HOME/.config/i3/lock.png
fi
revert() {
xset dpms 0 0 0
}
trap revert SIGHUP SIGINT SIGTERM
xset dpms 5 5 5
i3lock --nofork --color 648901 --image=$pattern --tiling --ignore-empty-password
revert
fi

BIN
config/i3/lock.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

1
config/i3/lock.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" height="50" width="50"><path fill="#82a401" d="M0 50h50V0H0z"/><path d="M0 0l50 50H25L0 25zm50 0v25L25 0z" fill="#466c01"/></svg>

After

Width:  |  Height:  |  Size: 189 B

26
config/i3/multimediaKey Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Send a key event to the current multimedia application or to MPD
# Currently since I did not found a way to test if a keystroke
# is grabbed by a windows or not, we test if MPD is playing
echo 8 "$1" "$2" "$(xdotool getactivewindow)" >> /tmp/dbg
if [ $# != 2 ]; then
echo "Usage: $0 KEY MPC_COMMAND"
exit 1
fi
if [ $(mpc status | wc -l) -ne 1 ]; then
# If mpd is running
mpc $2
else
# If mpd is not running
# echo "$1" "$2" "$(xdotool getactivewindow)" >> /tmp/dbg
xdotool key --window $(xdotool getactivewindow) $1
echo xdotool key --window $(xdotool getactivewindow) $1 >> /tmp/dbg
fi
exit 0

BIN
config/i3/pitch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 B

67
config/i3/screentime Executable file
View file

@ -0,0 +1,67 @@
#!/usr/bin/env python3
"""
Logs what window is in focus
"""
import csv
import datetime
import os
import typing
import i3ipc
class ScreenTime:
FIELDS = ["date", "type", "class", "role", "instance", "title"]
def write(self, line: typing.Dict) -> None:
now = datetime.datetime.now()
line["date"] = now.timestamp()
print("WROTE", line)
with open(self.csv_path, "a") as typedfd:
writer = csv.DictWriter(typedfd, fieldnames=self.FIELDS)
writer.writerow(line)
def on_window_event(
self, _: i3ipc.connection.Connection, e: i3ipc.events.WindowEvent
) -> None:
focused = self.i3.get_tree().find_focused()
self.write(
{
"type": "window_" + e.change,
"class": focused.window_class,
"role": focused.window_role,
"title": focused.window_title,
"instance": focused.window_instance,
}
)
def on_mode_event(
self, _: i3ipc.connection.Connection, e: i3ipc.events.ModeEvent
) -> None:
self.write({"type": "mode", "title": e.change})
def __init__(self) -> None:
self.i3 = i3ipc.Connection()
self.i3.on(i3ipc.Event.WINDOW, self.on_window_event)
self.i3.on(i3ipc.Event.MODE, self.on_mode_event)
self.csv_path = os.path.join(
os.path.expanduser(os.getenv("XDG_CACHE_PATH", "~/.cache/")),
"screentime.csv",
)
if not os.path.isfile(self.csv_path):
with open(self.csv_path, "w") as typedfd:
writer = csv.DictWriter(typedfd, fieldnames=self.FIELDS)
writer.writeheader()
self.write({"type": "start"})
def main(self) -> None:
self.i3.main()
if __name__ == "__main__":
ST = ScreenTime()
ST.main()

View file

@ -2,263 +2,168 @@
{ {
xsession.windowManager.i3 = { xsession.windowManager.i3 = {
enable = true; enable = true;
config = config = {
let terminal = "alacritty";
# lockColors = with config.lib.stylix.colors.withHashtag; { a = base00; b = base01; d = base00; }; # Black or White, depending on current theme # bars = []; # FIXME lemonbar
# lockColors = with config.lib.stylix.colors.withHashtag; { a = base0A; b = base0B; d = base00; }; # Green + Yellow colors = let ignore = "#ff00ff"; in
lockColors = { a = "#82a401"; b = "#466c01"; d = "#648901"; }; # Old with config.lib.stylix.colors.withHashtag; lib.mkForce {
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>"; focused = { border = base0B; background = base0B; text = base00; indicator = base00; childBorder = base0B; };
lockPng = pkgs.runCommand "lock.png" { } "${pkgs.imagemagick}/bin/convert ${lockSvg} $out"; focusedInactive = { border = base02; background = base02; text = base05; indicator = base02; childBorder = base02; };
locker = "exec ${ pkgs.writeShellScript "i3-locker" unfocused = { border = base05; background = base04; text = base00; indicator = base04; childBorder = base00; };
'' urgent = { border = base0F; background = base08; text = base00; indicator = base08; childBorder = base0F; };
# Remove SSH and GPG keys from keystores placeholder = { border = ignore; background = base00; text = base05; indicator = ignore; childBorder = base00; };
${pkgs.openssh}/bin/ssh-add -D background = base07;
echo RELOADAGENT | ${pkgs.gnupg}/bin/gpg-connect-agent # I set the color of the active tab as the the background color of the terminal so they merge together.
${pkgs.coreutils}/bin/rm -rf "/tmp/cached_pass_$UID" };
focus.followMouse = false;
${pkgs.lightdm}/bin/dm-tool lock keybindings =
# TODO Does that work for all DMs? let
if [ $? -ne 0 ]; then mod = config.xsession.windowManager.i3.config.modifier;
if [ -d ${config.xdg.cacheHome}/lockpatterns ] rofi = "exec --no-startup-id ${config.programs.rofi.package}/bin/rofi";
then focus = "exec ${ pkgs.writeShellScript "i3-focus-window"
pattern=$(${pkgs.findutils} ${config.xdg.cacheHome}/lockpatterns | sort -R | head -1) ''
else WINDOW=`${pkgs.xdotool}/bin/xdotool getwindowfocus`
pattern=${lockPng} eval `${pkgs.xdotool}/bin/xdotool getwindowgeometry --shell $WINDOW` # this brings in variables WIDTH and HEIGHT
fi TX=`${pkgs.coreutils}/bin/expr $WIDTH / 2`
revert() { TY=`${pkgs.coreutils}/bin/expr $HEIGHT / 2`
${pkgs.xorg.xset} dpms 0 0 0 ${pkgs.xdotool}/bin/xdotool mousemove -window $WINDOW $TX $TY
} ''
trap revert SIGHUP SIGINT SIGTERM
${pkgs.xorg.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`
eval `${pkgs.xdotool}/bin/xdotool getwindowgeometry --shell $WINDOW` # this brings in variables WIDTH and HEIGHT
TX=`${pkgs.coreutils}/bin/expr $WIDTH / 2`
TY=`${pkgs.coreutils}/bin/expr $HEIGHT / 2`
${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_resize = "Resize";
mode_pres_main = "Presentation (main display)";
mode_pres_sec = "Presentation (secondary display)";
mode_screen = "Screen setup [A] Auto [L] Load [S] Save [R] Remove [D] Default";
in
{
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
{
# 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";
# 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"
# -e zsh is for systems where I can't configure my user's shell
# TODO Is a shell script even required?
}"; }";
"${mod}+Shift+Return" = "exec ${config.programs.urxvt.package}/bin/urxvt"; pactl = "exec ${pkgs.pulseaudio}/bin/pactl"; # TODO Use NixOS package if using NixOS
"${mod}+p" = "exec ${pkgs.xfce.thunar}/bin/tunar"; scrot = "${pkgs.scrot}/bin/scrot --exec '${pkgs.coreutils}/bin/mv $f ~/Screenshots/ && ${pkgs.optipng}/bin/optipng ~/Screenshots/$f'";
"${mod}+m" = "exec ${config.programs.qutebrowser.package}/bin/qutebrowser --override-restore --backend=webengine"; # TODO nix path and create directory?
# TODO --backend not useful anymore in
# Volume control {
"XF86AudioRaiseVolume" = "${pactl} set-sink-mute @DEFAULT_SINK@ false; ${pactl} set-sink-volume @DEFAULT_SINK@ +5%"; # Compatibility layer for people coming from other backgrounds
"XF86AudioLowerVolume" = "${pactl} set-sink-mute @DEFAULT_SINK@ false; ${pactl} set-sink-volume @DEFAULT_SINK@ -5%"; # "Mod1+Tab" = "${rofi} -modi window -show window"; # FIXME When no longer using a VM
"XF86AudioMute" = "${pactl} set-sink-mute @DEFAULT_SINK@ true"; "Mod1+F2" = "${rofi} -modi drun -show drun";
"${mod}+F7" = "${pactl} suspend-sink @DEFAULT_SINK@ 1; ${pactl} suspend-sink @DEFAULT_SINK@ 0"; # Re-synchronize bluetooth headset "Mod1+F4" = "kill";
"${mod}+F11" = "exec ${pkgs.pavucontrol}/bin/pavucontrol"; # kill focused window
"${mod}+F12" = "exec ${pkgs.pavucontrol}/bin/pavucontrol"; "${mod}+z" = "kill";
# TODO Find pacmixer? button2 = "kill";
# Media control # Rofi
"XF86AudioPrev" = "exec ${pkgs.mpc-cli}/bin/mpc prev"; "${mod}+c" = "exec --no-startup-id ${pkgs.rofi-pass}/bin/rofi-pass --last-used";
"XF86AudioPlay" = "exec ${pkgs.mpc-cli}/bin/mpc toggle"; # TODO Try autopass.cr
"XF86AudioNext" = "exec ${pkgs.mpc-cli}/bin/mpc next"; # 23.11 config.programs.rofi.pass.package
# Misc "${mod}+i" = "exec --no-startup-id ${pkgs.rofimoji}/bin/rofimoji";
"${mod}+F10" = "exec ${ pkgs.writeShellScript "show-keyboard-layout" "${mod}+plus" = "${rofi} -modi ssh -show ssh";
'' "${mod}+ù" = "${rofi} -modi ssh -show ssh -ssh-command '{terminal} -e {ssh-client} {host} -t \"sudo -s -E\"'";
layout=`${pkgs.xorg.setxkbmap}/bin/setxkbmap -query | ${pkgs.gnugrep}/bin/grep ^layout: | ${pkgs.gawk}/bin/awk '{ print $2 }'` # TODO In which keyboard layout?
${pkgs.libgnomekbd}/bin/gkbd-keyboard-display -l $layout "${mod}+Tab" = "${rofi} -modi window -show window";
'' # start program launcher
}"; "${mod}+d" = "${rofi} -modi run -show run";
# Screenshots "${mod}+Shift+d" = "${rofi} -modi drun -show drun";
"Print" = "exec ${scrot} --focused"; # Start Applications
"${mod}+Print" = "exec ${scrot}"; # FIXME Doesn't work at least in the VM "${mod}+Return" = "exec ${
"Ctrl+Print" = "exec ${pkgs.coreutils}/bin/sleep 1 && ${scrot} --select"; pkgs.writeShellScript "terminal" "${config.programs.alacritty.package}/bin/alacritty msg create-window || exec ${config.programs.alacritty.package}/bin/alacritty -e zsh"
# TODO Try using bindsym --release instead of sleep # TODO Is -e zsh required?
# change focus }";
"${mod}+h" = "focus left; ${focus}"; "${mod}+Shift+Return" = "exec ${config.programs.urxvt.package}/bin/urxvt";
"${mod}+j" = "focus down; ${focus}"; "${mod}+p" = "exec ${pkgs.xfce.thunar}/bin/tunar";
"${mod}+k" = "focus up; ${focus}"; "${mod}+m" = "exec ${config.programs.qutebrowser.package}/bin/qutebrowser --override-restore --backend=webengine";
"${mod}+l" = "focus right; ${focus}"; # TODO --backend not useful anymore
# move focused window # Volume control
"${mod}+Shift+h" = "move left; ${focus}"; "XF86AudioRaiseVolume" = "${pactl} set-sink-mute @DEFAULT_SINK@ false; ${pactl} set-sink-volume @DEFAULT_SINK@ +5%";
"${mod}+Shift+j" = "move down; ${focus}"; "XF86AudioLowerVolume" = "${pactl} set-sink-mute @DEFAULT_SINK@ false; ${pactl} set-sink-volume @DEFAULT_SINK@ -5%";
"${mod}+Shift+k" = "move up; ${focus}"; "XF86AudioMute" = "${pactl} set-sink-mute @DEFAULT_SINK@ true";
"${mod}+Shift+l" = "move right; ${focus}"; "${mod}+F7" = "${pactl} suspend-sink @DEFAULT_SINK@ 1; ${pactl} suspend-sink @DEFAULT_SINK@ 0"; # Re-synchronize bluetooth headset
# workspace back and forth (with/without active container) "${mod}+F11" = "exec ${pkgs.pavucontrol}/bin/pavucontrol";
"${mod}+b" = "workspace back_and_forth; ${focus}"; "${mod}+F12" = "exec ${pkgs.pavucontrol}/bin/pavucontrol";
"${mod}+Shift+b" = "move container to workspace back_and_forth; workspace back_and_forth; ${focus}"; # TODO Find pacmixer?
# Change container layout # Media control
"${mod}+g" = "split h; ${focus}"; "XF86AudioPrev" = "exec ${pkgs.mpc-cli}/bin/mpc prev";
"${mod}+v" = "split v; ${focus}"; "XF86AudioPlay" = "exec ${pkgs.mpc-cli}/bin/mpc toggle";
"${mod}+f" = "fullscreen toggle; ${focus}"; "XF86AudioNext" = "exec ${pkgs.mpc-cli}/bin/mpc next";
"${mod}+s" = "layout stacking; ${focus}"; # Misc
"${mod}+w" = "layout tabbed; ${focus}"; "${mod}+F10" = "exec ${ pkgs.writeShellScript "show-keyboard-layout"
"${mod}+e" = "layout toggle split; ${focus}"; ''
"${mod}+Shift+space" = "floating toggle; ${focus}"; layout=`${pkgs.xorg.setxkbmap}/bin/setxkbmap -query | ${pkgs.gnugrep}/bin/grep ^layout: | ${pkgs.gawk}/bin/awk '{ print $2 }'`
# Focus container ${pkgs.libgnomekbd}/bin/gkbd-keyboard-display -l $layout
"${mod}+space" = "focus mode_toggle; ${focus}"; ''
"${mod}+a" = "focus parent; ${focus}"; }";
"${mod}+q" = "focus child; ${focus}"; # Screenshots
# Switch to workspace "Print" = "exec ${scrot} --focused";
"${mod}+1" = "workspace 1; ${focus}"; "${mod}+Print" = "exec ${scrot}"; # FIXME Doesn't work at least in the VM
"${mod}+2" = "workspace 2; ${focus}"; "Ctrl+Print" = "exec ${pkgs.coreutils}/bin/sleep 1 && ${scrot} --select";
"${mod}+3" = "workspace 3; ${focus}"; # change focus
"${mod}+4" = "workspace 4; ${focus}"; "${mod}+h" = "focus left; ${focus}";
"${mod}+5" = "workspace 5; ${focus}"; "${mod}+j" = "focus down; ${focus}";
"${mod}+6" = "workspace 6; ${focus}"; "${mod}+k" = "focus up; ${focus}";
"${mod}+7" = "workspace 7; ${focus}"; "${mod}+l" = "focus right; ${focus}";
"${mod}+8" = "workspace 8; ${focus}"; # move focused window
"${mod}+9" = "workspace 9; ${focus}"; "${mod}+Shift+h" = "move left; ${focus}";
"${mod}+0" = "workspace 10; ${focus}"; "${mod}+Shift+j" = "move down; ${focus}";
#navigate workspaces next / previous "${mod}+Shift+k" = "move up; ${focus}";
"${mod}+Ctrl+h" = "workspace prev_on_output; ${focus}"; "${mod}+Shift+l" = "move right; ${focus}";
"${mod}+Ctrl+l" = "workspace next_on_output; ${focus}"; # workspace back and forth (with/without active container)
"${mod}+Ctrl+j" = "workspace prev; ${focus}"; "${mod}+b" = "workspace back_and_forth; ${focus}";
"${mod}+Ctrl+k" = "workspace next; ${focus}"; "${mod}+Shift+b" = "move container to workspace back_and_forth; workspace back_and_forth; ${focus}";
# Move to workspace next / previous with focused container # Change container layout
"${mod}+Ctrl+Shift+h" = "move container to workspace prev_on_output; workspace prev_on_output; ${focus}"; "${mod}+g" = "split h; ${focus}";
"${mod}+Ctrl+Shift+l" = "move container to workspace next_on_output; workspace next_on_output; ${focus}"; "${mod}+v" = "split v; ${focus}";
"${mod}+Ctrl+Shift+j" = "move container to workspace prev; workspace prev; ${focus}"; "${mod}+f" = "fullscreen toggle; ${focus}";
"${mod}+Ctrl+Shift+k" = "move container to workspace next; workspace next; ${focus}"; "${mod}+s" = "layout stacking; ${focus}";
# move focused container to workspace "${mod}+w" = "layout tabbed; ${focus}";
"${mod}+ctrl+1" = "move container to workspace 1; ${focus}"; "${mod}+e" = "layout toggle split; ${focus}";
"${mod}+ctrl+2" = "move container to workspace 2; ${focus}"; "${mod}+Shift+space" = "floating toggle; ${focus}";
"${mod}+ctrl+3" = "move container to workspace 3; ${focus}"; # Focus container
"${mod}+ctrl+4" = "move container to workspace 4; ${focus}"; "${mod}+space" = "focus mode_toggle; ${focus}";
"${mod}+ctrl+5" = "move container to workspace 5; ${focus}"; "${mod}+a" = "focus parent; ${focus}";
"${mod}+ctrl+6" = "move container to workspace 6; ${focus}"; "${mod}+q" = "focus child; ${focus}";
"${mod}+ctrl+7" = "move container to workspace 7; ${focus}"; # Switch to workspace
"${mod}+ctrl+8" = "move container to workspace 8; ${focus}"; "${mod}+1" = "workspace 1; ${focus}";
"${mod}+ctrl+9" = "move container to workspace 9; ${focus}"; "${mod}+2" = "workspace 2; ${focus}";
"${mod}+ctrl+0" = "move container to workspace 10; ${focus}"; "${mod}+3" = "workspace 3; ${focus}";
# move to workspace with focused container "${mod}+4" = "workspace 4; ${focus}";
"${mod}+shift+1" = "move container to workspace 1; workspace 1; ${focus}"; "${mod}+5" = "workspace 5; ${focus}";
"${mod}+shift+2" = "move container to workspace 2; workspace 2; ${focus}"; "${mod}+6" = "workspace 6; ${focus}";
"${mod}+shift+3" = "move container to workspace 3; workspace 3; ${focus}"; "${mod}+7" = "workspace 7; ${focus}";
"${mod}+shift+4" = "move container to workspace 4; workspace 4; ${focus}"; "${mod}+8" = "workspace 8; ${focus}";
"${mod}+shift+5" = "move container to workspace 5; workspace 5; ${focus}"; "${mod}+9" = "workspace 9; ${focus}";
"${mod}+shift+6" = "move container to workspace 6; workspace 6; ${focus}"; "${mod}+0" = "workspace 10; ${focus}";
"${mod}+shift+7" = "move container to workspace 7; workspace 7; ${focus}"; #navigate workspaces next / previous
"${mod}+shift+8" = "move container to workspace 8; workspace 8; ${focus}"; "${mod}+Ctrl+h" = "workspace prev_on_output; ${focus}";
"${mod}+shift+9" = "move container to workspace 9; workspace 9; ${focus}"; "${mod}+Ctrl+l" = "workspace next_on_output; ${focus}";
"${mod}+shift+0" = "move container to workspace 10; workspace 10; ${focus}"; "${mod}+Ctrl+j" = "workspace prev; ${focus}";
# move workspaces to screen (arrow keys) "${mod}+Ctrl+k" = "workspace next; ${focus}";
"${mod}+ctrl+shift+Right" = "move workspace to output right; ${focus}"; # Move to workspace next / previous with focused container
"${mod}+ctrl+shift+Left" = "move workspace to output left; ${focus}"; "${mod}+Ctrl+Shift+h" = "move container to workspace prev_on_output; workspace prev_on_output; ${focus}";
"${mod}+Ctrl+Shift+Up" = "move workspace to output above; ${focus}"; "${mod}+Ctrl+Shift+l" = "move container to workspace next_on_output; workspace next_on_output; ${focus}";
"${mod}+Ctrl+Shift+Down" = "move workspace to output below; ${focus}"; "${mod}+Ctrl+Shift+j" = "move container to workspace prev; workspace prev; ${focus}";
# i3 control "${mod}+Ctrl+Shift+k" = "move container to workspace next; workspace next; ${focus}";
"${mod}+Shift+c" = "reload"; # move focused container to workspace
"${mod}+Shift+r" = "restart"; "${mod}+ctrl+1" = "move container to workspace 1; ${focus}";
"${mod}+Shift+e" = "exit"; "${mod}+ctrl+2" = "move container to workspace 2; ${focus}";
# Modes "${mod}+ctrl+3" = "move container to workspace 3; ${focus}";
"${mod}+Escape" = "mode ${mode_system}"; "${mod}+ctrl+4" = "move container to workspace 4; ${focus}";
"${mod}+r" = "mode ${mode_resize}"; "${mod}+ctrl+5" = "move container to workspace 5; ${focus}";
"${mod}+Shift+p" = "mode ${mode_pres_main}"; "${mod}+ctrl+6" = "move container to workspace 6; ${focus}";
"${mod}+t" = "mode ${mode_screen}"; "${mod}+ctrl+7" = "move container to workspace 7; ${focus}";
}; "${mod}+ctrl+8" = "move container to workspace 8; ${focus}";
modes = let return_bindings = { "${mod}+ctrl+9" = "move container to workspace 9; ${focus}";
"Return" = "mode default"; "${mod}+ctrl+0" = "move container to workspace 10; ${focus}";
"Escape" = "mode default"; # move to workspace with focused container
}; in "${mod}+shift+1" = "move container to workspace 1; workspace 1; ${focus}";
{ "${mod}+shift+2" = "move container to workspace 2; workspace 2; ${focus}";
"${mode_system}" = { "${mod}+shift+3" = "move container to workspace 3; workspace 3; ${focus}";
"l" = "exec --no-startup-id ${locker}, mode default"; "${mod}+shift+4" = "move container to workspace 4; workspace 4; ${focus}";
"e" = "exit, mode default"; "${mod}+shift+5" = "move container to workspace 5; workspace 5; ${focus}";
"s" = "exec --no-startup-id ${locker} & ${pkgs.systemd}/bin/systemctl suspend, mode default"; "${mod}+shift+6" = "move container to workspace 6; workspace 6; ${focus}";
"h" = "exec --no-startup-id ${locker} & ${pkgs.systemd}/bin/systemctl hibernate, mode default"; "${mod}+shift+7" = "move container to workspace 7; workspace 7; ${focus}";
"r" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl reboot, mode default"; "${mod}+shift+8" = "move container to workspace 8; workspace 8; ${focus}";
"p" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl poweroff -i, mode default"; "${mod}+shift+9" = "move container to workspace 9; workspace 9; ${focus}";
} // return_bindings; "${mod}+shift+0" = "move container to workspace 10; workspace 10; ${focus}";
"${mode_resize}" = { # move workspaces to screen (arrow keys)
"h" = "resize shrink width 10 px or 10 ppt; ${focus}"; "${mod}+ctrl+shift+Right" = "move workspace to output right; ${focus}";
"j" = "resize grow height 10 px or 10 ppt; ${focus}"; "${mod}+ctrl+shift+Left" = "move workspace to output left; ${focus}";
"k" = "resize shrink height 10 px or 10 ppt; ${focus}"; "${mod}+Ctrl+Shift+Up" = "move workspace to output above; ${focus}";
"l" = "resize grow width 10 px or 10 ppt; ${focus}"; "${mod}+Ctrl+Shift+Down" = "move workspace to output below; ${focus}";
} // return_bindings; # i3 control
"${mode_pres_main}" = { "${mod}+Shift+c" = "reload";
"b" = "workspace 3, workspace 4, mode ${mode_pres_sec}"; "${mod}+Shift+r" = "restart";
"q" = "mode default"; "${mod}+Shift+e" = "exit";
"Return" = "mode default"; };
}; };
"${mode_pres_sec}" = {
"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";
"l" = "exec ${autorandrmenu {title="Load profile"; option="--load"; builtin = true;}}, mode default";
"s" = "exec ${autorandrmenu {title="Save profile"; option="--save";}}, mode default";
"r" = "exec ${autorandrmenu {title="Remove profile"; option="--remove";}}, mode default";
"d" = "exec ${autorandrmenu {title="Default profile"; option="--default"; builtin = true;}}, mode default";
} // return_bindings;
};
};
}; };
programs = { programs = {
@ -352,6 +257,7 @@
# x11-exclusive # x11-exclusive
dunst dunst
i3lock
numlockx numlockx
# TODO urxvt-resize-font-git # TODO urxvt-resize-font-git
simplescreenrecorder simplescreenrecorder
@ -360,6 +266,7 @@
xautolock xautolock
xclip xclip
lemonbar-xft lemonbar-xft
autorandr
keynav keynav
sct sct
xorg.xinit xorg.xinit