### sway settings

# logo key. Use Mod1 for Alt.
set $mod Mod4

# home row direction keys, like vim
set $left h
set $down j
set $up k
set $right l

set $term kitty
set $menu rofi -show combi | xargs swaymsg exec --

# wallpaper
output * bg ~/syncthing/default/photos/wallpaper.jpg fill

### daemons

# notification daemon
exec --no-startup-id mako

# display orientation
exec --no-startup-id kanshi

# polkit
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1

# applets
exec nm-applet --indicator
exec blueman-tray

### gtk settings

set $gnome-schema org.gnome.desktop.interface

exec_always {
	gsettings set $gnome-schema gtk-theme 'Materia-dark'
	gsettings set $gnome-schema icon-theme 'Papirus-Dark'
}

### idle configuration

# timeout
exec swayidle -w \
    timeout 300 'playerctl -a pause && swaylock' \
    timeout 600 'swaymsg "output * dpms off"' \
    before-sleep 'playerctl -a pause' \
    lock 'swaylock' \
    resume 'swaymsg "output * dpms on"'

# screen lock
bindsym Ctrl+Shift+l exec "playerctl -a pause; \
    systemctl suspend && \
    swaylock"

# screen lock
bindsym Ctrl+Alt+l exec "playerctl -a pause; \
    swaylock

### input configuration

# fcitx5
exec --no-startup-id fcitx5 -d 

### key bindings

# start terminal
bindsym $mod+Return exec $term

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

# start your launcher
bindsym $mod+q exec $menu

# drag floating windows by holding down $mod and left mouse button.
# resize them with right mouse button + $mod.
# despite the name, also works for non-floating windows.
# change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
floating_modifier $mod normal

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

# exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'

# move your focus around
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
# or use $mod+[up|down|left|right]
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

# move the focused window with the same, but add Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right

# ditto, with arrow 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

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

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

# splits
bindsym $mod+b splith
bindsym $mod+v splitv

# switch the current container between different layout styles
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

# make the current focus fullscreen
bindsym $mod+f fullscreen

# toggle the current focus between tiling and floating mode
bindsym $mod+Shift+space floating toggle

# swap focus between the tiling area and the floating area
bindsym $mod+space focus mode_toggle

# move focus to the parent container
bindsym $mod+a focus parent

# move the currently focused window to the scratchpad
bindsym $mod+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 $mod+minus scratchpad show

mode "resize" {
    # left will shrink the containers width
    # right will grow the containers width
    # up will shrink the containers height
    # down will grow the containers height
    bindsym $left resize shrink width 10px
    bindsym $down resize grow height 10px
    bindsym $up resize shrink height 10px
    bindsym $right resize grow width 10px

    # ditto, with arrow keys
    bindsym Left resize shrink width 10px
    bindsym Down resize grow height 10px
    bindsym Up resize shrink height 10px
    bindsym Right resize grow width 10px

    # return to default mode
    bindsym Return mode "default"
    bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"


# waybar
bar {
    swaybar_command waybar
}

### special keys

# volume
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5%
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%

# mute
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle

# keyboard brightness
bindsym XF86MonBrightnessDown exec brightnessctl set 10%-
bindsym XF86MonBrightnessUp exec brightnessctl set +10%

# music controls
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
# bindsym XF86AudioPlay exec mpc toggle
# bindsym XF86AudioNext exec mpc next
# bindsym XF86AudioPrev exec mpc prev

# run menu
bindsym XF86Search exec $menu

# screenshot
bindsym Ctrl+Shift+p exec ~/scripts/screenshot

### gaps
gaps inner 25
# smart_gaps on
bindsym $mod+Shift+d border toggle

# notifications
bindsym $mod+m exec makoctl dismiss
bindsym $mod+n exec makoctl restore

### styles

# class			border	backgr	text
client.focused		#333333	#333333	#FFFFFF
client.focused_inactive	#222222	#222222	#AAAAAA
client.unfocused	#222222	#222222 #AAAAAA

# font
font pango: IBMPlexMono Regular 10

# wacom
input "1386:770:Wacom_Intuos_PT_S_Pen" {
    accel_profile "flat"
    pointer_accel 0
    map_to_output "Goldstar Company Ltd LG IPS QHD 201NTPCGD520"
}

input "1386:770:Wacom_Intuos_PT_S_Finger" {
    click_method clickfinger
    drag enabled
    scroll_method two_finger
    tap enabled
    accel_profile adaptive
}

input "1386:770:Wacom_Intuos_PT_S_Pad" {
    click_method clickfinger
    drag enabled
    scroll_method two_finger
    tap enabled
    accel_profile adaptive
    dwt enable
}

# sway-session.target
exec_always systemctl --user start sway-session.target

include /etc/sway/config.d/*
