# ~/.config/i3/config

client.focused          #3F8AC2 #096BAA #00BAA7 #00DA8E
client.focused_inactive #333333 #5F676A #ffffff #484e50
client.unfocused        #333333 #424242 #888888 #292d2e 
client.urgent           #C10004 #900000 #ffffff #900000

# GAPS
gaps inner 20
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+g mode "$mode_gaps"

# Modes for controlling 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"
}

set $mod mod4
set $term termite

bindsym $mod+d exec --no-startup-id rofi -show-icons -show drun -config /home/reekymarko/.config/rofi/config
bindsym $mod+p exec --no-startup-id rofi-pass --last-used
bindsym $mod+Shift+p exec --no-startup-id rofi-pass --bmarks --last-used

font pango:System San Francisco Display 11

new_window 1pixel
hide_edge_borders vertical

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

# start a terminal
bindsym $mod+Return exec --no-startup-id $term 

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

# 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
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+y split h

# split in vertical orientation
bindsym $mod+x 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+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

focus_follows_mouse no

# focus the child container
#bindsym $mod+d focus child

# open with clipboard contents
bindsym $mod+v exec --no-startup-id mpv --ytdl-format="bestvideo[ext=mp4][height<=?1080]+bestaudio[ext=m4a]" $(xclip -o)
bindym $mod+Shift+b exec --no-startup-id firefox-nightly $(xclip -o)

#workspace names
set $workspace1   "1: Start "
set $workspace2   "2"
set $workspace3   "3"
set $workspace4   "4"
set $workspace5   "5"
set $workspace6   "6"
set $workspace7   "7"
set $workspace8   "8: Mail "
set $workspace9   "9: Messaging "
set $workspace10  "10: Music "

# 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

# classes
for_window [class="TelegramDesktop"] move to workspace $workspace9
for_window [class="Thunderbird"] move to workspace $workspace8


# 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

# 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 --no-startup-id i3-msg 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 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"

set $bg-color 	         #263238
set $inactive-bg-color   #263238
set $text-color          #f3f4f5
set $inactive-text-color #676E7D
set $urgent-bg-color     #E53935

# window colors
#                       border              background         text                 indicator
client.focused          $bg-color           $bg-color          $text-color          #00ff00
client.unfocused        $inactive-bg-color $inactive-bg-color $inactive-text-color #00ff00
client.focused_inactive $inactive-bg-color $inactive-bg-color $inactive-text-color #00ff00
client.urgent           $urgent-bg-color    $urgent-bg-color   $text-color          #00ff00

# pulseaudio controls
bindsym XF86AudioRaiseVolume exec --no-startup-id amixer -D pulse sset Master 5%+ # increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id amixer -D pulse sset Master 5%- # decrease sound volume
bindsym XF86AudioMute exec --no-startup-id amixer -D pulse set Master 1+ toggle # mute sound

# sreen brightness controls
bindsym XF86MonBrightnessUp exec --no-startup-id light -A 5 # increase screen brightness
bindsym XF86MonBrightnessDown exec --no-startup-id light -U 5 # decrease screen brightness

# screenshot and screencast
bindsym Print exec --no-startup-id "maim -u -s -l -c 0.157,0.333,0.466,0.4 | xclip -selection clipboard -t image/png && canberra-gtk-play -i camera-shutter"
bindsym $mod+Print exec --no-startup-id ~/scripts/record-screen.sh


# mpd controls
bindsym XF86AudioNext exec --no-startup-id mpc next
bindsym XF86AudioPrev exec --no-startup-id mpc prev
bindsym XF86AudioPlay exec --no-startup-id mpc toggle
bindsym XF86AudioStop exec --no-startup-id mpc clear

# connect bluetooth headset
bindsym $mod+c exec --no-startup-id bluetoothctl connect 17:08:01:0D:09:33

# connect bluetooth speaker
bindsym $mod+Shift+c exec --no-startup-id bluetoothctl connect 27:59:BE:CE:45:42

# lock screen
bindsym Control+Shift+l exec --no-startup-id evenbetterlockscreen -l

# open browser
bindsym $mod+b exec --no-startup-id firefox-nightly

{%@@ if profile == "ReekyPC" @@%}
# desktop only
exec_always --no-startup-id ~/scripts/desktop_screenlayout.sh
{%@@ endif @@%}

# autostart applications
exec_always --no-startup-id ~/Scripts/polybar.sh
exec --no-startup-id redshift
exec --no-startup-id unclutter
exec --no-startup-id nm-applet
exec --no-startup-id compton -f --config ~/.config/compton/compton.conf
exec --no-startup-id LANG=en_DK.UTF-8 telegram-desktop
exec --no-startup-id setxkbmap eu
exec --no-startup-id blueberry-tray
exec --no-startup-id mpDris2
exec --no-startup-id /usr/lib/kdeconnectd
exec --no-startup-id kdeconnect-indicator
exec --no-startup-id /usr/lib/xfce4/notifyd/xfce4-notifyd
exec --no-startup-id udiskie --tray
exec --no-startup-id pamac-tray
exec --no-startup-id xfce4-clipman
exec --no-startup-id thunderbird
exec --no-startup-id /usr/bin/gnome-keyring-daemon --start --components=secrets
exec --no-startup-id evenbetterlockscreen -w
exec --no-startup-id evenbetterlockscreen -l
