# i3 config file (v4)

set $mod Mod4
set $TERMINAL urxvt

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:Jetbrains Mono 10
# font pango:Terminus 10
# font Terminus
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

# start a terminal
bindsym $mod+Return exec "$TERMINAL &"
bindsym $mod+Shift+Return exec "$TERMINAL --role=floating &"

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

# start dmenu (a program launcher)
bindsym $mod+d exec --no-startup-id rofi -show drun   -theme themes/app-launcher
bindsym $mod+i exec --no-startup-id rofi -show window 
 

# move focused window
bindsym $mod+j move left
bindsym $mod+k move down
bindsym $mod+l move up
bindsym $mod+semicolon move right

# alternatively, you can use the cursor keys:
bindsym $mod+Left move left
bindsym $mod+Down move down
bindsym $mod+Up move up
bindsym $mod+Right move right

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

# split in vertical orientation
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

# 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 'Exit i3 and end your X session?' -b 'Yes' '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 j resize shrink width 10 px or 10 ppt
        bindsym k resize grow height 10 px or 10 ppt
        bindsym l resize shrink height 10 px or 10 ppt
        bindsym semicolon resize grow width 10 px or 10 ppt

        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

        bindsym Shift+j resize shrink width 1 px or 1 ppt
        bindsym Shift+k resize grow height 1 px or 1 ppt
        bindsym Shift+l resize shrink height 1 px or 1 ppt
        bindsym Shift+semicolon resize grow width 1 px or 1 ppt

        bindsym Shift+Left resize shrink width 1 px or 1 ppt
        bindsym Shift+Down resize grow height 1 px or 1 ppt
        bindsym Shift+Up resize shrink height 1 px or 1 ppt
        bindsym Shift+Right resize grow width 1 px or 1 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"

# custom shit

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

exec --no-startup-id i3-msg 'exec $TERMINAL; workspace 2; exec firefox;'
exec --no-startup-id feh --bg-scale ~/Wallpapers/seneca.jpg
exec --no-startup-id xrandr --output HDMI1 --right-of eDP1 
exec --no-startup-id xset dpms 500
exec --no-startup-id clipit
exec --no-startup-id xautolock -time 10 -locker "betterlockscreen -l dim"
exec --no-startup-id ~/bin/dunstwal
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1

exec telegram-desktop
# exec cantata

exec --no-startup-id sleep 4; i3-msg '[class="Mattermost"] move scratchpad; [class="Telegram"] move scratchpad'

exec_always --no-startup-id wal -R -n

# gaps
gaps inner 10

# settings
hide_edge_borders both
for_window [class="^.*"] title_format "%title [%class]"
for_window [class="^.*"] border pixel 0
for_window [class="Telegram"] gaps outer 0
for_window [class="Mattermost"] gaps outer 0
for_window [window_role="floating"] floating enable
for_window [class="QSyncthingTray"] floating enable
for_window [class="Thunderbird" window_type="normal"] floating enable, resize set 1024 768
for_window [class="Gnome-calculator"] floating enable
for_window [class="Blueberry.py"] floating enable
for_window [class="Pavucontrol"] floating enable

# keybinds
bindsym Mod1+Tab workspace back_and_forth
bindsym $mod+Tab focus right
bindsym $mod+Ctrl+Tab focus left
bindsym Print exec "~/bin/screenshot.sh"
bindsym $mod+Print exec "owo -s --fullscreen --no-cursor"

bindsym $mod+minus [class="Telegram"] scratchpad show
bindsym $mod+p [class="Mattermost"] scratchpad show

bindsym $mod+Delete exec rofi -modi system:$HOME/.config/rofi/scripts/powermenu.sh -show system -theme themes/system-menu
bindsym $mod+d exec rofi -modi system:$HOME/.config/rofi/scripts/appsmenu.sh
bindsym $mod+shift+Delete exec betterlockscreen -l

# audio binds
bindsym XF86AudioMicMute exec --no-startup-id pulseaudio-ctl mute-input 

bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume alsa_output.pci-0000_00_1f.3.analog-stereo +10% && pactl set-sink-mute 1 0
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume alsa_output.pci-0000_00_1f.3.analog-stereo -10% && pactl set-sink-mute 1 0
bindsym XF86AudioMute        exec --no-startup-id pactl set-sink-mute alsa_output.pci-0000_00_1f.3.analog-stereo toggle

# backlight binds
bindsym XF86MonBrightnessDown exec --no-startup-id ~/bin/brightness.sh down
bindsym XF86MonBrightnessUp exec --no-startup-id ~/bin/brightness.sh up

