Announcement

Collapse
No announcement yet.

Conky Masters - Ideas for cpubar colorization?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Just FYI, not sure how you did the color on CPUBAR but the below seems to do just that. Again, just FYI since you already have that. Thought others might be interested.

    Code:
    ${if_match ${CPU CPU0} <= 23}${color7}${endif}${if_match ${CPU CPU0} >= 24}${color8}${endif}${if_match ${CPU CPU0} >= 88}${color9}${endif}${cpubar CPU0}

    Comment


      #17
      Originally posted by MoonRise View Post
      Just FYI, not sure how you did the color on CPUBAR but the below seems to do just that. Again, just FYI since you already have that. Thought others might be interested.

      Code:
      ${if_match ${CPU CPU0} <= 23}${color7}${endif}${if_match ${CPU CPU0} >= 24}${color8}${endif}${if_match ${CPU CPU0} >= 88}${color9}${endif}${cpubar CPU0}
      I ended up with:
      Code:
      CPU 1:$color ${cpu cpu1} ${if_match ${cpu cpu1}<30}${color dimgrey}${else}${if_match ${cpu cpu1}<50}${color grey}${else}${if_match ${cpu cpu1}<70}${color0}${else}${if_match ${cpu cpu1}<90}${color1}${else}${color2}${endif}${endif}${endif}${endif}${goto 0}${offset 80}${cpubar cpu1 3,124}${color dimgrey}
      Your line is smaller than using separate ifs rather than nested, but the logic is different too. Also, I went to five colors using mine. I think it could be done your way if you reversed the condition values.

      If you're nit picking single digits you could use >23 instead of >=24 as they're the same thing.

      Stand by for a re-write...

      Please Read Me

      Comment


        #18
        This one works the same as my previous and saves about 10 characters. I switched all the color references to variables to shorten further.

        Code:
        CPU 1:$color ${cpu cpu1}${color1}${if_match ${cpu cpu1}>29}${color2}${endif}${if_match ${cpu cpu1}>49}${color3}${endif}${if_match ${cpu cpu1}>69}${color4}${endif}${if_match ${cpu cpu1}>89}${color5}${endif}${goto 0}${offset 80}${cpubar cpu1 3,124}${color1}

        Please Read Me

        Comment


          #19
          - sweet!!

          Comment


            #20
            Here is a preview of mine. I combined the Graph with the Bar.

            Click image for larger version

Name:	Selection_065.png
Views:	1
Size:	43.2 KB
ID:	643716

            Comment


              #21
              OK, NOW I'm in deep; I decided to add a backup check to my conky. So I'm now running two conky's because I didn't want the backup check running all the time. I set the second conky to update hourly. I an automated backup script and btrfs to send my two subvolumes (root and home) to my two backup drives automatically on every Sunday. I decided it would be good to keep an eye on things since it's automated. Of course, I didn't want it to be easy, so I've decided to compare the date the backup was made with the current date and flag (with a bright color) if the backup is missing (red) or out-of-date (yellow).

              The date comparison isn't too hard. I can use the stat command to determine the age of the backup in seconds from the "Epoch" aka 1970-01-01 00:00:00 UTC, and the date command to do the same thing from the current date. Then, by subtracting and comparing to 604800 (seconds in a week) I can tell if the age is more than a week.

              Should be fun to blend all that into a color calculation!

              Please Read Me

              Comment


                #22
                You truly are, a GEEK (in the nicest of terms)!!
                Windows no longer obstructs my view.
                Using Kubuntu Linux since March 23, 2007.
                "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                Comment


                  #23
                  Originally posted by Snowhog View Post
                  You truly are, a GEEK (in the nicest of terms)!!
                  LOL, No use denying it at this point! My wife calls my that (also in the nicest way) all the time. Of course, you know who everyone calls when their stuff breaks.

                  Here's the conky line that:
                  1. Checks the existence of a backup subvolume on the backup location (using an outside script).
                  2. If negative, prints "NONE FOUND" in red letters.
                  3. If positive, calculates the age of the backup in seconds from now and if more than a week old, prints the date in Yellow.
                  4. If less than a week old, prints the date in grey.

                  Code:
                  Main backup 1: ${color1}${if_match "${exec ~/.conky/scripts/ckbackup1}"=="NONE FOUND"}${color5}${else}${if_match ${exec expr `date +%s` - `stat -c %Z /backup/@KDEneon`} >= 604800}${color4}${endif}${endif}${goto 0}${offset 116}${exec ~/.conky/scripts/ckbackup1}${color2}
                  I have four lines that look like this. Two for each backup destination and two subvolumes, so 2x2. Here's what it looks like:

                  Click image for larger version

Name:	Screenshot_20180108_160458.jpg
Views:	1
Size:	6.3 KB
ID:	643717

                  Unfortunately, the stat command generates errors (but still works) if the subvol is missing. Might have to move it to a script also.

                  Please Read Me

                  Comment

                  Working...
                  X