dotfiles/.config/i3/config_common

258 lines
8.2 KiB
Plaintext
Raw Normal View History

2018-05-03 20:23:53 +02:00
# i3 config file (v4)
##################################
# STARTING CONFIGURATION
##################################
# Mod1 = alt
2018-05-03 20:23:53 +02:00
set $mod Mod1
2019-11-17 22:34:18 +01:00
set $resize_mode Resize — [←] [→] [↑] [↓]
set $film_mode Film Mode — [u]p [d]own
2019-11-15 15:42:50 +01:00
# font for window titles.
2021-11-24 14:39:05 +01:00
font pango:Roboto, Bold 10
2018-05-03 20:23:53 +02:00
# use Mouse+$mod to drag floating windows to their wanted position
2018-05-03 20:23:53 +02:00
floating_modifier $mod
# no border nor title
new_window none
# hide borders when touching edges
hide_edge_borders both
# do not sync mouse position and focus
focus_follows_mouse no
2019-11-19 16:32:30 +01:00
# if a popup is coming when an app is fullscreen, leave the fullscreen
popup_during_fullscreen leave_fullscreen
# let urgency hint when switching to workspace
force_display_urgency_hint 500 ms
# script to lock the screen
set $Locker ~/.config/i3/lock/lock.sh
# settings for i3 gaps
gaps inner 10
gaps outer 0
smart_gaps on
##################################
# PROGRAMS STARTED AUTOMATICALLY
##################################
# Load Xresources
exec --no-startup-id xrdb -merge ~/.Xresources
# Start compositor
2020-09-22 19:06:32 +02:00
exec --no-startup-id picom --config ~/.config/picom.conf
# Start NetworkManager applet
2022-01-26 11:36:28 +01:00
exec --no-startup-id nm-applet
# Start polybar
2019-11-14 16:09:40 +01:00
exec_always --no-startup-id $HOME/.config/polybar/scripts/launch_polybar.sh
# set numlock on
exec --no-startup-id numlockx on
# turn to black screen after 9 minutes of doing nothing
exec --no-startup-id xset dpms 600
# autolock after 9 minutes of doing nothing
2021-11-24 14:39:05 +01:00
exec --no-startup-id xautolock -time 9 -locker $Locker -corners ----
# notifications
exec dunst
# set ALSA initial volume
exec --no-startup-id amixer -D hw:PCH -M sset Master 50%
# standard apps
exec --no-startup-id i3-msg 'workspace 1; exec i3-sensible-terminal'
exec firefox
exec thunderbird
exec signal-desktop
2020-05-08 19:13:46 +02:00
exec telegram-desktop
exec obsidian
2023-02-18 23:10:14 +01:00
exec --no-startup-id redshift-gtk
2023-02-28 15:01:01 +01:00
exec qbittorrent
# fetch keys from HSM
exec --no-startup-id gpg --card-status
2022-03-17 16:20:49 +01:00
# ensure keyboard layout
exec --no-startup-id setxkbmap fr
##################################
# BINDINGS FOR STARTING PROGRAMS
##################################
2018-05-03 20:23:53 +02:00
# start a terminal
bindsym $mod+Return exec --no-startup-id i3-sensible-terminal
2018-05-03 20:23:53 +02:00
# start rofi (a program launcher)
2018-07-27 20:34:21 +02:00
bindsym $mod+d exec rofi -show run -theme sidebar
2023-12-03 17:43:09 +01:00
bindsym $mod+Shift+d exec rofimoji
2018-05-03 20:23:53 +02:00
# just lock the screen
bindsym $mod+l exec --no-startup-id $Locker && sleep 1
# lock and suspend to SWAP
2023-02-23 18:19:03 +01:00
bindsym $mod+Shift+l exec --no-startup-id $Locker && systemctl suspend
2020-01-08 17:57:51 +01:00
# open Explorer
bindsym $mod+e exec --no-startup-id nemo
# screenshot and save to file
2020-05-14 13:07:55 +02:00
bindsym Shift+Print exec ~/.config/i3/scripts/screenshot.py -s
# screenshot and upload to Lychee
bindsym Print exec ~/.config/i3/scripts/screenshot.py -u
# screenshot with flameshot
2021-01-05 12:45:56 +01:00
bindsym $mod+Shift+i exec flameshot gui
2019-11-17 22:34:18 +01:00
mode "$film_mode" {
2019-11-15 15:42:50 +01:00
bindsym u exec ~/.config/i3/scripts/film_mode.sh on
bindsym d exec ~/.config/i3/scripts/film_mode.sh off
2019-11-17 22:18:57 +01:00
bindsym Escape mode "default"
2019-11-15 15:42:50 +01:00
}
# toggle film mode
2019-11-17 22:34:18 +01:00
bindsym $mod+Shift+f mode "$film_mode"
# pass
bindsym $mod+p exec passmenu
2019-11-20 23:09:30 +01:00
2022-05-18 15:02:15 +02:00
# playback control
bindsym Mod4+p exec playerctl play-pause
bindsym Mod4+Right exec playerctl next
bindsym Mod4+Left exec playerctl previous
##################################
# BINDINGS FOR STANDARD OPERATIONS
##################################
# kill focused window
bindsym $mod+q kill
# change focus
2018-05-03 20:23:53 +02:00
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move containers
2018-05-03 20:23:53 +02:00
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+h split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# toggle tiling / floating
bindsym $mod+space floating toggle
2018-05-03 20:23:53 +02:00
# focus the parent container
bindsym $mod+a focus parent
2018-05-03 20:23:53 +02:00
# switch to workspace
bindsym $mod+ampersand workspace number 1
bindsym $mod+eacute workspace number 2
bindsym $mod+quotedbl workspace number 3
bindsym $mod+apostrophe workspace number 4
bindsym $mod+parenleft workspace number 5
bindsym $mod+minus workspace number 6
bindsym $mod+egrave workspace number 7
bindsym $mod+underscore workspace number 8
bindsym $mod+ccedilla workspace number 9
bindsym $mod+agrave workspace number 10
2018-05-03 20:23:53 +02:00
# move focused container to workspace
bindsym $mod+Shift+ampersand move container to workspace 1
bindsym $mod+Shift+eacute move container to workspace 2
bindsym $mod+Shift+quotedbl move container to workspace 3
bindsym $mod+Shift+apostrophe move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+minus move container to workspace 6
bindsym $mod+Shift+egrave move container to workspace 7
bindsym $mod+Shift+underscore move container to workspace 8
bindsym $mod+Shift+ccedilla move container to workspace 9
bindsym $mod+Shift+agrave move container to workspace 10
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# resize window (you can also use the mouse for that)
2019-11-17 22:34:18 +01:00
mode "$resize_mode" {
2020-01-24 11:57:08 +01:00
bindsym Left resize shrink width 40 px or 20 ppt; move position center
bindsym Down resize grow height 40 px or 20 ppt; move position center
bindsym Up resize shrink height 40 px or 20 ppt; move position center
bindsym Right resize grow width 40 px or 20 ppt; move position center
2018-05-03 20:23:53 +02:00
bindsym Escape mode "default"
}
2019-11-17 22:34:18 +01:00
bindsym $mod+r mode "$resize_mode"
2018-05-03 20:23:53 +02:00
##################################
# BINDINGS FOR NOTIFICATIONS
##################################
2023-02-18 22:48:06 +01:00
bindsym Ctrl+Shift+space exec dunstctl close-all
2022-11-04 12:37:42 +01:00
bindsym Ctrl+$mod+space exec dunstctl history-pop
bindsym Shift+BackSpace exec dunstctl close
##################################
# OPERATIONS FOR SPECIFIC WINDOWS
##################################
2018-05-03 20:23:53 +02:00
2023-10-29 16:10:09 +01:00
# enable window icons for all windows
for_window [all] title_window_icon yes
# some windows will float automatically
for_window [class="(?i)Thunderbird"] floating enable
2018-05-03 20:23:53 +02:00
for_window [window_role="About"] floating enable
for_window [window_role="Organizer"] floating enable
for_window [title="^Terminator *"] floating enable
for_window [window_role="pop-up"] floating enable
for_window [window_role="task_dialog"] floating enable
for_window [title="Preferences$"] floating enable
for_window [class="Telegram"] floating enable
2022-09-12 12:10:30 +02:00
for_window [class="(?i)Thunderbird"] move position center
for_window [window_role="GtkFileChooserDialog"] move position center
2023-10-29 16:10:09 +01:00
# === Scratchpad ===
# Make the currently focused window a scratchpad
bindsym $mod+Shift+BackSpace move scratchpad
2022-11-10 12:03:38 +01:00
for_window [class="Signal" window_type="normal"] move scratchpad
for_window [class="Telegram"] move scratchpad
# we don't use class="Thunderbird" to not move windows like "MsgCompose" to scratchpad : only the main window will be in scratchpad
for_window [instance="Mail"] move scratchpad
2024-01-18 17:28:49 +01:00
# only target main window
for_window [title="qBittorrent v*"] move scratchpad
2020-05-08 19:13:46 +02:00
bindsym $mod+Shift+m [instance="Mail"] scratchpad show, move position center
bindsym $mod+Shift+s [class="Signal"] scratchpad show, move position center
2024-01-18 17:28:49 +01:00
bindsym $mod+Shift+e [title="qBittorrent v*"] scratchpad show, move position center
bindsym $mod+Shift+t [class="Telegram"] scratchpad show, move position center
2022-03-16 11:20:35 +01:00
bindsym Mod4+ampersand [title="(?i)perso.*obsidian"] scratchpad show, move container to workspace 4, workspace 4, floating disable
bindsym Mod4+eacute [title="(?i)tech.*obsidian"] scratchpad show, move container to workspace 4, workspace 4, floating disable
2023-02-22 12:38:41 +01:00
bindsym Mod4+quotedbl [title="(?i)notes.*obsidian"] scratchpad show, move container to workspace 4, workspace 4, floating disable
2019-10-02 22:12:55 +02:00
2023-10-29 16:10:09 +01:00
# Thanks to this epic discussion, with an unexpected ending, I am happily
# able to resize floating windows by percentage of the screen width/height,
# making it compatible with the shared configuration
# https://github.com/i3/i3/issues/2816
2024-01-20 21:12:25 +01:00
for_window [instance="Mail" window_type="normal"] resize set 90 ppt 85 ppt
2023-10-29 16:10:09 +01:00
for_window [class="Signal"] resize set 90 ppt 85 ppt
for_window [class="Telegram"] resize set 90 ppt 85 ppt
# automatic workspace
2022-03-16 11:20:35 +01:00
assign [class="(?i)Obsidian"] → number 4
assign [class="(?i)Tor Browser"] → number 5
assign [class="(?i)Firefox" window_role="browser"] → number 3
assign [class="(?i)VSCodium"] → number 2