# i3 config file (v4)
# Please see http://i3wm.org/docs/userguide.html for a complete reference!

# set modifier
set $super Mod4
set $alt Mod1

################################
### Commonly Used Variables: ###
################################
# - Below defined are some of the very common variables that users like to customise
# - For Keybindings search: Commonly Used Keybindings in this document
# - Make sure that you give the absolute path to the binary / program / executable
# - You may specify any additional arguments required by the binary / executable

### Wallpaper: ###
# - You need to specify homescreen wallpaper using azote

set $lockScreenWallpaper /usr/share/wallpapers/garuda-wallpapers/Dr460nized\ Honeycomb.png

### Applications: ###

set $preferredTerminalEmulator /usr/bin/kitty
set $preferredBrowser /usr/bin/firedragon
set $preferredFileManager /usr/bin/thunar
set $preferredMailClient /usr/bin/geary
set $preferredTextEditor /usr/bin/geany
set $preferredScreenCaptureTool /usr/bin/flameshot gui

###########################################
### Commonly Used Application Keybinds: ###
###########################################

bindsym $super+F1 exec $preferredBrowser;focus
bindsym $super+F2 exec $preferredMailClient;focus
bindsym $super+F3 exec $preferredFileManager;focus
bindsym $super+F4 exec $preferredTextEditor;focus

### Screen Capturing & Print Screen: ###

bindsym $super+F9 exec $preferredScreenCaptureTool
bindsym Print exec --no-startup-id $preferredScreenCaptureTool

### Start a Terminal Emulator: ###
# - You can change the preferredTerminalEmulator variable
# - Terminal can also be started using their individual keybindings

bindsym $super+Return exec $preferredTerminalEmulator
bindsym $super+t exec kitty
bindsym $super+SHIFT+i exec ~/.local/bin/shcts  # open cheatsheet

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

#autostart
exec --no-startup-id ~/.fehbg
exec --no-startup-id copyq
exec --no-startup-id dunst
exec --no-startup-id dex -a -s /etc/xdg/autostart/:~/.config/autostart/
exec --no-startup-id nm-applet
#exec --no-startup-id lxrandr
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec --no-startup-id xfce4-power-manager
exec_always --no-startup-id setcursor
exec --no-startup-id ~/.local/bin/shcts    # comment stop autostart cheatsheet
#exec_always --no-startup-id ${HOME}/.config/polybar/launch.sh
exec_always --no-startup-id numlockx on
exec blueberry-tray
exec --no-startup-id java -Xmx1024m -jar "/opt/xdman/xdman.jar" -m
exec --no-startup-id ~/.local/bin/fastfetch-garuda

# hide/unhide i3status bar
bindsym $super+m bar mode toggle

# start dmenu (a program launcher)
bindsym $super+Shift+d exec i3-dmenu-desktop --dmenu="dmenu -i -fn 'Noto Sans:size=20'"

# start rofi (a program launcher) change modus Ctrl + Tab
bindsym $super+d exec rofi -show run

# Garuda Linux install
bindsym $super+i exec sudo -E calamares

# Lock screen
bindsym $super+l exec i3lock -i $lockScreenWallpaper

# Screen brightness controls
bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl set +5%; exec notify-send 'brightness up 5%'
bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl set 5%-; exec notify-send 'brightness down 5%'

# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
#change volume
#bindsym XF86AudioRaiseVolume exec pulseaudio-ctl up
#bindsym XF86AudioLowerVolume exec pulseaudio-ctl down
#bindsym XF86AudioMute exec pulseaudio-ctl mute


# music control
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioStop exec playerctl stop

# Print screen
bindsym $super+Print exec --no-startup-id "flameshot gui"

# kill focused window
bindsym $super+c kill
bindsym $super+q 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

# toggle sticky
bindsym $super+Shift+s sticky toggle

# focus the parent container
bindsym $super+a focus parent

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

# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $super+minus scratchpad show

#navigate workspaces next / previous
bindsym $super+Ctrl+Right workspace next
bindsym $super+Ctrl+Left workspace prev


# 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 to workspace with focused container
bindsym $alt+Shift+1 move container to workspace 1; workspace 1
bindsym $alt+Shift+2 move container to workspace 2; workspace 2
bindsym $alt+Shift+3 move container to workspace 3; workspace 3
bindsym $alt+Shift+4 move container to workspace 4; workspace 4
bindsym $alt+Shift+5 move container to workspace 5; workspace 5
bindsym $alt+Shift+6 move container to workspace 6; workspace 6
bindsym $alt+Shift+7 move container to workspace 7; workspace 7
bindsym $alt+Shift+8 move container to workspace 8; workspace 8

# Swipe gestures
bindsym --whole-window button19 workspace prev
bindsym --whole-window button17 workspace next

# reload the configuration file
bindsym $super+Shift+c reload

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

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

# change borders
bindsym $super+u border none
bindsym $super+y border pixel 1
bindsym $super+n border normal


# panel
# Start i3bar to display a workspace bar

bar {
	status_command exec /usr/bin/net-speed.sh
	font pango:source code pro 16
	separator_symbol "|"
	#strip_workspace_numbers yes|no
	#strip_workspace_name yes|no
	colors {
    background #181b28
    statusline #161925
    separator  #2f343f
    
    # colour of          border   background text
    focused_workspace    #4C7899  #285577    #FFFFFF
    active_workspace     #333333  #222222    #FFFFFF
    inactive_workspace   #333333  #222222    #888888
    urgent_workspace     #2F343A  #900000    #FFFFFF
    #binding_mode        #2F343A  #900000    #FFFFFF
    }

}

# Open specific applications in floating mode
for_window [title="alsamixer"] floating enable border pixel 1
for_window [class="calamares"] floating enable border normal
for_window [class="Clipgrab"] floating enable
for_window [title="File Transfer*"] floating enable
for_window [class="bauh"] floating enable
for_window [class="Galculator"] floating enable border pixel 1
for_window [class="GParted"] floating enable border normal
for_window [title="i3_help"] floating enable sticky enable border normal
for_window [class="Lightdm-settings"] floating enable
for_window [class="Lxappearance"] floating enable border normal
for_window [class="Garuda Settings Manager"] floating enable border normal
for_window [title="MuseScore: Play Panel"] floating enable
for_window [class="azote"] floating enable sticky enable border normal
for_window [class="Oblogout"] fullscreen enable
for_window [class="octopi"] floating enable
for_window [title="About Pale Moon"] floating enable
for_window [class="Pamac-manager"] floating enable
for_window [class="Pamac-updater"] floating enable
for_window [class="pamac-aur"] floating enable
for_window [class="Pavucontrol"] floating enable
for_window [class="Qtconfig-qt4"] floating enable border normal
for_window [class="qt5ct"] floating enable sticky enable border normal
for_window [class="qt6ct"] floating enable sticky enable border normal
#for_window [title="sudo"] floating enable border normal
for_window [class="Simple-scan"] floating enable border normal
for_window [class="(?i)System-config-printer.py"] floating enable border normal
for_window [class="Skype"] floating enable border normal
for_window [class="Timeshift-gtk"] floating enable border normal
for_window [class="(?i)virtualbox"] floating enable border normal
for_window [class="Xfburn"] floating enable
for_window [class="keepassxc"] floating enable
for_window [class="garuda-welcome"] floating enable

# window rules, you can find the window class using xprop
for_window [class=".*"] border pixel 4
assign [class=URxvt] 1
for_window [class=Viewnior|feh|Audacious|File-roller|Lxappearance|Lxtask|Pavucontrol|upgrade2ultimate.sh] floating enable
for_window [class=URxvt|firedragon|Geany|Evince|Soffice|libreoffice*|mpv|Ghb|Xfburn|Gimp*|Inkscape|Vlc|Lxappearance|Audacity] focus
for_window [class=Xfburn|GParted|System-config-printer.py|Lxtask|Pavucontrol|Exo-helper*|Lxrandr|Arandr] focus

# class                 border  backgr. text    indicator child_border
client.focused          #4c7899 #285577 #ffffff #2e9ef4   #285577
client.focused_inactive #333333 #5f676a #ffffff #484e50   #5f676a
client.unfocused        #333333 #222222 #888888 #292d2e   #222222
client.urgent           #2f343a #900000 #ffffff #900000   #900000
client.placeholder      #000000 #0c0c0c #ffffff #000000   #0c0c0c



#############################
### settings for i3-gaps: ###
#############################

# Set inner/outer gaps
gaps inner 0
gaps outer -2

# Additionally, you can issue commands with the following syntax. This is useful to bind keys to changing the gap size.
# gaps inner|outer current|all set|plus|minus <px>
# gaps inner all set 10
# gaps outer all plus 5

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

# Smart borders (draw borders around container only if it is not the only container on this workspace)
# on|no_gaps (on=always activate and no_gaps=only activate if the gap size to the edge of the screen is 0)
smart_borders 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 $super+Shift+g 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"
}

# Set shut down, restart and locking features
bindsym $super+0 mode "$mode_system"
set $mode_system (l)ock, (e)xit, switch_(u)ser, (s)uspend, (h)ibernate, (r)eboot, (Shift+s)hutdown
mode "$mode_system" {
    bindsym l exec --no-startup-id i3exit lock, mode "default"
    bindsym s exec --no-startup-id i3exit suspend, mode "default"
    bindsym u exec --no-startup-id i3exit switch_user, mode "default"
    bindsym e exec --no-startup-id i3exit logout, mode "default"
    bindsym h exec --no-startup-id i3exit hibernate, mode "default"
    bindsym r exec --no-startup-id i3exit reboot, mode "default"
    bindsym Shift+s exec --no-startup-id i3exit shutdown, mode "default"

    # exit system mode: "Enter" or "Escape"
    bindsym Return mode "default"
    bindsym Escape mode "default"
}
