Skip to content

Instantly share code, notes, and snippets.

@diyan
Last active November 26, 2022 22:53

Revisions

  1. diyan revised this gist Dec 16, 2015. 1 changed file with 133 additions and 128 deletions.
    261 changes: 133 additions & 128 deletions i3.conf
    Original file line number Diff line number Diff line change
    @@ -18,22 +18,24 @@ set $mod Mod4
    #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
    #font pango:Ubuntu 11
    font pango:Ubuntu 16
    # 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
    bindsym $mod+Shift+q kill

    # start dmenu (a program launcher)
    #bindsym $mod+d exec dmenu_run
    #bindsym $mod+d exec xfce4-appfinder --disable-server
    bindsym $mod+d exec synapse
    # start rofi, a dmenu-like program launcher
    bindsym $mod+d exec rofi_run

    # change focus
    bindsym $mod+j focus left
    @@ -48,10 +50,10 @@ 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+colon move right
    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
    @@ -68,10 +70,10 @@ bindsym $mod+v split v
    # enter fullscreen mode for the focused container
    bindsym $mod+f fullscreen

    # change container layout (stacked, tabbed, default)
    # change container layout (stacked, tabbed, toggle split)
    bindsym $mod+s layout stacking
    bindsym $mod+w layout tabbed
    bindsym $mod+e layout default
    bindsym $mod+e layout toggle split

    # toggle tiling / floating
    bindsym $mod+Shift+space floating toggle
    @@ -83,41 +85,61 @@ bindsym $mod+space focus mode_toggle
    bindsym $mod+a focus parent

    # focus the child container
    #bindcode $mod+d focus child
    #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 "1: main"
    bindsym $mod+2 workspace "2: web"
    bindsym $mod+3 workspace "3: chat"
    bindsym $mod+4 workspace "4: notes"
    bindsym $mod+5 workspace "5: music"
    bindsym $mod+6 workspace "6: vnc/rdp"
    bindsym $mod+7 workspace 7
    bindsym $mod+8 workspace 8
    bindsym $mod+9 workspace 9
    bindsym $mod+0 workspace 10
    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+exclam move container to workspace "1: main"
    bindsym $mod+Shift+at move container to workspace "2: web"
    bindsym $mod+Shift+numbersign move container to workspace "3: chat"
    bindsym $mod+Shift+dollar move container to workspace "4: notes"
    bindsym $mod+Shift+percent move container to workspace "5: music"
    bindsym $mod+Shift+asciicircum move container to workspace "6: vnc/rdp"
    bindsym $mod+Shift+ampersand move container to workspace 7
    bindsym $mod+Shift+asterisk move container to workspace 8
    bindsym $mod+Shift+parenleft move container to workspace 9
    bindsym $mod+Shift+parenright move container to workspace 10
    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
    bindsym $mod+Shift+c reload

    # restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
    bindsym $mod+Shift+R restart
    bindsym $mod+Shift+r restart

    # exit i3 (logs you out of your X session)
    bindsym $mod+Shift+E exit
    #bindsym $mod+Shift+E exec "i3-nagbar -t warning -m 'Do you really want to exit i3 and end your X session?' -b 'Yes, exit i3' 'exit'"
    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" {
    @@ -149,117 +171,72 @@ bindsym $mod+r mode "resize"
    # finds out, if available)
    bar {
    #font pango:Ubuntu 11

    position top
    tray_output primary
    status_command i3status
    }

    # Q: How to setup preferred applications?
    # sudo update-alternatives --config x-www-browser
    # sudo update-alternatives --config x-terminal-emulator
    # sudo update-alternatives --config editor

    ### Setup displays and wallpaper ###
    #exec_always xrandr --output HDMI1 --mode 1920x1080 --primary --left-of VGA1
    exec_always (xrandr | grep -E 'connected .*? 518mm x 324mm' &> /dev/null) && xrandr --output HDMI1 --mode 1920x1200 --primary --left-of VGA1

    # Investigate how to delay feh execution until xrandr will finish setup display
    exec_always feh --no-fehbg --bg-fill ~/Dropbox/pictures/wallpapers/horseregion_ssro_2356.jpg

    ### Custom Keyboard Shortcuts ###
    # Lock screen. --dpms option will turn off all displays right after locking.
    bindsym Mod4+Control+l exec i3-msg workspace 10 && i3lock --tiling --dpms --color 000000

    # Audio shortcuts
    bindsym XF86AudioRaiseVolume exec pactl set-sink-volume 0 -- +5%
    bindsym XF86AudioLowerVolume exec pactl set-sink-volume 0 -- -5%
    bindsym XF86AudioMute exec pactl set-sink-mute 0 $((pactl list sinks | grep -q Mute:.no && echo 1) || echo 0)
    #bindsym XF86AudioPlay exec clementine --play-pause
    #bindsym XF86AudioStop exec clementine --stop
    #bindsym XF86AudioPrev exec clementine --previous
    #bindsym XF86AudioNext exec clementine --next

    # TODO consider use this shortcut instead of Win+Shift+Q
    # bindsym $mod+Shift+C kill

    # https://bbs.archlinux.org/viewtopic.php?id=159418
    # http://www.linux.org.ru/forum/general/6603527
    exec_always setxkbmap -layout us,ru -option grp:ctrl_shift_toggle -variant winkeys
    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` > $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` > $file; fi"
    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"

    #exec_always i3-msg border normal
    # 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 consider setup 'N: code' workspace
    #4 code

    workspace "1: main" output HDMI1
    workspace "2: web" output HDMI1
    workspace "3: chat" output HDMI1
    workspace "4: notes" output VGA1
    workspace "5: music" output VGA1
    workspace "6: vnc/rdp" output VGA1

    exec_always (xrandr | grep -E 'connected 1920x1080.*? 282mm x 165mm' &> /dev/null) && gnome-settings-daemon
    exec i3-sensible-terminal
    exec nm-applet
    exec dropbox start -i
    exec remmina -i
    #exec shutter
    exec zim
    exec deadbeef

    # workspace layout could be switched only in following way:
    # run first program in that workspace and wait when it finish to load
    # switch layout
    # run all other programs

    exec firefox
    exec pidgin
    exec skype --dbpath=~/.config/skype/alexey.diyan
    exec skype --dbpath=~/.config/skype/dev-pro.alexey.diyan

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

    assign [class="(?i)firefox"] 2: web
    assign [class="(?i)chrome"] 2: web
    assign [class="(?i)skype"] 3: chat
    assign [class="(?i)pidgin"] 3: chat
    assign [class="(?i)zim"] 4: notes
    assign [class="(?i)sublime"] 4: notes
    assign [class="(?i)deadbeef"] 5: music
    assign [class="jetbrains-pycharm"] 10
    assign [class="(?i)remmina"] 6: vnc/rdp

    # 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 [class="Skype" title="Information"] floating enable
    for_window [class="Skype" title="Add to Chat"] floating enable
    for_window [class="Skype" title="Profile for"] floating enable
    for_window [class="Skype" title="Contact request from"] floating enable
    for_window [class="Skype" title="Are you sure you want to call?"] floating enable
    for_window [class="Skype" title="Rename"] floating enable
    for_window [class="Skype" title="Search for Skype Contacts"] floating enable
    for_window [class="Speedcrunch"] floating enable
    for_window [class="Synapse"] border 1pixel
    for_window [title="HeidiSQL"] floating disable

    #TODO investigate how to arrange windows in a correct way
    #exec_always $HOME/.config/i3/autostart.sh
    #
    #
    #TODO setup font aliasing for GTK and Qt applications
    #TODO setup Qt theme
    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?
    @@ -270,4 +247,32 @@ for_window [title="HeidiSQL"] floating disable
    #TODO avahi-daemon atd cron acpid getty bluetoothd rsyslogd
    #TODO upstart-socket-bridge udevd upstart-udev-bridge

    # vim:filetype=i3
    ### 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
  2. diyan revised this gist Dec 4, 2013. 1 changed file with 32 additions and 23 deletions.
    55 changes: 32 additions & 23 deletions i3.conf
    Original file line number Diff line number Diff line change
    @@ -13,11 +13,13 @@ 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 = 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
    #font pango:$font
    #font pango:Ubuntu 11
    font pango:Ubuntu 16

    # Use Mouse+$mod to drag floating windows to their wanted position
    floating_modifier $mod
    @@ -30,7 +32,8 @@ bindsym $mod+Shift+Q kill

    # start dmenu (a program launcher)
    #bindsym $mod+d exec dmenu_run
    bindsym $mod+d exec xfce4-appfinder --disable-server
    #bindsym $mod+d exec xfce4-appfinder --disable-server
    bindsym $mod+d exec synapse

    # change focus
    bindsym $mod+j focus left
    @@ -87,8 +90,8 @@ bindsym $mod+1 workspace "1: main"
    bindsym $mod+2 workspace "2: web"
    bindsym $mod+3 workspace "3: chat"
    bindsym $mod+4 workspace "4: notes"
    bindsym $mod+5 workspace 5
    bindsym $mod+6 workspace 6
    bindsym $mod+5 workspace "5: music"
    bindsym $mod+6 workspace "6: vnc/rdp"
    bindsym $mod+7 workspace 7
    bindsym $mod+8 workspace 8
    bindsym $mod+9 workspace 9
    @@ -99,8 +102,8 @@ bindsym $mod+Shift+exclam move container to workspace "1: main"
    bindsym $mod+Shift+at move container to workspace "2: web"
    bindsym $mod+Shift+numbersign move container to workspace "3: chat"
    bindsym $mod+Shift+dollar move container to workspace "4: notes"
    bindsym $mod+Shift+percent move container to workspace 5
    bindsym $mod+Shift+asciicircum move container to workspace 6
    bindsym $mod+Shift+percent move container to workspace "5: music"
    bindsym $mod+Shift+asciicircum move container to workspace "6: vnc/rdp"
    bindsym $mod+Shift+ampersand move container to workspace 7
    bindsym $mod+Shift+asterisk move container to workspace 8
    bindsym $mod+Shift+parenleft move container to workspace 9
    @@ -154,9 +157,15 @@ bar {

    # Q: How to setup preferred applications?
    # sudo update-alternatives --config x-www-browser
    # sudo update-alternatives --config x-terminal-emulator
    # sudo update-alternatives --config editor

    ### Displays setup ###
    exec_always xrandr --output HDMI1 --mode 1920x1080 --primary --left-of VGA1
    ### Setup displays and wallpaper ###
    #exec_always xrandr --output HDMI1 --mode 1920x1080 --primary --left-of VGA1
    exec_always (xrandr | grep -E 'connected .*? 518mm x 324mm' &> /dev/null) && xrandr --output HDMI1 --mode 1920x1200 --primary --left-of VGA1

    # Investigate how to delay feh execution until xrandr will finish setup display
    exec_always feh --no-fehbg --bg-fill ~/Dropbox/pictures/wallpapers/horseregion_ssro_2356.jpg

    ### Custom Keyboard Shortcuts ###
    # Lock screen. --dpms option will turn off all displays right after locking.
    @@ -197,19 +206,17 @@ workspace "1: main" output HDMI1
    workspace "2: web" output HDMI1
    workspace "3: chat" output HDMI1
    workspace "4: notes" output VGA1
    workspace 5 output VGA1
    workspace 6 output VGA1

    # NOTE this is temporary and sould be removed later
    #exec xfsettingsd
    workspace "5: music" output VGA1
    workspace "6: vnc/rdp" output VGA1

    exec_always (xrandr | grep -E 'connected 1920x1080.*? 282mm x 165mm' &> /dev/null) && xfsettingsd
    exec_always (xrandr | grep -E 'connected 1920x1080.*? 282mm x 165mm' &> /dev/null) && gnome-settings-daemon
    exec i3-sensible-terminal
    exec nm-applet
    exec dropbox start -i
    exec remmina -i
    #exec shutter

    exec i3-msg workspace 4: notes; i3-msg exec zim; i3-msg exec /opt/deadbeef/bin/deadbeef
    exec zim
    exec deadbeef

    # workspace layout could be switched only in following way:
    # run first program in that workspace and wait when it finish to load
    @@ -230,18 +237,21 @@ assign [class="(?i)skype"] 3: chat
    assign [class="(?i)pidgin"] 3: chat
    assign [class="(?i)zim"] 4: notes
    assign [class="(?i)sublime"] 4: notes
    assign [class="(?i)deadbeef"] 5: music
    assign [class="jetbrains-pycharm"] 10
    assign [class="(?i)remmina"] 6: vnc/rdp

    # xprop tool can be used to get WM_CLASS, WM_NAME properties
    for_window [title="Unlock Login Keyring"] floating enable
    for_window [class="Xfce4-appfinder"] floating enable
    for_window [class="Skype" title="Information"] floating enable
    for_window [class="Skype" title="Add to Chat"] floating enable
    for_window [class="Skype" title="Profile for"] floating enable
    for_window [class="Skype" title="Contact request from"] floating enable
    for_window [class="Skype" title="Are you sure you want to call?"] floating enable
    for_window [class="Skype" title="Rename"] floating enable
    for_window [class="Skype" title="Search for Skype Contacts"] floating enable
    for_window [class="Speedcrunch"] floating enable

    #for_window [class="Xfce4-notifyd"] floating enable; border none

    for_window [class="Synapse"] border 1pixel
    for_window [title="HeidiSQL"] floating disable

    #TODO investigate how to arrange windows in a correct way
    @@ -250,8 +260,7 @@ for_window [title="HeidiSQL"] floating disable
    #
    #TODO setup font aliasing for GTK and Qt applications
    #TODO setup Qt theme
    #TODO display current volume and current keyboard language at i3bar
    #TODO how to use xfce4-terminal and xfce4-appfinder without full XFCE installed
    #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?
  3. diyan created this gist Aug 9, 2013.
    264 changes: 264 additions & 0 deletions i3.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,264 @@
    # 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 = 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
    #font pango:Ubuntu 11

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

    # start a terminal
    bindsym $mod+Return exec i3-sensible-terminal

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

    # start dmenu (a program launcher)
    #bindsym $mod+d exec dmenu_run
    bindsym $mod+d exec xfce4-appfinder --disable-server

    # 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+colon 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, default)
    bindsym $mod+s layout stacking
    bindsym $mod+w layout tabbed
    bindsym $mod+e layout default

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

    # switch to workspace
    bindsym $mod+1 workspace "1: main"
    bindsym $mod+2 workspace "2: web"
    bindsym $mod+3 workspace "3: chat"
    bindsym $mod+4 workspace "4: notes"
    bindsym $mod+5 workspace 5
    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+exclam move container to workspace "1: main"
    bindsym $mod+Shift+at move container to workspace "2: web"
    bindsym $mod+Shift+numbersign move container to workspace "3: chat"
    bindsym $mod+Shift+dollar move container to workspace "4: notes"
    bindsym $mod+Shift+percent move container to workspace 5
    bindsym $mod+Shift+asciicircum move container to workspace 6
    bindsym $mod+Shift+ampersand move container to workspace 7
    bindsym $mod+Shift+asterisk move container to workspace 8
    bindsym $mod+Shift+parenleft move container to workspace 9
    bindsym $mod+Shift+parenright move container to workspace 10

    # 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 exit
    #bindsym $mod+Shift+E exec "i3-nagbar -t warning -m 'Do you really want to exit i3 and end your X session?' -b 'Yes, exit i3' '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
    }

    # Q: How to setup preferred applications?
    # sudo update-alternatives --config x-www-browser

    ### Displays setup ###
    exec_always xrandr --output HDMI1 --mode 1920x1080 --primary --left-of VGA1

    ### Custom Keyboard Shortcuts ###
    # Lock screen. --dpms option will turn off all displays right after locking.
    bindsym Mod4+Control+l exec i3-msg workspace 10 && i3lock --tiling --dpms --color 000000

    # Audio shortcuts
    bindsym XF86AudioRaiseVolume exec pactl set-sink-volume 0 -- +5%
    bindsym XF86AudioLowerVolume exec pactl set-sink-volume 0 -- -5%
    bindsym XF86AudioMute exec pactl set-sink-mute 0 $((pactl list sinks | grep -q Mute:.no && echo 1) || echo 0)
    #bindsym XF86AudioPlay exec clementine --play-pause
    #bindsym XF86AudioStop exec clementine --stop
    #bindsym XF86AudioPrev exec clementine --previous
    #bindsym XF86AudioNext exec clementine --next

    # TODO consider use this shortcut instead of Win+Shift+Q
    # bindsym $mod+Shift+C kill

    # https://bbs.archlinux.org/viewtopic.php?id=159418
    # http://www.linux.org.ru/forum/general/6603527
    exec_always setxkbmap -layout us,ru -option grp:ctrl_shift_toggle -variant winkeys

    # 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` > $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` > $file; fi"

    #exec_always i3-msg border normal

    # 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 consider setup 'N: code' workspace
    #4 code

    workspace "1: main" output HDMI1
    workspace "2: web" output HDMI1
    workspace "3: chat" output HDMI1
    workspace "4: notes" output VGA1
    workspace 5 output VGA1
    workspace 6 output VGA1

    # NOTE this is temporary and sould be removed later
    #exec xfsettingsd

    exec_always (xrandr | grep -E 'connected 1920x1080.*? 282mm x 165mm' &> /dev/null) && xfsettingsd
    exec nm-applet
    exec dropbox start -i
    exec remmina -i
    #exec shutter

    exec i3-msg workspace 4: notes; i3-msg exec zim; i3-msg exec /opt/deadbeef/bin/deadbeef

    # workspace layout could be switched only in following way:
    # run first program in that workspace and wait when it finish to load
    # switch layout
    # run all other programs

    exec firefox
    exec pidgin
    exec skype --dbpath=~/.config/skype/alexey.diyan
    exec skype --dbpath=~/.config/skype/dev-pro.alexey.diyan

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

    assign [class="(?i)firefox"] 2: web
    assign [class="(?i)chrome"] 2: web
    assign [class="(?i)skype"] 3: chat
    assign [class="(?i)pidgin"] 3: chat
    assign [class="(?i)zim"] 4: notes
    assign [class="(?i)sublime"] 4: notes

    for_window [title="Unlock Login Keyring"] floating enable
    for_window [class="Xfce4-appfinder"] floating enable
    for_window [class="Skype" title="Information"] floating enable
    for_window [class="Skype" title="Add to Chat"] floating enable
    for_window [class="Skype" title="Profile for"] floating enable
    for_window [class="Skype" title="Contact request from"] floating enable
    for_window [class="Skype" title="Are you sure you want to call?"] floating enable
    for_window [class="Speedcrunch"] floating enable

    #for_window [class="Xfce4-notifyd"] floating enable; border none

    for_window [title="HeidiSQL"] floating disable

    #TODO investigate how to arrange windows in a correct way
    #exec_always $HOME/.config/i3/autostart.sh
    #
    #
    #TODO setup font aliasing for GTK and Qt applications
    #TODO setup Qt theme
    #TODO display current volume and current keyboard language at i3bar
    #TODO how to use xfce4-terminal and xfce4-appfinder without full XFCE installed
    #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

    # vim:filetype=i3