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

32 lines
697 B
Bash
Raw Normal View History

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