builtin-programs/keyboard-shortcuts.folk

# When sudo is removed in the exec commands below you get:
# Error in builtin-programs/keyboard-shortcuts.folk, match m10029:6: Failed to restart folk.service: Interactive authentication required.
#
# TODO: Figure out how to do this with less powerful permissions than `sudo`. (@cwervo)

# Keyboard shortcuts
# ---
#  Alt + Esc: Restart Folk
#  Alt + F1: Stop Folk completely (note: need to ssh to restart Folk)

# Alt-Esc on most keyboards
Subscribe: keyboard /k/ claims key Meta_Escape is down with /...options/ {
	puts "==== Folk restarting ... ===="
    exec sudo systemctl restart folk
}

# Console_1 corresponds to Alt-F1 on most keyboards
Subscribe: keyboard /k/ claims key Console_1 is down with /...options/ {
	puts "==== Stopping Folk. ===="
	puts "===="
	puts "     Run `make sync-restart` on your laptop or SSH into [info hostname] to restart Folk ===="
	puts "===="
	exec sudo systemctl stop folk
        Exit! 0
}