# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#

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

set $Alt   Mod1
set $Super Mod4
set $mod   Mod4

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

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

# move tiling windows via drag & drop by left-clicking into the title bar,
# or left-clicking anywhere into the window while holding the floating modifier.
tiling_drag modifier titlebar


###################################
# starting auxiliary applications #
###################################

# start notification daemon
exec --no-startup-id dunst

# start compositor and polybar, etc.
exec --no-startup-id picom -b

# clean up and start polybar
exec_always --no-startup-id killall polybar
exec_always --no-startup-id bash ~/.config/polybar/launch_polybar.sh

# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
# screen before suspend. Use loginctl lock-session to lock your screen.
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork -e -c 7070bb


###########################
# configuring keybindings #
###########################

# keymaps for i3 actions
## reload the i3 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'"
## lock screen
bindsym $mod+Escape exec i3lock --nofork -e -c 7070bb
## kill focused window
bindsym $mod+q kill
## start/kill compositor
bindsym $mod+Shift+f exec --no-startup-id picom -b
bindsym $mod+Shift+v exec pkill picom

# start rofi (a program launcher with fuzzy finder functionality)
bindsym $mod+d       exec --no-startup-id rofi -show combi
bindsym $mod+Shift+d exec --no-startup-id rofi -show run

# start keyboard layout selector
bindsym $mod+m  exec --no-startup-id i3-kb-layout-switcher.sh

# start a terminal
bindsym $mod+Return exec ghostty
bindsym $mod+t      exec ghostty -e tmux attach

# 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

# set splitting strategy
bindsym $mod+n split h
bindsym $mod+v split v

# toggle window between tiling/floating
bindsym $mod+$Alt+Shift+f floating toggle

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

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

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

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

# switch workspace
bindsym $mod+Shift+Tab workspace prev
bindsym $Alt+Shift+Tab workspace prev
bindsym $mod+Tab workspace next
bindsym $Alt+Tab workspace next

# move focused workspace to output
bindsym $mod+u move workspace to output left
bindsym $mod+i move workspace to output down
bindsym $mod+o move workspace to output up
bindsym $mod+p move workspace to output right

# take screenshots
bindsym $mod+s       exec --no-startup-id maim -suo | xclip -selection clipboard -t image/png
bindsym $mod+Shift+s exec --no-startup-id maim -suo "${HOME}/Pictures/screenshots/$(date '+%Y%m%d_%H%M%S').png"

# use pactl for media keys
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
bindsym XF86AudioPlay        exec --no-startup-id playerctl play-pause
bindsym XF86AudioPrev        exec --no-startup-id playerctl previous
bindsym XF86AudioNext        exec --no-startup-id playerctl next
bindsym XF86AudioStop        exec --no-startup-id playerctl stop
bindsym $mod+a               exec --no-startup-id bash audio-sink-switcher.sh


#########################
# configuring behaviour #
#########################

focus_follows_mouse no
focus_wrapping no
mouse_warping none

############################
# configuring presentation #
############################

# load background image
exec --no-startup-id feh --bg-fill ~/dotfiles/images/blaa.jpg

# window border style
default_border pixel 2
default_floating_border pixel 0
for_window [class=".*"] border pixel 1

# gaps between windows and screen border
gaps inner 4 px
gaps outer 2 px

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:VictorMonoNerdFont SemiBold 12

# defining colors
set $cyan       #15d7e5
set $magenta    #e02482
set $l_magenta  #fbaddd
set $d_blue     #001d42
set $indc_focus #a0a0ff
set $background #ffffff
set $text_focus #000000
set $transp     #00000000

# class                 border   backgr.      text         indicator  child_border
client.focused          $cyan    $background  $text_focus  $cyan      $cyan
client.focused_inactive $transp  $background  $text_focus  $transp    $transp
client.unfocused        $transp  $background  $text_focus  $transp    $transp
client.urgent           $transp  $background  $text_focus  $transp    $transp
client.placeholder      $transp  $background  $text_focus  $transp    $transp
client.background       $background

exec i3-msg workspace number $ws1


# window rules
for_window [title="Slay.*" class="steam.*"] floating enable

