This commit is contained in:
Stephan Raabe
2023-12-27 23:19:24 +01:00
parent 7a8de31afe
commit bd8fdde4d3
15 changed files with 282 additions and 148 deletions

View File

@@ -5,10 +5,11 @@ echo "Define the label of the Apps Starter"
# Define File
targetFile="$HOME/dotfiles/waybar/modules.json"
settingsFile="$HOME/dotfiles/.settings/waybar_appslabel"
# Define Markers
startMarker="\/\/ START APPS LABEL"
endMarker="\/\/ END APPS LABEL"
startMarker="START APPS LABEL"
endMarker="END APPS LABEL"
# Define Replacement Template
customtemplate="\"format\": \"VALUE\","
@@ -20,7 +21,8 @@ if [ ! -z $customvalue ]; then
# Replace in Template
customtext="${customtemplate/VALUE/"$customvalue"}"
_replaceInFile $startMarker $endMarker $customtext $targetFile
_writeSettings $settingsFile $customtext
# Reload Waybar
setsid $HOME/dotfiles/waybar/launch.sh 1>/dev/null 2>&1 &
_goBack

View File

@@ -1,2 +1,2 @@
name="Toggle Bluetooth"
name="Show/Hide Bluetooth"
order=1

View File

@@ -8,37 +8,27 @@ targetFile1="$HOME/dotfiles/waybar/themes/ml4w/config"
targetFile2="$HOME/dotfiles/waybar/themes/ml4w-blur/config"
targetFile3="$HOME/dotfiles/waybar/themes/ml4w-blur-bottom/config"
targetFile4="$HOME/dotfiles/waybar/themes/ml4w-bottom/config"
if [ ! -f $targetFile1 ] || [ ! -f $targetFile2 ] || [ ! -f $targetFile3 ] || [ ! -f $targetFile4 ] ;then
echo "ERROR: Target file not found."
sleep 2
_goBack
fi
settingsFile="$HOME/dotfiles/.settings/waybar_bluetooth"
# Define Markers
startMarker="\/\/ START BT TOOGLE"
endMarker="\/\/ END BT TOOGLE"
# Define Replacement Template
customtemplate="VALUE\"bluetooth\","
startMarker="START BT TOOGLE"
endMarker="END BT TOOGLE"
# Select Value
customvalue=$(gum choose "SHOW" "HIDE")
if [ ! -z $customvalue ]; then
if [ "$customvalue" == "SHOW" ] ;then
customvalue=""
customtext=" \"bluetooth\","
else
customvalue="//"
customtext=" \/\/\"bluetooth\","
fi
# Replace in Template
customtext="${customtemplate/VALUE/"$customvalue"}"
_replaceInFile $startMarker $endMarker $customtext $targetFile1
_replaceInFile $startMarker $endMarker $customtext $targetFile2
_replaceInFile $startMarker $endMarker $customtext $targetFile3
_replaceInFile $startMarker $endMarker $customtext $targetFile4
_writeSettings $settingsFile $customtext
# Reload Waybar
setsid $HOME/dotfiles/waybar/launch.sh 1>/dev/null 2>&1 &

View File

@@ -4,6 +4,7 @@ _getHeader "$name" "$author"
echo "Define the date format for the clock module. Default: {:%Y-%m-%d}"
# Define File
targetFile="$HOME/dotfiles/waybar/modules.json"
settingsFile="$HOME/dotfiles/.settings/waybar_date"
# Define Markers
startMarker="\/\/ START CLOCK FORMAT"
@@ -20,9 +21,11 @@ if [ ! -z $customvalue ]; then
customtext="${customtemplate/VALUE/"$customvalue"}"
_replaceInFile $startMarker $endMarker $customtext $targetFile
_writeSettings $settingsFile $customtext
# Reload Waybar
setsid $HOME/dotfiles/waybar/launch.sh 1>/dev/null 2>&1 &
_goBack
else
echo "ERROR: Define a value."
sleep 2

View File

@@ -1,2 +1,2 @@
name="Toggle Systray"
name="Show/Hide Systray"
order=1

View File

@@ -8,37 +8,27 @@ targetFile1="$HOME/dotfiles/waybar/themes/ml4w/config"
targetFile2="$HOME/dotfiles/waybar/themes/ml4w-blur/config"
targetFile3="$HOME/dotfiles/waybar/themes/ml4w-blur-bottom/config"
targetFile4="$HOME/dotfiles/waybar/themes/ml4w-bottom/config"
if [ ! -f $targetFile1 ] || [ ! -f $targetFile2 ] || [ ! -f $targetFile3 ] || [ ! -f $targetFile4 ] ;then
echo "ERROR: Target file not found."
sleep 2
_goBack
fi
settingsFile="$HOME/dotfiles/.settings/waybar_systray"
# Define Markers
startMarker="\/\/ START TRAY TOOGLE"
endMarker="\/\/ END TRAY TOOGLE"
# Define Replacement Template
customtemplate="VALUE\"tray\","
startMarker="START TRAY TOOGLE"
endMarker="END TRAY TOOGLE"
# Select Value
customvalue=$(gum choose "SHOW" "HIDE")
if [ ! -z $customvalue ]; then
if [ "$customvalue" == "SHOW" ] ;then
customvalue=""
customtext=" \"tray\","
else
customvalue="//"
customtext=" \/\/\"tray\","
fi
# Replace in Template
customtext="${customtemplate/VALUE/"$customvalue"}"
_replaceInFile $startMarker $endMarker $customtext $targetFile1
_replaceInFile $startMarker $endMarker $customtext $targetFile2
_replaceInFile $startMarker $endMarker $customtext $targetFile3
_replaceInFile $startMarker $endMarker $customtext $targetFile4
_writeSettings $settingsFile $customtext
# Reload Waybar
setsid $HOME/dotfiles/waybar/launch.sh 1>/dev/null 2>&1 &

View File

@@ -3,10 +3,11 @@ _getHeader "$name" "$author"
# Define File
targetFile="$HOME/dotfiles/waybar/modules.json"
settingsFile="$HOME/dotfiles/.settings/waybar_workspaces"
# Define Markers
startMarker="\/\/ START WORKSPACE"
endMarker="\/\/ END WORKSPACES"
startMarker="START WORKSPACE"
endMarker="END WORKSPACES"
# Define Replacement Template
customtemplate="\"*\": VALUE"
@@ -14,28 +15,17 @@ customtemplate="\"*\": VALUE"
# Select Value
customvalue=$(gum choose 5 6 7 8 9 10)
if [ ! -z $customvalue ] ;then
# Replace in Template
customtext="${customtemplate/VALUE/"$customvalue"}"
# Ensure that markers are in target file
if grep -s "$startMarker" $targetFile && grep -s "$endMarker" $targetFile; then
# Replace in Template
customtext="${customtemplate/VALUE/"$customvalue"}"
# Write into File
sed -i '/'"$startMarker"'/,/'"$endMarker"'/ {
//!d
/'"$startMarker"'/a\
'"$customtext"'
}' $targetFile
_replaceInFile $startMarker $endMarker $customtext $targetFile
_writeSettings $settingsFile $customtext
# Reload Waybar
setsid $HOME/dotfiles/waybar/launch.sh 1>/dev/null 2>&1 &
_goBack
else
echo "ERROR: Marker not found."
sleep 2
_goBack
fi
else
_goBack
fi