Skip to content

Instantly share code, notes, and snippets.

@notpratheek
Forked from diyan/i3.conf
Created July 14, 2017 04:12
Show Gist options
  • Save notpratheek/8fb0325990b455f1e588471c26cb3fd0 to your computer and use it in GitHub Desktop.
Save notpratheek/8fb0325990b455f1e588471c26cb3fd0 to your computer and use it in GitHub Desktop.
i3 tiling window manager configuration
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout somewhen, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4
# Note that only i3 >= 4.3 has support for TTF fonts via Pango library
#set $font = exec (xrandr | grep -E 'connected 1920x1080.*? 282mm x 165mm' &> /dev/null) && echo Ubuntu 16 || echo Ubuntu 16
#set $font = exec xrandr | grep -E 'connected 1920x1080.*? 282mm x 165mm' > /dev/null && echo Ubuntu 16 || echo Ubuntu 11
#set $font = Ubuntu 16
#set $font = exec "if [ `xrandr | grep -E 'connected 1920x1080.*? 282mm x 165mm' | wc -l` -eq 1 ]; then echo 'Ubuntu 16'; else echo 'Ubuntu 16'; fi"
#set $font = exec "mon=`xrandr | grep -E 'connected 1920x1080.*? 282mm x 165mm'`; if [ -n "$mon" ]; then echo 'Ubuntu 16'; else echo 'Ubuntu 16'; fi"
#font pango:$font
# TODO check is omitted font size will help on Asus Zenbook
font pango:FontAwesome 12
#font pango:Ubuntu 14
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
new_window pixel 3
new_float pixel 3
# start a terminal
bindsym $mod+Return exec i3-sensible-terminal
# kill focused window
bindsym $mod+Shift+q kill
# start rofi, a dmenu-like program launcher
bindsym $mod+d exec rofi_run
# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon 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+semicolon 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
# 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
# workspaces
# https://fortawesome.github.io/Font-Awesome/cheatsheet/
# 1 work, 2 web, 3 chat, 4 notes, 5 music, 6 vnc/rdp, 7/8 noname, 9 mail, 10 dev
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 $ws1 output HDMI1
workspace $ws2 output HDMI1
workspace $ws3 output HDMI1
workspace $ws4 output HDMI2
workspace $ws5 output HDMI2
workspace $ws6 output HDMI2
# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10
# 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 'Do you really want to exit i3 and end your 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 semicolon 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 Right resize grow width 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
#font pango:Ubuntu 11
position top
tray_output primary
status_command i3status
}
### Custom Keyboard Shortcuts ###
# Lock screen. --dpms option will turn off all displays right after locking.
bindsym Mod4+Control+l exec i3-msg workspace "10: dev" && i3lock --tiling --dpms --color 000000
# Audio shortcuts compatible with PulseAudio 6.x and 4.x
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume 0 +5% || pactl set-sink-volume 0 -- +5%
bindsym XF86AudioLowerVolume exec pactl set-sink-volume 0 -5% || pactl set-sink-volume 0 -- -5%
bindsym XF86AudioMute exec pactl set-sink-mute 0 toggle
bindsym XF86AudioPlay exec mpc -q toggle
bindsym XF86AudioPrev exec mpc -q prev
bindsym XF86AudioNext exec mpc -q next
bindsym XF86AudioStop exec mpc -q stop
bindsym Ctrl+slash exec mpc -q toggle
bindsym Ctrl+comma exec mpc -q prev
bindsym Ctrl+period exec mpc -q next
# Keyboard backlight shortcuts
bindsym XF86KbdBrightnessUp exec "file=/sys/class/leds/asus::kbd_backlight/brightness; val=`cat $file`; if [ $val -lt 3 ]; then echo `expr $val + 1` | sudo tee $file; fi"
bindsym XF86KbdBrightnessDown exec "file=/sys/class/leds/asus::kbd_backlight/brightness; val=`cat $file`; if [ $val -gt 0 ]; then echo `expr $val - 1` | sudo tee $file; fi"
# Display brightness shortcuts
# It does not work on Arch Linux / Kernel 4.1.8 out of box
bindsym XF86MonBrightnessUp exec "file=/sys/class/backlight/intel_backlight/brightness; val=$(cat $file); if [ $val -lt 4302 ]; then echo $(expr $val + 100) | sudo tee $file; fi"
bindsym XF86MonBrightnessDown exec "file=/sys/class/backlight/intel_backlight/brightness; val=$(cat $file); if [ $val -gt 0 ]; then echo $(expr $val - 100) | sudo tee $file; fi"
# TODO display current keyboard layout on i3status or i3bar
# http://docs.slackware.com/howtos:window_managers:keyboard_layout_in_i3
# TODO investigate how-to setup launcher for i3
# wine ~/Dropbox/soft/develop/heidi_sql/heidisql.exe
# TODO i3 created additonal useless container. We should avoid this behavior
#exec i3-msg 'workspace 1: main; exec wine ~/Dropbox/soft/develop/heidi_sql/heidisql.exe'
# xprop tool can be used to get WM_CLASS, WM_NAME properties
assign [class="Firefox"] $ws2
assign [instance="chrome"] $ws2
assign [instance="skype|scudcloud"] $ws3
assign [class="Pidgin"] $ws3
assign [instance="zim"] $ws4
#assign [class="sublime"] $ws4
assign [instance="deadbeef|cantata"] $ws5
assign [class="jetbrains"] $ws10
assign [instance="remmina"] $ws6
# use tiling mode only for main/chat Skype window and floating of all dialogs
# Skype main window title looks like this - "alexey.diyan - Skype™"
for_window [instance="skype" title="^.*?(?<!Skype™)$"] floating enable
for_window [instance="skype" title="Skype™|Call with|File Transfers"] floating disable
for_window [instance="keepassx|speedcrunch|eog|viewnior"] floating enable
for_window [title="Unlock Login Keyring"] floating enable
for_window [instance="synapse"] border none
for_window [instance="kupfer" title="^Kupfer$"] border none
#for_window [title="HeidiSQL"] floating disable
for_window [class="^Nautilus$" instance="^file_progress$"] floating enable
# Wine/HeidiSQL produces a windows with total crap, so hide it
#for_window [title="^HeidiSQL$"] floating enable; border none
for_window [instance="heidisql.exe" id=75497475] floating enable; border none; move scratchpad
#TODO display current keyboard language at i3bar
#TODO is gnome-keyring-daemon required on i3?
#TODO should NetworkManaber be replaced with wicd?
#TODO gvfsd-http dconf-service gnome-pty-helper xfconfd notify-osd gconfd-2?
#TODO at-spi2-registryd at-spi-bus-launcher pulseaudio/gconf-helper udisksd
#TODO rtkit-daemon winbindd nmdb upowerd console-kit-daemon accounts-daemon
#TODO wpa_supplicant smbd whoopsie polkitd cupsd irqbalance cups-browsed
#TODO avahi-daemon atd cron acpid getty bluetoothd rsyslogd
#TODO upstart-socket-bridge udevd upstart-udev-bridge
### Autostart ###
exec xcompmgr -n &
# NOTE xrandr setup will put i3bar and notifications on the primary display
# NOTE laptop and workstation has different display dimentions/resolutions
exec (xrandr | grep -E 'connected .*? 518mm x 324mm' &> /dev/null) && xrandr --output HDMI1 --mode 1920x1200 --primary --left-of HDMI2
exec (xrandr | grep -E 'connected .*? 282mm x 165mm' &> /dev/null) && xrandr --output eDP1 --mode 1920x1080 --primary
exec_always feh --no-fehbg --bg-fill ~/Dropbox/pictures/wallpapers/horseregion_ssro_2356.jpg
# NOTE setxbkmap must be executed after delay; otherwise Keyboard Layout settings will be lost
# https://bbs.archlinux.org/viewtopic.php?id=159418
# http://www.linux.org.ru/forum/general/6603527
exec "sleep 3 && setxkbmap -layout us,ru -option grp:caps_toggle -variant winkeys"
exec nm-applet &
exec dropbox start -i &
#exec ~/.dropbox-dist/dropboxd &
#exec remmina -i &
# exec shutter &
exec zim &
# exec pidgin &
exec skype --dbpath=~/.config/skype/alexey.diyan &
exec skype --dbpath=~/.config/skype/dev-pro.alexey.diyan &
exec firefox &
exec --no-startup-id i3-msg 'workspace 2'
#TODO consider thunar-volman, gnome-volumen-manager, ivman
# http://urukrama.wordpress.com/openbox-guide/
# vim:filetype=i3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment