Created
October 7, 2023 02:30
-
-
Save appel/0a7a90c980cf5465ea68ac657d3ddad6 to your computer and use it in GitHub Desktop.
Set Windows shortcuts on Gnome (Work in progress)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Function to set a keyboard shortcut | |
set_shortcut() { | |
local schema="$1" | |
local key="$2" | |
local value="$3" | |
local description="$4" | |
read -p "Do you want to set ${description}? (y/n): " -n 1 -r | |
echo # Newline | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
gsettings set "$schema" "$key" "$value" | |
echo "${description} set successfully." | |
else | |
echo "${description} skipped." | |
fi | |
} | |
echo "Setting up keyboard shortcuts to resemble Windows..." | |
# Set Super+Tab to show the Activities overview | |
set_shortcut "org.gnome.shell.keybindings" "toggle-overview" "['<Super>Tab']" "Super+Tab to show the Activities overview" | |
# Set Super to show All Apps using toggle-application-view | |
gsettings set org.gnome.mutter overlay-key '' 2> /dev/null | |
set_shortcut "org.gnome.shell.keybindings" "toggle-application-view" "['Super_L']" "Super key to open All Apps" | |
# Set Ctrl+Super+Right to switch to the desktop on the right | |
set_shortcut "org.gnome.desktop.wm.keybindings" "switch-to-workspace-right" "['<Ctrl><Super>Right']" "Ctrl+Super+Right to switch to the desktop on the right" | |
# Set Ctrl+Super+Left to switch to the desktop on the left | |
set_shortcut "org.gnome.desktop.wm.keybindings" "switch-to-workspace-left" "['<Ctrl><Super>Left']" "Ctrl+Super+Left to switch to the desktop on the left" | |
# Set Alt+P to pin the active window to all desktops (Note: this actually toggles the pinning state) | |
set_shortcut "org.gnome.shell.keybindings" "toggle-stick" "['<Alt>p']" "Alt+P to pin the active window to all desktops" | |
# Set Ctrl+Shift+Esc to open the System Monitor (You'll need to create a custom shortcut for this; the script provides the info but does not set it due to the complexity of custom shortcuts in GNOME.) | |
echo "For Ctrl+Shift+Esc to open the System Monitor, you'll need to set a custom shortcut manually in GNOME settings to run the 'gnome-system-monitor' command." | |
echo "Shortcut setup complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment