You are not logged in.
Well I must be sleep coding or something... Everything today has been completely wrong.. Back to the drawing board after I partake of some caffeine... Deleting all my gibberish so I don't look any more foolish than I already do......
This is post one I trashed...
Last edited by rwyarbrough (2016-12-17 21:43:38)
Offline
Followed by my second gibberish post that I'm deleting all of it also so I don't look any more foolish than I already do......
Last edited by rwyarbrough (2016-12-17 21:51:56)
Offline
Oh dear ... deleting post is not something to be done lightly. It 'could' get you banned.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Sector11 wrote:${alignc x} or ${alignr x} will work on 'text' elements in conky but images are different:
Thanks, Next time I'll TEST IT first before giving bad advice... :8
But it's a learning experience therefore a good thing.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Oh dear ... deleting post is not something to be done lightly. It 'could' get you banned.
I apologize - I didn't know. The code wasn't working and I didn't want to confuse anyone.
I fixed the code...
Offline
How to modify the script so that the numbers begin to the right and moves towards the left
like this
[- - - 6] = 6mn
[- - 1 4] = 14 mn
[- 2 5 1] = 2h 51 mn not like here [2 - 5 1]
[1 0 2 5] = 10h 25 mn
Try this with bash... My version may be different, but this is tested and works even with single digits.
You will want to comment out my test echos...
#!/bin/bash
uptime=`uptime -p`
days=`uptime -p | awk '{print $2}'`
hours=`uptime -p | awk '{print $4}'`
mins=`uptime -p | awk '{print $6}'`
day1=${days:0:1}
day2=${days:1:1}
day3=${days:2:1}
hour1=${hours:0:1}
hour2=${hours:1:1}
min1=${mins:0:1}
min2=${mins:1:1}
#
if [ "$day3" = "" ] ;
then
if [ "$day2" = "" ] ;
then
if [ "$day1" != " " ] ;
then
echo \${image ~/conky/rwy_test_conkys/uptime/1-$day1.png -p 111,20}
fi
else
echo \${image ~/conky/rwy_test_conkys/uptime/1-$day1.png -p 80,20}\${image ~/conky/rwy_test_conkys/uptime/1-$day2.png -p 111,20}
fi
else
echo \${image ~/conky/rwy_test_conkys/uptime/1-$day1.png -p 49,20}\${image ~/conky/rwy_test_conkys/uptime/1-$day2.png -p 80,20}\${image ~/conky/rwy_test_conkys/uptime/1-$day3.png -p 111,20}
fi
if [ "$hour2" = "" ] ;
then
echo \${image ~/conky/rwy_test_conkys/uptime/1-$hour1.png -p 184,20}
else
echo \${image ~/conky/rwy_test_conkys/uptime/1-$hour1.png -p 153,20}\${image ~/conky/rwy_test_conkys/uptime/1-$hour2.png -p 184,20}
fi
if [ "$min2" = "" ] ;
then
echo \${image ~/conky/rwy_test_conkys/uptime/1-$min1.png -p 256,20}
else
echo \${image ~/conky/rwy_test_conkys/uptime/1-$min1.png -p 225,20}\${image ~/conky/rwy_test_conkys/uptime/1-$min2.png -p 256,20}
fi
Edited Sat Dec 17, 8:59pm Central Time to correct bulky code with tighter code noted by Sector 11.
Last edited by rwyarbrough (2016-12-18 03:00:30)
Offline
Now that ROCKS!!!! I was struggling all day with "uptime -p" but - - "scripts" are not my thing.
A thought: at what point do days become, months, years etc etc ... nmmmmmmmmm never mind - it's all days:
16 and a half years worth of uptime ±6025 days so four columns should be good for uptime days.
Not for me though, I shut down nightly.
Still: AWESOME!
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
OK, I have one of those "noobs" HUH!!!! things.
I copied the script to /media/5/Conky/SuperKaramba/scripts and made changes for the /path/to/the/images
It works as advertised with one "hmmmm ... that's not right." No way I've been up 5 days 17 hours. Especially as I did a couple of reboots today playing with uptime.
It's confusing to me as to why the "script" is reporting my uptime (see the top left of the conky) wrongly. I'm assuming that the spacing for the images will have enough for 999d 23h 59m from the looks of it.
Script is reporting my hours as days and minutes as hours.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
BTW you can shorten your commands to use AWK's "print" - much simpler.... I should have known that.
17 Dec 16 @ 20:53:51 ~
$ uptime -p | awk '{print $2}'
5
17 Dec 16 @ 20:54:05 ~
$ uptime -p | awk '{print $4}'
47
17 Dec 16 @ 20:54:09 ~
$ uptime -p | awk '{print $6}'
17 Dec 16 @ 20:54:16 ~
$ uptime -p
up 5 hours, 47 minutes
17 Dec 16 @ 20:54:22 ~
$
Can't build 'em, but I can tweak 'em
The "print $2" will always be "minutes" for the first 59 minutes the machine is turned on then it becomes the "print $4" as hours kick in and take over the "print $2" slot and when days kick in and we see "print $6" come into some data.
Should make things easier for us noobs.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
BTW you can shorten your commands to use AWK's "print" - much simpler.... I should have known that.
17 Dec 16 @ 20:53:51 ~ $ uptime -p | awk '{print $2}' 5 17 Dec 16 @ 20:54:05 ~ $ uptime -p | awk '{print $4}' 47 17 Dec 16 @ 20:54:09 ~ $ uptime -p | awk '{print $6}' 17 Dec 16 @ 20:54:16 ~ $ uptime -p up 5 hours, 47 minutes 17 Dec 16 @ 20:54:22 ~ $
You are 100% correct, I was in such a hurry to post that I got it to work, I didn't go back and tighten up the code. I simply copied and pasted the initial test line I got to work that gave me only the numbers from the -p flag and instead of making it tight, I just add the -f cut.
I should have caught that myself and spent the extra few minutes to tighten it up.
Last edited by rwyarbrough (2016-12-18 03:06:34)
Offline
Ut Oh.... an oddity in uptime -p
uptime -p
up 4 days, 3 hours
I suspect you could also see this as well
uptime -p
up 300 days
if it hits just right where hours are 0 and mins are 0
Means that there will be a minute of time (or possibly an hour) where you will receive an error like this if your watching debug messages with this code.
Conky: Unable to load image '/home/robert/conky/rwy_test_conkys/uptime/1-.png'
Don't think it messes up the display, but that can be tested easily enough by hard setting the values to force the different combinations - like so
days=`uptime -p | awk '{print $2}'`
days=1234
hours=`uptime -p | awk '{print $4}'`
hours=12
mins=`uptime -p | awk '{print $6}'`
mins=""
or
days=`uptime -p | awk '{print $2}'`
days=1234
hours=`uptime -p | awk '{print $4}'`
hours=""
mins=`uptime -p | awk '{print $6}'`
mins=""
I'll have to work on this later as I now have to buckle down and work on things that "bring the bacon home" that I've been putting off cause I'm having more fun with conky.
gut tells me this should work fine to cover all combinations of uptime -p output.
#!/bin/bash
days=`uptime -p | awk '{print $2}'`
hours=`uptime -p | awk '{print $4}'`
mins=`uptime -p | awk '{print $6}'`
day1=${days:0:1}
day2=${days:1:1}
day3=${days:2:1}
hour1=${hours:0:1}
hour2=${hours:1:1}
min1=${mins:0:1}
min2=${mins:1:1}
if [ "$day3" = "" ] ;
then
if [ "$day2" = "" ] ;
then
if [ "$day1" != "" ] ;
then
echo \${image ~/conky/rwy_test_conkys/uptime/1-$day1.png -p 111,20}
fi
else
echo \${image ~/conky/rwy_test_conkys/uptime/1-$day1.png -p 80,20}\${image ~/conky/rwy_test_conkys/uptime/1-$day2.png -p 111,20}
fi
else
echo \${image ~/conky/rwy_test_conkys/uptime/1-$day1.png -p 49,20}\${image ~/conky/rwy_test_conkys/uptime/1-$day2.png -p 80,20}\${image ~/conky/rwy_test_conkys/uptime/1-$day3.png -p 111,20}
fi
if [ "$hour2" = "" ] ;
then
if [ "$hour1" != "" ] ;
then
echo \${image ~/conky/rwy_test_conkys/uptime/1-$hour1.png -p 184,20}
fi
else
echo \${image ~/conky/rwy_test_conkys/uptime/1-$hour1.png -p 153,20}\${image ~/conky/rwy_test_conkys/uptime/1-$hour2.png -p 184,20}
fi
if [ "$min2" = "" ] ;
then
if [ "$min1" != "" ] ;
then
echo \${image ~/conky/rwy_test_conkys/uptime/1-$min1.png -p 256,20}
fi
else
echo \${image ~/conky/rwy_test_conkys/uptime/1-$min1.png -p 225,20}\${image ~/conky/rwy_test_conkys/uptime/1-$min2.png -p 256,20}
fi
I'll test it later when I finish up some boring - pay the bills - work.
BTW, you could easily substitute the blank values from the uptime -p output (min = "" for example) for "0" if you are looking for 0 padded output.
Last edited by rwyarbrough (2016-12-18 03:33:28)
Offline
Now that ROCKS!!!!
Well thank you - been bash scripting for a while, so I'm probably most comfortable with bash scripts than any other language. I dabble in PHP, PERL, MySQL (not sure if there are any conky uses for MySQL - but could be!) and maybe a smidgen of Python, but usually try bash first.
16 and a half years worth of uptime ±6025 days so four columns should be good for uptime days.
so three digits will get you to 2.736986301 years. Plenty for me!
Offline
I should have caught that myself and spent the extra few minutes to tighten it up.
... but it gave me something to do.
Gotta play with your new script. Something you might want to look at: faketime although it does nothing with "uptime":
18 Dec 16 @ 11:31:18 ~
$ faketime '2525-07-31 13:45:00' uptime -p
up 2 hours, 23 minutes
Very handy when testing conky though:
faketime '2525-07-31 13:45:00' conky -c /media/5/Conky/test.conky &
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Hello
tank's for all the job you're maked
Sorry new script don' work by me
uptime 3 minutes
10 mn
the script (just modify image way)
Last edited by loutch (2016-12-19 10:37:56)
Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX
Offline
Offline
good Morning
here 15 conky's 2 or 3 do not work well but i'm searching to correct this .
http://pix.tdct.org/upload/thumb/1482141282.png
I think that I would need your help to solve these problems.
@+
I think you need to post the code if you want help.
They look awesome!
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Sorry new script don' work by me
The script works for me, however I could be using a different shell. If you define the position for the minutes to always be in the same place and use IF statements to control what gets displayed and what doesn't, this should work.
The image will always be static. The first hour position will always be static. The second hour position will always be static. The first minute position will always be static. The second minute always static. Only display those of the four positions which have a value.
This sure looks like a positional problem to me.
Can you copy paste the output of your uptime -p command and your code please?
Last edited by rwyarbrough (2016-12-19 20:27:22)
Offline
@loutch
Looking good!
Would love to know what scripting language your using to position the pointers in the dials. <whisper> and would love to see the code! </whisper>
Last edited by rwyarbrough (2016-12-19 20:34:28)
Offline
Hello
konsole :
[loutch@localhost ~]$ uptime -p
up 3 minutes
code i use
#!/bin/bash
days=`uptime -p | awk '{print $2}'`
hours=`uptime -p | awk '{print $4}'`
mins=`uptime -p | awk '{print $6}'`
day1=${days:0:1}
day2=${days:1:1}
day3=${days:2:1}
hour1=${hours:0:1}
hour2=${hours:1:1}
min1=${mins:0:1}
min2=${mins:1:1}
if [ "$day3" = "" ] ;
then
if [ "$day2" = "" ] ;
then
if [ "$day1" != "" ] ;
then
echo \${image ~/.conky/karamba/images/1-$day1.png -p 111,20}
fi
else
echo \${image ~/.conky/karamba/images/1-$day1.png -p 80,20}\${image ~/.conky/karamba/images/1-$day2.png -p 111,20}
fi
else
echo \${.conky/karamba/images/1-$day1.png -p 49,20}\${image ~/.conky/karamba/images/1-$day2.png -p 80,20}\${image ~/.conky/karamba/images/1-$day3.png -p 111,20}
fi
if [ "$hour2" = "" ] ;
then
if [ "$hour1" != "" ] ;
then
echo \${image ~/.conky/karamba/images/1-$hour1.png -p 184,20}
fi
else
echo \${image ~/.conky/karamba/images/1-$hour1.png -p 153,20}\${image ~/.conky/karamba/images/1-$hour2.png -p 184,20}
fi
if [ "$min2" = "" ] ;
then
if [ "$min1" != "" ] ;
then
echo \${.conky/karamba/images/1-$min1.png -p 256,20}
fi
else
echo \${image ~/.conky/karamba/images/1-$min1.png -p 225,20}\${image ~/.conky/karamba/images/uptime/1-$min2.png -p 256,20}
fi
Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX
Offline