17 KiB
Desktop
- i3wm
My general desktop environment configuration.
Parts prefexed with [OFF] are not used, but kept for historic purposes. For some reason GitHub's org renderer ignores TODO status, hence such a prefix.
Most of the colors are from the Palenight theme. Colorcodes are taken from this repo:
| Color | Default | Lighter |
|---|---|---|
| Black | #292d3e | #434758 |
| Red | #f07178 | #ff8b92 |
| Green | #c3e88d | #ddffa7 |
| Yellow | #ffcb6b | #ffe585 |
| Blue | #82aaff | #9cc4ff |
| Magenta | #c792ea | #e1acff |
| Cyan | #89ddff | #a3f7ff |
| White | #d0d0d0 | #ffffff |
i3wm
i3wm is a manual tiling window manager, which is currently my window manager of choice. I've tried several alternatives, including xmonad & EXWM, but i3 seems to fit my workflow best.
i3-gaps is a i3 fork with a few features like window gaps. I like to enable inner gaps when there is at least one container in a workspace.
References:
General settings
set $mod Mod4
font pango:monospace 10
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# Move cursor between monitors
mouse_warping output
# Apply XFCE Settings
exec xfsettingsd
exec xiccd
# Most needed keybindigs
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
Managing windows
# kill focused window
bindsym $mod+Shift+q kill
# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
# alternatively, you can use the cursor keys:
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+s split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+w layout stacking
bindsym $mod+t layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+f floating toggle
bindsym $mod+Tab move workspace to output right
bindsym $mod+q focus output right
# change focus between tiling / floating windows
# bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
bindsym $mod+Shift+A focus child
Workspaces
set $w1 "1 🚀"
set $w2 "2 🌍"
set $w3 "3 💬"
set $w4 "4 🛠️️"
set $w7 "7 🛰️"
set $w8 "8 📝"
set $w9 "9 🎵"
set $w10 "10 📦"
bindsym $mod+1 workspace $w1
bindsym $mod+2 workspace $w2
bindsym $mod+3 workspace $w3
bindsym $mod+4 workspace $w4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace $w7
bindsym $mod+8 workspace $w8
bindsym $mod+9 workspace $w9
bindsym $mod+0 workspace $w10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $w1
bindsym $mod+Shift+2 move container to workspace $w2
bindsym $mod+Shift+3 move container to workspace $w3
bindsym $mod+Shift+4 move container to workspace $w4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace $w7
bindsym $mod+Shift+8 move container to workspace $w8
bindsym $mod+Shift+9 move container to workspace $w9
bindsym $mod+Shift+0 move container to workspace $w10
# Cycle workspaces
bindsym $mod+comma workspace prev
bindsym $mod+period workspace next
Rules
Rules to automatically assign applications to workspaces and do other stuff, like enable floating.
Most apps can be distinguished by a WM class (you can get one with xprop), but in some cases it doesn't work, e.g. for terminal applications. In that case rules can be based on a window title, for instance.
However, watch out for the following: rule such as for_window [title="ncmpcpp.*"] move to workspace $w9 will move any windows with a title, starting with ncmpcpp to workspace $w9, which, for instance, may move your browser there if you google "ncmpcpp".
assign [class="Emacs"] $w1
assign [class="qutebrowser"] $w2
assign [class="firefox"] $w2
assign [class="VK"] $w3
assign [class="Slack"] $w3
assign [class="discord"] $w3
assign [class="TelegramDesktop"] $w3
assign [class="Postman"] $w4
assign [class="Chromium-browse"] $w4
assign [class="chromium"] $w4
assign [class="google-chrome"] $w4
assign [title="Vue Developer Tools"] $w4
assign [class="Google Play Music Desktop Player"] $w9
assign [class="jetbrains-datagrip"] $w4
assign [class="zoom"] $w7
assign [class="skype"] $w7
assign [class="Mailspring"] $w8
assign [class="Thunderbird"] $w8
assign [class="Joplin"] $w8
assign [class="keepassxc"] $w10
for_window [title="VirtScreen"] floating enable
for_window [title="ncmpcpp.*"] move to workspace $w9
for_window [title="newsboat.*"] move to workspace $w9
for_window [title=".*run_wego"] move to workspace $w9
for_window [class="cinnamon-settings*"] floating enable
for_window [title="Picture-in-Picture"] sticky enable
Scratchpad
Scratch terminal, inspired by this Luke Smith's video.
Launch script
First of all, we have to distinguish scratchpad terminal from a normal one. To do that, one can create st with a required classname.
Then, it would be cool not to duplicate scratchpads, so the following script first looks for a window with a created classname. If it exists, the script just toggles the scratchpad visibilty. Otherwise, a new instance of a window is created.
CLASSNAME="dropdown_tmux"
COMMAND="st -n $CLASSNAME -e tmux new-session -s $CLASSNAME"
pid=$(xdotool search --classname "dropdown_tmux")
if [[ ! -z $pid ]]; then
i3-msg scratchpad show
else
setsid -f ${COMMAND}
fi
i3 config
# Scratchpad
for_window [instance="dropdown_*"] floating enable
for_window [instance="dropdown_*"] move scratchpad
for_window [instance="dropdown_*"] sticky enable
for_window [instance="dropdown_*"] scratchpad show
for_window [instance="dropdown_*"] move position center
bindsym $mod+u exec ~/bin/scripts/dropdown
Gaps & borders
The main reason to use i3-gaps
# Borders
# for_window [class=".*"] border pixel 0
default_border pixel 3
hide_edge_borders both
# Gaps
set $default_inner 10
set $default_outer 0
gaps inner $default_inner
gaps outer $default_outer
smart_gaps on
Keybindings
mode "inner gaps" {
bindsym plus gaps inner current plus 5
bindsym minus gaps inner current minus 5
bindsym Shift+plus gaps inner all plus 5
bindsym Shift+minus gaps inner all minus 5
bindsym 0 gaps inner current set 0
bindsym Shift+0 gaps inner all set 0
bindsym r gaps inner current set $default_inner
bindsym Shift+r gaps inner all set $default_inner
bindsym Return mode "default"
bindsym Escape mode "default"
}
mode "outer gaps" {
bindsym plus gaps outer current plus 5
bindsym minus gaps outer current minus 5
bindsym Shift+plus gaps outer all plus 5
bindsym Shift+minus gaps outer all minus 5
bindsym 0 gaps outer current set 0
bindsym Shift+0 gaps outer all set 0
bindsym r gaps outer current set $default_outer
bindsym Shift+r gaps outer all set $default_outer
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+g mode "inner gaps"
bindsym $mod+Shift+g mode "outer gaps"
Move & resize windows
More or less standard set of keybindings to move & resize floating windows.
Just be careful to always make a way to return from these new modes, otherwise you'd end up in a rather precarious position.
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
bindsym h resize shrink width 10 px or 10 ppt
bindsym j resize grow height 10 px or 10 ppt
bindsym k resize shrink height 10 px or 10 ppt
bindsym l resize grow width 10 px or 10 ppt
bindsym Shift+h resize shrink width 100 px or 100 ppt
bindsym Shift+j resize grow height 100 px or 100 ppt
bindsym Shift+k resize shrink height 100 px or 100 ppt
bindsym Shift+l resize grow width 100 px or 100 ppt
# 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
bindsym Shift+Left resize shrink width 100 px or 100 ppt
bindsym Shift+Down resize grow height 100 px or 100 ppt
bindsym Shift+Up resize shrink height 100 px or 100 ppt
bindsym Shift+Right resize grow width 100 px or 100 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
mode "move" {
bindsym $mod+Tab focus right
bindsym Left move left
bindsym Down move down
bindsym Up move up
bindsym Right move right
bindsym h move left
bindsym j move down
bindsym k move up
bindsym l move right
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+m mode "move" focus floating
OFF [OFF] Intergration with dmenu
dmenu is a dynamic menu program for X. I've opted out of using in favour of rofi, but here is a relevant bit of config.
Scripts are located in the bin/scripts folder.
# dmenu
bindsym $mod+d exec i3-dmenu-desktop --dmenu="dmenu -l 10"
bindsym $mod+apostrophe mode "dmenu"
mode "dmenu" {
bindsym d exec i3-dmenu-desktop --dmenu="dmenu -l 10"; mode default
bindsym p exec dmenu_run -l 10; mode default
bindsym m exec dmenu-man; mode default
bindsym b exec dmenu-buku; mode default
bindsym f exec dmenu-explore; mode default
bindsym t exec dmenu-tmuxp; mode default
bindsym Escape mode "default"
}
bindsym $mod+b exec --no-startup-id dmenu-buku
Integration with rofi
Keybindings to launch rofi. For more detail, look the /sqrtminusone/dotfiles/src/commit/d869192bf14ab2ee9d68c633bb4644588d357a27/*Rofi section.
bindsym $mod+d exec "rofi -modi 'drun,run' -show drun"
bindsym $mod+b exec --no-startup-id rofi-buku-mine
bindsym $mod+apostrophe mode "rofi"
mode "rofi" {
bindsym d exec "rofi -modi 'drun,run' -show drun"
bindsym m exec rofi-man; mode default
bindsym b exec rofi-buku-mine; mode default
bindsym k exec rofi-keepassxc -d ~/MEGAsync/Passwords.kdbx; mode default
bindsym Escape mode "default"
}
Launching apps & misc keybindings
I prefer to use a separate mode to launch most of my apps, with some exceptions.
Apps
# Launch apps
# start a terminal at workspace 1
bindsym $mod+Return exec "i3-msg 'workspace 1 🚀; exec st'"
bindsym $mod+p exec "copyq menu"
bindsym $mod+Shift+x exec "i3lock -f -i /home/pavel/Pictures/lock-wallpaper-2-1.png"
bindsym $mod+semicolon mode "apps"
mode "apps" {
bindsym Escape mode "default"
bindsym b exec firefox; mode default
bindsym v exec vk-messenger; mode default
bindsym s exec slack; mode default;
bindsym m exec "st -e ncmpcpp"; mode default
bindsym c exec "copyq toggle"; mode default
bindsym k exec "keepassxc"; mode default
# bindsym e exec mailspring; mode default
bindsym a exec "bash /home/pavel/bin/emacs.sh"; mode default
bindsym n exec "st -e newsboat"; mode default
bindsym w exec "st /home/pavel/bin/scripts/run_wego"; mode default
# bindsym a exec emacsclient -c; mode default
# bindsym Shift+a exec emacs; mode default
}
Media controls & brightness
# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec --no-startup-id "pactl set-sink-volume @DEFAULT_SINK@ +5%"
bindsym XF86AudioLowerVolume exec --no-startup-id "pactl set-sink-volume @DEFAULT_SINK@ -5%"
bindsym XF86AudioMute exec --no-startup-id "pactl set-sink-mute @DEFAULT_SINK@ toggle"
# Media player controls
bindsym XF86AudioPlay exec mpc toggle
bindsym XF86AudioPause exec mpc pause
bindsym XF86AudioNext exec mpc next
bindsym XF86AudioPrev exec mpc prev
# Screen brightness
bindsym XF86MonBrightnessUp exec xbacklight -inc 5
bindsym XF86MonBrightnessDown exec xbacklight -dec 5
Screenshots
# Screenshots
bindsym --release Print exec "flameshot gui"
bindsym --release Shift+Print exec "xfce4-screenshooter"
Colors
Application of the palenight theme to the WM.
# Colors
set $bg-color #292d3e
set $active-color #82aaff
set $inactive-bg-color #434758
set $text-color #f3f4f5
set $inactive-text-color #aaaaaa
set $urgent-bg-color #f07178
set $urgent-text-color #000000
# window colors
# border background text indicator child border
client.focused $active-color $bg-color $text-color $bg-color $active-color
client.unfocused $bg-color $inactive-bg-color $inactive-text-color $bg-color $bg-color
client.focused_inactive $active-color $inactive-bg-color $inactive-text-color $bg-color $bg-color
client.urgent $urgent-bg-color $urgent-bg-color $urgent-text-color $bg-color $urgent-bg-color
OFF [OFF] i3blocks
I've opted out of i3bar & i3blocks for polybar
bar {
status_command i3blocks -c ~/.config/i3/i3blocks.conf
i3bar_command i3bar
font pango:monospace 12
output HDMI-A-0
tray_output none
colors {
background $bg-color
separator #757575
# border background text
focused_workspace $bg-color $bg-color $text-color
inactive_workspace $inactive-bg-color $inactive-bg-color $inactive-text-color
urgent_workspace $urgent-bg-color $urgent-bg-color $urgent-text-color
}
}
bar {
status_command i3blocks -c ~/.config/i3/i3blocks.conf
i3bar_command i3bar
font pango:monospace 10
output DVI-D-0
colors {
background $bg-color
separator #757575
# border background text
focused_workspace $bg-color $bg-color $text-color
inactive_workspace $inactive-bg-color $inactive-bg-color $inactive-text-color
urgent_workspace $urgent-bg-color $urgent-bg-color $urgent-text-color
}
}
Keyboard Layout
A script to set Russian-English keyboard layout:
setxkbmap -layout us,ru
setxkbmap -model pc105 -option 'grp:win_space_toggle' -option 'grp:alt_shift_toggle'
A script to toggle the layout
if setxkbmap -query | grep -q us,ru; then
setxkbmap -layout us
setxkbmap -option
else
setxkbmap -layout us,ru
setxkbmap -model pc105 -option 'grp:win_space_toggle' -option 'grp:alt_shift_toggle'
fi
And the relevant i3 settings:
# Layout
exec_always --no-startup-id set_layout
bindsym $mod+slash exec toggle_layout
Autostart
# Polybar
exec_always --no-startup-id "bash /home/pavel/bin/polybar.sh"
# PulseEffects
exec --no-startup-id pulseeffects --gapplication-service
# Sudo
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
# Wallpaper
exec_always "feh --bg-fill ~/Pictures/wallpaper-2.jpg"
# Picom
exec picom
# Keynav
exec keynav
# Applets
exec --no-startup-id /usr/bin/nm-applet
exec --no-startup-id /usr/bin/blueman-applet
# MPD
exec --no-startup-id mpd
# Stuff
exec aw-qt
exec "vnstatd -d"
exec dunst
exec kde-connect-indicator
exec copyq
exec "xmodmap ~/.Xmodmap"
exec "bash ~/bin/autostart.sh"