From fec8e9fb963e92351fca5d1139c70f95dfb28a55 Mon Sep 17 00:00:00 2001 From: Stephan Raabe Date: Tue, 27 Feb 2024 13:15:56 +0100 Subject: [PATCH] Autohide for waybar bluetooth module if no device detected --- .install/cleanup.sh | 5 +++ .install/restore.sh | 19 -------- CHANGELOG | 2 + .../modules/waybar/bluetooth/config.sh | 2 - .../modules/waybar/bluetooth/module.sh | 44 ------------------- waybar/modules.json | 3 +- waybar/themes/starter/modules.json | 3 +- 7 files changed, 11 insertions(+), 67 deletions(-) delete mode 100644 hypr/settings/modules/waybar/bluetooth/config.sh delete mode 100755 hypr/settings/modules/waybar/bluetooth/module.sh diff --git a/.install/cleanup.sh b/.install/cleanup.sh index 436a9a1..7ca96e5 100644 --- a/.install/cleanup.sh +++ b/.install/cleanup.sh @@ -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..." diff --git a/.install/restore.sh b/.install/restore.sh index 9b2a50e..7a4cf44 100755 --- a/.install/restore.sh +++ b/.install/restore.sh @@ -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" diff --git a/CHANGELOG b/CHANGELOG index 7403ef2..f4481aa 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/hypr/settings/modules/waybar/bluetooth/config.sh b/hypr/settings/modules/waybar/bluetooth/config.sh deleted file mode 100644 index 3e547d2..0000000 --- a/hypr/settings/modules/waybar/bluetooth/config.sh +++ /dev/null @@ -1,2 +0,0 @@ -name="Show/Hide Bluetooth" -order=1 diff --git a/hypr/settings/modules/waybar/bluetooth/module.sh b/hypr/settings/modules/waybar/bluetooth/module.sh deleted file mode 100755 index 462b65d..0000000 --- a/hypr/settings/modules/waybar/bluetooth/module.sh +++ /dev/null @@ -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 diff --git a/waybar/modules.json b/waybar/modules.json index 551a3a3..d4f60cc 100644 --- a/waybar/modules.json +++ b/waybar/modules.json @@ -351,7 +351,8 @@ "format-disabled": "", "format-off": "", "interval": 30, - "on-click": "blueman-manager" + "on-click": "blueman-manager", + "format-no-controller": "" }, // Other diff --git a/waybar/themes/starter/modules.json b/waybar/themes/starter/modules.json index 66d9c1d..8644a83 100644 --- a/waybar/themes/starter/modules.json +++ b/waybar/themes/starter/modules.json @@ -306,7 +306,8 @@ "format-disabled": "", "format-off": "", "interval": 30, - "on-click": "blueman-manager" + "on-click": "blueman-manager", + "format-no-controller": "" }, // Other