eww update of bluetooth widget
This commit is contained in:
parent
507d84c16d
commit
35e64c371b
@ -246,6 +246,18 @@ in {
|
||||
margin: 10px 0px 0px 0px;
|
||||
}
|
||||
|
||||
.bt_bluetooth {
|
||||
color: #${config.lib.stylix.colors.base02};
|
||||
font-size: 22px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.bt_toggle {
|
||||
font-size: 52px;
|
||||
font-weight: normal;
|
||||
color: #${config.lib.stylix.colors.base16};
|
||||
}
|
||||
|
||||
/** Weather ***************************************/
|
||||
.iconweather {
|
||||
font-family: Iosevka Nerd Font;
|
||||
@ -472,6 +484,61 @@ in {
|
||||
home.packages = with pkgs; [
|
||||
brightnessctl
|
||||
|
||||
(writeShellScriptBin "bluetooth-toggle" ''
|
||||
# Check if MAC address is provided
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <MAC_ADDRESS>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MAC_ADDRESS="$1"
|
||||
|
||||
# Get connection status
|
||||
CONNECTED=$(bluetoothctl info "$MAC_ADDRESS" | grep "Connected" | awk '{print $2}')
|
||||
|
||||
if [ "$CONNECTED" = "yes" ]; then
|
||||
echo "Device $MAC_ADDRESS is connected. Disconnecting..."
|
||||
bluetoothctl disconnect "$MAC_ADDRESS"
|
||||
else
|
||||
echo "Device $MAC_ADDRESS is not connected. Connecting..."
|
||||
bluetoothctl connect "$MAC_ADDRESS"
|
||||
fi
|
||||
'')
|
||||
|
||||
(writeShellScriptBin "bluetooth-status" ''
|
||||
# Check if MAC address is provided as an argument
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <MAC_ADDRESS>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run bluetoothctl command and check if the device is connected
|
||||
status=$(bluetoothctl info "$1" | grep "Connected" | awk '{print $2}')
|
||||
|
||||
if [ "$status" == "yes" ]; then
|
||||
echo "Connected"
|
||||
else
|
||||
echo "Offline"
|
||||
fi
|
||||
'')
|
||||
|
||||
(writeShellScriptBin "bluetooth-battery" ''
|
||||
# Check if MAC address is provided as an argument
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <MAC_ADDRESS>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run bluetoothctl command and check if the device is connected
|
||||
status=$(bluetoothctl info "$1" | grep "Connected" | awk '{print $2}')
|
||||
|
||||
if [ "$status" == "yes" ]; then
|
||||
battery=$(bluetoothctl info "$1" | grep "Battery Percentage" | awk '{print $4}')
|
||||
echo " ''${battery:1:-1}%"
|
||||
else
|
||||
echo ""
|
||||
fi'')
|
||||
|
||||
(writeShellScriptBin "eww-dashboard-toggle" ''
|
||||
FILE="$HOME/${EWW_CACHE}"
|
||||
CFG="$HOME/${EWW_PATH}"
|
||||
@ -490,7 +557,8 @@ in {
|
||||
system \
|
||||
clock \
|
||||
uptime \
|
||||
music
|
||||
music \
|
||||
bluetooth
|
||||
}
|
||||
|
||||
## Launch or close widgets accordingly
|
||||
@ -499,7 +567,7 @@ in {
|
||||
run_eww
|
||||
else
|
||||
${EWW} --config "$CFG" close \
|
||||
background profile system clock uptime music apps logout sleep reboot poweroff folders
|
||||
background profile system clock uptime music apps logout sleep reboot poweroff folders bluetooth
|
||||
rm "$FILE"
|
||||
fi
|
||||
'')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user