# set modifier
set $super Mod4
set $alt Mod1

# set font
font pango: BlexMono Nerd Font Book 8

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

# automatically putting workspaces on specific screens
workspace 1 output eDP-1
workspace 2 output VGA-1
workspace 3 output eDP-1
workspace 4 output VGA-1
workspace 5 output eDP-1
workspace 6 output VGA-1
workspace 7 output eDP-1
workspace 8 output VGA-1


# window rules, you can find the window class using xprop
for_window [class=".*"] border pixel 5
assign [class=URxvt|Tilix|Telegram] 1
assign [class=Google-chrome|Firefox|Brave] 3
assign [class=Code|Goland*|Pycharm*|Neovim] 5
assign [class=Slack|Thunderbird|libreoffice*] 5
assign [class=Kdocker|Spotify|Vlc|mpv|Xfburn|Gimp*|Inkscape|Zoom] 5
assign [class=GParted] 6
assign [class=Virtual-Manager] 7
for_window [class=Firefox|Brave|Google-Chrome instance=DTA] floating enable
for_window [class=Firefox|Brave|Google-Chrome window_role=Preferences] floating enable
for_window [class=Firefox|Brave|Google-Chrome window_role=Options] floating enable
for_window [class=Firefox|Brave|Google-Chrome window_role=About] floating enable
for_window [window_role=pop-up] floating enable
for_window [window_role=bubble] floating enable
for_window [class=Telegram] resize set 300 300
for_window [class=Bluemail|Telegram|Thunderbird|Slack|URxvt|Firefox|Brave|Google-Chrome|Tilix|Code|Goland*|Pycharm*|libreoffice*|Gimp*|Inkscape|Vlc] focus
for_window [class=keepassxc|feh] floating enable

# autostart
exec --no-startup-id nm-applet
exec --no-startup-id polybar -rq -c $HOME/.config/polybar/config.ini top &
exec --no-startup-id xsettingsd &
exec --no-startup-id compton -b
exec --no-startup-id source ~/.fehbg
exec --no-startup-id /home/kiennt/Apps/Telegram/Telegram
exec --no-startup-id tilix
exec --no-startup-id google-chrome

# start a terminal
bindsym $super+Return exec tilix
bindsym $super+d exec rofi -show drun
bindsym Print exec scrot 'Cheese_%a-%d%b%y_%H.%M.png' -e 'viewnior ~/$f'
bindsym $super+l exec betterlockscreen -l blur
bindsym $super+Shift+w exec firefox
bindsym $super+Shift+f exec thunar

# change volume
bindsym $alt+u exec amixer -D pulse sset Master 5%+
bindsym $alt+d exec amixer -D pulse sset Master 5%-
bindsym $alt+m exec pactl set-sink-mute 0 toggle

# kill focused window
bindsym $super+c kill
bindsym $alt+F4 kill

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

# move focused window
bindsym $super+Shift+Left move left
bindsym $super+Shift+Down move down
bindsym $super+Shift+Up move up
bindsym $super+Shift+Right move right

# split in horizontal orientation
bindsym $super+h split h

# split in vertical orientation
bindsym $super+v split v

# enter fullscreen mode for the focused container
bindsym $super+f fullscreen toggle

# change container layout split
bindsym $super+s layout toggle split

# toggle tiling / floating
bindsym $super+space floating toggle

# change focus between tiling / floating windows
bindsym $super+Shift+space focus mode_toggle

# switch to workspace
bindsym $alt+Control+Right workspace next
bindsym $alt+Control+Left workspace prev
bindsym $super+1 workspace 1
bindsym $super+2 workspace 2
bindsym $super+3 workspace 3
bindsym $super+4 workspace 4
bindsym $super+5 workspace 5
bindsym $super+6 workspace 6
bindsym $super+7 workspace 7
bindsym $super+8 workspace 8

# move focused container to workspace
bindsym $super+Shift+1 move container to workspace 1
bindsym $super+Shift+2 move container to workspace 2
bindsym $super+Shift+3 move container to workspace 3
bindsym $super+Shift+4 move container to workspace 4
bindsym $super+Shift+5 move container to workspace 5
bindsym $super+Shift+6 move container to workspace 6
bindsym $super+Shift+7 move container to workspace 7
bindsym $super+Shift+8 move container to workspace 8

# move focused container to next/previous workspace
bindsym $alt+Control+Shift+Right move container to workspace next
bindsym $alt+Control+Shift+Left move container to workspace prev

# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $super+Shift+r restart
# reload i3
bindsym $super+Shift+c reload

# exit i3
bindsym $super+q exec "i3-nagbar -t warning -m 'Really, exit?' -b 'Yes' 'i3-msg exit'"

# resize window (you can also use the mouse for that)
mode "resize" {
        bindsym Left resize shrink width 5 px or 5 ppt
        bindsym Down resize grow height 5 px or 5 ppt
        bindsym Up resize shrink height 5 px or 5 ppt
        bindsym Right resize grow width 5 px or 5 ppt
        bindsym Return mode "default"
}
bindsym $super+r mode "resize"

set_from_resource $fg foreground
set_from_resource $bg background

# class                 border  backgr. text indicator child_border
client.focused          $bg     $bg     $fg  $bg       $bg
client.focused_inactive $bg     $bg     $fg  $bg       $bg
client.unfocused        $bg     $bg     $fg  $bg       $bg
client.urgent           $bg     $bg     $fg  $bg       $bg
client.placeholder      $bg     $bg     $fg  $bg       $bg

# gaps
# gap variable
set $inner 20
set $outer 10
gaps inner $inner
gaps outer $outer

# rounded corners
border_radius 10

# toggle gaps
bindsym $super+g exec compton; gaps inner all set $inner; gaps outer all set $outer
bindsym $super+Ctrl+g exec compton; gaps inner all set 0; gaps outer all set 0

# reload
exec_always--no-startup-id xrandr --output VGA-1 --auto --right-of eDP-1
exec_always --no-startup-id pkill compton && compton --config ~/.config/compton.conf
exec_always xrdb --merge ~/.Xresources
exec_always --no-startup-id  bash ~/.scripts/dunst_xr_theme_changer.sh && \
    dunst -conf ~/.config/dunst/dunstrc_xr_colors &
#exec_always --no-startup-id hsetroot -solid "$fg"
exec_always --no-startup-id feh --bg-fill ~/Pictures/diogo-nunes-Wa9ilX9XYOI-unsplash.jpg
exec_always --no-startup-id bash ~/.scripts/launch_polybar.sh
