# set mod to super
set $mod Mod4

# font for window titles
font pango:Roboto Mono for Powerline 10

# use mouse + $mod to move windows
floating_modifier $mod

# start a terminal
bindsym $mod+Return exec alacritty

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

# start dmenu
bindsym $mod+d exec dmenu_run

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

# split in vertical orienta! special
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+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 the child container
#bindsym $mod+d focus child

# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"

# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10

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

# resize window
mode "resize" {
        # 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 h resize shrink width 10 px or 10 ppt
        bindsym j resize grow height 10 px or 10 ppt
        bindsym k resize shrink height 10 px or 10 ppt
        bindsym l 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 or $mod+r
        bindsym Return mode "default"
        bindsym Escape mode "default"
        bindsym $mod+r mode "default"
}

bindsym $mod+r mode "resize"

# client colors		border	backgr	text	indicator child_border
client.focused		#161b1d	#161b1d	#ebf8ff	#161b1d	#161b1d	
client.focused_inactive	#333333	#161bfd	#7ea2b4	#5a7b8c	#333333
client.unfocused	#333333	#161b1d	#7ea2b4	#5a7b8c	#333333
client.urgent		#d22d72	#161b1d	#7ea2b4	#5d5db1	#d22d72
client.placeholder	#333333	#161b1d	#7ea2b4	#5a7b8c	#333333

client.background	#161b1d

# start urxvtd for faster term load
# exec /usr/bin/urxvtd

# start polybar
exec_always --no-startup-id $HOME/.config/polybar/launch.sh

# start kde connect
exec --no-startup-id /usr/lib/kdeconnectd

# invoke i3lock
bindsym $mod+x exec i3lock

# move focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad

# Show the scratchpad
bindsym $mod+minus scratchpad show

# remove title bars
for_window [class=".*"] border pixel 2
for_window [class="VirtualBox Manager"] border normal 1
for_window [class="VirtualBox Machine"] border normal 1

# set gaps
#gaps top 43
gaps inner 20

# set smart gaps
#smart_gaps on

# ws 4 no gaps
workspace $ws4 gaps inner 0

# set desktop bg
exec_always --no-startup-id feh --bg-fill /home/ayush/.config/i3/wall.jpg

# start picom, config: .config/picom.conf
exec --no-startup-id dbus-launch picom --experimental-backend

# start dunst, config: .config/dunst/dunstrc
exec --no-startup-id dunst -config .config/dunst/dunstrc

# start nextcloud
# exec sleep 5; nextcloud --background

# start nm-applet
exec --no-startup-id nm-applet

# dunst keybinds
bindsym Ctrl+space exec dunstctl close
bindsym Ctrl+Shift+space exec dunstctl close-all

# take screenshot using gnome-screenshot
#bindsym $mod+s exec gnome-screenshot -c
bindsym --release $mod+Control+s exec "import -format png -window root /tmp/ss.png && xclip -i /tmp/ss.png -selection c -t image/png && mv /tmp/ss.png ~/Pictures/Screenshots/Screenshot-$(date +%s).png"

# drag area for gnome-screenshot
#bindsym --release $mod+Shift+s exec gnome-screenshot -a -c
bindsym --release $mod+Shift+s exec "import -format png /tmp/ss.png && xclip -i /tmp/ss.png -selection c -t image/png && mv /tmp/ss.png ~/Pictures/Screenshots/Screenshot-$(date +%s).png"


# Vol Up
bindsym XF86AudioRaiseVolume exec pamixer --allow-boost -i 5

# Vol Down
bindsym XF86AudioLowerVolume exec pamixer --allow-boost -d 5

# Media Controls! Through playerctl
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous

# Brightness Up
bindsym XF86MonBrightnessUp exec sudo /usr/bin/light -A 10

# Brightness Down
bindsym XF86MonBrightnessDown exec sudo /usr/bin/light -U 10

# Custom Bindings for Applications
# Mod + n brave
bindsym $mod+n exec brave

# Mod + m pantheon files
bindsym $mod+m exec io.elementary.files

# Assign windows to workspaces
assign [class="Brave-browser"] 3
assign [class="Steam"] 4
assign [class="discord"] 10

# make notification windows floating
for_window [window_role="pop-up"] floating enable
for_window [window_role="task_dialog"] floating enable

# fix notifs for ms teams
for_window [title="Microsoft Teams Notification"] floating enable

# pavucontrol as floating
for_window [class="Pavucontrol"] floating enable
