#!/bin/bash # Get the list of custom keybindings keybindings=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings) # Clean up the keybindings list: remove square brackets, and strip quotes and spaces keybindings=$(echo "$keybindings" | sed 's/^\[\(.*\)\]$/\1/' | tr -d '[:space:]') # Loop through each custom keybinding path and print the details IFS=',' read -r -a keybinding_paths <<< "$keybindings" for path in "${keybinding_paths[@]}"; do # Remove both leading/trailing single and double quotes, and any spaces path=$(echo "$path" | sed 's/^"\(.*\)"$/\1/' | sed "s/^'\(.*\)'$/\1/" | sed 's/^[[:space:]]*//g' | sed 's/[[:space:]]*$//g') # Debugging: Print the path to check for hidden characters echo "DEBUG: Raw Keybinding Path: '$path'" # Make sure the path starts with a slash and is not empty if [[ "$path" != /* ]] || [[ -z "$path" ]]; then echo "Error: Path does not begin with a slash (/): '$path'" continue fi # Print the cleaned keybinding path echo "Keybinding Path: $path" # Query the details for the keybinding name=$(gsettings get org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:$path name) command=$(gsettings get org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:$path command) binding=$(gsettings get org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:$path binding) # Print the details if they're available echo " Name: $name" echo " Command: $command" echo " Binding: $binding" echo "--------------------------" done