This commit is contained in:
The-Repo-Club 2022-11-06 18:56:44 +00:00
parent d3b5fb26a6
commit f123af5e33
No known key found for this signature in database
GPG Key ID: E30EC2FBFB05C44F
4 changed files with 42 additions and 57 deletions

View File

@ -12,7 +12,7 @@
#Created: #Created:
# Tue 07 December 2021, 02:36:45 PM [GMT+1] # Tue 07 December 2021, 02:36:45 PM [GMT+1]
#Modified: #Modified:
# Sun 16 October 2022, 12:37:19 AM [GMT+1] # Sun 06 November 2022, 05:24:52 PM [GMT]
# #
#Description: #Description:
# <Todo> # <Todo>
@ -22,8 +22,11 @@
# #
# shellcheck disable=all # shellcheck disable=all
first=$(xrandr | grep -w connected | awk '{print $1}' | sed -n '1p')
second=$(xrandr | grep -w connected | awk '{print $1}' | sed -n '2p')
topleft() { topleft() {
echo -e "%{l}$(lemonbar_workspaces)%{r}$(lemonbar_keyboard)$(lemonbar_sep)$(lemonbar_updates)$(lemonbar_sep)$(lemonbar_volume)$(lemonbar_sep)$(lemonbar_battery)$(lemonbar_sep)$(lemonbar_network)$(lemonbar_sep)$(lemonbar_clock)" echo -e "%{l}$(lemonbar_workspaces $first)%{r}$(lemonbar_keyboard)$(lemonbar_sep)$(lemonbar_updates)$(lemonbar_sep)$(lemonbar_volume)$(lemonbar_sep)$(lemonbar_battery)$(lemonbar_sep)$(lemonbar_network)$(lemonbar_sep)$(lemonbar_clock)"
} }
bottomleft() { bottomleft() {
@ -31,7 +34,7 @@ bottomleft() {
} }
topright() { topright() {
echo -e "%{l}$(lemonbar_workspaces)%{r}$(lemonbar_keyboard)$(lemonbar_sep)$(lemonbar_updates)$(lemonbar_sep)$(lemonbar_volume)$(lemonbar_sep)$(lemonbar_battery)$(lemonbar_sep)$(lemonbar_network)$(lemonbar_sep)$(lemonbar_clock)" echo -e "%{l}$(lemonbar_workspaces $second)%{r}$(lemonbar_keyboard)$(lemonbar_sep)$(lemonbar_updates)$(lemonbar_sep)$(lemonbar_volume)$(lemonbar_sep)$(lemonbar_battery)$(lemonbar_sep)$(lemonbar_network)$(lemonbar_sep)$(lemonbar_clock)"
} }
bottomright() { bottomright() {

View File

@ -13,23 +13,19 @@ killall -q lemonbar
killall -q lemonbar_config killall -q lemonbar_config
topleft() { topleft() {
lemonbar_config -tl | lemonbar -p -g 1920x18+0+0 -F "#C4C7C5" -B "#282A36" -U "#268bd2" -o eDP-1 -f "SauceCodePro Nerd Font" | $SHELL lemonbar_config -tl | lemonbar -p -g 1920x18+0+0 -F "#e5e9f0" -B "#283036" -U "#434c5e" -o -3 -f "Hack Nerd Font:size=10" -o -2 -f "Noto Sans CJK JP" | $SHELL
#succade -s topleft
} }
bottomleft() { bottomleft() {
lemonbar_config -bl | lemonbar -p -b -g 1920x18+0+0 -F "#C4C7C5" -B "#282A36" -U "#268bd2" -o eDP-1 -f "SauceCodePro Nerd Font" | $SHELL lemonbar_config -bl | lemonbar -p -b -g 1920x18+0+0 -F "#e5e9f0" -B "#283036" -U "#434c5e" -o -3 -f "Hack Nerd Font:size=10" -o -2 -f "Noto Sans CJK JP" | $SHELL
#succade -s bottomleft
} }
topright() { topright() {
lemonbar_config -tr | lemonbar -p -g 1920x18+1920+0 -F "#C4C7C5" -B "#282A36" -U "#268bd2" -o HDMI-1-0 -f "SauceCodePro Nerd Font" | $SHELL lemonbar_config -tr | lemonbar -p -g 1920x18+1920+0 -F "#e5e9f0" -B "#283036" -U "#434c5e" -o -3 -f "Hack Nerd Font:size=10" -o -2 -f "Noto Sans CJK JP" | $SHELL
#succade -s topright
} }
bottomright() { bottomright() {
lemonbar_config -br | lemonbar -p -b -g 1920x18+1920+0 -F "#C4C7C5" -B "#282A36" -U "#268bd2" -o HDMI-1-0 -f "SauceCodePro Nerd Font" | $SHELL lemonbar_config -br | lemonbar -p -b -g 1920x18+1920+0 -F "#e5e9f0" -B "#283036" -U "#434c5e" -o -3 -f "Hack Nerd Font:size=10" -o -2 -f "Noto Sans CJK JP" | $SHELL
#succade -s bottomright
} }
if [ "$1" ]; then if [ "$1" ]; then

View File

@ -1,51 +1,37 @@
#!/usr/bin/env bash #!/usr/bin/env bash
MON_IDX="0" monitor=$1
mapfile -t MONITOR_LIST < <(herbstclient list_monitors | cut -d":" -f1)
for ((i = 0; i < $((${#MONITOR_LIST[@]})); i++)); do
[[ ${MONITOR_LIST[${i}]} == "$MONITOR" ]] && MON_IDX="$i"
done
# Read tags into $tags as array workspaces() {
IFS=$'\t' read -ra tags <<<"$(herbstclient tag_status "${MON_IDX}")" coloractive='%{F#283036}%{B#a6fffc}'
{ colorurgent='%{F#283036}%{B#ff5959}'
for i in "${tags[@]}"; do colorinactive='%{F#283036}%{B#59fff9}'
# Read the prefix from each tag and render them according to that prefix workspace_list=""
case ${i:0:1} in
'.') length="$(i3-msg -t get_workspaces | jq -r '. | length')"
# the tag is empty for i in $(seq "$length"); do
echo "%{B#283036}%{F#e5e9f0}" workspace=$(i3-msg -t get_workspaces | jq -j '.['"($i - 1)"']')
;; if [ "$(echo "$workspace" | jq -r '.output')" == "${monitor}" ]; then
':') if [ "$(echo "$workspace" | jq -r '.urgent')" = true ]; then
# the tag is not empty workspace_list+="$colorurgent"
echo "%{B#59ff59}" elif [ "$(echo "$workspace" | jq -r '.focused')" != true ]; then
;; workspace_list+="$colorinactive"
'+') else
# the tag is viewed on the specified MONITOR, but this monitor is not focused. workspace_list+="$coloractive"
echo "%{B#ff9c59}" fi
;; if [ "$(echo "$workspace" | jq -r '.num')" == "1" ]; then
'#') workspace_list+=" 一"
# the tag is viewed on the specified MONITOR and it is focused. fi
echo "%{B#ff59f9}" ws=$(echo "$workspace" | jq -r '.name' | awk '{print $1,$2}')
;; workspace_list+=" ${ws} "
'-') fi
# the tag is viewed on a different MONITOR, but this monitor is not focused.
echo "%{B#b56727}"
;;
'%')
# the tag is viewed on a different MONITOR and it is focused.
echo "%{B#9059ff}"
;;
'!')
# the tag contains an urgent window
echo "%{B#ff5959}"
;;
esac
# 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-}"
done done
# reset foreground and background color to default echo "$workspace_list"
echo "%{F-}%{B-}" }
} | tr -d "\n"
echo runme() {
printf "%s\r" "$(workspaces)"
sleep .1s
}
runme

Binary file not shown.