Re: [qubes-users] Help finetuning i3status in Qubes dom0 [solved]
Hello Ilpo, amazing, thank you for the quick tip! I was able to get exactly what I was looking for (see attached screenshot) I can now get my summarized RAM usage via: [USER@dom0 ~] xl list | awk '{print $3}' | tail -n +2 | paste -s -d+ - | bc 15022 as such I have edited my /usr/bin/qubes-i3status to add the RAM usage to my status bar near the "running qubes section" status_qubes() { # Output in Status bar, ex: 6 Qubes using 15.050 MB RAM local sum_ram="("$(xl list | awk '{print $3}' | tail -n +2 | paste -s -d+ -)")/1000" local sum_ram=$(bc <<< "scale=3;$sum_ram")"MB" local qubes=$(qvm-ls 2>/dev/null | grep ' \* ' | wc -l) json qubes "$qubes Qubes using $sum_ram RAM" } or if you want to have the output as with "15.0G" instead of "15.050MB": status_qubes() { # Output in Status bar, ex: 6 Qubes using 15.0G RAM local sum_ram="("$(xl list | awk '{print $3}' | tail -n +2 | paste -s -d+ -)")/1000" local sum_ram=$(bc <<< "scale=1;$sum_ram")"G" local qubes=$(qvm-ls 2>/dev/null | grep ' \* ' | wc -l) json qubes "$qubes Qubes using $sum_ram RAM" } Maybe someone more skilled can write a subroutine in qubes-i3status so that it can be enabled or disabled by the user like with all other party in the main() area. [799] -- You received this message because you are subscribed to the Google Groups "qubes-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to qubes-users+unsubscr...@googlegroups.com. To post to this group, send email to qubes-users@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/qubes-users/Im2I4u-BvUyMeVGDGbdw5ISLcJm94IIudWM_9F-1e75TFsfoarChvgE2BbGA8-xJUKTo-nRqZIE6jsLcCzpLEJeGIS6j49p6R4_KveII9_U%3D%40protonmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [qubes-users] Help finetuning i3status in Qubes dom0
On Tue, 3 Oct 2017, 'One7two99' via qubes-users wrote: > Hello, > > [ ...snip...] > > 2) Extracted only the column which includes the RAM with > [USER@dom0 ~]$ xl list | awk '{print $3}' > Mem > 4061 > 297 > 1424 > 1023 > 4095 > 44 > 3999 > ** > QUESTION: How can I remove the first line? > ** | tail -n +2 -- i. -- You received this message because you are subscribed to the Google Groups "qubes-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to qubes-users+unsubscr...@googlegroups.com. To post to this group, send email to qubes-users@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/qubes-users/alpine.DEB.2.20.1710040011190.24024%40whs-18.cs.helsinki.fi. For more options, visit https://groups.google.com/d/optout.
[qubes-users] Help finetuning i3status in Qubes dom0
Hello, after switching to i3vm in Qubes 3.2 as primary window manager I'm working on tweaking it to my needs. I've learned that Qubes is adding a small script to generate the status bar in i3: /usr/bin/qubes-i3status I'd like to add the total consumed RAM in the status bar, but my scripting is not good enough to make it work, can someone give me a hint? My current approach: 1) get the used RAM for each AppVM from running 'xl list' in dom0 [USER@dom0 ~]$ xl list NameID Mem VCPUs State Time(s) dom0 0 4061 4 r- 902.7 sys-net 1 297 2 -b 61.1 sys-firewall 2 1424 2 -b 74.3 sys-usb 3 1023 2 -b 54.3 win7 4 4095 2 -b 298.9 win7-dm 544 1 -b 92.2 untrusted6 3999 2 -b 492.9 2) Extracted only the column which includes the RAM with [USER@dom0 ~]$ xl list | awk '{print $3}' Mem 4061 297 1424 1023 4095 44 3999 ** QUESTION: How can I remove the first line? ** 3) If I get rid of the first line, I could add everything up. Looking here: https://unix.stackexchange.com/questions/320217/how-to-calculate-the-the-value-of-each-line-with-awk-command the command to do so would be: [USER@dom0 ~]$ xl list | awk '{print $3}' | paste -s -d+ - which will create: 4061+297+1424+1023+4095+44+3999 4) passing this to bc should give me the total RAM: [USER@dom0 ~]$ xl list | awk '{print $3}' | paste -s -d+ - | bc If someone is interested in additional tweaks to i3status: I've added some changes to this file to format date and time and more important to get better battery metrics as I like to keep an eye on the current discharge rate to learn how system load is impacting battery runtime. This is also usefull to learn how optimizations like tlp will influence battery runtime etc. [...] status_bat() { local my_bat=/sys/class/power_supply/BAT0 local bat_rate=$(bc <<< "scale=1;`cat $my_bat/current_now`*`cat $my_bat/voltage_now`/10^12")"W" local bat=$((100*`cat $my_bat/charge_now`/`cat $my_bat/charge_full_design`)) local ac='' local color='' if [[ $(cat /sys/class/power_supply/AC/online) == '1' ]]; then ac=' AC' elif ((bat < 25)); then color='#ff' # red elif ((bat < 50)); then color='#ff6600' #was #00 = yellow before fi json bat "Bat: $bat_rate $bat%$ac" "$color" } [799] -- You received this message because you are subscribed to the Google Groups "qubes-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to qubes-users+unsubscr...@googlegroups.com. To post to this group, send email to qubes-users@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/qubes-users/W3biJfnI57zpgFICAeyZ3MFjveXf4FvnmTmRYTQ4t9xRcMFAJ6zoLdeFpLpSQWqh3yyU5aejwKz_81TzHMMuLo2qkfO57p7oh74uzTh_i6A%3D%40protonmail.com. For more options, visit https://groups.google.com/d/optout.