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:
# Tue 07 December 2021, 02:36:45 PM [GMT+1]
#Modified:
# Sun 16 October 2022, 12:37:19 AM [GMT+1]
# Sun 06 November 2022, 05:24:52 PM [GMT]
#
#Description:
# <Todo>
@ -22,8 +22,11 @@
#
# 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() {
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() {
@ -31,7 +34,7 @@ bottomleft() {
}
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() {

View File

@ -13,23 +13,19 @@ killall -q lemonbar
killall -q lemonbar_config
topleft() {
lemonbar_config -tl | lemonbar -p -g 1920x18+0+0 -F "#C4C7C5" -B "#282A36" -U "#268bd2" -o eDP-1 -f "SauceCodePro Nerd Font" | $SHELL
#succade -s topleft
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
}
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
#succade -s bottomleft
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
}
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
#succade -s topright
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
}
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
#succade -s bottomright
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
}
if [ "$1" ]; then

View File

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

Binary file not shown.