set $mod Mod4

# Reload Restart config | moved to rofi
#bindsym $mod+c reload
#bindsym $mod+r restart
#bindsym $mod+e exit

# Floating Modifier
floating_modifier $mod

# Kill focused window
bindsym $mod+q kill

# change focus
bindsym $mod+Up focus up
bindsym $mod+Down focus down
bindsym $mod+Left focus left
bindsym $mod+Right focus right

# Move Focused
bindsym $mod+Control+Up move up
bindsym $mod+Control+Down move down
bindsym $mod+Control+Left move left
bindsym $mod+Control+Right move right

bindsym $mod+o move container to output next

# Resizing window
bindsym $mod+Shift+Up resize grow height 10 px or 10 ppt
bindsym $mod+Shift+Down resize shrink height 10 px or 10 ppt
bindsym $mod+Shift+Left resize shrink width 10 px or 10 ppt
bindsym $mod+Shift+Right resize grow width 10 px or 10 ppt

# Workspace layout
bindsym $mod+space layout toggle splitv splith tabbed

# Fullscreen
bindsym $mod+f fullscreen toggle

# Splitting
bindsym $mod+v split vertical
bindsym $mod+h split horizontal
bindsym $mod+Control+space split toggle

# Volume control
bindsym F5 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5%
bindsym F6 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5%

##############
# Workspaces #
##############

set $monitor0 HDMI-0
set $monitor1 HDMI-1

set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"

workspace $ws1 output $monitor0
workspace $ws2 output $monitor0
workspace $ws3 output $monitor0
workspace $ws4 output $monitor0
workspace $ws5 output $monitor1
workspace $ws6 output $monitor1
workspace $ws7 output $monitor1
workspace $ws8 output $monitor1

bindsym $mod+mod2+KP_1 workspace $ws1
bindsym $mod+mod2+KP_2 workspace $ws2
bindsym $mod+mod2+KP_3 workspace $ws3
bindsym $mod+mod2+KP_4 workspace $ws4
bindsym $mod+mod2+KP_5 workspace $ws5
bindsym $mod+mod2+KP_6 workspace $ws6
bindsym $mod+mod2+KP_7 workspace $ws7
bindsym $mod+mod2+KP_8 workspace $ws8

bindsym $mod+Control+mod2+KP_1 move container to workspace $ws1
bindsym $mod+Control+mod2+KP_2 move container to workspace $ws2
bindsym $mod+Control+mod2+KP_3 move container to workspace $ws3
bindsym $mod+Control+mod2+KP_4 move container to workspace $ws4
bindsym $mod+Control+mod2+KP_5 move container to workspace $ws5
bindsym $mod+Control+mod2+KP_6 move container to workspace $ws6
bindsym $mod+Control+mod2+KP_7 move container to workspace $ws7
bindsym $mod+Control+mod2+KP_8 move container to workspace $ws8

###########################
#Design
###########################

title_align center
default_border pixel 1

# Gaps
gaps inner 10px
smart_gaps off
gaps inner 5

#smart|ignore|leave_fullscreen
popup_during_fullscreen ignore

# Font
set $font ComicShannsMono Nerd Font Bold
font pango:$font 11

#colors
set_from_resource $fg     i3wm.foreground         #abb2bf
set_from_resource $fgli   i3wm.foreground-light   #d4d8df
set_from_resource $fglier i3wm.foreground-lighter #f6f7f9
set_from_resource $bg     i3wm.background         #282c34
set_from_resource $bgli   i3wm.background-light   #323842
set_from_resource $bgda   i3wm.background-dark    #21252b
set_from_resource $bgdaer i3wm.background-darker  #1e2227
set_from_resource $black  i3wm.color0             #1e2227
set_from_resource $red    i3wm.color1             #e06c75
set_from_resource $green  i3wm.color2             #98c379
set_from_resource $yellow i3wm.color3             #e5c07b
set_from_resource $blue   i3wm.color4             #000000
set_from_resource $purple i3wm.color5             #c678dd
set_from_resource $cyan   i3wm.color6             #56b6c2
set_from_resource $white  i3wm.color7             #f6f7f9

# class                 border  backgr. text    indicator child_border

client.focused          $blue     $bg     $blue   $purple   $blue
client.focused_inactive $bgda     $bgli   $fglier $purple   $bgda
client.unfocused        $bgdaer   $bg     $fg     $purple   $bgdaer
client.urgent           $red      $bg     $fg     $purple   $red
client.placeholder      $bgdaer   $bg     $fg     $purple   $bgdaer

client.background       $bg

###########
# Startup #
###########
exec --no-startup-id xrandr --output HDMI-1 --primary --right-of HDMI-0
exec_always --no-startup-id /usr/local/share/dotfiles/scripts/wallpapers.sh
exec_always --no-startup-id "killall picom ; picom"
exec_always --no-startup-id "killall dunst ; dunst"
exec_always --no-startup-id "killall polybar ; polybar HDMI-1 & polybar HDMI-0 &"
#exec_always --no-startup-id "killall nextcloud ; nextcloud"

#################
# Apps shortcut #
#################

bindsym Print exec --no-startup-id  flameshot gui

bindsym $mod+d exec --no-startup-id rofi -show drun -show-icons
bindsym $mod+l exec --no-startup-id /usr/local/share/dotfiles/scripts/disconnect.sh
bindsym $mod+b exec --no-startup-id /usr/local/share/dotfiles/scripts/bookmarks.sh
bindsym $mod+m exec --no-startup-id /usr/local/share/dotfiles/scripts/mpv.sh
bindsym $mod+g exec --no-startup-id /usr/local/share/dotfiles/scripts/search.sh
bindsym $mod+c exec --no-startup-id rofi -show calc -theme disconnect.rasi

bindsym $mod+Shift+p exec --no-startup-id pavucontrol
bindsym $mod+Shift+d exec --no-startup-id discord --no-sandbox
bindsym $mod+Shift+f exec --no-startup-id firefox
bindsym $mod+Shift+s exec --no-startup-id steam


# Start a terminal
bindsym $mod+Return exec --no-startup-id urxvt

# Display help
for_window [instance="cheatsheet"] floating enable
bindsym  $mod+s exec --no-startup-id urxvt -geometry 120x40 -name cheatsheet -e /usr/local/share/dotfiles/scripts/i3wm_key_help.sh
