# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!


# --- basics --------------------------------------------------------------------------------------

set $mod Mod4

font pango:DejaVu Sans Mono 10

# default workspace layout <default|stacking|tabbed>
workspace_layout stacking

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

# start a terminal
#bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+Return exec xterm
bindsym $mod+Shift+Return exec qutebrowser
bindsym $mod+p exec xterm -e ~/miniconda3/bin/ipython
bindsym $mod+e exec emacsclient -c -a ""

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

# launcher
bindsym $mod+d exec rofi -show run -hide-scrollbar -separator-style "solid"

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


# --- custom shortcuts ----------------------------------------------------------------------------


# i3lock
bindsym $mod+l exec i3lock -c 000000 && exec xset dpms force off

# touchpad toggle
bindsym $mod+t exec ~/.config/i3/toggle_mouse.sh


# --- navigation ----------------------------------------------------------------------------------


# change focus
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+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+q layout toggle split

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

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

# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
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
bindsym $mod+a workspace A
bindsym $mod+b workspace B
bindsym $mod+c workspace C
bindsym $mod+x workspace X
bindsym $mod+space workspace ~

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
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

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

bindsym $mod+Tab workspace back_and_forth

bindsym $mod+Shift+Tab move workspace to output right

# --- theme ---------------------------------------------------------------------------------------


# colors --- https://github.com/chriskempson/tomorrow-theme
set $background #1d1f21
set $current    #282a2e
set $selection  #373b41
set $foreground #c5c8c6
set $comment    #969896
set $red        #cc6666
set $orange     #de935f
set $yellow     #f0c674

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
        status_command i3blocks
        position top
        colors {
               background $selection
               focused_workspace  $selection $selection $yellow
               inactive_workspace $selection $selection $foreground
        }
}

# class                 border      background  text        indicator child_border
client.focused          $selection  $selection  $yellow     $red      $yellow
client.focused_inactive $selection  $selection  $yellow     $red      $selection
client.unfocused        $selection  $selection  $comment    $red      $selection
client.urgent           $selection  $selection  $red        $red      $red
client.placeholder      #282a2e     #0c0c0c     #ffffff     #000000   #0c0c0c
client.background       $background

for_window [class="^.*"] border pixel 5
hide_edge_borders smart


# --- software ------------------------------------------------------------------------------------

exec xrdb ~/.Xresources
exec --no-startup-id /usr/libexec/gnome-settings-daemon-localeexec
exec --no-startup-id /usr/lib/gnome-settings-daemon/gsd-xsettings
exec --no-startup-id dconf write /org/gnome/settings-daemon/plugins/cursor/active false
exec --no-startup-id xsetroot -solid "#000000"

exec_always xset dpms 0 0 0  # never turn off screen
exec_always xset -dpms  # never turn off screen
exec_always xset s off  # never turn off screen
exec_always xset s 0 0
exec xset -b  # never beep

exec_always --no-startup-id dunst -config ~/.dunstrc

exec xmodmap -e "clear lock"  # disable caps lock switch
exec xmodmap -e "keysym Caps_Lock = Escape"  # set caps_lock as escape