Add systray

This commit is contained in:
Stephan Raabe
2023-12-26 10:56:06 +01:00
parent 48b298601a
commit 97cfa63fc5
12 changed files with 70 additions and 7 deletions

View File

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

View File

@@ -1,7 +1,7 @@
#!/bin/bash
_getHeader "$name" "$author"
echo "Hide the bluetooth icon in ML4W waybar themes."
echo "Hide or show the bluetooth icon in ML4W waybar themes."
# Define File
targetFile1="$HOME/dotfiles/waybar/themes/ml4w/config"

View File

@@ -0,0 +1,2 @@
name="Toggle Systray"
order=1

View File

@@ -0,0 +1,50 @@
#!/bin/bash
_getHeader "$name" "$author"
echo "Hide or Show the systray in ML4W waybar themes."
# Define File
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
# Define Markers
startMarker="\/\/ START TRAY TOOGLE"
endMarker="\/\/ END TRAY TOOGLE"
# Define Replacement Template
customtemplate="VALUE\"tray\","
# Select Value
customvalue=$(gum choose "SHOW" "HIDE")
if [ ! -z $customvalue ]; then
if [ "$customvalue" == "SHOW" ] ;then
customvalue=""
else
customvalue="//"
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
# Reload Waybar
setsid $HOME/dotfiles/waybar/launch.sh 1>/dev/null 2>&1 &
_goBack
else
echo "ERROR: Define a value."
sleep 2
_goBack
fi