# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!

# Set the mod key to the "Windows key" and the floating modifier to the mod key.
set $mod Mod4
floating_modifier $mod

############################################
#    Constants                             #
############################################

set $urgentTextBackgroundColour #a6a6a6
set $primaryBackgroundColour    #1e1e1e
set $secondaryBackgroundColour  #252526
set $tertiaryBackgroundColour   #333333

set $textColour                 #848484
set $focusedTextColour          #f6f6f7

set $statusLineColour           #d1d4e0
set $urgentTextColour           #ef5350
set $indicatorColour            #fcc09e

set $workspace1 "1: "
set $workspace2 "2: "
set $workspace3 "3: "
set $workspace4 "4: "
set $workspace5 "5: "
set $workspace6 "6: "
set $workspace7 "7: "
set $workspace8 "8: "
set $workspace9 "9: "
set $workspace10 "10: "
set $workspace11 "11: "
set $workspace12 "12: "
set $workspace13 "13: "

# scripts
set $tidal ~/.config/i3/scripts/tidal-cli.sh
set $vpnmanager ~/.config/i3/scripts/vpn-manager.sh

############################################
#    i3 management keys                    #
############################################
# kill focused window
bindsym $mod+Shift+q kill

# 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+shift+s layout stacking
bindsym $mod+shift+t layout tabbed
bindsym $mod+shift+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

# 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+Escape exec "i3-nagbar -t warning -m 'Do you really want to exit i3?' -b 'Yes, exit i3' 'i3-msg exit'"
bindsym $mod+Shift+Delete exec "i3-nagbar -t alert -m 'Do you really want to shut down?' -b 'Yes, Shutdown' 'shutdown -h now'"
bindsym $mod+Shift+BackSpace exec "i3-nagbar -t error -m 'Do you really want to reboot?' -b 'Yes, Reboot' 'reboot'"

# focus on the parent window
bindsym $mod+shift+alt+p focus parent

# resize window (you can also use the mouse for that)
mode "resize" {
    # These bindings trigger as soon as you enter the resize mode
    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"

# Lock the computer
bindsym $mod+l exec /bin/bash ~/.config/i3/scripts/i3lock.sh

# Suspend the computer
bindsym $mod+shift+l exec /bin/bash ~/.config/i3/scripts/suspend.sh

############################################
#    Application Keys                      #
############################################
bindsym $mod+Return exec xfce4-terminal                                 # terminal
bindsym $mod+e exec nautilus                                            # File manager
bindsym Print exec  flameshot screen -d 0 -p ~/Pictures/Screenshots     # Fullscreen screenshot
bindsym $mod+Print exec flameshot gui					                          # Show screenshot window
bindsym $mod+shift+Print exec flameshot launcher					              # Show settings window (delay) then show screenshot window
bindsym $mod+shift+b exec /bin/bash ~/.config/i3/scripts/brightness.sh
bindsym control+shift+Escape exec sysmontask

# Rofi
bindsym $mod+d exec "rofi -show run"
bindsym $mod+Tab exec "rofi -show"
bindsym $mod+s exec "rofi -show ssh"
bindsym $mod+n exec $vpnmanager
bindsym $mod+shift+v exec "rofi -modi 'clipboard:greenclip print' -show clipboard -run-command '{cmd}'"

############################################
#    Media keys                            #
############################################
# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% #increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% #decrease sound volume
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle # mute sound

# Sreen brightness controls
bindsym XF86MonBrightnessUp exec xbacklight -inc 20 # increase screen brightness
bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # decrease screen brightness

# Media player controls
bindsym XF86AudioPlay exec playerctl play
bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
bindsym $mod+Next exec $tidal next
bindsym $mod+End exec $tidal previous
bindsym $mod+Delete exec $tidal playpause

############################################
#    Workspaces                            #
############################################
# switch to workspace
bindsym $mod+1 workspace $workspace1
bindsym $mod+2 workspace $workspace2
bindsym $mod+3 workspace $workspace3
bindsym $mod+4 workspace $workspace4
bindsym $mod+5 workspace $workspace5
bindsym $mod+6 workspace $workspace6
bindsym $mod+7 workspace $workspace7
bindsym $mod+8 workspace $workspace8
bindsym $mod+9 workspace $workspace9
bindsym $mod+0 workspace $workspace10
bindsym $mod+w workspace $workspace11
bindsym $mod+p workspace $workspace12
bindsym $mod+g workspace $workspace13

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $workspace1
bindsym $mod+Shift+2 move container to workspace $workspace2
bindsym $mod+Shift+3 move container to workspace $workspace3
bindsym $mod+Shift+4 move container to workspace $workspace4
bindsym $mod+Shift+5 move container to workspace $workspace5
bindsym $mod+Shift+6 move container to workspace $workspace6
bindsym $mod+Shift+7 move container to workspace $workspace7
bindsym $mod+Shift+8 move container to workspace $workspace8
bindsym $mod+Shift+9 move container to workspace $workspace9
bindsym $mod+Shift+0 move container to workspace $workspace10
bindsym $mod+Shift+w move container to workspace $workspace11
bindsym $mod+Shift+p move container to workspace $workspace12
bindsym $mod+Shift+g move container to workspace $workspace13


############################################
#    Appearance settings                   #
############################################
# Set the default font
font pango:Ubuntu regular 12
# Bar decoration
bar {
    status_command i3blocks -c ~/.config/i3/i3blocks.conf
    position top
    strip_workspace_numbers no
    tray_output primary
    colors {
        separator $textColour
        background $primaryBackgroundColour
        statusline $statusLineColour
        #                  border                   background                  text
        focused_workspace  $primaryBackgroundColour $primaryBackgroundColour    $focusedTextColour
        active_workspace   $primaryBackgroundColour $secondaryBackgroundColour  $textColour
        inactive_workspace $primaryBackgroundColour $primaryBackgroundColour    $textColour
        urgent_workspace   $primaryBackgroundColour $primaryBackgroundColour    $urgentTextColour
    }
}

new_window 1pixel
hide_edge_borders both

# Window Colours
#                       border                     background                  text               indicator
client.focused          $primaryBackgroundColour   $primaryBackgroundColour    $focusedTextColour $indicatorColour
client.focused_inactive $secondaryBackgroundColour $secondaryBackgroundColour  $textColour        $indicatorColour
client.unfocused        $secondaryBackgroundColour $secondaryBackgroundColour  $textColour        $indicatorColour
client.urgent           $secondaryBackgroundColour $urgentTextBackgroundColour $urgentTextColour  $indicatorColour

# Floating windows
for_window [class="Pavucontrol"] floating enable
for_window [class="Lxappearance"] floating enable
for_window [class="Arandr"] floating enable
for_window [class="Eog"] floating enable
for_window [title="Tidal-hifi - settings"] floating enable
for_window [class="Sysmontask"] floating enable
for_window [class="Sysmontask"] resize set 930 665

############################################
#    Workspace specific tools              #
#       Use xprop to determine class       #
############################################
# assign [class="Enpass"] $workspace12 # moves all windows... including the browser popup
assign [class="VirtualBox Machine"] $workspace11

# database stuff
assign [class="MongoDB Compass"] $workspace8
assign [class="robo3t"] $workspace8
assign [class="Mysql-workbench-bin"] $workspace8
assign [class="azuredatastudio"] $workspace8
assign [class="beekeeper"] $workspace8

############################################
#    i3-gaps                               #
############################################
# Disable window titlebars entirely
for_window [class="^.*"] border pixel 2

# Set inner/outer gaps
gaps inner 10
# gaps outer 0

bindsym $mod+Shift+plus gaps inner all plus 5
bindsym $mod+Shift+minus gaps inner all minus 5
bindsym $mod+Shift+Home gaps inner all set 10
bindsym $mod+Shift+a border normal

# Smart borders (draw borders around container only if it is not the only container on this workspace)
smart_borders on

# Smart gaps (gaps used if only more than one container on the workspace)
smart_gaps on

# Press $mod+Shift+g to enter the gap mode. Choose o or i for modifying outer/inner gaps.
# Press one of + / - (in-/decrement for current workspace) or 0 (remove gaps for current workspace).
# If you also press Shift with these keys, the change will be global for all workspaces.
set $mode_gaps Gaps: (o) outer, (i) inner
set $mode_gaps_outer Outer Gaps: +|-|0 (local), Shift + +|-|0 (global)
set $mode_gaps_inner Inner Gaps: +|-|0 (local), Shift + +|-|0 (global)
bindsym $mod+Shift+End mode "$mode_gaps"

mode "$mode_gaps" {
    bindsym o      mode "$mode_gaps_outer"
    bindsym i      mode "$mode_gaps_inner"
    bindsym Return mode "default"
    bindsym Escape mode "default"
}

mode "$mode_gaps_inner" {
    bindsym plus  gaps inner current plus 5
    bindsym minus gaps inner current minus 5
    bindsym 0     gaps inner current set 0
    
    bindsym Shift+plus  gaps inner all plus 5
    bindsym Shift+minus gaps inner all minus 5
    bindsym Shift+0     gaps inner all set 0
    
    bindsym Return mode "default"
    bindsym Escape mode "default"
}
mode "$mode_gaps_outer" {
    bindsym plus  gaps outer current plus 5
    bindsym minus gaps outer current minus 5
    bindsym 0     gaps outer current set 0
    
    bindsym Shift+plus  gaps outer all plus 5
    bindsym Shift+minus gaps outer all minus 5
    bindsym Shift+0     gaps outer all set 0
    
    bindsym Return mode "default"
    bindsym Escape mode "default"
}

############################################
#    Autorun                               #
############################################
# exec_always --no-startup-id picom -b
exec --no-startup-id i3-msg 'workspace $workspace2; exec xfce4-terminal' && i3-msg 'workspace $workspace1'
exec --no-startup-id i3-msg 'workspace $workspace12; exec enpass'
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec --no-startup-id nm-applet
exec --no-startup-id blueman-applet
exec_always feh --bg-scale $(find ~/Pictures/wallpapers/ -type f -name "*" | shuf -n 1)
exec /usr/bin/compton
exec /bin/bash ~/.config/i3/scripts/startup.sh
exec --no-startup-id greenclip daemon
