Set up bluetooth handling

This commit is contained in:
tactonbishop 2022-05-25 21:18:22 +01:00
parent cfc5d686d2
commit 346f521e0d
4 changed files with 45 additions and 12 deletions

View file

@ -22,6 +22,7 @@ foreground-alt = #717f24
primary = #2f7e25 primary = #2f7e25
secondary = #2f6a7f secondary = #2f6a7f
alert = #7f2b26 alert = #7f2b26
disabled = #707880 disabled = #707880
@ -51,9 +52,9 @@ font-2 = FontAwesome:size=10;1"
font-3 = SymbolsNerdFont:size=15;3 font-3 = SymbolsNerdFont:size=15;3
modules-left = my-text-label xworkspaces xwindow modules-left = my-text-label xworkspaces
modules-right = filesystem memory cpu battery temperature wlan date modules-right = filesystem memory cpu battery temperature pulseaudio bluetooth wlan date
; modules-right = filesystem pulseaudio xkeyboard memory cpu wlan eth date ; modules-right = xwindow filesystem pulseaudio xkeyboard memory cpu wlan eth date
tray-position = right tray-position = right
tray-padding = 2 tray-padding = 2
@ -91,20 +92,24 @@ type = internal/fs
interval = 25 interval = 25
mount-0 = / mount-0 = /
label-mounted = %{F#2f7e25}  %{F-} %percentage_used%% (%used%/%free%) #label-mounted = %{F#2f7e25}  %{F-} %percentage_used%% (%used%/%free%)
label-mounted = %{F#2f7e25}  %{F-} %percentage_used%%
label-mounted-underline = #2f7e25 label-mounted-underline = #2f7e25
label-unmounted = %mountpoint% not mounted label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.disabled} label-unmounted-foreground = ${colors.disabled}
[module/pulseaudio] [module/pulseaudio]
type = internal/pulseaudio type = internal/pulseaudio
format-volume-prefix = "VOL " format-volume-prefix = " "
format-volume-prefix-foreground = ${colors.primary} format-volume-prefix-foreground = ${colors.primary}
format-volume = <label-volume> format-volume = <label-volume>
label-volume = %percentage%% label-volume = %percentage%%
label-muted = muted label-muted = "muted"
label-muted-foreground = ${colors.disabled}
label-muted-foreground = ${colors.disabled}
label-padding = 1
format-volume-underline = #00aae0
format-muted-underline = ${colors.alert}
[module/xkeyboard] [module/xkeyboard]
type = internal/xkeyboard type = internal/xkeyboard
blacklist-0 = num lock blacklist-0 = num lock
@ -121,8 +126,10 @@ interval = 2
format-prefix = "" format-prefix = ""
format-underline = #707f23 format-underline = #707f23
format-prefix-foreground = ${colors.primary} format-prefix-foreground = ${colors.primary}
label = %percentage_used:2%% (%gb_used%/%gb_free%) # label = %percentage_used:2%% (%gb_used%/%gb_free%)
label = %percentage_used:2%%
label-padding = 1 label-padding = 1
[module/cpu] [module/cpu]
type = internal/cpu type = internal/cpu
interval = 2 interval = 2
@ -168,10 +175,8 @@ format-underline = #2f697f
format-prefix-foreground = ${colors.primary} format-prefix-foreground = ${colors.primary}
format-prefix = "" format-prefix = ""
date = %a %d %b %Y date = %a %d %b %Y
date-alt = %Y-%m-%d %H:%M:%S
time = %H:%M time = %H:%M
time-alt = %H:%M:%S label = %date% | %{F#2f7e25}%time%
label = %date% %{F#717f24}%time%
label-padding = 2 label-padding = 2
[module/temperature] [module/temperature]
@ -237,6 +242,15 @@ content = 
content-foreground = #2f6a7f content-foreground = #2f6a7f
content-padding = 1 content-padding = 1
[module/bluetooth]
type = custom/script
exec = ~/.config/polybar/polybar_scripts/launch_bluetooth_manager.sh
interval = 2
click-right = exec blueberry
click-left = exec ~/.config/polybar/polybar_scripts/toggle_bluetooth.sh
format-padding = 1
format-foreground = ${colors.primary}
format-underline = ${colors.primary}
[settings] [settings]
screenchange-reload = true screenchange-reload = true
pseudo-transparency = true pseudo-transparency = true

View file

@ -0,0 +1,12 @@
#!/bin/bash
#!/bin/sh
if [ $(bluetoothctl show | grep "Powered: yes" | wc -c) -eq 0 ]
then
echo "%{F#66ffffff}"
else
if [ $(echo info | bluetoothctl | grep 'Device' | wc -c) -eq 0 ]
then
echo ""
fi
echo "%{F#73fa91}"
fi

View file

@ -0,0 +1,7 @@
#!/bin/sh
if [ $(bluetoothctl show | grep "Powered: yes" | wc -c) -eq 0 ]
then
bluetoothctl power on
else
bluetoothctl power off
fi

View file

@ -1,5 +1,5 @@
{ {
"editor.fontFamily": "Liberation Mono", "editor.fontFamily": "Liga Liberation Mono",
"editor.fontLigatures": true, "editor.fontLigatures": true,
"editor.fontSize": 12, "editor.fontSize": 12,
"editor.fontWeight": 500, "editor.fontWeight": 500,