feat: add keyboard shortcuts status check and update status script
This commit is contained in:
parent
65dc9155bc
commit
db2beac40c
@ -4,6 +4,8 @@ source ~/dotfiles/bin/helpers/functions.sh
|
||||
source ~/dotfiles/bin/helpers/apt_packages.sh
|
||||
source ~/dotfiles/bin/helpers/vscode-extensions.sh
|
||||
source ~/dotfiles/bin/helpers/cargo_packages.sh
|
||||
source ~/dotfiles/bin/helpers/flatpak_packages.sh
|
||||
source ~/dotfiles/bin/helpers/keyboard_shortcuts.sh
|
||||
|
||||
# Check if parameter --verbose was passed
|
||||
if [ "$2" = "--verbose" ]; then
|
||||
@ -12,6 +14,10 @@ else
|
||||
verbose=false
|
||||
fi
|
||||
|
||||
echo -e "\n"
|
||||
|
||||
print_keyboard_shortcuts_status
|
||||
print_apt_status
|
||||
print_cargo_status
|
||||
print_flatpak_status
|
||||
print_vsc_status
|
||||
|
@ -45,3 +45,26 @@ ensure_keyboard_shortcuts() {
|
||||
|
||||
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "${new_bindings_string}"
|
||||
}
|
||||
|
||||
print_keyboard_shortcuts_status() {
|
||||
printfe "%s" "cyan" "Checking keyboard shortcuts..."
|
||||
echo -en "\r"
|
||||
|
||||
# Retrieve current custom keybindings
|
||||
existing_bindings=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings | tr -d "[]'")
|
||||
existing_count=$(echo $existing_bindings | tr -cd , | wc -c)
|
||||
|
||||
# Iterate over parsed JSON shortcuts
|
||||
for key_combination in $(echo "$shortcuts" | jq -r 'keys[]'); do
|
||||
command=$(echo "$shortcuts" | jq -r ".[\"$key_combination\"]")
|
||||
|
||||
if [[ ! $existing_bindings =~ "custom${index}" ]]; then
|
||||
printfe "%s\n" "red" " - Custom shortcut ${key_combination} is missing"
|
||||
fi
|
||||
|
||||
((index++))
|
||||
done
|
||||
|
||||
json_count=$(echo $shortcuts | jq 'keys | length')
|
||||
printfe "%s\n" "cyan" "Keyboard shortcuts $index/$json_count configured"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user