Reformat my i3-config a bit to make better use of vim folds

This commit is contained in:
2025-08-25 19:20:59 +02:00
parent 577610166f
commit 0dc1eeaaf5
2 changed files with 128 additions and 95 deletions

View File

@@ -1,6 +1,4 @@
# Basic variables # General variables {{{
# vim: set foldexpr=getline(v\:lnum)=~'^\\s*$'&&getline(v\:lnum+1)=~'\\S'?'<1'\:1:
# vim: set foldmethod=expr:
set $mod Mod4 set $mod Mod4
set $lock screensaver set $lock screensaver
set $terminal x-terminal-emulator set $terminal x-terminal-emulator
@@ -26,26 +24,8 @@ set $w11 "11 󰍁"
# spotify # spotify
set $w12 "12 󰓇" set $w12 "12 󰓇"
# colors and font # }}}
#font pango:Roboto Mono 11 # German keyboard mappings {{{
set $c_bg1 "#282A2E"
set $c_bg2 "#373B41"
set $c_fg "#C5C8C6"
set $c_pri "#F0C674"
set $c_sec "#8ABEB7"
set $c_warn "#A54242"
set $c_dis "#707880"
set $font "pango:monospace 11"
font $font
# border back text indicator child_border
client.focused $c_bg2 $c_pri $c_bg1 $c_warn $c_bg2
client.focused_inactive $c_sec $c_bg2 $c_fg $c_warn $c_bg1
client.unfocused $c_bg2 $c_bg1 $c_fg $c_sec $c_bg1
client.urgent $c_pri $c_warn $c_bg1 $c_pri $c_pri
client.placeholder $c_bg1 $c_bg1 $c_fg $c_fg $c_bg1
client.background $c_bg1
# Keyboard-Keys
# ┏━━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━┓ # ┏━━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━┳━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━┓
# ┃ 9 ┃ 67 ┃ 68 ┃ 69 ┃ 70 ┃ 71 ┃ 72 ┃ 73 ┃ 74 ┃ 75 ┃ 76 ┃ 95 ┃ 96 ┃ 77 ┃ 127 ┃ 118 ┃ 119 ┃ # ┃ 9 ┃ 67 ┃ 68 ┃ 69 ┃ 70 ┃ 71 ┃ 72 ┃ 73 ┃ 74 ┃ 75 ┃ 76 ┃ 95 ┃ 96 ┃ 77 ┃ 127 ┃ 118 ┃ 119 ┃
# ┃ Esc ┃ F1 ┃ F2 ┃ F3 ┃ F4 ┃ F5 ┃ F6 ┃ F7 ┃ F8 ┃ F9 ┃ F10┃ F11┃ F12┃ Num ┃ Break ┃ Einfg ┃ Del ┃ # ┃ Esc ┃ F1 ┃ F2 ┃ F3 ┃ F4 ┃ F5 ┃ F6 ┃ F7 ┃ F8 ┃ F9 ┃ F10┃ F11┃ F12┃ Num ┃ Break ┃ Einfg ┃ Del ┃
@@ -65,48 +45,105 @@ client.background $c_bg1
# ┃ 37 ┃ ┃ Mod4┃ Mod1┃ 65 ┃ 108 ┃ 135 ┃ 105 ┃ 113┃ 116┃ 114┃ # ┃ 37 ┃ ┃ Mod4┃ Mod1┃ 65 ┃ 108 ┃ 135 ┃ 105 ┃ 113┃ 116┃ 114┃
# ┃ Ctrl┃ FN ┃super┃ Alt ┃ Space ┃ AltGr┃ menu ┃ Ctrl ┃ ← ┃ ↓ ┃ → ┃ # ┃ Ctrl┃ FN ┃super┃ Alt ┃ Space ┃ AltGr┃ menu ┃ Ctrl ┃ ← ┃ ↓ ┃ → ┃
# ┗━━━━━┻━━━━━┻━━━━━┻━━━━━┹─────────────────────────────────┺━━━━━━┻━━━━━━┻━━━━━━┻━━━━┻━━━━┻━━━━┛ # ┗━━━━━┻━━━━━┻━━━━━┻━━━━━┹─────────────────────────────────┺━━━━━━┻━━━━━━┻━━━━━━┻━━━━┻━━━━┻━━━━┛
# }}}
# Defaults appearence, floating windows and general X-settings (X11) {{{
set $c_bg1 "#282A2E"
set $c_bg2 "#373B41"
set $c_fg "#C5C8C6"
set $c_pri "#F0C674"
set $c_sec "#8ABEB7"
set $c_warn "#A54242"
set $c_dis "#707880"
set $font "pango:monospace 11"
font $font
# border back text indicator child_border
client.focused $c_bg2 $c_pri $c_bg1 $c_warn $c_bg2
client.focused_inactive $c_sec $c_bg2 $c_fg $c_warn $c_bg1
client.unfocused $c_bg2 $c_bg1 $c_fg $c_sec $c_bg1
client.urgent $c_pri $c_warn $c_bg1 $c_pri $c_pri
client.placeholder $c_bg1 $c_bg1 $c_fg $c_fg $c_bg1
client.background $c_bg1
# Floating window-types default_border none
for_window [window_role="^About"] floating enable default_floating_border normal
for_window [instance="^Update"] floating enable
for_window [instance="^gcalctool"] floating enable for_window [window_role="^About"] floating enable
for_window [instance="^gnome-keyring"] floating enable for_window [instance="^Update"] floating enable
for_window [instance="^file_progress"] floating enable for_window [instance="^gcalctool"] floating enable
for_window [instance="^arandr"] floating enable resize set width 900 for_window [instance="^gnome-keyring"] floating enable
for_window [instance="^file_progress"] floating enable
for_window [instance="^arandr"] floating enable resize set width 900
for_window [class="jetbrains-idea" title="splash"] floating enable for_window [class="jetbrains-idea" title="splash"] floating enable
#for_window [class="^Microsoft Teams - Preview$"] floating enable for_window [class="^Microsoft Teams - Preview$"] floating enable
# If I have opened the nm-openconnect-auth-dialog I set focus by myself,
# otherwise it appeared automatically and I don't want the focus!
no_focus [instance="^nm-openconnect-auth-dialog"] no_focus [instance="^nm-openconnect-auth-dialog"]
# $mod (super) # Status-Bar
bar {
# I'll use polybar instead of i3status
i3bar_command $HOME/.config/polybar/launch.sh
}
# ensure a neat network-tray icon
exec nm-applet || true
# warn when battery dies, I do nothing else but this will give me time to save everthing :)
exec --no-startup-id ~/Development/nemoinho/github.com/rjekker/i3-battery-popup -Nn -f "$font" -s ~/Development/nemoinho/github.com/rjekker/i3-battery-popup.wav
# set some nice looking background
exec_always --no-startup-id feh --bg-fill ~/.config/i3/green-wheat.jpg
# gaps and transparency
gaps inner 10
gaps outer 5
# compton allows some transparent windows if I like :)
exec_always --no-startup-id compton --config ~/.config/compton.conf -b
# TODO: move the following to Xresources or similar, it feels clunky here
# switch to screensaver after 1 hour w/o interaction
exec xset s 3600 3600
# set a blazing fast keyboard repeat rate, and make it happen more quickly (defaults: 660/25)
exec xset r rate 200 100
# }}}
# $mod (super) {{{
floating_modifier $mod floating_modifier $mod
# Layout ($mod+[asdf]) # }}}
# Layout ($mod+[asdf]) {{{
bind $mod+38 layout stacking bind $mod+38 layout stacking
bind $mod+39 layout tabbed bind $mod+39 layout tabbed
bind $mod+40 layout default bind $mod+40 layout default
bind $mod+41 fullscreen bind $mod+41 fullscreen
# Split container horizontal/vertical ($mod[+shift]+o) # }}}
# Split container horizontal/vertical ($mod[+shift]+o) {{{
bind $mod+32 split v bind $mod+32 split v
bind $mod+Shift+32 split h bind $mod+Shift+32 split h
# }}}
# Focus outer container ($mod+ö|$mod+control+shift+o) # Focus outer container ($mod+ö|$mod+control+shift+o) {{{
bind $mod+Shift+Control+32 focus parent bind $mod+Shift+Control+32 focus parent
bind $mod+47 focus parent bind $mod+47 focus parent
#bind $mod+Control+32 focus parent #bind $mod+Control+32 focus parent
# Fullscreen ($mod+shift+f) # }}}
# Fullscreen ($mod+shift+f) {{{
bind $mod+Shift+41 fg bind $mod+Shift+41 fg
# Toggle floating ($mod+shift+space) # }}}
# Toggle floating ($mod+shift+space) {{{
bind $mod+Shift+65 floating toggle bind $mod+Shift+65 floating toggle
# Toggle floating focus ($mod+control+space) # }}}
# Toggle floating focus ($mod+control+space) {{{
bind $mod+Control+65 focus mode_toggle bind $mod+Control+65 focus mode_toggle
# Change focus ($mod+[hjkl|arrows]) # }}}
# Change focus ($mod+[hjkl|arrows]) {{{
bind $mod+43 focus left bind $mod+43 focus left
bind $mod+44 focus down bind $mod+44 focus down
bind $mod+45 focus up bind $mod+45 focus up
@@ -116,8 +153,8 @@ bind $mod+116 focus down
bind $mod+111 focus up bind $mod+111 focus up
bind $mod+114 focus right bind $mod+114 focus right
# }}}
# Change workspace [1…12] ($mod+[1234567890ß´]) # Change workspace [1…12] ($mod+[1234567890ß´]) {{{
bind $mod+10 workspace $w01 bind $mod+10 workspace $w01
bind $mod+11 workspace $w02 bind $mod+11 workspace $w02
bind $mod+12 workspace $w03 bind $mod+12 workspace $w03
@@ -131,7 +168,8 @@ bind $mod+19 workspace $w10
bind $mod+20 workspace $w11 bind $mod+20 workspace $w11
bind $mod+21 workspace $w12 bind $mod+21 workspace $w12
# Move window within workspace ($mod+shift+[hjkl|arrows]) # }}}
# Move window within workspace ($mod+shift+[hjkl|arrows]) {{{
bind $mod+Shift+43 move left bind $mod+Shift+43 move left
bind $mod+Shift+44 move down bind $mod+Shift+44 move down
bind $mod+Shift+45 move up bind $mod+Shift+45 move up
@@ -141,7 +179,8 @@ bind $mod+Shift+116 move down
bind $mod+Shift+111 move up bind $mod+Shift+111 move up
bind $mod+Shift+114 move right bind $mod+Shift+114 move right
# Move window to workspace ($mod+shift+[1234567890ß´]) # }}}
# Move window to workspace ($mod+shift+[1234567890ß´]) {{{
bind $mod+Shift+10 move container to workspace $w01 bind $mod+Shift+10 move container to workspace $w01
bind $mod+Shift+11 move container to workspace $w02 bind $mod+Shift+11 move container to workspace $w02
bind $mod+Shift+12 move container to workspace $w03 bind $mod+Shift+12 move container to workspace $w03
@@ -155,44 +194,55 @@ bind $mod+Shift+19 move container to workspace $w10
bind $mod+Shift+20 move container to workspace $w11 bind $mod+Shift+20 move container to workspace $w11
bind $mod+Shift+21 move container to workspace $w12 bind $mod+Shift+21 move container to workspace $w12
# Move workspace to screen ($mod+[shift|control]+[ui]) # }}}
# Move workspace to screen ($mod+[shift|control]+[ui]) {{{
bind $mod+Shift+30 move workspace to output left bind $mod+Shift+30 move workspace to output left
bind $mod+Shift+31 move workspace to output right bind $mod+Shift+31 move workspace to output right
bind $mod+Control+30 move workspace to output up bind $mod+Control+30 move workspace to output up
bind $mod+Control+31 move workspace to output down bind $mod+Control+31 move workspace to output down
# Reload i3 configuration ($mod+shift+r) # }}}
# Reload i3 configuration ($mod+shift+r) {{{
bind $mod+Shift+27 reload bind $mod+Shift+27 reload
# Restart i3 ($mod+shift+backspace) # }}}
# Restart i3 ($mod+shift+backspace) {{{
bind $mod+Shift+22 restart bind $mod+Shift+22 restart
# Exit i3 ($mod+control+backspace) # }}}
# Exit i3 ($mod+control+backspace) {{{
bind $mod+Control+22 exit bind $mod+Control+22 exit
# Change border ($mod+b) # }}}
# Change border ($mod+b) {{{
bind $mod+56 border toggle bind $mod+56 border toggle
# Start terminal ($mod+enter) # }}}
# Start terminal ($mod+enter) {{{
bind $mod+36 exec $terminal bind $mod+36 exec $terminal
bind $mod+48 split h; exec $terminal bind $mod+48 split h; exec $terminal
bind $mod+51 split v; exec $terminal bind $mod+51 split v; exec $terminal
# Start application ($mod+p) # }}}
# Start application ($mod+p) {{{
bind $mod+33 exec $rofi bind $mod+33 exec $rofi
# Lock screen ($mod+Control+Shift+l) # }}}
# Lock screen ($mod+Control+Shift+l) {{{
bindsym $mod+Shift+Control+l exec $lock bindsym $mod+Shift+Control+l exec $lock
bindsym $mod+Shift+Control+p exec $lock --configure bindsym $mod+Shift+Control+p exec $lock --configure
# Kill window ($mod+shift+q) # }}}
# Kill window ($mod+shift+q) {{{
bind $mod+Shift+24 kill bind $mod+Shift+24 kill
# Suspend / Shutdown ($mod+F12) # }}}
# Suspend / Shutdown ($mod+F12) {{{
bindsym $mod+F12 exec "bash -c '$lock & sleep 3; systemctl suspend; $autorandr -- --change'" bindsym $mod+F12 exec "bash -c '$lock & sleep 3; systemctl suspend; $autorandr -- --change'"
bindsym $mod+Control+F12 exec bash -c "shutdown -h now &" bindsym $mod+Control+F12 exec bash -c "shutdown -h now &"
# Manage sound ($mod+[F1,F3,F5,F6]|Audio-Keys) # }}}
# Manage sound ($mod+[F1,F3,F5,F6]|Audio-Keys) {{{
bindsym XF86AudioRaiseVolume exec ~/.config/i3/audio set-sink-volume +3% bindsym XF86AudioRaiseVolume exec ~/.config/i3/audio set-sink-volume +3%
bindsym XF86AudioLowerVolume exec ~/.config/i3/audio set-sink-volume -3% bindsym XF86AudioLowerVolume exec ~/.config/i3/audio set-sink-volume -3%
bindsym XF86AudioMute exec ~/.config/i3/audio set-sink-mute toggle bindsym XF86AudioMute exec ~/.config/i3/audio set-sink-mute toggle
@@ -200,8 +250,8 @@ bindsym $mod+F6 exec ~/.config/i3/audio set-sink-volume +3%
bindsym $mod+F5 exec ~/.config/i3/audio set-sink-volume -3% bindsym $mod+F5 exec ~/.config/i3/audio set-sink-volume -3%
bindsym $mod+F3 exec ~/.config/i3/audio set-sink-mute toggle bindsym $mod+F3 exec ~/.config/i3/audio set-sink-mute toggle
bindsym $mod+F1 exec pactl set-source-mute @DEFAULT_SOURCE@ toggle bindsym $mod+F1 exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
# }}}
# Manage monitors ($mod+[control]+[F2,F8,F9]) # Manage monitors ($mod+[control]+[F2,F8,F9]) {{{
bindsym XF86MonBrightnessUp exec sudo ~/.local/bin/backlight inc bindsym XF86MonBrightnessUp exec sudo ~/.local/bin/backlight inc
bindsym XF86MonBrightnessDown exec sudo ~/.local/bin/backlight dec bindsym XF86MonBrightnessDown exec sudo ~/.local/bin/backlight dec
bindsym $mod+F9 exec sudo ~/.local/bin/backlight inc bindsym $mod+F9 exec sudo ~/.local/bin/backlight inc
@@ -210,42 +260,16 @@ bindsym $mod+F2 exec $autorandr --change
bindsym $mod+Control+F2 exec bash -c '$autorandr | $rofi -dmenu | xargs -r $autorandr --load' bindsym $mod+Control+F2 exec bash -c '$autorandr | $rofi -dmenu | xargs -r $autorandr --load'
bindsym $mod+Control+Shift+F2 exec $autorandr --load laptop bindsym $mod+Control+Shift+F2 exec $autorandr --load laptop
# }}}
# Switching keyboard layout ($mod+[F10]) {{{
# Defaults # my laptop has a broken keyboard and this is a workaround
default_border none
default_floating_border normal
#workspace $w01 output DP-1.2
#workspace $w02 output DP-1.3
#workspace $w03 output eDP-1-1
# Status-Bar
bar {
# I'll use polybar instead of i3status for the moment
i3bar_command $HOME/.config/polybar/launch.sh
}
# switch to screensaver after 1 hour w/o interaction
exec xset s 3600 3600
# set a blazing fast keyboard repeat rate, and make it happen more quickly (defaults: 660/25)
exec xset r rate 200 100
# Executions
#exec xrandr --output eDP-1 --auto --primary
exec nm-applet || true
#exec ~/.local/bin/Enpass || true
exec --no-startup-id ~/Development/nemoinho/github.com/rjekker/i3-battery-popup -Nn -f "$font" -s ~/Development/nemoinho/github.com/rjekker/i3-battery-popup.wav
#exec ~/.local/bin/wiki || true
exec ~/.local/bin/init-i3.sh
exec --no-startup-id systemctl --user start podman.socket
# reset keyboard, because of physical failures...
exec switch-keyboard-variant nemoinho exec switch-keyboard-variant nemoinho
bindsym $mod+F10 exec switch-keyboard-variant nemoinho bindsym $mod+F10 exec switch-keyboard-variant
bindsym $mod+F11 exec switch-keyboard-variant de
# }}}
# Shortcuts to different applications ($mod+Control+[cdefmv]|$mod+Control+Shift+f){{{
# Specific commands ($mod+Control+[cdefmv]|$mod+Control+Shift+f)
bind $mod+61 move scratchpad bind $mod+61 move scratchpad
bind $mod+35 exec ~/.local/bin/wiki bind $mod+35 exec ~/.local/bin/wiki
bindsym $mod+Control+f exec $(screenshot) bindsym $mod+Control+f exec $(screenshot)
@@ -256,9 +280,9 @@ bindsym $mod+Control+m exec $($terminal --title btop -e btop)
bindsym $mod+Control+d exec $($terminal --title ctop -e ctop) bindsym $mod+Control+d exec $($terminal --title ctop -e ctop)
bindsym $mod+Control+e exec $($terminal -e mutt) bindsym $mod+Control+e exec $($terminal -e mutt)
# gaps and transparency # }}}
gaps inner 10
gaps outer 5 # Start podman {{{
#exec --no-startup-id "compton --config ~/.config/compton.conf -b" # TODO: there is probaply also another "better" place for this
exec_always --no-startup-id compton --config ~/.config/compton.conf -b exec --no-startup-id systemctl --user start podman.socket
exec_always --no-startup-id feh --bg-fill ~/.config/i3/green-wheat.jpg #}}}

View File

@@ -117,3 +117,12 @@ vim.api.nvim_create_autocmd("FileType", {
vim.opt_local.tabstop = 4 vim.opt_local.tabstop = 4
end, end,
}) })
-- i3config
vim.api.nvim_create_autocmd("FileType", {
pattern = "i3config",
group = configgroup,
callback = function()
vim.opt_local.foldlevel = 0
vim.opt_local.foldmethod = "marker"
end,
})