This commit is contained in:
The-Repo-Club 2022-11-06 18:56:00 +00:00
parent e002934f52
commit 0f359f35f8
No known key found for this signature in database
GPG Key ID: E30EC2FBFB05C44F
2 changed files with 77 additions and 29 deletions

View File

@ -722,26 +722,26 @@ type = internal/xworkspaces
pin-workspaces = false
strip-wsnumbers = false
index-sort = false
index-sort = true
enable-click = true
enable-scroll = true
wrapping-scroll = false
reverse-scroll = false
wrapping-scroll = true
reverse-scroll = true
fuzzy-match = false
icon-1 = 1: Terminal;
icon-2 = 2: Editor;
icon-3 = 3: Files;
icon-4 = 4: Graphics;
icon-5 = 5: Music;
icon-6 = 6: WebBrowser;
icon-7 = 7: Mail;
icon-8 = 8: VirtualBox;
icon-9 = 9: Chat;
icon-0 = 10: Settings;
icon-1 = 1;一
icon-2 = 2;二
icon-3 = 3;三
icon-4 = 4;四
icon-5 = 5;五
icon-6 = 6;六
icon-7 = 7;七
icon-8 = 8;八
icon-9 = 9;九
icon-0 = 10;零
icon-default = ""
format = <label-state>
@ -760,7 +760,7 @@ label-urgent = %name% %icon%
label-urgent-foreground = ${color.fg}
label-urgent-background = ${color.red}
label-empty = %name% %icon%
label-empty =
label-empty-foreground = ${color.fg}
label-empty-background = ${color.mf}

View File

@ -1,5 +1,29 @@
#!/usr/bin/env bash
# shellcheck disable=SC2034
## Set Colors (copied from makepkg)
b_blk="#283036"
b_red="#ffa6a6"
b_grn="#a6ffa6"
b_yel="#ffffa6"
b_pnk="#ffa6fc"
b_pur="#c5a6ff"
b_cyn="#a6fffc"
b_org="#ffc9a6"
b_wht="#e5e9f0"
blk="#283036"
red="#ff5959"
grn="#59ff59"
yel="#ffff59"
pnk="#ff59f9"
pur="#9059ff"
cyn="#59fff9"
org="#ff9c59"
wht="#e5e9f0"
readonly b_blk b_red b_grn b_yel b_pnk b_pur b_cyn b_org b_wht blk red grn yel pnk pur cyn org wht
# Multi monitor support. Needs MONITOR environment variable to be set for each instance of polybar
# If MONITOR environment variable is not set this will default to monitor 0
# Check https://github.com/polybar/polybar/issues/763
@ -18,49 +42,73 @@ herbstclient --idle "tag_*" 2>/dev/null | {
{
for i in "${tags[@]}"; do
if [[ ${i:1} =~ $re ]]; then
if [[ ${i:1} -eq 1 ]]; then
tag="${i:1}: 一"
elif [[ ${i:1} -eq 2 ]]; then
tag="${i:1}: 二"
elif [[ ${i:1} -eq 3 ]]; then
tag="${i:1}: 三"
elif [[ ${i:1} -eq 4 ]]; then
tag="${i:1}: 四"
elif [[ ${i:1} -eq 5 ]]; then
tag="${i:1}: 五"
elif [[ ${i:1} -eq 6 ]]; then
tag="${i:1}: 六"
elif [[ ${i:1} -eq 7 ]]; then
tag="${i:1}: 七"
elif [[ ${i:1} -eq 8 ]]; then
tag="${i:1}: 八"
elif [[ ${i:1} -eq 9 ]]; then
tag="${i:1}: 九"
elif [[ ${i:1} -eq 0 ]]; then
tag="${i:1}: 零"
else
tag="${i:1}: "
fi
# Read the prefix from each tag and render them according to that prefix
case ${i:0:1} in
'.')
# the tag is empty
# echo "%{B#283036}%{F#e5e9f0}%{u#283036}%{+u}"
# # focus the monitor of the current bar before switching tags
# echo "%{A1:herbstclient focus_monitor ${MON_IDX}; herbstclient use ${i:1}:} ${i:1} %{A -u -o F- B-}"
# echo "%{B${cyn}}%{u${b_cyn}}%{+u}"
# # # focus the monitor of the current bar before switching tags
# echo "%{A1:herbstclient focus_monitor ${MON_IDX}; herbstclient use ${i:1}:} ${tag} %{A -u -o F- B-}"
;;
':')
# the tag is not empty
echo "%{B#59ff59}%{u#a6ffa6}%{+u}"
echo "%{B${yel}}%{u${b_yel}}%{+u}"
# focus the monitor of the current bar before switching tags
echo "%{A1:herbstclient focus_monitor ${MON_IDX}; herbstclient use ${i:1}:} ${i:1} %{A -u -o F- B-}"
echo "%{A1:herbstclient focus_monitor ${MON_IDX}; herbstclient use ${i:1}:} ${tag} %{A -u -o F- B-}"
;;
'+')
# the tag is viewed on the specified MONITOR, but this monitor is not focused.
echo "%{B#ff9c59}%{u#ffc9a6}%{+u}"
echo "%{B${grn}}%{u${b_grn}}%{+u}"
# focus the monitor of the current bar before switching tags
echo "%{A1:herbstclient focus_monitor ${MON_IDX}; herbstclient use ${i:1}:} ${i:1} %{A -u -o F- B-}"
echo "%{A1:herbstclient focus_monitor ${MON_IDX}; herbstclient use ${i:1}:} ${tag} %{A -u -o F- B-}"
;;
'#')
# the tag is viewed on the specified MONITOR and it is focused.
echo "%{B#59fff9}%{u#a6fffc}%{+u}"
echo "%{B${grn}}%{u${b_grn}}%{+u}"
# focus the monitor of the current bar before switching tags
echo "%{A1:herbstclient focus_monitor ${MON_IDX}; herbstclient use ${i:1}:} ${i:1} %{A -u -o F- B-}"
echo "%{A1:herbstclient focus_monitor ${MON_IDX}; herbstclient use ${i:1}:} ${tag} %{A -u -o F- B-}"
;;
'-')
# the tag is viewed on a different MONITOR, but this monitor is not focused.
echo "%{B#ff59f9}%{u#ffa6fc}%{+u}"
#echo "%{B#ff59f9}%{u#ffa6fc}%{+u}"
# focus the monitor of the current bar before switching tags
echo "%{A1:herbstclient focus_monitor ${MON_IDX}; herbstclient use ${i:1}:} ${i:1} %{A -u -o F- B-}"
#echo "%{A1:herbstclient focus_monitor ${MON_IDX}; herbstclient use ${i:1}:} ${tag} %{A -u -o F- B-}"
;;
'%')
# the tag is viewed on a different MONITOR and it is focused.
echo "%{B#9059ff}%{u#c5a6ff}%{+u}"
#echo "%{B#9059ff}%{u#c5a6ff}%{+u}"
# focus the monitor of the current bar before switching tags
echo "%{A1:herbstclient focus_monitor ${MON_IDX}; herbstclient use ${i:1}:} ${i:1} %{A -u -o F- B-}"
#echo "%{A1:herbstclient focus_monitor ${MON_IDX}; herbstclient use ${i:1}:} ${tag} %{A -u -o F- B-}"
;;
'!')
# the tag contains an urgent window
echo "%{B#ff5959}%{u#ffa6a6}%{+u}"
echo "%{B${red}}%{u${b_red}}%{+u}"
# focus the monitor of the current bar before switching tags
echo "%{A1:herbstclient focus_monitor ${MON_IDX}; herbstclient use ${i:1}:} ${i:1} %{A -u -o F- B-}"
echo "%{A1:herbstclient focus_monitor ${MON_IDX}; herbstclient use ${i:1}:} ${tag} %{A -u -o F- B-}"
;;
esac
# reset foreground and background color to default