# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
font pango:$font $font_size

# Colors
# class                 border  backgr. text    indicator child_border
client.focused          #1297e0 #0057a0 #ffffff #ff6ca8   #0057a0
client.focused_inactive #0067b0 #102770 #ffffff #102770   #102770
client.unfocused        #4c5a69 #1c2a39 #9caab9 #1c2a39   #1c2a39
client.urgent           #FF8C7C #E74C3C #ffffff #E74C3C   #E74C3C
client.background       #ab69c6

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

# start a browser
bindsym $mod+b exec $browser

# start a terminal
bindsym $mod+Return exec $terminal

# kill focused window
bindsym $mod+q kill

# start dmenu (a program launcher)
bindsym $mod+Control+x exec dmenu_run -i -fn '$font-$dmenu_font_size'
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
bindsym $mod+x exec --no-startup-id i3-dmenu-desktop --dmenu="dmenu -i -fn '$font-$dmenu_font_size'"

# 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, vim keys
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right

# move focused window, 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

# toggle split orientation
bindsym $mod+z split toggle
bindsym $mod+Shift+w split toggle
bindsym $mod+v split toggle

# 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+space floating toggle

# change focus between tiling / floating windows
bindsym $mod+Tab focus mode_toggle

# focus the parent container
bindsym $mod+Control+a focus parent

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

# Show the first scratchpad window
bindsym $mod+Control+n scratchpad show

# Restore the first scratchpad window
bindsym $mod+m scratchpad show, floating toggle

# switch previous/next workspace
bindsym $mod+a workspace prev
bindsym $mod+d workspace next
bindsym $mod+Control+Left workspace prev
bindsym $mod+Control+Right workspace next
bindsym $mod+Control+h workspace prev
bindsym $mod+Control+l workspace next

# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
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"
set $ws11 "11"
set $ws12 "12"
set $ws13 "13"
set $ws14 "14"
set $ws15 "15"
set $ws16 "16"
set $ws17 "17"
set $ws18 "18"
set $ws19 "19"
set $ws20 "20"
set $ws21 "21"
set $ws22 "22"

# switch to workspace
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10
bindsym $mod+F1 workspace number $ws11
bindsym $mod+F2 workspace number $ws12
bindsym $mod+F3 workspace number $ws13
bindsym $mod+F4 workspace number $ws14
bindsym $mod+F5 workspace number $ws15
bindsym $mod+F6 workspace number $ws16
bindsym $mod+F7 workspace number $ws17
bindsym $mod+F8 workspace number $ws18
bindsym $mod+F9 workspace number $ws19
bindsym $mod+F10 workspace number $ws20
bindsym $mod+F11 workspace number $ws21
bindsym $mod+F12 workspace number $ws22

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10
bindsym $mod+Shift+F1 move container to workspace number $ws11
bindsym $mod+Shift+F2 move container to workspace number $ws12
bindsym $mod+Shift+F3 move container to workspace number $ws13
bindsym $mod+Shift+F4 move container to workspace number $ws14
bindsym $mod+Shift+F5 move container to workspace number $ws15
bindsym $mod+Shift+F6 move container to workspace number $ws16
bindsym $mod+Shift+F7 move container to workspace number $ws17
bindsym $mod+Shift+F8 move container to workspace number $ws18
bindsym $mod+Shift+F9 move container to workspace number $ws19
bindsym $mod+Shift+F10 move container to workspace number $ws20
bindsym $mod+Shift+F11 move container to workspace number $ws21
bindsym $mod+Shift+F12 move container to workspace number $ws22

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

bindsym $mod+y resize shrink width 5 px or 5 ppt
bindsym $mod+u resize grow height 5 px or 5 ppt
bindsym $mod+i resize shrink height 5 px or 5 ppt
bindsym $mod+o resize grow width 5 px or 5 ppt

# 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 h resize shrink width 5 px or 5 ppt
    bindsym j resize grow height 5 px or 5 ppt
    bindsym k resize shrink height 5 px or 5 ppt
    bindsym l resize grow width 5 px or 5 ppt

    # same bindings, but for the arrow keys
    bindsym Left  resize shrink width 5 px or 5 ppt
    bindsym Down  resize grow height 5 px or 5 ppt
    bindsym Up    resize shrink height 5 px or 5 ppt
    bindsym Right resize grow width 5 px or 5 ppt

    # back to normal: Enter or Escape or $mod+r
    bindsym Return mode "default"
    bindsym Escape mode "default"
    bindsym $mod+r mode "default"
}

bindsym $mod+r mode "resize"

mode "system" {
    bindsym l exec --no-startup-id i3exit lock, mode "default"
    bindsym s exec --no-startup-id i3exit suspend, mode "default"
    bindsym h exec --no-startup-id i3exit hibernate, mode "default"
    bindsym u exec --no-startup-id i3exit switch_user, mode "default"
    bindsym Shift+l exec "i3-nagbar -t warning -m 'Are you sure you want to log out?' -B 'Yes' 'i3exit logout'"
    bindsym p exec "i3-nagbar -t warning -m 'Are you sure you want to power off?' -B 'Yes' 'poweroff'"
    bindsym r exec "i3-nagbar -t warning -m 'Are you sure you want to reboot?' -B 'Yes' 'reboot'"

    # back to normal: Enter or Escape or $mod+r
    bindsym Return       mode "default"
    bindsym Escape       mode "default"
    bindsym $mod+Shift+s mode "default"
}

bindsym $mod+Shift+s mode "system"

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
    status_command i3status
    tray_output primary
}
