hyprland-dotfiles/hypr/settings/modules/waybar/appslabel/module.sh

34 lines
845 B
Bash
Raw Normal View History

2023-12-18 19:33:29 +00:00
#!/bin/bash
_getHeader "$name" "$author"
2024-01-11 15:03:36 +00:00
echo "Define the label of the Apps Starter (Default is Apps). "
2023-12-18 19:33:29 +00:00
# Define File
targetFile="$HOME/dotfiles/waybar/modules.json"
2023-12-27 22:19:24 +00:00
settingsFile="$HOME/dotfiles/.settings/waybar_appslabel"
2023-12-18 19:33:29 +00:00
# Define Markers
2023-12-27 22:19:24 +00:00
startMarker="START APPS LABEL"
endMarker="END APPS LABEL"
2023-12-18 19:33:29 +00:00
# Define Replacement Template
customtemplate="\"format\": \"VALUE\","
# Select Value
customvalue=$(gum input --placeholder="Define the Apps label")
if [ ! -z $customvalue ]; then
# Replace in Template
customtext="${customtemplate/VALUE/"$customvalue"}"
2023-12-19 15:48:01 +00:00
_replaceInFile $startMarker $endMarker $customtext $targetFile
2023-12-27 22:19:24 +00:00
_writeSettings $settingsFile $customtext
2023-12-19 15:48:01 +00:00
# Reload Waybar
setsid $HOME/dotfiles/waybar/launch.sh 1>/dev/null 2>&1 &
_goBack
2023-12-18 19:33:29 +00:00
else
echo "ERROR: Define a value."
sleep 2
_goBack
fi