# 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 http://i3wm.org/docs/userguide.html for a complete reference!
set $mod %mod%

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

# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8

# Before i3 v4.8, we used to recommend this one as the default:
# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap
# font, it doesn’t scale on retina/hidpi displays.

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

# start a terminal
#bindsym $mod+Return exec i3-sensible-terminal
%execst%bindsym $mod+Return exec st
%execghostty%bindsym $mod+Return exec ghostty

# kill focused window (Alt+F4)
bindsym Mod1+F4 kill

# rofi
bindsym $mod+space exec "rofi -show combi -combi-modi 'drun,run' -modi combi -combi-hide-mode-prefix -eh 1 -font '%rofifont %rofifontsize' -theme 'Arc-Dark' -theme-str 'window {width:35%;}' -theme-str 'listview {lines:8;}'"
bindsym $mod+BackSpace exec "rofi -show combi -combi-modi 'drun,run' -modi combi -combi-hide-mode-prefix -eh 1 -font '%rofifont %rofifontsize' -theme 'Arc-Dark' -theme-str 'window {width:35%;}' -theme-str 'listview {lines:8;}'"

# change focus
bindsym $mod+h focus left
bindsym $mod+k focus down
bindsym $mod+j 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+k move down
bindsym $mod+Shift+j 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+b split h

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

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

# change container layout (stacking, tabbed, toggle split)
bindsym $mod+n layout stacking
bindsym $mod+m layout tabbed
bindsym $mod+i layout toggle split

# toggle tiling / floating
bindsym $mod+Shift+e floating toggle

# change focus between tiling / floating windows
bindsym $mod+shift+space focus mode_toggle

# switch to workspace
workspace_layout tabbed
set $ws1 1
set $ws2 2
set $ws3 3
set $ws4 4
set $ws5 5
bindsym $mod+q workspace $ws1
bindsym $mod+w workspace $ws2
bindsym $mod+f workspace $ws3
bindsym $mod+a workspace $ws4
bindsym $mod+r workspace $ws5
bindsym $mod+Shift+n workspace next
bindsym $mod+Shift+p workspace prev

# move focused container to workspace
bindsym $mod+Shift+q move container to workspace $ws1; workspace $ws1
bindsym $mod+Shift+w move container to workspace $ws2; workspace $ws2
bindsym $mod+Shift+f move container to workspace $ws3; workspace $ws3
bindsym $mod+Shift+a move container to workspace $ws4; workspace $ws4
bindsym $mod+Shift+r move container to workspace $ws5; workspace $ws5

# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+F5 restart
# exit i3 (logs you out of your X session)
bindsym $mod+F4 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 (you can also use the mouse for that)
mode "resize" {
    # These bindings trigger as soon as you enter the resize mode
    bindsym l resize grow width 10 px or 10 ppt
    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

    # same bindings, but for the arrow keys
    bindsym Right resize grow width 10 px or 10 ppt
    bindsym Left resize shrink width 10 px or 10 ppt
    bindsym Up resize grow height 10 px or 10 ppt
    bindsym Down resize shrink height 10 px or 10 ppt

    # back to normal: Enter or Escape
    bindsym Return mode "default"
    bindsym Escape mode "default"
}
bindsym $mod+z mode "resize"

# pass mode: disalbe all keybindigs
mode "pass" {
    bindsym $mod+9 mode "default"
}
bindsym $mod+9 mode "pass"

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
  status_command i3blocks
  position top
}

set $Locker i3lock && sleep 1

set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
mode "$mode_system" {
    bindsym l exec --no-startup-id $Locker, mode "default"
    bindsym e exec --no-startup-id i3-msg exit, mode "default"
    bindsym s exec --no-startup-id $Locker && systemctl suspend, mode "default"
    bindsym h exec --no-startup-id $Locker && systemctl hibernate, mode "default"
    bindsym r exec --no-startup-id systemctl reboot, mode "default"
    bindsym Shift+s exec --no-startup-id systemctl poweroff -i, mode "default"

    # back to normal: Enter or Escape
    bindsym Return mode "default"
    bindsym Escape mode "default"
}

bindsym $mod+Pause mode "$mode_system"

# no border
for_window [class="^.*$"] border none
for_window [class="st-256color"] border 1pixel
for_window [class="Alacritty"] border 1pixel
for_window [class="XTerm"] border 1pixel
for_window [instance="ghostty"] border 1pixel
hide_edge_borders none
new_window 1pixel

# floating windows
for_window [window_role="pop-up"] floating enable
for_window [window_role="task_dialog"] floating enable
for_window [title="Preferences$"] floating enable
for_window [class="(?i)mplayer"] floating enable
for_window [class="feh"] floating enable
for_window [class="Wine"] floating enable
for_window [class="Peek"] stacking enable

# Volume
bindsym XF86AudioRaiseVolume exec "pamixer -i 5 --allow-boost;notify-send -u low $(pamixer --get-volume)'%'"
bindsym XF86AudioLowerVolume exec "pamixer -d 5 --allow-boost;notify-send -u low $(pamixer --get-volume)'%'"
bindsym XF86AudioMute exec "pamixer -t; if $(pamixer --get-mute); then notify-send -u critical 'mute'; else notify-send -u normal 'sound '$(pamixer --get-volume)'%'; fi"
bindsym %raisevol% exec "pamixer -i 5 --allow-boost;notify-send -u low $(pamixer --get-volume)'%'"
bindsym %lowervol% exec "pamixer -d 15 --allow-boost;notify-send -u low $(pamixer --get-volume)'%'"
bindsym %mute% exec "pamixer -t; if $(pamixer --get-mute); then notify-send -u critical 'mute'; else notify-send -u normal 'sound '$(pamixer --get-volume)'%'; fi"

# Brightness
bindsym XF86MonBrightnessUp exec "light -A 10"
bindsym XF86MonBrightnessDown exec "light -U 10"

# Rotate screen
bindsym $mod+Control+Shift+Up exec "xrandr --output eDP-1 --rotate normal"
bindsym $mod+Control+Shift+Down exec "xrandr --output eDP-1 --rotate inverted"
bindsym $mod+Control+Shift+Left exec "xrandr --output eDP-1 --rotate left"
bindsym $mod+Control+Shift+Right exec "xrandr --output eDP-1 --rotate right"

# Fixed workspace
assign [class="Nightly"] $ws1
for_window [class="Nightly"] layout tabbed
assign [class="firefox"] $ws1
for_window [class="firefox"] layout tabbed
assign [class="Firefox-esr"] $ws1
for_window [class="Firefox-esr"] layout tabbed
assign [class="qutebrowser"] $ws1
for_window [class="qutebrowser"] layout tabbed

assign [class="Chromium"] $ws4
for_window [class="Chromium"] layout tabbed

assign [class="Viewnior"] $ws5
for_window [class="Viewnior"] layout default

assign [class="MuPDF"] $ws5
for_window [class="MuPDF"] layout default

assign [class="Zathura"] $ws5
for_window [class="Zathura"] layout default

assign [class="thunderbird-nightly"] $ws3
assign [class="Darktable"] $ws3
assign [class="mpv"] $ws3
assign [class="Gthumb"] $ws3
assign [class="Gimp"] $ws4
assign [class="VirtualBox"] $ws5
assign [class="libreoffice-startcenter"] $ws4
assign [class="libreoffice-writer"] $ws4
assign [class="libreoffice-calc"] $ws4
assign [class="Soffice"] $ws4
assign [class="calibre"] $ws3
assign [class="Qemu-system-x86_64"] $ws5

# Theme
# <colorclass> <border> <background> <text> <indicator> <child_border>
client.focused #0088CC #0088CC #ffffff #dddddd
client.focused_inactive #333333 #333333 #888888 #292d2e
client.unfocused #333333 #333333 #888888 #292d2e
client.urgent #2f343a #900000 #ffffff #900000

# Mouse behavior
mouse_warping none
focus_follows_mouse no

# Autostart
no_focus [title="ranger"]
no_focus [title="fff"]
no_focus [instance="tasksh"]
no_focus [instance="additional"]
%execst%exec --no-startup-id i3-msg "workspace 2; append_layout ${HOME}/.config/i3/st-workspace.json"
%execghostty%exec --no-startup-id i3-msg "workspace 2; append_layout ${HOME}/.config/i3/terminal-workspace.json"
exec --no-startup-id dunst
%browser%exec --no-startup-id "qutebrowser"
exec --no-startup-id ${HOME}/Script/fswatch.sh
%bluetooth%exec --no-startup-id blueman-applet
exec --no-startup-id ${HOME}/.config/systemd/user/changepaper.sh
%execst%exec --no-startup-id i3-msg 'workspace 2; exec st -n term-main'
%execst%exec --no-startup-id i3-msg 'workspace 2; exec st -n term-medium'
%execst%exec --no-startup-id i3-msg 'workspace 2; exec st -n term-small'
%execghostty%exec --no-startup-id i3-msg 'exec ghostty --x11-instance-name=term-main'
%execghostty%exec --no-startup-id i3-msg 'exec ghostty --x11-instance-name=term-medium'
%execghostty%exec --no-startup-id i3-msg 'exec ghostty --x11-instance-name=term-small'
