-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial commit. readme is under work yet...
- Loading branch information
Showing
5 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,29 @@ | ||
# polybar-dynamic-centered-tray | ||
A bunch of scripts able to create a "dynamic traybar" experience for Polybar, making it behave kinda like a module. | ||
Apenas alguns scripts capazes de criar a experiência de uma "traybar dinâmica" para a Polybar, fazendo-a com que se comporte *tipo* um módulo. | ||
|
||
## Requisitos | ||
1. Versão recente da [Polybar](https://github.com/polybar/polybar/); | ||
2. i3wm (preferencialmente v.4.17+); | ||
3. Instalar os scripts e o módulo corretamente. | ||
|
||
## Instalação | ||
1. Baixe a release mais recente ou clone este repositório com ```git clone https://github.com/daltroaugusto/polybar-dynamic-centered-tray.git```, depois navegue para a pasta extraída; | ||
2. Execute ```sudo ./install``` (script de instalação com privilégios de superusuário), ou copie os scripts para uma pasta em seu ```$PATH```; | ||
3. Insira o módulo ```polybar_trayoffset``` na posição em que desejar, no arquivo de configuração da Polybar: | ||
|
||
<table> | ||
<tbody> | ||
<tr> | ||
<td><img src="https://i.imgur.com/Jp2SVAv.png" /></td> | ||
<td> | ||
``` | ||
[module/trayoffset] | ||
type = custom/script | ||
interval = 1.0 | ||
exec = polybar_trayoffset echo | ||
format = <label> | ||
``` | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# polybar-dynamic-centered-tray | ||
A bunch of scripts able to create a "dynamic traybar" experience for Polybar, making it behave *kinda like* a module. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
install "$PWD/polybar_trayoffset" "/usr/local/bin/" | ||
install "$PWD/watchps_tray" "/usr/local/bin/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
|
||
# Script base que apenas insere e remove caracteres U+2000 (Unicode) no módulo, a fim de dar espaço para a traybar, que já pode ter um offset inicial configurado, a depender da intenção da rice/pessoa. | ||
# EN: base script which just insert and remove U+2000 (Unicode) characters in the module, giving the needed offset for traybar, that may need some initial offset setted up, depending on ricing/people intentions. | ||
|
||
# Daltro Augusto. 2021-. LGPLv2. | ||
|
||
POLYBAR_TRAYOFFSET=$(<"${HOME}/.config/polybar/.trayoffset") | ||
SYNTAX_TEXT="SYNTAX: [ \e[3madd [no. of spaces]\e[0m | \e[3mecho\e[0m | \e[3mremove\e[0m | \e[3mremove-all\e[0m ]" | ||
|
||
case $1 in | ||
add) | ||
result="${POLYBAR_TRAYOFFSET} " | ||
|
||
if test -n "$2" -a "$2" -ge 1 2>/dev/null ; then | ||
result="${POLYBAR_TRAYOFFSET}" | ||
|
||
for((i=0; i<$2; i++)); do | ||
result+=" " | ||
done | ||
fi | ||
|
||
echo "$result" > "${HOME}/.config/polybar/.trayoffset" | ||
;; | ||
|
||
echo) | ||
echo "${POLYBAR_TRAYOFFSET}" | ||
;; | ||
|
||
remove) | ||
i=${POLYBAR_TRAYOFFSET} | ||
offset=$((${#i} - 6)) | ||
|
||
if test -n "$2" -a "$2" -ge 1 2>/dev/null; then offset=$((${#i} - $2)); fi | ||
|
||
result=${i:0:$offset} | ||
|
||
echo "$result" > "${HOME}/.config/polybar/.trayoffset" | ||
;; | ||
|
||
remove-all) | ||
echo "" > "${HOME}/.config/polybar/.trayoffset" | ||
;; | ||
|
||
*) | ||
echo -e "$SYNTAX_TEXT" | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
# Este script é para ser hookado no arquivo i3config, usando os seletores for_window do i3wm. | ||
# EN: script to be hooked in i3config file, with for_window i3wm's selectors. | ||
|
||
# Daltro Augusto. 2021-. LGPLv2. | ||
|
||
PS=$1 | ||
polybar_trayoffset add "$2" | ||
|
||
while true | ||
do | ||
if [ "$(pidof "${PS}" | wc -l)" -eq 0 ]; then | ||
polybar_trayoffset remove "$2" | ||
break | ||
fi | ||
|
||
sleep 1 | ||
done |