Compare commits

...

9 commits

18 changed files with 568 additions and 839 deletions

View file

@ -10,16 +10,9 @@
when: root_access when: root_access
- role: dotfiles - role: dotfiles
tags: dotfiles tags: dotfiles
- role: mnussbaum.base16-builder-ansible # Required for desktop_environment
tags:
- color
- desktop_environment
- role: termux - role: termux
tags: termux tags: termux
when: termux when: termux
- role: desktop_environment
tags: desktop_environment
when: display_server
- role: extensions - role: extensions
tags: extensions tags: extensions
# TODO Dependencies # TODO Dependencies

View file

@ -1 +0,0 @@
base16_scheme: solarized-dark

View file

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

View file

@ -1,148 +0,0 @@
---
- name: Ensure directories for desktop applications are present
ansible.builtin.file:
state: directory
path: "{{ ansible_user_dir }}/{{ item }}"
mode: u=rwx,g=rx,o=rx
with_items:
- .config/Xresources
- .config/rofi
- .local/bin
- .local/share/fonts
- .config/qutebrowser
- .config/tridactyl/themes
# Download fonts
- name: Download Nerd fonts
ansible.builtin.get_url:
url: https://raw.githubusercontent.com/ryanoasis/nerd-fonts/704336735f576781b2a57b12a0c723e3316cbdec/patched-fonts/DejaVuSansMono/{{ item.folder }}/complete/{{
item.filename | urlencode }}
dest: "{{ ansible_user_dir }}/.local/share/fonts/{{ item.filename }}"
mode: u=rw,g=r,o=r
loop:
- filename: DejaVu Sans Mono Bold Nerd Font Complete Mono.ttf
folder: Bold
- filename: DejaVu Sans Mono Bold Oblique Nerd Font Complete Mono.ttf
folder: Bold-Italic
- filename: DejaVu Sans Mono Nerd Font Complete Mono.ttf
folder: Regular
- filename: DejaVu Sans Mono Oblique Nerd Font Complete Mono.ttf
folder: Italic
- name: Download icon fonts
ansible.builtin.get_url:
url: https://raw.githubusercontent.com/FortAwesome/Font-Awesome/a8386aae19e200ddb0f6845b5feeee5eb7013687/fonts/fontawesome-webfont.ttf
dest: "{{ ansible_user_dir }}/.local/share/fonts/fontawesome-webfont.ttf"
mode: u=rw,g=r,o=r
# TODO Either replace with ForkAwesome or Nerd Fonts
- name: Install python dependencies for lemonbar
ansible.builtin.pip:
requirements: "{{ ansible_user_dir }}/.dotfiles/config/lemonbar/requirements.txt"
extra_args: --break-system-packages # It's fine, it's local anyways
# Build a single color scheme and template and assign it to a variable
- base16_builder:
scheme: "{{ base16_scheme }}"
template: # This requires https://github.com/mnussbaum/base16-builder-ansible/pull/6
- i3
- xresources
- rofi
- alacritty
- shell
- fzf
- vim
- qutebrowser
- tridactyl
- dunst
register: base16_schemes
tags:
- color
- i3
- name: Download base16 theme for Tridactyl
ansible.builtin.copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['tridactyl']['base16-' + base16_scheme + '.config.py'] }}"
# url: "https://raw.githubusercontent.com/bezmi/base16-tridactyl/master/base16-{{ base16_scheme }}.css"
dest: "{{ ansible_env.HOME }}/.config/tridactyl/themes/theme.css"
mode: u=rw,g=r,o=r
when: false # Not currently used
tags:
- color
- name: Configure i3
ansible.builtin.template:
src: "{{ ansible_env.HOME }}/.config/i3/config.j2"
dest: "{{ ansible_env.HOME }}/.config/i3/config"
mode: u=rw,g=r,o=r
notify:
- i3-reload
tags:
- color
- i3
when: display_server == 'x11'
- name: Set base16 theme for rofi
ansible.builtin.copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['rofi']['themes']['base16-' + base16_scheme + '.' + item] }}"
dest: "{{ ansible_env.HOME }}/.config/rofi/theme.{{ item }}"
mode: u=rw,g=r,o=r
tags:
- color
loop:
- config
- rasi
- name: Configure Dunst
ansible.builtin.template:
src: "{{ ansible_env.HOME }}/.config/dunst/dunstrc.j2"
dest: "{{ ansible_env.HOME }}/.config/dunst/dunstrc"
mode: u=rw,g=r,o=r
tags:
- color
when: display_server == 'x11'
- name: Download base16 theme for fzf
ansible.builtin.copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['fzf']['bash']['base16-' + base16_scheme + '.config'] }}"
dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf"
mode: u=rw,g=r,o=r
notify:
- fzf-reload
tags:
- color
- name: Download base16 theme for shell
ansible.builtin.copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['shell']['script']['base16-' + base16_scheme + '.sh'] }}"
dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply"
mode: u=rwx,g=rx,o=rx
notify:
- shell-reload
when: false # Not currently used
tags:
- color
- name: Set used base16 theme for vim
ansible.builtin.copy:
path: "{{ ansible_env.HOME }}/.config/vim/colorscheme.vim"
mode: u=rw,g=r,o=r
content: colorscheme base16-{{ base16_scheme }}
when: false # Not currently used
tags:
- color
- name: Enable user services
ansible.builtin.systemd:
name: "{{ item }}"
state: started
enabled: true
scope: user
loop:
- pulseaudio
- mpd
when: has_systemd
# TODO bar (might change bar in the future, so...)
# TODO highlight (there IS a template but the colors look different from vim and mostly the same from when there's no config)
# TODO https://github.com/makuto/auto-base16-theme ? :P

View file

@ -13,15 +13,7 @@
path: "{{ ansible_user_dir }}/.hushlogin" path: "{{ ansible_user_dir }}/.hushlogin"
mode: u=rw,g=r,o=r mode: u=rw,g=r,o=r
# Build a single color scheme and template and assign it to a variable # https://github.com/kdrag0n/base16-termux/blob/master/templates/default.mustache
- base16_builder:
scheme: "{{ base16_scheme }}"
template: # This requires https://github.com/mnussbaum/base16-builder-ansible/pull/6
- termux
register: base16_schemes
tags:
- color
- name: Download base16 theme for Termux - name: Download base16 theme for Termux
ansible.builtin.copy: ansible.builtin.copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['termux']['colors']['base16-' + base16_scheme + '.properties'] }}" content: "{{ base16_schemes['schemes'][base16_scheme]['termux']['colors']['base16-' + base16_scheme + '.properties'] }}"

View file

@ -1,2 +0,0 @@
dunstrc
theme

View file

@ -1,65 +0,0 @@
[global]
alignment = left
always_run_script = true
browser = /usr/bin/qutebrowser
class = Dunst
dmenu = /usr/bin/dmenu -p dunst:
ellipsize = middle
follow = none
font = DejaVu Sans 10
force_xinerama = false
format = "<b>%s %p</b>\n%b"
frame_color = "#A6E22E"
frame_width = 3
geometry = "500x5-30+20"
hide_duplicate_count = false
history_length = 20
horizontal_padding = 8
icon_path = /usr/share/icons/gnome/256x256/actions/:/usr/share/icons/gnome/256x256/status/:/usr/share/icons/gnome/256x256/devices/
icon_position = left
idle_threshold = 120
ignore_newline = no
indicate_hidden = yes
line_height = 0
markup = full
max_icon_size = 48
monitor = 0
notification_height = 0
padding = 8
separator_color = frame
separator_height = 2
show_age_threshold = 60
show_indicators = yes
shrink = no
sort = yes
stack_duplicates = true
startup_notification = false
sticky_history = yes
title = Dunst
transparency = 0
verbosity = mesg
word_wrap = yes
[experimental]
per_monitor_dpi = false
[shortcuts]
close_all = ctrl+mod4+n
close = mod4+n
context = mod1+mod4+n
history = shift+mod4+n
[urgency_low]
background = "#272822"
foreground = "#F8F8F2"
frame_color = "#A6E22E"
timeout = 10
[urgency_normal]
background = "#272822"
foreground = "#F8F8F2"
frame_color = "#F4BF75"
timeout = 10
[urgency_critical]
background = "#272822"
foreground = "#F8F8F2"
frame_color = "#F92672"
timeout = 0
{{ base16_schemes['schemes'][base16_scheme]['dunst']['themes']['base16-' + base16_scheme + '.dunstrc'] }}
# TODO Not used. Not sure how it's supposed to be used :D

View file

@ -1,2 +0,0 @@
config
theme

View file

@ -1,107 +0,0 @@
# vi:syntax=conf
# i3 config file (v4)
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
# Set mod key (Mod1=<Alt>, Mod4=<Super>)
set $mod Mod4
# set default desktop layout (default is tiling)
# workspace_layout tabbed <stacking|tabbed>
# Configure border style <normal|1pixel|pixel xx|none|pixel>
new_window pixel 2
new_float normal
# Hide borders
hide_edge_borders both
mouse_warping output
# Workspace names
set $WS1 1
set $WS2 2
set $WS3 3
set $WS4 4
set $WS5 5
set $WS6 6
set $WS7 7
set $WS8 8
set $WS9 9
set $WS10 10
# Workspace output
{% set screens = x11_screens | default(['DEFAULT']) %}
{% for i in range(1, 11) %}
workspace "$WS{{ i }}" output {{ screens[(i - 1) % (screens | length)] }}
{% endfor %}
# Default layout = tabs, since I mostly exclusively use them
workspace_layout tabbed
# Open specific applications in floating mode
for_window [title="pacmixer"] floating enable border pixel 2
for_window [class="Firefox"] layout tabbed # Doesn't seem to work anymore
for_window [class="qutebrowser"] layout tabbed
for_window [window_role="pop-up"] floating enable
for_window [window_role="task_dialog"] floating enable
for_window [ title="^pdfpc.*" window_role="presenter" ] move to output left, fullscreen
for_window [ title="^pdfpc.*" window_role="presentation" ] move to output right, fullscreen
# switch to workspace with urgent window automatically
for_window [urgent=latest] focus
# Set shut down, restart and locking features
set $locker $HOME/.config/i3/lock
# Screen temperature ("redness") setting
"$mod+y" = "mode "$mode_temp"";
set $mode_temp Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue
mode "$mode_temp" {
"r" = "exec sct 1000";
"d" = "exec sct 2000";
"c" = "exec sct 4500";
"o" = "exec sct";
"a" = "exec sct 8000";
"b" = "exec sct 10000";
# back to normal: Enter or Escape
"Return" = "mode "default"";
"Escape" = "mode "default"";
}
# Inactivity settings
exec --no-startup-id xautolock -time 10 -locker 'xset dpms force standby' -killtime 1 -killer '$locker'
"$mod+F1" = "exec --no-startup-id sh -c "sleep .25 && xset dpms force off"";
"$mod+F4" = "exec --no-startup-id xautolock -disable";
"$mod+F5" = "exec --no-startup-id xautolock -enable";
# Autostart applications
#exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 # Password remembering
#exec --no-startup-id gnome-keyring-daemon # Password remembering
# exec --no-startup-id urxvtd -q -f # urxvt daemon
{% if auto_numlock %}
exec --no-startup-id numlockx on # Activate Num lock
{% endif %}
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 keynav # Keyboard cursor controller
#exec --no-startup-id mpd # Music Player Daemon (handled by systemd)
exec --no-startup-id autorandr --change --force # Screen configuration and everything that depends on it
{% if has_battery %}
exec --no-startup-id ~/.config/i3/batteryNotify -d # Battery state notification
{% endif %}

View file

@ -54,7 +54,7 @@ class Bar:
""" """
# Constants # Constants
FONTS = ["DejaVuSansMono Nerd Font Mono", "Font Awesome"] FONTS = ["DejaVuSansMono Nerd Font Mono"]
FONTSIZE = 10 FONTSIZE = 10
@staticmethod @staticmethod

View file

@ -1,5 +1,3 @@
#!/usr/bin/env bash
BATT="/sys/class/power_supply/BAT0" BATT="/sys/class/power_supply/BAT0"
LOW=10 LOW=10
CRIT=3 CRIT=3
@ -25,10 +23,10 @@ function computeState() {
if [ "$acpiStatus" == "Discharging" ] if [ "$acpiStatus" == "Discharging" ]
then then
if [ $acpiCapacity -le $CRIT ] if [ "$acpiCapacity" -le $CRIT ]
then then
setState "CRIT" -u critical -i battery-caution "Battery level is critical" "$acpiCapacity %" setState "CRIT" -u critical -i battery-caution "Battery level is critical" "$acpiCapacity %"
elif [ $acpiCapacity -le $LOW ] elif [ "$acpiCapacity" -le $LOW ]
then then
setState "LOW" -u critical -i battery-low "Battery level is low" "$acpiCapacity %" setState "LOW" -u critical -i battery-low "Battery level is low" "$acpiCapacity %"
else else

View file

@ -1,15 +1,31 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
{ {
home.stateVersion = "23.05";
programs = { programs = {
home-manager.enable = true; home-manager.enable = true;
bash.enable = true; # Just in case the default shell is not ZSH, so we still have the variables
zsh = { zsh = {
enable = true; enable = true;
enableAutosuggestions = true; enableAutosuggestions = true;
enableCompletion = true; enableCompletion = true;
enableSyntaxHighlighting = true; enableSyntaxHighlighting = true;
# syntaxHighlighting.enable = true; # 23.11 syntax # syntaxHighlighting.enable = true; # 23.11 syntax
historySubstringSearch.enable = true;
initExtra = builtins.readFile ./zshrc.sh;
defaultKeymap = "viins";
};
powerline-go = {
enable = true;
modules = [ "user" "host" "venv" "cwd" "perms" "git" ];
modulesRight = [ "jobs" "exit" "duration" "load" ];
settings = {
colorize-hostname = true;
max-width = 25;
cwd-max-dir-size = 10;
duration = "$( test -n \"$__TIMER\" && echo $(( $EPOCHREALTIME - $\{__TIMER:-EPOCHREALTIME})) || echo 0 )";
# UPST Implement this properly in home-manager
};
extraUpdatePS1 = ''unset __TIMER'';
}; };
# neovim = { # neovim = {
# enable = true; # enable = true;
@ -50,84 +66,96 @@
trust = "ultimate"; trust = "ultimate";
}]; }];
}; };
fzf.enable = true;
# TODO highlight or bat
nix-index = {
enable = true;
enableZshIntegration = true;
};
}; };
home = {
stateVersion = "23.05";
language = {
base = "en_US.UTF-8";
time = "en_DK.UTF-8";
};
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,41 +1,43 @@
{ pkgs, config, lib, ... }: { pkgs, config, lib, ... }:
{ {
xsession.windowManager.i3 = { xsession = {
enable = true; enable = true;
config = windowManager = {
let i3 = {
# lockColors = with config.lib.stylix.colors.withHashtag; { a = base00; b = base01; d = base00; }; # Black or White, depending on current theme enable = true;
# lockColors = with config.lib.stylix.colors.withHashtag; { a = base0A; b = base0B; d = base00; }; # Green + Yellow config =
lockColors = { a = "#82a401"; b = "#466c01"; d = "#648901"; }; # Old let
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 = base00; b = base01; d = base00; }; # Black or White, depending on current theme
lockPng = pkgs.runCommand "lock.png" { } "${pkgs.imagemagick}/bin/convert ${lockSvg} $out"; # lockColors = with config.lib.stylix.colors.withHashtag; { a = base0A; b = base0B; d = base00; }; # Green + Yellow
locker = "exec ${ pkgs.writeShellScript "i3-locker" lockColors = { a = "#82a401"; b = "#466c01"; d = "#648901"; }; # Old
'' 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>";
# Remove SSH and GPG keys from keystores lockPng = pkgs.runCommand "lock.png" { } "${pkgs.imagemagick}/bin/convert ${lockSvg} $out";
${pkgs.openssh}/bin/ssh-add -D locker = pkgs.writeShellScript "i3-locker"
echo RELOADAGENT | ${pkgs.gnupg}/bin/gpg-connect-agent ''
${pkgs.coreutils}/bin/rm -rf "/tmp/cached_pass_$UID" # Remove SSH and GPG keys from keystores
${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 fi
revert() { revert() {
${pkgs.xorg.xset} dpms 0 0 0 ${pkgs.xorg.xset}/bin/xset dpms 0 0 0
} }
trap revert SIGHUP SIGINT SIGTERM trap revert SIGHUP SIGINT SIGTERM
${pkgs.xorg.xset} dpms 5 5 5 ${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 ${pkgs.i3lock}/bin/i3lock --nofork --color ${builtins.substring 1 6 lockColors.d} --image=$pattern --tiling --ignore-empty-password
revert revert
fi fi
'' '';
}"; focus = "exec ${ pkgs.writeShellScript "i3-focus-window"
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
@ -44,221 +46,285 @@
${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";
in mode_temp = "Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue";
{
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"; 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}";
#navigate workspaces next / previous # TODO Prevent repetitions, see workspace assignation for example
"${mod}+Ctrl+h" = "workspace prev_on_output; ${focus}"; #navigate workspaces next / previous
"${mod}+Ctrl+l" = "workspace next_on_output; ${focus}"; "${mod}+Ctrl+h" = "workspace prev_on_output; ${focus}";
"${mod}+Ctrl+j" = "workspace prev; ${focus}"; "${mod}+Ctrl+l" = "workspace next_on_output; ${focus}";
"${mod}+Ctrl+k" = "workspace next; ${focus}"; "${mod}+Ctrl+j" = "workspace prev; ${focus}";
# Move to workspace next / previous with focused container "${mod}+Ctrl+k" = "workspace next; ${focus}";
"${mod}+Ctrl+Shift+h" = "move container to workspace prev_on_output; workspace prev_on_output; ${focus}"; # Move to workspace next / previous with focused container
"${mod}+Ctrl+Shift+l" = "move container to workspace next_on_output; workspace next_on_output; ${focus}"; "${mod}+Ctrl+Shift+h" = "move container to workspace prev_on_output; workspace prev_on_output; ${focus}";
"${mod}+Ctrl+Shift+j" = "move container to workspace prev; workspace prev; ${focus}"; "${mod}+Ctrl+Shift+l" = "move container to workspace next_on_output; workspace next_on_output; ${focus}";
"${mod}+Ctrl+Shift+k" = "move container to workspace next; workspace next; ${focus}"; "${mod}+Ctrl+Shift+j" = "move container to workspace prev; workspace prev; ${focus}";
# move focused container to workspace "${mod}+Ctrl+Shift+k" = "move container to workspace next; workspace next; ${focus}";
"${mod}+ctrl+1" = "move container to workspace 1; ${focus}"; # move focused container to workspace
"${mod}+ctrl+2" = "move container to workspace 2; ${focus}"; "${mod}+ctrl+1" = "move container to workspace 1; ${focus}";
"${mod}+ctrl+3" = "move container to workspace 3; ${focus}"; "${mod}+ctrl+2" = "move container to workspace 2; ${focus}";
"${mod}+ctrl+4" = "move container to workspace 4; ${focus}"; "${mod}+ctrl+3" = "move container to workspace 3; ${focus}";
"${mod}+ctrl+5" = "move container to workspace 5; ${focus}"; "${mod}+ctrl+4" = "move container to workspace 4; ${focus}";
"${mod}+ctrl+6" = "move container to workspace 6; ${focus}"; "${mod}+ctrl+5" = "move container to workspace 5; ${focus}";
"${mod}+ctrl+7" = "move container to workspace 7; ${focus}"; "${mod}+ctrl+6" = "move container to workspace 6; ${focus}";
"${mod}+ctrl+8" = "move container to workspace 8; ${focus}"; "${mod}+ctrl+7" = "move container to workspace 7; ${focus}";
"${mod}+ctrl+9" = "move container to workspace 9; ${focus}"; "${mod}+ctrl+8" = "move container to workspace 8; ${focus}";
"${mod}+ctrl+0" = "move container to workspace 10; ${focus}"; "${mod}+ctrl+9" = "move container to workspace 9; ${focus}";
# move to workspace with focused container "${mod}+ctrl+0" = "move container to workspace 10; ${focus}";
"${mod}+shift+1" = "move container to workspace 1; workspace 1; ${focus}"; # move to workspace with focused container
"${mod}+shift+2" = "move container to workspace 2; workspace 2; ${focus}"; "${mod}+shift+1" = "move container to workspace 1; workspace 1; ${focus}";
"${mod}+shift+3" = "move container to workspace 3; workspace 3; ${focus}"; "${mod}+shift+2" = "move container to workspace 2; workspace 2; ${focus}";
"${mod}+shift+4" = "move container to workspace 4; workspace 4; ${focus}"; "${mod}+shift+3" = "move container to workspace 3; workspace 3; ${focus}";
"${mod}+shift+5" = "move container to workspace 5; workspace 5; ${focus}"; "${mod}+shift+4" = "move container to workspace 4; workspace 4; ${focus}";
"${mod}+shift+6" = "move container to workspace 6; workspace 6; ${focus}"; "${mod}+shift+5" = "move container to workspace 5; workspace 5; ${focus}";
"${mod}+shift+7" = "move container to workspace 7; workspace 7; ${focus}"; "${mod}+shift+6" = "move container to workspace 6; workspace 6; ${focus}";
"${mod}+shift+8" = "move container to workspace 8; workspace 8; ${focus}"; "${mod}+shift+7" = "move container to workspace 7; workspace 7; ${focus}";
"${mod}+shift+9" = "move container to workspace 9; workspace 9; ${focus}"; "${mod}+shift+8" = "move container to workspace 8; workspace 8; ${focus}";
"${mod}+shift+0" = "move container to workspace 10; workspace 10; ${focus}"; "${mod}+shift+9" = "move container to workspace 9; workspace 9; ${focus}";
# move workspaces to screen (arrow keys) "${mod}+shift+0" = "move container to workspace 10; workspace 10; ${focus}";
"${mod}+ctrl+shift+Right" = "move workspace to output right; ${focus}"; # move workspaces to screen (arrow keys)
"${mod}+ctrl+shift+Left" = "move workspace to output left; ${focus}"; "${mod}+ctrl+shift+Right" = "move workspace to output right; ${focus}";
"${mod}+Ctrl+Shift+Up" = "move workspace to output above; ${focus}"; "${mod}+ctrl+shift+Left" = "move workspace to output left; ${focus}";
"${mod}+Ctrl+Shift+Down" = "move workspace to output below; ${focus}"; "${mod}+Ctrl+Shift+Up" = "move workspace to output above; ${focus}";
# i3 control "${mod}+Ctrl+Shift+Down" = "move workspace to output below; ${focus}";
"${mod}+Shift+c" = "reload"; # i3 control
"${mod}+Shift+r" = "restart"; "${mod}+Shift+c" = "reload";
"${mod}+Shift+e" = "exit"; "${mod}+Shift+r" = "restart";
# Modes "${mod}+Shift+e" = "exit";
"${mod}+Escape" = "mode ${mode_system}"; # Screen off commands
"${mod}+r" = "mode ${mode_resize}"; "${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}+Shift+p" = "mode ${mode_pres_main}"; # TODO --release?
"${mod}+t" = "mode ${mode_screen}"; "${mod}+F4" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -disable";
}; "${mod}+F5" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -enable";
modes = let return_bindings = { # Modes
"Return" = "mode default"; "${mod}+Escape" = "mode ${mode_system}";
"Escape" = "mode default"; "${mod}+r" = "mode ${mode_resize}";
}; in "${mod}+Shift+p" = "mode ${mode_pres_main}";
{ "${mod}+t" = "mode ${mode_screen}";
"${mode_system}" = { "${mod}+y" = "mode ${mode_temp}";
"l" = "exec --no-startup-id ${locker}, mode default"; };
"e" = "exit, mode default"; modes = let return_bindings = {
"s" = "exec --no-startup-id ${locker} & ${pkgs.systemd}/bin/systemctl suspend, mode default";
"h" = "exec --no-startup-id ${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";
"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";
};
"${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;
"${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";
runtimeInputs = with pkgs; [coreutils libnotify];
text = builtins.readFile ./batteryNotify.sh;
# TODO Use batsignal instead?
# TODO Only on computers with battery
}}/bin/batteryNotify";
}
# TODO There's a services.screen-locker.xautolock but not sure it can match the above command
];
workspaceLayout = "tabbed";
focus.mouseWarping = true; # i3 only supports warping to workspace, hence ${focus}
workspaceOutputAssign =
let
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);
forEachWorkspace = f: map (w: f { w = w; workspace = ((builtins.elemAt workspaces w)); }) (lib.lists.range 0 ((builtins.length workspaces) - 1));
in
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
}; };
programs = { programs = {
@ -313,62 +379,133 @@
enable = true; enable = true;
pass.enable = true; pass.enable = true;
}; };
autorandr.enable = true;
}; };
home.packages = with pkgs; [ xdg = {
# remote mimeApps = {
tigervnc enable = true;
associations.added = {
"text/html" = "org.qutebrowser.qutebrowser.desktop";
"x-scheme-handler/http" = "org.qutebrowser.qutebrowser.desktop";
"x-scheme-handler/https" = "org.qutebrowser.qutebrowser.desktop";
"x-scheme-handler/about" = "org.qutebrowser.qutebrowser.desktop";
"x-scheme-handler/unknown" = "org.qutebrowser.qutebrowser.desktop";
};
};
userDirs.enable = true; # TODO Which ones do we want?
};
services = {
unclutter.enable = true;
dunst =
{
enable = true;
settings =
# TODO Change dmenu for rofi, so we can use context
with config.lib.stylix.colors.withHashtag; {
global = {
separator_color = lib.mkForce base05;
idle_threshold = 120;
markup = "full";
max_icon_size = 48;
# TODO Those shortcuts don't seem to work, maybe try:
# > define shortcuts inside your window manager and bind them to dunstctl(1) commands
close_all = "ctrl+mod4+n";
close = "mod4+n";
context = "mod1+mod4+n";
history = "shift+mod4+n";
};
# music urgency_low = {
mpd background = lib.mkForce base01;
mpc-cli foreground = lib.mkForce base03;
ashuffle frame_color = lib.mkForce base05;
vimpc };
urgency_normal = {
background = lib.mkForce base02;
foreground = lib.mkForce base05;
frame_color = lib.mkForce base05;
};
urgency_critical = {
background = lib.mkForce base08;
foreground = lib.mkForce base06;
frame_color = lib.mkForce base05;
};
};
};
mpd.enable = true;
autorandr.enable = true;
};
# multimedia common home = {
gimp file =
inkscape let
mpv nixgl = import
mpvScripts.thumbnail (builtins.fetchGit {
libreoffice url = "https://github.com/nix-community/nixGL";
rev = "489d6b095ab9d289fe11af0219a9ff00fe87c7c5";
})
{ };
in
{
".xinitrc" = {
# TODO Configurable
source = pkgs.writeShellScript "xinitrc" ''
${pkgs.xorg.xrdb}/bin/xrdb ${config.xresources.path}
${nixgl.nixVulkanIntel}/bin/nixVulkanIntel ${nixgl.nixGLIntel}/bin/nixGLIntel ${config.xsession.windowManager.command}
'';
};
};
packages = with pkgs; [
# remote
tigervnc
# data management # music
freefilesync mpc-cli
ashuffle
vimpc
# browsers # multimedia common
firefox gimp
inkscape
mpv
mpvScripts.thumbnail
libreoffice
# fonts # data management
dejavu_fonts freefilesync
twemoji-color-font
gnome.gedit
feh
zathura
zbar
zathura
meld
python3Packages.magic
yubikey-touch-detector
# x11-exclusive # browsers
dunst firefox
numlockx
# TODO urxvt-resize-font-git # fonts
simplescreenrecorder dejavu_fonts
trayer twemoji-color-font
unclutter gnome.gedit
xautolock feh
xclip zathura
lemonbar-xft zbar
keynav zathura
sct meld
xorg.xinit python3Packages.magic
xorg.xbacklight yubikey-touch-detector
# x11-exclusive
numlockx
# TODO urxvt-resize-font-git
simplescreenrecorder
trayer
xclip
lemonbar-xft
keynav
xorg.xinit
xorg.xbacklight
# organisation # organisation
pass pass
thunderbird thunderbird
]; ];
};
} }

View file

@ -27,5 +27,8 @@ in
}; };
# Fix https://nix-community.github.io/home-manager/index.html#_why_do_i_get_an_error_message_about_literal_ca_desrt_dconf_literal_or_literal_dconf_service_literal # Fix https://nix-community.github.io/home-manager/index.html#_why_do_i_get_an_error_message_about_literal_ca_desrt_dconf_literal_or_literal_dconf_service_literal
home.packages = [ pkgs.dconf ]; # home.packages = [ pkgs.dconf ];
dconf.enable = false; # Otherwise standalone home-manager complains it can't find /etc/dbus-1/session.conf on Arch.
# Symlinking it to /usr/share/dbus-1/session.conf goes further but not much.
} }

42
config/nix/hm/zshrc.sh Normal file
View file

@ -0,0 +1,42 @@
# powerline-go duration support
zmodload zsh/datetime
function preexec() {
__TIMER=$EPOCHREALTIME
}
# Cursor based on mode
if [ $TERM = "linux" ]; then
_LINE_CURSOR="\e[?0c"
_BLOCK_CURSOR="\e[?8c"
else
_LINE_CURSOR="\e[6 q"
_BLOCK_CURSOR="\e[2 q"
fi
function zle-keymap-select zle-line-init
{
case $KEYMAP in
vicmd) print -n -- "$_BLOCK_CURSOR";;
viins|main) print -n -- "$_LINE_CURSOR";;
esac
}
function zle-line-finish
{
print -n -- "$_BLOCK_CURSOR"
}
zle -N zle-line-init
zle -N zle-line-finish
zle -N zle-keymap-select
# Also return to normal mode from jk shortcut
bindkey 'jk' vi-cmd-mode
# Edit command line
autoload edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line
# Additional history-substring-search bindings for vi cmd mode
# TODO Doesn't work, as home-manager loads history-substring at the very end of the file
# bindkey -M vicmd 'k' history-substring-search-up
# bindkey -M vicmd 'j' history-substring-search-down

View file

@ -51,9 +51,8 @@ padding-right = 2
module-margin-left = 1 module-margin-left = 1
module-margin-right = 1 module-margin-right = 1
font-0 = "Font Awesome:size=10;0" font-0 = "DejaVu Sans:size=10;0"
font-1 = "DejaVu Sans:size=10;0" font-1 = "DejaVuSansMono Nerd Font Mono:pixelsize=10;0"
font-2 = "DejaVuSansMono Nerd Font Mono:pixelsize=10;0"
modules-left = i3 modules-left = i3

View file

@ -23,7 +23,6 @@ alias dmesg='dmesg --ctime'
alias wget='wget --hsts-file $HOME/.cache/wget-hsts' alias wget='wget --hsts-file $HOME/.cache/wget-hsts'
# [ -f ~/.local/bin/colorSchemeApplyFzf ] && . ~/.local/bin/colorSchemeApplyFzf # Only applies RGB colors... # [ -f ~/.local/bin/colorSchemeApplyFzf ] && . ~/.local/bin/colorSchemeApplyFzf # Only applies RGB colors...
POWERLINE_GO_DEFAULT_OPTS=(-colorize-hostname -max-width 25 -cwd-max-dir-size 10 -modules 'user,host,venv,cwd,perms,git' -modules-right 'jobs,exit,duration,load') # For reading by shell profiles
FZF_DEFAULT_OPTS="--height 40% --layout=default" FZF_DEFAULT_OPTS="--height 40% --layout=default"
FZF_CTRL_T_OPTS="--preview '[[ -d {} ]] && ls -l --color=always {} || [[ \$(file --mime {}) =~ binary ]] && file --brief {} || (highlight -O ansi -l {} || coderay {} || rougify {} || cat {}) 2> /dev/null | head -500'" FZF_CTRL_T_OPTS="--preview '[[ -d {} ]] && ls -l --color=always {} || [[ \$(file --mime {}) =~ binary ]] && file --brief {} || (highlight -O ansi -l {} || coderay {} || rougify {} || cat {}) 2> /dev/null | head -500'"
FZF_COMPLETION_OPTS="${FZF_CTRL_T_OPTS}" FZF_COMPLETION_OPTS="${FZF_CTRL_T_OPTS}"

View file

@ -5,134 +5,7 @@
# #
# TODO Learn `setopt extendedglob` # TODO Learn `setopt extendedglob`
# TODO Add asdf (oh-my-zsh plugin is air, git clone is the way (aur package outdated))
# Approximate RGB colors by terminal colors
[[ "$COLORTERM" == (24bit|truecolor) || "${terminfo[colors]}" -eq '16777216' ]] || zmodload zsh/nearcolor
# Plugins
ADOTDIR=~/.cache/antigen
mkdir -p $ADOTDIR
typeset -a ANTIGEN_CHECK_FILES=(~/.config/shell/zshrc)
if [ -f /usr/share/zsh/share/antigen.zsh ]
then
source /usr/share/zsh/share/antigen.zsh
else
[ -f ~/.local/share/zsh/antigen.zsh ] || (mkdir -p ~/.local/share/zsh/ && curl -L git.io/antigen > ~/.local/share/zsh/antigen.zsh)
# TODO If the downloaded file is wrong then we're doomed
source ~/.local/share/zsh/antigen.zsh
fi
# This is better to have them installed as system since we can use them as root
# pacman -S zsh-autosuggestions zsh-history-substring-search zsh-syntax-highlighting zsh-completions --needed
function plugin() {
if [ -d "/usr/share/licenses/$2" ]
then
trysource "/usr/share/zsh/plugins/$2/$2.zsh"
# It's ok if it fails
else
antigen bundle "$1/$2"
fi
}
plugin zsh-users zsh-completions
plugin zsh-users zsh-syntax-highlighting
plugin zsh-users zsh-autosuggestions
plugin zsh-users zsh-history-substring-search
antigen apply
# Prompt customization
zmodload zsh/datetime
function preexec() {
__TIMER=$EPOCHREALTIME
}
if command -v powerline-go > /dev/null
then
function powerline_precmd() {
local __ERRCODE=$?
local __DURATION=0
if [ -n $__TIMER ]; then
local __ERT=$EPOCHREALTIME
__DURATION="$(($__ERT - ${__TIMER:-__ERT}))"
fi
echo -en "\033]0; ${USER}@${HOST} $PWD\007"
# echo -en "… $\r"
eval "$(powerline-go -shell zsh -eval -duration $__DURATION -error $__ERRCODE "${POWERLINE_GO_DEFAULT_OPTS[@]}")"
unset __TIMER
}
function install_powerline_precmd() {
for s in "${precmd_functions[@]}"; do
if [ "$s" = "powerline_precmd" ]; then
return
fi
done
precmd_functions+=(powerline_precmd)
}
install_powerline_precmd
else
export PS1="\[\e]2;\u@\H \w\a\]\[\e[0;37m\][\[\e[0;${col}m\]\u\[\e[0;37m\]@\[\e[0;34m\]\h \[\e[0;36m\]\W\[\e[0;37m\]]\$\[\e[0m\] "
fi
# Cursor based on mode
if [ $TERM = "linux" ]; then
_LINE_CURSOR="\e[?0c"
_BLOCK_CURSOR="\e[?8c"
else
_LINE_CURSOR="\e[6 q"
_BLOCK_CURSOR="\e[2 q"
fi
function zle-keymap-select zle-line-init
{
case $KEYMAP in
vicmd) print -n -- "$_BLOCK_CURSOR";;
viins|main) print -n -- "$_LINE_CURSOR";;
esac
# zle reset-prompt
# zle -R
}
function zle-line-finish
{
print -n -- "$_BLOCK_CURSOR"
}
zle -N zle-line-init
zle -N zle-line-finish
zle -N zle-keymap-select
# Should I really put a comment to explain what this does?
bindkey 'jk' vi-cmd-mode
# Edit command line
autoload edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line
# History search
# bind UP and DOWN arrow keys
zmodload zsh/terminfo
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
# bind UP and DOWN arrow keys (compatibility fallback
# for Ubuntu 12.04, Fedora 21, and MacOSX 10.9 users)
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
# bind P and N for EMACS mode
bindkey -M emacs '^P' history-substring-search-up
bindkey -M emacs '^N' history-substring-search-down
# bind k and j for VI mode
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
# Autocompletion # Autocompletion
autoload -Uz promptinit autoload -Uz promptinit