Hyprland-dotfiles/hypr/settings/modules/waybar/workspaces/module.sh

32 lines
697 B
Bash
Raw Normal View History

2023-12-18 14:33:29 -05:00
#!/bin/bash
_getHeader "$name" "$author"
# Define File
targetFile="$HOME/dotfiles/waybar/modules.json"
2023-12-27 17:19:24 -05:00
settingsFile="$HOME/dotfiles/.settings/waybar_workspaces"
2023-12-18 14:33:29 -05:00
# Define Markers
2023-12-27 17:19:24 -05:00
startMarker="START WORKSPACE"
endMarker="END WORKSPACES"
2023-12-18 14:33:29 -05:00
# Define Replacement Template
customtemplate="\"*\": VALUE"
# Select Value
customvalue=$(gum choose 5 6 7 8 9 10)
2023-12-20 05:58:05 -05:00
if [ ! -z $customvalue ] ;then
2023-12-18 14:33:29 -05:00
2023-12-27 17:19:24 -05:00
# Replace in Template
customtext="${customtemplate/VALUE/"$customvalue"}"
2023-12-18 14:33:29 -05:00
2023-12-27 17:19:24 -05:00
_replaceInFile $startMarker $endMarker $customtext $targetFile
_writeSettings $settingsFile $customtext
2023-12-18 14:33:29 -05:00
# Reload Waybar
2023-12-18 22:32:25 -05:00
setsid $HOME/dotfiles/waybar/launch.sh 1>/dev/null 2>&1 &
2023-12-18 14:33:29 -05:00
_goBack
2023-12-20 05:58:05 -05:00
else
_goBack
fi