Closed revuwa closed 1 year ago
Could look into it later today or tomorrow, since I was considering doing something like this a few days ago but never really got to actually doing it
Done in afb84a9bbd73883d93e3865c1af8b32ea9fd8869 (0.3.8
), 1:1 syntax as you suggested.
If update_rate
is left unspecified, then it uses 100
as the default value. Using values like 0
completely shuts off command listening, making it a static label
Reopening because I forgot to make it call the command immediately upon startup.
Currently if you have a command set to 30m
, then it won't be executed until 30m later on and will be left blank until then.
Will fix in a few hours
Reopening because I forgot to make it call the command immediately upon startup. Currently if you have a command set to
30m
, then it won't be executed until 30m later on and will be left blank until then.
First of all thank you so much for implementing this π And sorry for late response, because I realized that behavior, and wanted to report this, too.
In this context I experienced another side effect, but I don't know if this is related to the latest change/s π€·
Since 0.3.8
the tooltips needs (partly way) more time to display. With 0.3.7
I hovered over the single buttons/labels and instantly got the tooltips / results of tooltip_commands. With 0.3.8
I get the result/s after few moments to several seconds later.
Is it possible, that the display time until tooltips appear could be related to update_rate
?
I stopped for tooltips with update_rate
of 5000 from <1 sec up to ~7 seconds, until they got displayed.
But for a tooltips with update_rate
of 1000 ~3-4 seconds.
I'm confused, and hope you got what I mean, because I can't narrow it down further, for now π
EDIT: Even buttons which opens applications triggers the execution of them delayed (~1-3 sec delay).
The tooltips part seems like an issue on your end, I just tested it and can't notice anything OOTO. Neither can I notice slowdowns with buttons, here's a video of it all: https://streamable.com/y3y1rc
The tooltips part seems like an issue on your end
π€ Thanks for your clip; so I made one, too: https://streamable.com/6ts31f There is not every single time a noticeable delay, but some times, with different seconds of delay. Some times >10 sec.
I don't want to exclude that it's an issue on my end; I just wanted to precise the behavior I have.
What's the update frequency of that tooltip?
What's the update frequency of that tooltip?
-> 10000 (10s), but I personally don't think it have to be related, because I played around with much bigger values, too, but every tooltip interacts the same way.
config
is this:``` { "variables": { "$foot_term": "foot -c /etc/foot/foot.ini" }, "hybrid": { "stylesheet": "style.css", "r": 10, "g": 10, "b": 10, "a": 0.2 }, "left-spacing_workspaces_margin": { "update_rate": 0, "spacing_start": 1, "spacing_end": 7 }, "left-label_workspaces": { "update_rate": 500, "command": "for i in $(hyprctl workspaces -j | jq -r 'sort_by(.id) | .[].id'); do if [[ $i == $(hyprctl monitors -j | jq -r '.[].activeWorkspace.id') ]]; then echo [$i] | tr '\n' ' '; else echo $i | tr '\n' ' '; fi; done" }, "centered-label_titles": { "update_rate": 500, "command": "hyprctl activewindow -j | jq -r '.title' | sed -E 's/ - Chromium| β LibreWolf| β Mozilla Firefox//'" }, "right-button_cpu": { "update_rate": 0, "text": "#", "command": "hyprctl dispatch exec \"$foot_term -a 'foot-float' btop\"", "tooltip": "run btop" }, "right-label_cpu": { "update_rate": 3000, "command": "top -b -n 1 | grep 'Cpu(s):' | awk '{printf \"%02d\", (100-$8)}' | cut -f 1 -d '.'", "tooltip_command": "ps -A -o pcpu,comm --sort=-pcpu | head -n 10" }, "right-label_cpu_close": { "update_rate": 0, "text": "% " }, "right-label_temp": { "update_rate": 10000, "text": "(", "command": "cat /sys/class/thermal/thermal_zone0/temp | awk '{print ($1)/1000}'", "tooltip": "temperature" }, "right-label_temp_close": { "update_rate": 0, "text": "Β°C) | ", "tooltip": "temperature" }, "right-label_mem": { "update_rate": 3000, "text": "β° ", "command": "free -m | grep 'Mem:' | awk '{print ($3/$2)*100}' | cut -f 1 -d '.'", "tooltip_command": "free -h | grep 'Mem:' | awk '{print $3 \" used (\" $7 \"/\" $2 \" free)\"}' | sed 's/Gi/GB/g'" }, "right-label_mem_close": { "update_rate": 0, "text": "% | " }, "right-label_disk": { "update_rate": 10000, "text": "β ", "command": "df -h / | awk '{print $5}' | tail -n 1", "tooltip_command": "df -h | grep -v -E '(tmp|boot)' | tail -n 1 | awk '{print $3 \" used (\" $4 \"/\" $2 \" free)\"}' | sed 's/G/GB/g'" }, "right-label_disk_separator": { "update_rate": 0, "text": " | " }, "right-label_volmuted": { "update_rate": 500, "command": "if wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep 'Volume:' | grep -q 'MUTED'; then echo 'β '; else echo 'β '; fi" }, "right-label_vol": { "update_rate": 500, "command": "wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep 'Volume:' | awk -F 'Volume: ' '{print ($2)*100 \"%\"}'", "tooltip_command": "if wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep 'Volume:' | grep -q 'MUTED'; then echo 'audio muted'; else echo 'audio unmuted'; fi" }, "right-label_micmuted": { "update_rate": 500, "command": "if wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | grep 'Volume:' | grep -q 'MUTED'; then echo ' ('; else echo ' (β'; fi" }, "right-label_micvol": { "update_rate": 500, "command": "wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | grep 'Volume:' | awk -F 'Volume: ' '{print ($2)*100 \"%)\"}'", "tooltip_command": "if wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | grep 'Volume:' | grep -q 'MUTED'; then echo 'mic muted'; else echo 'mic unmuted'; fi" }, "right-button_audiomgmt": { "update_rate": 0, "text": "β", "command": "hyprctl dispatch exec \"pavucontrol\"", "tooltip": "run pavucontrol" }, "right-label_audio_separator": { "update_rate": 0, "text": "|" }, "right-button_wifistats": { "update_rate": 0, "text": "οͺ¨", "command": "hyprctl dispatch exec \"$foot_term -a 'foot-float' wavemon\"", "tooltip": "run wavemon" }, "right-label_wifi": { "update_rate": 1000, "command": "if iwctl station wlan0 show | grep 'State' | awk -F 'State' '{print $2}' | grep -q 'disconnected'; then echo 'β'; else echo 'οΊ΄'; fi", "tooltip_command": "iwctl station wlan0 show | grep 'Connected network' | awk -F 'Connected network' '{print $2}' | awk '{gsub(/^[ \t]+|[ \t]+$/, \"\"); print}'" }, "right-label_wifi_separator": { "update_rate": 0, "text": " |" }, "right-label_workspacescount": { "update_rate": 1000, "text": "ο« ", "command": "hyprctl workspaces -j | jq -r '.[].id' | wc -l", "tooltip": "active windows: ", "tooltip_command": "hyprctl clients -j | jq -r '.[].pid' | wc -l" }, "right-label_workspacescount_separator": { "update_rate": 0, "text": " |" }, "right-button_idleinhibition": { "update_rate": 0, "text": "β―", "command": "slc=$(echo -e \"10 minutes\n1 hour\n1 day\ncancel all\" | bemenu -p 'inhibit idle for:' -i -l 4 -c -W 0.1); if [[ $slc == '10 minutes' ]]; then hyprctl dispatch exec \"systemd-inhibit --what=idle --why=HybridBarIdleInhibition sleep 10m\"; elif [[ $slc == '1 hour' ]]; then hyprctl dispatch exec \"systemd-inhibit --what=idle --why=HybridBarIdleInhibition sleep 1h\"; elif [[ $slc == '1 day' ]]; then hyprctl dispatch exec \"systemd-inhibit --what=idle --why=HybridBarIdleInhibition sleep 1d\"; elif [[ $slc == 'cancel all' ]]; then pkill systemd-inhibit; fi", "tooltip": "inhibit idle" }, "right-label_idleinhibition": { "update_rate": 1000, "command": "if systemd-inhibit --list | grep -q 'HybridBarIdleInhibition'; then echo 'βΈ '; else echo 'β '; fi", "tooltip_command": "if systemd-inhibit --list | grep -q 'HybridBarIdleInhibition'; then echo 'idle inhibition active'; else echo 'idle inhibition inactive '; fi" }, "right-label_idleinhibition_separator": { "update_rate": 0, "text": "|" }, "right-button_calendar": { "update_rate": 0, "text": "ο¨", "command": "hyprctl dispatch exec \"$foot_term -a 'foot-float-cal' -H cal -Y\"", "tooltip": "run calendar" }, "right-label_timedate": { "update_rate": 1000, "command": "date +%H:%M", "tooltip_command": "date +%d.%m.%Y" }, "right-label_timedate_separator": { "update_rate": 0, "text": " |" }, "right-button_powermenu": { "update_rate": 0, "text": "β»", "command": "slc=$(echo -e \"logout\nreboot\nshutdown\" | bemenu -p 'power menu' -i -l 3 -c -W 0.1); if [[ $slc == logout ]]; then hyprctl dispatch exec \"loginctl terminate-user $USER\"; elif [[ $slc == reboot ]]; then hyprctl dispatch exec \"systemctl reboot\"; elif [[ $slc == shutdown ]]; then hyprctl dispatch exec \"systemctl poweroff\"; fi", "tooltip": "power menu" } } ```
Can re-create but at a much smaller scale, although no idea what the root cause of it is as of right now. Could you try and backup your config, make a new one with just a Label/Button with a dynamic tooltip command, see if it's also slow?
Tried just the following:
{
"hybrid": {
"r": 10,
"g": 10,
"b": 10,
"a": 0.2
},
"right-label_cpu": {
"update_rate": 5000,
"command": "top -b -n 1 | grep 'Cpu(s):' | awk '{printf \"%02d\", (100-$8)}' | cut -f 1 -d '.'",
"tooltip_command": "ps -A -o pcpu,comm --sort=-pcpu | head -n 10"
}
}
and it was mostly blazing fast. None of my tries was >1s. So it seems that it could be linked to the amount of used labels/buttons (in my personal case)?
It's most likely blocking the UI Thread temporarily for a few milliseconds when updating widgets, leading to the slight delay.
I can look into it in a bit, although don't expect a fix for it since async
with GTK and Labels is a hit or miss, so we'll see if it works out
Update: Won't fix since it doesn't bother me, and because making it run in an asynchronous-like way would require a ton of rework to be done, just doing it for the Cava output was a huge nightmare and is hacky as-is.
So until I can be bothered dealing with this in the future (or someone else, if so open a PR), it'll remain as-is.
Won't fix since it doesn't bother me, and because making it run in an asynchronous-like way would require a ton of rework to be done, just doing it for the Cava output was a huge nightmare and is hacky as-is.
Thanks a ton for looking into this and spending so much time, before making this decision π
I realized that the more commands I execute, the more the cpu usage HybridBar needs, (of course π ). Since I (currently) use >23 commands, I saw that the bar now uses 0.1% more cpu as with less commands, so I wondered if this couldn't be optimized with individual update rates?
My config as example, I thought that cpu/mem/disk/... usage could have bigger update rates, than volume/clock/workspaces/... should have.
So I thought it would be cool, if the
could be some kind of fallback if no individual "update_rate" is given, but otherwise commands which doesn't change (in results) that much, could be declared like this:
So
whoami
triggers ever minute,hostname
every hour, anddate
every 100ms.What do you think?