How can I create a simple / Disk Space tray icon?

Forum Forums General Software How can I create a simple / Disk Space tray icon?

  • This topic has 11 replies, 5 voices, and was last updated Aug 6-11:55 am by BobC.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #25290
    Member
    AvatarBobC

    It would need to be simple and minimal memory/cpu required.

    It would look like a disk drive, and colored green up to 70% used, yellow up to 85% used, and red above that

    Displayed overlayed would be “/” for what drive on the top line and the percentage full ie “25% used” on the 2nd line

    When you hover over it, it would say

    Disk Space: /
    Total Used Avail
    20gb 5gb 15gb
    100% 25% 75%

    I am thinking this could be parameter driven
    heading
    command (needs to return numeric values for total and used)
    image filename and max percentage levels for good and caution, with critical being anything above that
    colors always green, yellow and red, or could be 3 values

    Any thoughts? Does this exist already? Easy way to create?

    Or something like that, format being not critical, whatever is easily available would be fine

    #25295
    Member
    manyroadsmanyroads

    I think that should be pretty easy to do with either conky or on polybar. There are scripts for both that should accomplish your objective(s).

    Attached is an image of what I have on polybar…

    The internet search gods offer quite a wealth of approaches here are two + :
    https://www.cyberciti.biz/tips/shell-script-to-watch-the-disk-space.html

    Linux Shell Script To Monitor Disk Space Usage And Send Email

    • This reply was modified 4 months, 1 week ago by manyroads.

    Pax vobiscum,
    Mark Rabideau - http://many-roads.com
    MX-19 kernel: 5.2.21-antix.1-amd64-smp
    "For every complex problem there is an answer that is clear, simple, and wrong." H. L. Mencken
    MX- antiX- bspwm, hlwm, xfce4

    #25299
    Member
    AvatarBobC

    Yes, conky has it, but reason for doing this is to put the conky info that is most important to me down in the tray.

    I am trying to create an icon there with the icon telling me what (ie a disk drive symbol), the color telling me the status, and the values giving me a current reading (ie / has a value of 25%). Then if I want to see the details, I could hover over it for a tooltip, or click it to execute something.

    I came up with this thanks to your link… It gets me part way there…

    For a tooltip, output the result of this command, which gets rid of the tmpfs and udev lines:

    $ df -h | grep -v -e '^[tmpfs |udev ]'
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda4        21G  9.6G  9.9G  50% /
    /dev/sda1       534M   32M  503M   6% /boot/efi
    /dev/sdb5       200G   98G  103G  49% /media/BIGData

    For the actual values to display, output the value of this command, and I see I need columns 6 and 5:

    $ df -h | grep -e '\/$'
    /dev/sda4        21G  9.6G  9.9G  50% /

    Therefore, this gets me the 2 values I need for my icon:

    $ df -h | grep -e '\/$' | awk '{ print $6, $5 }'
    / 50%
    

    Ok, Now I need to get those to an icon in the tray every x or xx seconds…

    #25302
    Member
    AvatarBobC

    I think what I need to do is display an icon that gets redisplayed whenever it actually changes, not sure how to do that, LOL

    And… have a script running in a sleep loop that changes the icon that is being displayed when the values change.

    I’m looking for something cheap on memory and cpu so it doesn’t kill performance on the old ones…

    #25303
    Member
    KooKoo

    The below code is for i3 just not sure how this would work with GUI type desktop. How you get a script to run on the tray as an icon and change color.
    Do you have tray output turned on in your conky..

    bar {
         status_command ~/.config/i3/conkybar.sh
         i3bar_command i3bar -t
         height 18
         workspace_buttons yes
         font pango:Noto Sans 9
         position top
         height 25
         tray_output none
    

    Still an in conky script
    Still in conky.

    Sorry this is not much help..

    anitX-19 (5.3.14-antix.1-amd64-smp) + (i3) & 2 Laps T430 17.2 X220 17.4
    Debian 4.19.67-2+deb10u2 + (i3)

    #25312
    AvatarAnonymous

    There’s also good old GKrellM monitoring tool.
    It’s not on the task bar though.
    http://gkrellm.srcbox.net/

    #25333
    Member
    AvatarBobC

    I want to get it very compact, but down in the tray.

    I found that it could be done with Yad or gtkdialog, but it costs 20 mb of memory…

    Still trying…

    If I can’t do it, I guess I’ll need to make an alarm of some kind.

    #25344
    Member
    AvatarBobC

    There are many similarities to a disk drive and a battery, only reversed. I worry about the battery getting empty, and worry about the disk getting full. Perhaps if it were looked at as percentage of disk AVAILABLE, the logic would be the same…

    #25362
    AvatarAnonymous

    Perhaps you should ask somebody here, who understands something about Python programming to modify the “spaceview”.
    You can see it in action on the screenshots below. It works fine in Debian, but not in combination with IceWM.
    Already by default, it even offers all “my” colors — blue and yellow, besides orange/green and purple one.

    Spaceview Download (.deb)

    #25377
    Member
    AvatarBobC

    Yes, thanks, that’s what I was looking for. I will investigate and try it.

    Thanks
    BobC

    PS: I got it to install and then to run and work, but it took 39 mb of memory, which for a 16 gb machine is nothing, but for a 512 mb machine is too much to spare. My next thought is to add the feature to IceWM. I will look at it, but not likely something that I can do. I’m not really sure an easy answer exists…

    • This reply was modified 4 months, 1 week ago by BobC.
    #25433
    Member
    AvatarPPC

    hi, bob, you also have https://github.com/SergKolo/udisks-indicator but it’s about the ram as the above app in what concerns RAM usage… 🙁 – it«s a phyton script…
    If I find something else, I’ll send it your way…
    P.

    #25434
    Member
    AvatarBobC

    YAD would be 26 mb it looks.

    Volumeicon is 16 mb.

    LOL, conky is under 10 mb, but it doesn’t go in the tray that I have ever seen.

    The only indicator I am missing is available disk space. All the others I need are already built into IceWM.

    I wish I could just clone the battery or network monitor indicators already in IceWM into a “filesystem” space indicator. Even hard coded for “/” it would provide proof of concept. It could work like the network status monitors where it puts up an icon for each partition listed if found. That would be the best solution, I’m sure, but beyond my meager talents, I’m afraid. I suppose I could try…

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.