# Small screen. Default to Tabbed layout and slightly larger font
workspace_layout tabbed
font pango:monospace 13

# Nokia N900 hardware keyboard
input "1:1:TWL4030_Keypad" {
    xkb_model "nokiarx51"
    xkb_layout "us"
}

input "0:2005:TSC2005_touchscreen" map_to_output "DPI-1"

# provide a "nomod" mode since N900 does not have a ModX key
mode "nomod" {
    bindsym t exec $term; mode "default"
    bindsym q mode "default"
    bindsym d exec $menu; mode "default"
    bindsym Shift+q kill; mode "default"
    bindsym Shift+c reload; mode "default"
    bindsym f fullscreen; mode "default"
    bindsym Shift+space floating toggle; mode "default"
    bindsym a focus parent; mode "default"
}
bindsym Shift+space mode "nomod"

# Mouse actions
bindsym --release Shift+Left -- seat * cursor press button2
bindsym --release Shift+Right -- seat * cursor press button3
bindsym --release Shift+Up exec -- seat * cursor press button4
bindsym --release Shift+Down exec -- seat * cursor press button5

# Handle screenlock key (XF86ScreenSaver)
# Bind using code due to sway bug: https://github.com/swaywm/sway/issues/8438
bindcode --no-repeat 160 exec screenlock.sh

# Handle keypad slide
bindswitch keypad_slide:on exec screenlock.sh kbd_backlight 31 && screenlock.sh unlock
bindswitch keypad_slide:off exec screenlock.sh kbd_backlight 0

# TODO: Pressing the power button should offer choices including rebooting,
# shutdown, and suspend.
# At present, it will only lock and unlock the screen, same as XF86ScreenSaver
bindsym XF86PowerOff exec screenlock.sh

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

# Adjust display brightness using Shift + Volume buttons in 10% steps
bindsym Shift+XF86AudioRaiseVolume exec brightnessctl --quiet --class=backlight set +10%
bindsym Shift+XF86AudioLowerVolume exec brightnessctl --quiet --class=backlight set 10%-

# Idle configuration
exec swayidle timeout 120 'swaymsg exec screenlock.sh lock'
