Add bluetooth module
This commit is contained in:
parent
6501e49fb9
commit
bcd151651b
57
polybar.org
57
polybar.org
@ -80,7 +80,7 @@
|
|||||||
|
|
||||||
modules-left = i3 bspwm xwindow
|
modules-left = i3 bspwm xwindow
|
||||||
modules-center =
|
modules-center =
|
||||||
modules-right = pulseaudio wired-network wireless-network wireguard nordvpn loopback redshift lockscreen dunst packages unread_news unread_mail calendar temperature battery date
|
modules-right = pulseaudio wired-network wireless-network wireguard nordvpn bluetooth redshift lockscreen dunst packages unread_news unread_mail calendar temperature battery date
|
||||||
|
|
||||||
wm-restack = i3
|
wm-restack = i3
|
||||||
|
|
||||||
@ -825,6 +825,61 @@
|
|||||||
fi
|
fi
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
* Blueooth
|
||||||
|
#+BEGIN_SRC conf
|
||||||
|
[module/bluetooth]
|
||||||
|
type = custom/script
|
||||||
|
|
||||||
|
format-underline = ${colors.bg}
|
||||||
|
click-left = ~/.config/polybar/scripts/bluetooth-toggle.sh >/dev/null 2>%1 &
|
||||||
|
format = <label>
|
||||||
|
exec = ~/.config/polybar/scripts/bluetooth-status.sh
|
||||||
|
|
||||||
|
interval = 2
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Bluetooth Connection Status
|
||||||
|
:PROPERTIES:
|
||||||
|
:header-args: :tangle ~/.config/polybar/scripts/bluetooth-status.sh
|
||||||
|
:header-args+: :comments both :mkdirp yes
|
||||||
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
||||||
|
:END:
|
||||||
|
|
||||||
|
#+begin_src bash
|
||||||
|
controllerid="9C:B6:D0:96:6E:C0"
|
||||||
|
|
||||||
|
isconnected=$(bluetoothctl show $controllerid | grep Powered | grep yes)
|
||||||
|
|
||||||
|
if [ -z "$isconnected" ]
|
||||||
|
then
|
||||||
|
echo ""
|
||||||
|
else
|
||||||
|
echo "%{F#859900}%{F-}"
|
||||||
|
fi
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Toggle Bluetooth Connection
|
||||||
|
:PROPERTIES:
|
||||||
|
:header-args: :tangle ~/.config/polybar/scripts/bluetooth-toggle.sh
|
||||||
|
:header-args+: :comments both :mkdirp yes
|
||||||
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
||||||
|
:END:
|
||||||
|
|
||||||
|
#+begin_src bash
|
||||||
|
controllerid="9C:B6:D0:96:6E:C0"
|
||||||
|
|
||||||
|
isconnected=$(bluetoothctl show $controllerid | grep Powered | grep yes)
|
||||||
|
|
||||||
|
if [ -z "$isconnected" ]
|
||||||
|
then
|
||||||
|
bluetoothctl power on && \
|
||||||
|
dunstify --replace=88498 "Bluetooth" "Power ON"
|
||||||
|
else
|
||||||
|
bluetoothctl power off && \
|
||||||
|
dunstify --replace=88498 "Bluetooth" "Power OFF"
|
||||||
|
fi
|
||||||
|
#+end_src
|
||||||
|
|
||||||
* Wireguard
|
* Wireguard
|
||||||
#+BEGIN_SRC conf
|
#+BEGIN_SRC conf
|
||||||
[module/wireguard]
|
[module/wireguard]
|
||||||
|
Loading…
Reference in New Issue
Block a user