From 346f521e0dcc8f62cbaea6ec25ac544dce3850cf Mon Sep 17 00:00:00 2001 From: tactonbishop Date: Wed, 25 May 2022 21:18:22 +0100 Subject: [PATCH] Set up bluetooth handling --- polybar/config.ini | 36 +++++++++++++------ .../launch_bluetooth_manager.sh | 12 +++++++ polybar/polybar_scripts/toggle_bluetooth.sh | 7 ++++ vscode/settings.json | 2 +- 4 files changed, 45 insertions(+), 12 deletions(-) create mode 100755 polybar/polybar_scripts/launch_bluetooth_manager.sh create mode 100755 polybar/polybar_scripts/toggle_bluetooth.sh diff --git a/polybar/config.ini b/polybar/config.ini index 0a3ccaa..e04c977 100644 --- a/polybar/config.ini +++ b/polybar/config.ini @@ -22,6 +22,7 @@ foreground-alt = #717f24 primary = #2f7e25 secondary = #2f6a7f alert = #7f2b26 + disabled = #707880 @@ -51,9 +52,9 @@ font-2 = FontAwesome:size=10;1" font-3 = SymbolsNerdFont:size=15;3 -modules-left = my-text-label xworkspaces xwindow -modules-right = filesystem memory cpu battery temperature wlan date -; modules-right = filesystem pulseaudio xkeyboard memory cpu wlan eth date +modules-left = my-text-label xworkspaces +modules-right = filesystem memory cpu battery temperature pulseaudio bluetooth wlan date +; modules-right = xwindow filesystem pulseaudio xkeyboard memory cpu wlan eth date tray-position = right tray-padding = 2 @@ -91,20 +92,24 @@ type = internal/fs interval = 25 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-unmounted = %mountpoint% not mounted label-unmounted-foreground = ${colors.disabled} [module/pulseaudio] type = internal/pulseaudio -format-volume-prefix = "VOL " +format-volume-prefix = " " format-volume-prefix-foreground = ${colors.primary} format-volume = label-volume = %percentage%% -label-muted = muted -label-muted-foreground = ${colors.disabled} +label-muted = "muted" +label-muted-foreground = ${colors.disabled} +label-padding = 1 +format-volume-underline = #00aae0 +format-muted-underline = ${colors.alert} [module/xkeyboard] type = internal/xkeyboard blacklist-0 = num lock @@ -121,8 +126,10 @@ interval = 2 format-prefix = "" format-underline = #707f23 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 + [module/cpu] type = internal/cpu interval = 2 @@ -168,10 +175,8 @@ format-underline = #2f697f format-prefix-foreground = ${colors.primary} format-prefix = "" date = %a %d %b %Y -date-alt = %Y-%m-%d %H:%M:%S time = %H:%M -time-alt = %H:%M:%S -label = %date% %{F#717f24}%time% +label = %date% | %{F#2f7e25}%time% label-padding = 2 [module/temperature] @@ -237,6 +242,15 @@ content =  content-foreground = #2f6a7f 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] screenchange-reload = true pseudo-transparency = true diff --git a/polybar/polybar_scripts/launch_bluetooth_manager.sh b/polybar/polybar_scripts/launch_bluetooth_manager.sh new file mode 100755 index 0000000..5eebc0f --- /dev/null +++ b/polybar/polybar_scripts/launch_bluetooth_manager.sh @@ -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 diff --git a/polybar/polybar_scripts/toggle_bluetooth.sh b/polybar/polybar_scripts/toggle_bluetooth.sh new file mode 100755 index 0000000..dffb663 --- /dev/null +++ b/polybar/polybar_scripts/toggle_bluetooth.sh @@ -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 diff --git a/vscode/settings.json b/vscode/settings.json index d894a7f..4fc63ee 100644 --- a/vscode/settings.json +++ b/vscode/settings.json @@ -1,5 +1,5 @@ { - "editor.fontFamily": "Liberation Mono", + "editor.fontFamily": "Liga Liberation Mono", "editor.fontLigatures": true, "editor.fontSize": 12, "editor.fontWeight": 500,