set $mod Mod4
set $term kitty
set $menu kickoff
set $lock swaylock

include ~/.config/sway/config.d/*

# scale internal display
# output eDP-1 scale 1.5
# output * scale 1.25

# notification daemon
exec mako

# redshift
exec wlsunset -l 53.5 -L 10.0

# polkit
exec /usr/bin/lxqt-policykit-agent

focus_follows_mouse no

default_border pixel 2
default_floating_border pixel 2
gaps inner 10
gaps outer 5

# enable gnome keyring
exec dbus-update-activation-environment --all
exec eval $(gnome-keyring-daemon --start)
exec export SSH_AUTH_SOCK

exec swayidle -w \
    timeout 300 '$lock -f'\
    timeout 310 'swaymsg "output * power off"'\
    resume 'swaymsg "output * power on"' \
    before-sleep $lock

bindsym $mod+Shift+Ctrl+l exec $lock
exec swaybg -c#000000 -m solid_color

bindsym $mod+Return exec $term
bindsym $mod+Shift+Return exec $term -e zsh -ic 'rosterm'
bindsym $mod+d exec $menu --from-path --from-file "$HOME/.config/kickoff/custom_commands.csv"

bindsym $mod+Shift+r restart
bindsym $mod+Shift+c reload
bindsym $mod+Shift+q kill

bindsym $mod+Shift+s exec grim -g "$(slurp)" - | swappy -f -

mode "$mode_exit" {
    bindsym l exec --no-startup-id $lock, mode "default"
    bindsym o exec --no-startup-id swaymsg exit, mode "default"
    bindsym r exec --no-startup-id reboot, mode "default"
    bindsym s exec --no-startup-id systemctl poweroff -i, mode "default"
    bindsym Escape mode "default"
    bindsym Return mode "default"
}
bindsym $mod+Shift+e mode "$mode_exit"

mode "$mode_resize" {
    bindsym {
        h resize shrink width
        j resize grow height
        k resize shrink height
        l resize grow width
        Escape mode "default"
    }
}
bindsym $mod+r mode "$mode_resize"

bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10

bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10

bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right

bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right

bindsym $mod+Ctrl+h move workspace to output left
bindsym $mod+Ctrl+j move workspace to output down
bindsym $mod+Ctrl+k move workspace to output up
bindsym $mod+Ctrl+l move workspace to output right

bindsym Control_R floating toggle

bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl s 10%-
bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl s +10%

bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5%
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5%
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle

# screenshot
bindsym Print exec "mkdir -p screenshots;slurp | grim -g - $HOME/screenshots/$(date +'%d-%m-%Y_%H-%M-%S').png"

bindsym $mod+v split h
bindsym $mod+s split v
bindsym $mod+a focus parent
bindsym $mod+f fullscreen toggle

bar {
    position top
    swaybar_command waybar
}

# switch keyboard layouts with right ctrl key
input type:keyboard {
    xkb_layout us,de
    xkb_options grp:win_space_toggle
}

input type:touchpad {
    tap enabled
    natural_scroll enabled
}
input type:pointer {
    accel_profile flat
    pointer_accel 0.6
}
#                       #border #BG     #text   #indica #child_border
client.focused          #ca9ee6 #ca9ee6 #ca9ee6 #ea999c #81c8be
client.focused_inactive #000000 #000000 #c6d0f5 #ea999c #232634
client.unfocused        #000000 #000000 #c6d0f5 #ea999c #232634

floating_modifier $mod

exec "systemctl --user import-environment {,WAYLAND_}DISPLAY SWAYSOCK; systemctl --user start sway-session.target"
exec swaymsg -t subscribe '["shutdown"]' && systemctl --user stop sway-session.target

# enable automatic display arrangements
exec_always "systemctl --user restart kanshi.service"
