Add bluetooth module
This commit is contained in:
parent
9794a37683
commit
e387ca2fef
57
polybar.org
57
polybar.org
@ -80,7 +80,7 @@
|
||||
|
||||
modules-left = i3 bspwm xwindow
|
||||
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
|
||||
|
||||
@ -825,6 +825,61 @@
|
||||
fi
|
||||
#+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
|
||||
#+BEGIN_SRC conf
|
||||
[module/wireguard]
|
||||
|
Loading…
Reference in New Issue
Block a user