Autohide for waybar bluetooth module if no device detected

This commit is contained in:
Stephan Raabe 2024-02-27 13:15:56 +01:00
parent d7aabb2599
commit fec8e9fb96
7 changed files with 11 additions and 67 deletions

View File

@ -51,6 +51,11 @@ if [ -d ~/dotfiles/hypr/settings/modules/system/swaylock ] ;then
echo "~/dotfiles/hypr/settings/modules/system/swaylock removed."
fi
if [ -d ~/dotfiles/hypr/settings/modules/waybar/bluetooth ] ;then
rm -rf ~/dotfiles/hypr/settings/modules/waybar/bluetooth
echo "~/dotfiles/hypr/settings/modules/waybar/bluetooth removed."
fi
# Create default folder structure
xdg-user-dirs-update
echo "Default folders created..."

View File

@ -221,25 +221,6 @@ echo -e "${NONE}"
echo "Waybar ChatGPT restored."
fi
# Restore Waybar Bluetooth
targetFile1="$HOME/dotfiles-versions/$version/waybar/themes/ml4w/config"
targetFile2="$HOME/dotfiles-versions/$version/waybar/themes/ml4w-blur/config"
targetFile3="$HOME/dotfiles-versions/$version/waybar/themes/ml4w-blur-bottom/config"
targetFile4="$HOME/dotfiles-versions/$version/waybar/themes/ml4w-bottom/config"
targetFile5="$HOME/dotfiles-versions/$version/waybar/themes/ml4w-minimal/config"
settingsFile="$HOME/dotfiles/.settings/waybar_bluetooth"
if [ -f $settingsFile ] ;then
startMarker="START BT TOOGLE"
endMarker="END BT TOOGLE"
customtext="$(cat $settingsFile)"
_replaceInFile "$startMarker" "$endMarker" "$customtext" "$targetFile1"
_replaceInFile "$startMarker" "$endMarker" "$customtext" "$targetFile2"
_replaceInFile "$startMarker" "$endMarker" "$customtext" "$targetFile3"
_replaceInFile "$startMarker" "$endMarker" "$customtext" "$targetFile4"
_replaceInFile "$startMarker" "$endMarker" "$customtext" "$targetFile5"
echo "Waybar Bluetooth restored."
fi
# Restore Waybar Systray
targetFile1="$HOME/dotfiles-versions/$version/waybar/themes/ml4w/config"
targetFile2="$HOME/dotfiles-versions/$version/waybar/themes/ml4w-blur/config"

View File

@ -4,6 +4,8 @@ https://gitlab.com/stephan-raabe/dotfiles/-/releases/2.8.2
General:
- Force installation of sddm to fix theme issue with sddm-sugar-candy theme. sddm-git doesn't work
- Wallpaper script creates a blurred version with imagemagick for wlogout background
- snapshot.sh script check now for required timeshift and (optional) grub-btrfs packages
- Waybar Bluetooth module now hides automatically if no bluetooth device is detected
Version 2.8.1
https://gitlab.com/stephan-raabe/dotfiles/-/releases/2.8.1

View File

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

View File

@ -1,44 +0,0 @@
#!/bin/bash
_getHeader "$name" "$author"
echo "Hide or show the bluetooth module 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"
targetFile5="$HOME/dotfiles/waybar/themes/ml4w-minimal/config"
settingsFile="$HOME/dotfiles/.settings/waybar_bluetooth"
# Define Markers
startMarker="START BT TOOGLE"
endMarker="END BT TOOGLE"
# Select Value
customvalue=$(gum choose "SHOW" "HIDE" "DEFAULT")
if [ ! -z $customvalue ]; then
if [ "$customvalue" == "SHOW" ] ;then
customtext=" \"bluetooth\","
elif [ "$customvalue" == "DEFAULT" ] ;then
customtext=" \"bluetooth\","
else
customtext=" \/\/\"bluetooth\","
fi
_replaceInFile $startMarker $endMarker $customtext $targetFile1
_replaceInFile $startMarker $endMarker $customtext $targetFile2
_replaceInFile $startMarker $endMarker $customtext $targetFile3
_replaceInFile $startMarker $endMarker $customtext $targetFile4
_replaceInFile $startMarker $endMarker $customtext $targetFile5
_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
_goBack
fi

View File

@ -351,7 +351,8 @@
"format-disabled": "",
"format-off": "",
"interval": 30,
"on-click": "blueman-manager"
"on-click": "blueman-manager",
"format-no-controller": ""
},
// Other

View File

@ -306,7 +306,8 @@
"format-disabled": "",
"format-off": "",
"interval": 30,
"on-click": "blueman-manager"
"on-click": "blueman-manager",
"format-no-controller": ""
},
// Other