Update polybar

This commit is contained in:
Thomas Dehaeze 2022-02-06 21:47:16 +01:00
parent 6ece088848
commit b38b5e3da1
2 changed files with 84 additions and 106 deletions

View File

@ -214,7 +214,7 @@ startup_notification = false
# Available modifiers are "ctrl", "mod1" (the alt-key), "mod2", # Available modifiers are "ctrl", "mod1" (the alt-key), "mod2",
# "mod3" and "mod4" (windows-key). # "mod3" and "mod4" (windows-key).
close = mod1+space close = mod1+space
history = mod1+Escape history = mod1+BackSpace
#+end_src #+end_src
* Urgency * Urgency

View File

@ -2,7 +2,7 @@
#+SETUPFILE: ./setup/org-setup-file.org #+SETUPFILE: ./setup/org-setup-file.org
#+PROPERTY: header-args :comments no #+PROPERTY: header-args :comments no
#+PROPERTY: header-args+ :mkdirp yes #+PROPERTY: header-args+ :mkdirp yes
#+PROPERTY: header-args+ :tangle ~/.config/polybar/config #+PROPERTY: header-args+ :tangle ~/.config/polybar/config.ini
* Colors * Colors
#+begin_src conf #+begin_src conf
@ -57,13 +57,12 @@ padding-right = 12
module-margin-left = 1 module-margin-left = 1
module-margin-right = 1 module-margin-right = 1
font-0 = Hack Nerd Font:style=Medium,Regular:pixelsize=10;1 font-0 = Hack Nerd Font:style=Regular:pixelsize=10;1
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0 font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
font-2 = Weather Icons:size=10;1
modules-left = i3 xwindow modules-left = i3 xwindow
modules-center = modules-center =
modules-right = pulseaudio wired-network wireless-network wireguard nordvpn bluetooth redshift cursor lockscreen dunst packages unread_news unread_mail calendar temperature battery date modules-right = pulseaudio drive_tmp drive_homelab drive_groupshare drive_data_id21 drive_unix_home dunst cursor unread_mail calendar battery date
# wm-restack = i3 # wm-restack = i3
@ -828,106 +827,9 @@ fi
The script is accessible [[file:binaries.org::#nordvpn-toggle][here]]. The script is accessible [[file:binaries.org::#nordvpn-toggle][here]].
* Wireguard
#+BEGIN_SRC conf
[module/wireguard]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/wireguard-toggle.sh >/dev/null 2>%1 &
format = <label>
exec = ~/.config/polybar/scripts/wireguard-status.sh
interval = 2
#+END_SRC
** Wireguard Connection Status
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/wireguard-status.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
config="homelab"
connection=$(sudo wg show "$config" 2>/dev/null | head -n 1 | awk '{print $NF }')
if [ "$connection" = "$config" ]; then
echo "%{F#859900}%{F-}"
else
echo ""
fi
#+end_src
** Toggle Wireguard Connection
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/wireguard-toggle.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
if pgrep -x "highlight-point" >/dev/null; then
killall highlight-point && \
notify-send --hint=string:x-dunst-stack-tag:kidF4g53 "Cursor" "Turned off";
else
nohup highlight-pointer -r 10 > /dev/null 2>&1 &
notify-send --hint=string:x-dunst-stack-tag:kidF4g53 "Cursor" "Highlight...";
fi
#+end_src
* Microphone loopback
#+BEGIN_SRC conf
[module/loopback]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/loopback-toggle.sh >/dev/null 2>%1 &
format = <label>
exec = ~/.config/polybar/scripts/loopback-status.sh
interval = 2
#+END_SRC
** Loopback Status
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/loopback-status.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
loopback=$(pactl list 2>/dev/null | grep module-loopback | wc -l)
if [ "$loopback" -eq "0" ]; then
echo ""
else
echo "%{F#859900}%{F-}"
fi
#+end_src
** Toggle Loopback
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/loopback-toggle.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
loopback=$(pactl list 2>/dev/null | grep module-loopback | wc -l)
if [ "$loopback" -eq "0" ]; then
pactl load-module module-loopback latency_msec=1 && \
dunstify --replace=82244 "Loopback" "Enabled"
else
pactl unload-module module-loopback && \
dunstify --replace=82244 "Loopback" "Disabled"
fi
#+end_src
* High cursor * High cursor
This is using this program: module/
#+BEGIN_SRC conf #+BEGIN_SRC conf
[module/cursor] [module/cursor]
type = custom/script type = custom/script
@ -963,10 +865,86 @@ fi
#+begin_src bash #+begin_src bash
if pgrep -x "highlight-point" >/dev/null; then if pgrep -x "highlight-point" >/dev/null; then
killall highlight-point && \ killall highlight-point && \
dunstify --replace=46492 "Cursor" "Turned off"; notify-send --hint=string:x-dunst-stack-tag:kidF4g53 "Cursor" "Turned off";
else else
nohup highlight-pointer -r 10 > /dev/null 2>&1 & nohup highlight-pointer -r 10 > /dev/null 2>&1 &
dunstify --replace=46492 "Cursor" "Highlight..."; notify-send --hint=string:x-dunst-stack-tag:kidF4g53 "Cursor" "Highlight...";
fi
#+end_src
* Mounted Drives
#+BEGIN_SRC conf
[module/drive_tmp]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.local/bin/mount-dir tmp_14_days >/dev/null 2>%1 &
format = <label>
exec = ~/.config/polybar/scripts/drive-status.sh tmp_14_days T
interval = 5
#+END_SRC
#+BEGIN_SRC conf
[module/drive_groupshare]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.local/bin/mount-dir groupshare >/dev/null 2>%1 &
format = <label>
exec = ~/.config/polybar/scripts/drive-status.sh groupshare G
interval = 5
#+END_SRC
#+BEGIN_SRC conf
[module/drive_homelab]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.local/bin/mount-dir homelab >/dev/null 2>%1 &
format = <label>
exec = ~/.config/polybar/scripts/drive-status.sh homelab H
interval = 5
#+END_SRC
#+BEGIN_SRC conf
[module/drive_unix_home]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.local/bin/mount-dir unix_home >/dev/null 2>%1 &
format = <label>
exec = ~/.config/polybar/scripts/drive-status.sh unix_home U
interval = 5
#+END_SRC
#+BEGIN_SRC conf
[module/drive_data_id21]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.local/bin/mount-dir data_id21 >/dev/null 2>%1 &
format = <label>
exec = ~/.config/polybar/scripts/drive-status.sh data_id21 D
interval = 5
#+END_SRC
** Drive - Status
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/drive-status.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
if mountpoint -q ~/mnt/$1; then
echo "%{F#859900}$2 歷%{F-}";
else
echo "$2 轢";
fi fi
#+end_src #+end_src