image/svg+xml

My i3 config

Since I’m using the i3 window manager I’ve been tweaking it to fit my needs till now. Sure this process will never come to end, but I want to share with you my current config. I’ve copied many useful things from other configs and added for myself some settings which might be useful for you. Feel free to copy some parts into your own config or to change some settings.

Here are some changes I would like to highlight:

You can find more info in the comments of my config below.

set $mod Mod4

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:Droid Sans 10

# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

# start a terminal
bindsym $mod+Return exec i3-sensible-terminal, workspace --no-auto-back-and-forth $wrksp3

# kill focused window
bindsym $mod+Shift+q kill

# start dmenu (a program launcher)
bindsym $mod+d exec dmenu_run -b -i

# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+odiaeresis 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+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+odiaeresis 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+h 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+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

# toggle tiling / floating
bindsym $mod+Shift+space floating toggle

# 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+d focus child

# Make the currently focused window a scratchpad
bindsym $mod+Shift+minus move scratchpad

# Show the first scratchpad window
bindsym $mod+minus scratchpad show

# set own variables
set $wrksp1 "1:  Chrome"
set $wrksp2 "2:  Dateien"
set $wrksp3 "3:  Terminal"
set $wrksp4 "4:  Code"
set $wrksp5 "5:  Dokumente"

# switch to workspace
bindsym $mod+1 workspace $wrksp1
bindsym $mod+2 workspace $wrksp2
bindsym $mod+3 workspace $wrksp3
bindsym $mod+4 workspace $wrksp4
bindsym $mod+5 workspace $wrksp5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $wrksp1
bindsym $mod+Shift+2 move container to workspace $wrksp2
bindsym $mod+Shift+3 move container to workspace $wrksp3
bindsym $mod+Shift+4 move container to workspace $wrksp4
bindsym $mod+Shift+5 move container to workspace $wrksp5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10

# assign programs to workspaces
assign [class="Chromium"]           $wrksp1
assign [class="Thunar"]             $wrksp2
assign [class="dolphin"]            $wrksp2
assign [class="terminal"]           $wrksp3
assign [class="Omnetpp"]            $wrksp3
assign [class="OMNeT\+\+\sIDE"]     $wrksp3
assign [class="(?i)Sublime_text"]   $wrksp4
assign [class="(?i)Subl3"]          $wrksp4
assign [class="(?i)libreoffice"]    $wrksp5
assign [class="TexMaker"]           $wrksp5

# 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'"

# resize window (you can also use the mouse for that)
mode " resize" {
        # These bindings trigger as soon as you enter the resize mode

        # Pressing left will shrink the window’s width.
        # Pressing right will grow the window’s width.
        # Pressing up will shrink the window’s height.
        # Pressing down will grow the window’s height.
        bindsym j resize shrink width 10 px or 10 ppt
        bindsym k resize grow height 10 px or 10 ppt
        bindsym l resize shrink height 10 px or 10 ppt
        bindsym odiaeresis resize grow width 10 px or 10 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

        # back to normal: Enter or Escape
        bindsym Return mode "default"
        bindsym Escape mode "default"
}

bindsym $mod+r mode " resize"

set $bg-color            #59647D
set $inactive-bg-color   #2f343f
set $text-color          #f3f4f5
set $inactive-text-color #8E95A3
set $urgent-bg-color     #E53935

# window colors
#                       border              background         text                 indicator
client.focused          $bg-color           $bg-color          $text-color          #8BB7D6
client.unfocused        $inactive-bg-color $inactive-bg-color  $inactive-text-color #8BB7D6
client.focused_inactive $inactive-bg-color $inactive-bg-color  $inactive-text-color #8BB7D6
client.urgent           $urgent-bg-color    $urgent-bg-color   $text-color          #8BB7D6

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
    status_command i3blocks
    colors {
        background #3E4557
        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   $text-color
    }
}

#########################################################
#------------------ OWN ADDITIONS ----------------------#
#########################################################

# border style
#new_window pixel 4 - removes title bar
hide_edge_borders both

# own keybindings
bindsym $mod+b exec chromium --enable-native-gpu-memory-buffers, workspace --no-auto-back-and-forth $wrksp1
bindsym $mod+c exec dolphin, workspace --no-auto-back-and-forth $wrksp2
bindsym $mod+z exec subl3,    workspace --no-auto-back-and-forth $wrksp4
bindsym $mod+shift+a exec xfce4-appfinder
bindsym $mod+shift+s exec xfce4-screenshooter
bindsym $mod+shift+y exec ~/Skripte/Omnet_Automation.py
bindsym $mod+x move workspace to output right

# power menu from https://wiki.archlinux.org/index.php/i3
set $Locker /home/denis/Skripte/lock.sh -p

set $mode_system  shutdown (d),  reboot (r),  lock (l),  stand-by (s),  logout (e)
mode "$mode_system" {
    bindsym l exec --no-startup-id $Locker, mode "default"
    bindsym e exec --no-startup-id i3-msg exit, mode "default"
    bindsym s exec --no-startup-id $Locker && systemctl suspend, mode "default"
    bindsym r exec --no-startup-id systemctl reboot, mode "default"
    bindsym d exec --no-startup-id systemctl poweroff -i, mode "default"

    # back to normal: Enter or Escape
    bindsym Return mode "default"
    bindsym Escape mode "default"
}

bindsym $mod+End mode "$mode_system"

# return to previous workspace by pressing last workspace again
workspace_auto_back_and_forth yes

# remove title bar from programs
for_window [class="Chromium" title="Chromium"] border none
for_window [class="(?i)Sublime_text" title="Sublime Text"] border none
for_window [ title="^pdfpc - present" ] border none floating enable
for_window [class="Galculator"] floating enable resize set 500 400
for_window [class="Arandr"] floating enable

# pulse audio controls
bindsym XF86AudioLowerVolume exec amixer set Master 3%-
bindsym XF86AudioRaiseVolume exec amixer set Master 3%+
bindsym XF86AudioMute        exec amixer -q set Master toggle

# screen brightness controls
bindsym XF86MonBrightnessUp   exec /home/denis/Skripte/backlight_fcn_keys.sh -i
bindsym XF86MonBrightnessDown exec /home/denis/Skripte/backlight_fcn_keys.sh -d

# change caps lock to shift
exec --no-startup-id xmodmap -e "keycode 66 = Shift_L NoSymbol Shift_L"

# set velocity for MX Master
exec_always --no-startup-id xinput --set-prop "pointer:Logitech MX Master" "libinput Accel Speed" 1.0
# from https://unix.stackexchange.com/a/177640/182096
exec_always --no-startup-id xinput --set-prop "pointer:Logitech MX Master" "Coordinate Transformation Matrix" 2 0 0 0 2 0 0 0 1.5

# enable natural scrolling on touchpad
exec --no-startup-id xinput --set-prop "SynPS/2 Synaptics TouchPad" "libinput Natural Scrolling Enabled" 1
exec --no-startup-id xinput --set-prop "SynPS/2 Synaptics TouchPad" "libinput Tapping Enabled" 1
exec_always --no-startup-id xinput --set-prop "TPPS/2 IBM TrackPoint" "libinput Left Handed Enabled" 1

# startup programs
exec --no-startup-id nm-applet
exec --no-startup-id solaar
exec --no-startup-id redshift-gtk
exec --no-startup-id dolphin
exec --no-startup-id start-pulseaudio-x11
exec --no-startup-id xfce4-power-manager
exec --no-startup-id ~/.dropbox-dist/dropboxd
exec_always --no-startup-id compton -CGb
exec --no-startup-id udiskie -as

# remove urgent from all windows
exec --no-startup-id "sleep 3; for win in $(wmctrl -l | awk -F' ' '{print $1}'); do wmctrl -i -r $win -b remove,demands_attention; done"

# set background image
exec_always --no-startup-id feh --bg-scale /home/denis/Medien/Bilder/Glazer.jpg