Script to add reboot and shutdown shortcuts

I’m trying to write a script that adds reboot and shutdown shortcuts in Manjaro Cinnamon. Right now I’m getting:

❯ ./add_reboot_shortcut.sh
No such schema “org.gnome.settings-daemon.plugins.media-keys”
No such schema “org.gnome.settings-daemon.plugins.media-keys.custom-keybinding”
No such schema “org.gnome.settings-daemon.plugins.media-keys.custom-keybinding”
No such schema “org.gnome.settings-daemon.plugins.media-keys.custom-keybinding”

with the following script:

#!/bin/bash

# Define the command to reboot the system
COMMAND="sync && mount -o remount,ro -a && reboot"

# Define the shortcut key combination
KEYS="<Primary><Alt>r"

# Set the shortcut using the gsettings command
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command "$COMMAND"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name "Reboot System"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding "$KEYS"

5 posts were merged into an existing topic: Shortcut to restart the system