#------------------------------------------------------------------------#
## Some colors have names                                               ##
#------------------------------------------------------------------------#

set_from_resource $col_c_focd_bor i3wm.color.client.focused.bor          #000000
set_from_resource $col_c_focd_bgn i3wm.color.client.focused.bgn          #7a7a7a
set_from_resource $col_c_focd_txt i3wm.color.client.focused.txt          #0a0a0a
set_from_resource $col_c_focd_ind i3wm.color.client.focused.ind          #c5c5c5
set_from_resource $col_c_fcdi_bor i3wm.color.client.focused_inactive.bor #0a0a0a
set_from_resource $col_c_fcdi_bgn i3wm.color.client.focused_inactive.bgn #505050
set_from_resource $col_c_fcdi_txt i3wm.color.client.focused_inactive.txt #f0f0f0
set_from_resource $col_c_fcdi_ind i3wm.color.client.focused_inactive.ind #505050
set_from_resource $col_c_ufcd_bor i3wm.color.client.unfocused.bor        #5a5a5a
set_from_resource $col_c_ufcd_bgn i3wm.color.client.unfocused.bgn        #505050
set_from_resource $col_c_ufcd_txt i3wm.color.client.unfocused.txt        #f0f0f0
set_from_resource $col_c_ufcd_ind i3wm.color.client.unfocused.ind        #c5c5c5
set_from_resource $col_c_urgt_bor i3wm.color.client.urgent.bor           #f0f0f0
set_from_resource $col_c_urgt_bgn i3wm.color.client.urgent.bgn           #f0f0f0
set_from_resource $col_c_urgt_txt i3wm.color.client.urgent.txt           #0a0a0a
set_from_resource $col_c_urgt_ind i3wm.color.client.urgent.ind           #5a5a5a
set_from_resource $col_c_bgnd     i3wm.color.client.background           #0a0a0a
set_from_resource $col_b_stln     i3wm.color.bar.statusline              #f0f0f0
set_from_resource $col_b_bgnd     i3wm.color.bar.background              #0a0a0a
set_from_resource $col_b_sepa     i3wm.color.bar.separator               #7a7a7a
set_from_resource $col_b_wspf_bor i3wm.color.bar.focused_workspace.bor   #0a0a0a
set_from_resource $col_b_wspf_bgn i3wm.color.bar.focused_workspace.bgn   #7a7a7a
set_from_resource $col_b_wspf_txt i3wm.color.bar.focused_workspace.txt   #0a0a0a
set_from_resource $col_b_wspi_bor i3wm.color.bar.inactive_workspace.bor  #0a0a0a
set_from_resource $col_b_wspi_bgn i3wm.color.bar.inactive_workspace.bgn  #505050
set_from_resource $col_b_wspi_txt i3wm.color.bar.inactive_workspace.txt  #f0f0f0
set_from_resource $col_b_wspa_bor i3wm.color.bar.active_workspace.bor    #c5c5c5
set_from_resource $col_b_wspa_bgn i3wm.color.bar.active_workspace.bgn    #505050
set_from_resource $col_b_wspa_txt i3wm.color.bar.active_workspace.txt    #f0f0f0
set_from_resource $col_b_wspu_bor i3wm.color.bar.urgent_workspace.bor    #7a7a7a
set_from_resource $col_b_wspu_bgn i3wm.color.bar.urgent_workspace.bgn    #f0f0f0
set_from_resource $col_b_wspu_txt i3wm.color.bar.urgent_workspace.txt    #0a0a0a
set_from_resource $col_b_bind_bor i3wm.color.bar.binding_mode.bor        #0a0a0a
set_from_resource $col_b_bind_bgn i3wm.color.bar.binding_mode.bgn        #f0f0f0
set_from_resource $col_b_bind_txt i3wm.color.bar.binding_mode.txt        #0a0a0a

# assign workspace names
set_from_resource $name_wsp1 i3wm.name.workspace1  1
set_from_resource $name_wsp2 i3wm.name.workspace2  2
set_from_resource $name_wsp3 i3wm.name.workspace3  3
set_from_resource $name_wsp4 i3wm.name.workspace4  4
set_from_resource $name_wsp5 i3wm.name.workspace5  5
set_from_resource $name_wsp6 i3wm.name.workspace6  6
set_from_resource $name_wsp7 i3wm.name.workspace7  7
set_from_resource $name_wsp8 i3wm.name.workspace8  8
set_from_resource $name_wsp9 i3wm.name.workspace9  9
set_from_resource $name_wsp0 i3wm.name.workspace10 10

set $transparent #0000000F


#------------------------------------------------------------------------#
## Basically basic                                                      ##
#------------------------------------------------------------------------#

set $spn PRETTY=notify
set $mod Mod4

floating_modifier $mod
mouse_warping none
hide_edge_borders vertical
font pango:Inconsolata 12
workspace_layout stacked

# 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

# change output focus
bindsym $mod+Ctrl+h         focus output left
bindsym $mod+Ctrl+j         focus output down
bindsym $mod+Ctrl+k         focus output up
bindsym $mod+Ctrl+l         focus output right

# alternatively, you can use the cursor keys:
bindsym $mod+Ctrl+Left      focus output left
bindsym $mod+Ctrl+Down      focus output down
bindsym $mod+Ctrl+Up        focus output up
bindsym $mod+Ctrl+Right     focus output 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+g 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
bindsym $mod+Shift+a focus child

# switch to workspace
bindsym $mod+1 workspace $name_wsp1
bindsym $mod+2 workspace $name_wsp2
bindsym $mod+3 workspace $name_wsp3
bindsym $mod+4 workspace $name_wsp4
bindsym $mod+5 workspace $name_wsp5
bindsym $mod+6 workspace $name_wsp6
bindsym $mod+7 workspace $name_wsp7
bindsym $mod+8 workspace $name_wsp8
bindsym $mod+9 workspace $name_wsp9
bindsym $mod+0 workspace $name_wsp0
bindsym $mod+Page_Up   workspace prev_on_output
bindsym $mod+Page_Down workspace next_on_output

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $name_wsp1
bindsym $mod+Shift+2 move container to workspace $name_wsp2
bindsym $mod+Shift+3 move container to workspace $name_wsp3
bindsym $mod+Shift+4 move container to workspace $name_wsp4
bindsym $mod+Shift+5 move container to workspace $name_wsp5
bindsym $mod+Shift+6 move container to workspace $name_wsp6
bindsym $mod+Shift+7 move container to workspace $name_wsp7
bindsym $mod+Shift+8 move container to workspace $name_wsp8
bindsym $mod+Shift+9 move container to workspace $name_wsp9
bindsym $mod+Shift+0 move container to workspace $name_wsp0
bindsym $mod+Shift+Page_Up   move container to workspace prev_on_output
bindsym $mod+Shift+Page_Down move container to workspace next_on_output

bindsym $mod+Shift+Tab move scratchpad
bindsym $mod+Tab scratchpad show

bindsym $mod+Shift+r exec "xrdb .Xdefaults; i3-msg restart"

#                       BORDER          BACKGROUND      TEXT            INDICATOR
client.focused          $col_c_focd_bor $col_c_focd_bgn $col_c_focd_txt $col_c_focd_ind
client.unfocused        $col_c_ufcd_bor $col_c_ufcd_bgn $col_c_ufcd_txt $col_c_ufcd_ind
client.focused_inactive $col_c_fcdi_bor $col_c_fcdi_bgn $col_c_fcdi_txt $col_c_fcdi_ind
client.urgent           $col_c_urgt_bor $col_c_urgt_bgn $col_c_urgt_txt $col_c_urgt_ind
client.background       $col_c_bgnd


#------------------------------------------------------------------------#
## Maybe Modes                                                          ##
#------------------------------------------------------------------------#

bindsym $mod+backslash               mode "mark"

mode "mark" {
  #      
  #        
  # ⓿ ❶ ❷ ❸ ❹ ❺ ❻ ❼ ❽ ❾
  set $neutral  "<span></span> %title"
  set $runn     "<span foreground='cyan'></span> %title"
  set $pass     "<span foreground='lime'></span> %title"
  set $warn     "<span foreground='orange'></span> %title"
  set $fail     "<span foreground='#992222'></span> %title"
  set $num1     "❶ %title"
  set $num2     "❷ %title"
  set $num3     "❸ %title"
  set $num4     "❹ %title"
  set $num5     "❺ %title"
  set $num6     "❻ %title"
  set $num7     "❼ %title"
  set $num8     "❽ %title"
  set $num9     "❾ %title"
  set $num0     "⓿ %title"

  # Ⓐ Ⓑ Ⓒ Ⓓ Ⓔ Ⓕ Ⓖ Ⓗ Ⓘ Ⓙ Ⓚ Ⓛ Ⓜ Ⓝ Ⓞ Ⓟ Ⓠ Ⓡ Ⓢ Ⓣ Ⓤ Ⓥ Ⓦ Ⓧ Ⓨ Ⓩ
  # ⓐ ⓑ ⓒ ⓓ ⓔ ⓕ ⓖ ⓗ ⓘ ⓙ ⓚ ⓛ ⓜ ⓝ ⓞ ⓟ ⓠ ⓡ ⓢ ⓣ ⓤ ⓥ ⓦ ⓧ ⓨ ⓩ
  set $letterA "Ⓐ %title"
  set $letterB "Ⓑ %title"
  set $letterC "Ⓒ %title"
  set $letterD "Ⓓ %title"
  set $letterE "Ⓔ %title"
  set $letterF "Ⓕ %title"
  set $letterG "Ⓖ %title"
  set $letterH "Ⓗ %title"
  set $letterI "Ⓘ %title"
  set $letterJ "Ⓙ %title"
  set $letterK "Ⓚ %title"
  set $letterL "Ⓛ %title"
  set $letterM "Ⓜ %title"
  set $letterN "Ⓝ %title"
  set $letterO "Ⓞ %title"
  set $letterP "Ⓟ %title"
  set $letterQ "Ⓠ %title"
  set $letterR "Ⓡ %title"
  set $letterS "Ⓢ %title"
  set $letterT "Ⓣ %title"
  set $letterU "Ⓤ %title"
  set $letterV "Ⓥ %title"
  set $letterW "Ⓦ %title"
  set $letterX "Ⓧ %title"
  set $letterY "Ⓨ %title"
  set $letterZ "Ⓩ %title"

  set $strike   "<s>%title</s>"
  set $unders   "<u>%title</u>"
  set $italic   "<i>%title</i>"
  set $normal   "%title"

  set $list     "<span></span> %title"
  set $item     "<span></span> %title"
  set $favorite "<span></span> %title"
  set $watcher  "<span foreground='black'>| |</span> %title"
  set $ewatcher "<span foreground='black'>|</span><span foreground='#ee0000'> </span><span foreground='black'>|</span> %title"
  set $gwatcher "<span foreground='black'>|</span><span foreground='#00aa00'> </span><span foreground='black'>|</span> %title"

  bindsym Page_Up [workspace=__focused__] \
                        title_format $neutral; mode "default"
  bindsym Page_Down [workspace=__focused__] \
                        title_format $normal ; mode "default"
  bindsym p             title_format $pass   ; mode "default"
  bindsym bracketleft   title_format $warn   ; mode "default"
  bindsym bracketright  title_format $fail   ; mode "default"
  bindsym apostrophe    title_format $runn   ; mode "default"
  bindsym semicolon     title_format $neutral; mode "default"

  bindsym w             title_format $watcher ; mode "default"
  bindsym e             title_format $ewatcher ; mode "default"
  bindsym g             title_format $gwatcher ; mode "default"
  bindsym comma         title_format $favorite ; mode "default"
  bindsym period        title_format $item ; mode "default"
  bindsym slash         title_format $list ; mode "default"

  bindsym BackSpace     title_format $strike ; mode "default"
  bindsym equal         title_format $unders ; mode "default"
  bindsym minus         title_format $italic ; mode "default"

  bindsym space         title_format $normal ; mode "default"
  bindsym backslash     title_format $normal ; mode "default"

  bindsym 1             title_format $num1; mode "default"
  bindsym 2             title_format $num2; mode "default"
  bindsym 3             title_format $num3; mode "default"
  bindsym 4             title_format $num4; mode "default"
  bindsym 5             title_format $num5; mode "default"
  bindsym 6             title_format $num6; mode "default"
  bindsym 7             title_format $num7; mode "default"
  bindsym 8             title_format $num8; mode "default"
  bindsym 9             title_format $num9; mode "default"
  bindsym 0             title_format $num0; mode "default"

  bindsym Shift+a       title_format $letterA; mode "default"
  bindsym Shift+b       title_format $letterB; mode "default"
  bindsym Shift+c       title_format $letterC; mode "default"
  bindsym Shift+d       title_format $letterD; mode "default"
  bindsym Shift+e       title_format $letterE; mode "default"
  bindsym Shift+f       title_format $letterF; mode "default"
  bindsym Shift+g       title_format $letterG; mode "default"
  bindsym Shift+h       title_format $letterH; mode "default"
  bindsym Shift+i       title_format $letterI; mode "default"
  bindsym Shift+j       title_format $letterJ; mode "default"
  bindsym Shift+k       title_format $letterK; mode "default"
  bindsym Shift+l       title_format $letterL; mode "default"
  bindsym Shift+m       title_format $letterM; mode "default"
  bindsym Shift+n       title_format $letterN; mode "default"
  bindsym Shift+o       title_format $letterO; mode "default"
  bindsym Shift+p       title_format $letterP; mode "default"
  bindsym Shift+q       title_format $letterQ; mode "default"
  bindsym Shift+r       title_format $letterR; mode "default"
  bindsym Shift+s       title_format $letterS; mode "default"
  bindsym Shift+t       title_format $letterT; mode "default"
  bindsym Shift+u       title_format $letterU; mode "default"
  bindsym Shift+v       title_format $letterV; mode "default"
  bindsym Shift+w       title_format $letterW; mode "default"
  bindsym Shift+x       title_format $letterX; mode "default"
  bindsym Shift+y       title_format $letterY; mode "default"
  bindsym Shift+z       title_format $letterZ; mode "default"

  bindsym $mod+backslash    mode "default"
  bindsym Escape            mode "default"
  bindsym Return            mode "default"
}

bindsym $mod+r mode "resize"
mode "resize" {
        bindsym Left        resize shrink   width   200 px or 12 ppt
        bindsym Down        resize grow     height  200 px or 12 ppt
        bindsym Up          resize shrink   height  200 px or 12 ppt
        bindsym Right       resize grow     width   200 px or 12 ppt
        bindsym Shift+Left  resize shrink   width   25 px or 2 ppt
        bindsym Shift+Down  resize grow     height  25 px or 2 ppt
        bindsym Shift+Up    resize shrink   height  25 px or 2 ppt
        bindsym Shift+Right resize grow     width   25 px or 2 ppt
        bindsym $mod+r      mode "default"
        bindsym Return      mode "default"
        bindsym Escape      mode "default"
}

bar {
    id clementine
    status_command "~/.i3/bin/cstatus"
    workspace_buttons no
    tray_output none
    mode hide
    hidden_state hide
    modifier none
    output eDP-1
}

bindsym --release button3 kill

bar {
        id main
        status_command "~/.i3/bin/i3staplus"
        bindsym button2 exec thunar
        bindsym button3 exec "$spn xclose"
        separator_symbol "•"
        # other suggestions:
        #     ‧•┇╻╹╹╿═╎╏◆◾║︙⎪∣∕⟘⟙∙∼⦀⦑⦒⦚⧸⧹▓▒░⧻⧺┆˘͡͡ːˌ˷|・፧።
        colors {
                statusline         $col_b_stln
                background         $col_b_bgnd
                separator          $col_b_sepa

                #                  BORDER           BACKGROUND      TEXT
                focused_workspace  $col_b_wspf_bor  $col_b_wspf_bgn $col_b_wspf_txt
                inactive_workspace $col_b_wspi_bor  $col_b_wspi_bgn $col_b_wspi_txt
                active_workspace   $col_b_wspa_bor  $col_b_wspa_bgn $col_b_wspa_txt
                urgent_workspace   $col_b_wspu_bor  $col_b_wspu_bgn $col_b_wspu_txt
                binding_mode       $col_b_bind_bor  $col_b_bind_bgn $col_b_bind_txt
        }
}

bindsym Caps_Lock           mode "caps"
bindsym Shift+Caps_Lock     mode "caps"
bindsym Ctrl+Caps_Lock      mode "caps"
bindsym $mod+Caps_Lock      mode "caps"
mode "caps" {
        bindsym Caps_Lock       mode "default"
        bindsym Shift+Caps_Lock mode "default"
        bindsym Ctrl+Caps_Lock  mode "default"
        bindsym $mod+Caps_Lock  mode "default"
}

#------------------------------------------------------------------------#
## Openers                                                              ##
#------------------------------------------------------------------------#

bindsym $mod+Return         exec "urxvt"
bindsym $mod+Shift+Return   exec "xfce4-terminal"
bindsym $mod+Home           exec "$spn bmo menu home"
bindsym $mod+Shift+Home     exec "thunar"
bindsym $mod+p              exec "$spn bmo menu run"
bindsym $mod+Shift+p        exec "$spn bmo menu run_hist"

#------------------------------------------------------------------------#
## WWW magic mind readers                                               ##
#------------------------------------------------------------------------#

bindsym $mod+b              exec "$spn bmo wish -c -1 -a"
bindsym $mod+c              exec "$spn bmo wish -c -1 -a -B"
bindsym $mod+Shift+b        exec "$spn bmo wish -c"
bindsym $mod+Shift+c        exec "$spn bmo wish -c -B"
bindsym $mod+i              exec "$spn bmo menu uris"
bindsym $mod+Shift+i        exec "$spn bmo menu www_hist"
bindsym $mod+q              exec "$spn bmo wish -c -q ddg"
bindsym $mod+Shift+q        exec "$spn bmo wish -c -Q"
bindsym $mod+t              exec "acclive"


#------------------------------------------------------------------------#
## Killers                                                              ##
#------------------------------------------------------------------------#

bindsym $mod+Delete         kill
bindsym $mod+Shift+Delete   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-msg exit'"

#------------------------------------------------------------------------#
## Desktop states                                                       ##
#------------------------------------------------------------------------#

bindsym $mod+Escape         exec "$spn bmo be %afk"
bindsym $mod+Shift+Escape   exec "$spn bmo be %gone"
bindsym $mod+m              exec "$spn bmo menu status"
bindsym $mod+Shift+m        exec "i3-dmenu-desktop --dmenu='bmo dmenu'"
bindsym $mod+o              exec "$spn bmo menu context"
bindsym $mod+Print          exec "newfeh"
bindsym $mod+grave          exec "$spn bmo menu windows"
bindsym $mod+Shift+w        exec "$spn bmo menu projects"


#------------------------------------------------------------------------#
## Desktop-ey other stuff                                               ##
#------------------------------------------------------------------------#

bindsym $mod+n                  exec "$spn bmo kb home"
bindsym $mod+Shift+n            exec "$spn bmo kb next"
bindsym $mod+Insert             exec "$spn bmo clip save"
bindsym $mod+Shift+Insert       exec "$spn bmo clip open"
bindsym $mod+d                  exec "xbacklight -dec 49"
bindsym $mod+Shift+d            exec "xbacklight -inc 5"
bindsym XF86AudioRaiseVolume    exec "$spn bmo au up"
bindsym XF86AudioLowerVolume    exec "$spn bmo au down"
bindsym XF86AudioMute           exec "$spn bmo au flip"


#------------------------------------------------------------------------#
## Typing macros wow                                                    ##
#------------------------------------------------------------------------#

bindsym --release $mod+Ctrl+apostrophe      exec "xdotool .i3/macros/apostrophe.xdotool"
bindsym --release $mod+Ctrl+asterisk        exec "xdotool .i3/macros/asterisk.xdotool"
bindsym --release $mod+Ctrl+slash           exec "xdotool .i3/macros/slash.xdotool"
bindsym --release $mod+Ctrl+comma           exec "xdotool .i3/macros/comma.xdotool"
bindsym --release $mod+Ctrl+semicolon       exec "xdotool .i3/macros/semicolon.xdotool"
bindsym --release $mod+Ctrl+period          exec "xdotool .i3/macros/period.xdotool"
bindsym --release $mod+Ctrl+9               exec "xdotool .i3/macros/9.xdotool"
bindsym --release $mod+Ctrl+grave           exec "xdotool .i3/macros/grave.xdotool"
bindsym --release $mod+Ctrl+bracketleft     exec "xdotool .i3/macros/bracketleft.xdotool"
bindsym --release $mod+Ctrl+bracketright    exec "xdotool .i3/macros/bracketright.xdotool"




#------------------------------------------------------------------------#
## Less smart apps                                                      ##
#------------------------------------------------------------------------#

for_window [class="Shutter"]    floating enable
for_window [class="Orage"]      floating enable


#------------------------------------------------------------------------#
## autoexec.bat                                                         ##
#------------------------------------------------------------------------#

exec "newfeh"
exec "dunst"
exec "dropbox start"
exec "urxvt -e weechat"
exec "nm-applet"
exec "blueman-applet"
exec "shutter --min_at_startup"