You are not logged in.

#1 2017-05-27 01:26:03

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,813

S11 needs Conky help.

OK, I'm working on a conky project and need some help from script guru's and CLI geeks  smile

The commands found in "man conky" I am quite familiar with and will be using a lot of them along with "sensors info", hddtemp, nvidia, etc.  (Sorry Intel people but you can tweak it later)

I'm looking for little one liners that I can use in a rather massive conky.  A Keyboard conky, I made one of my actual keyboard - just because - but it's just the keyboard, doesn’t do anything.  So, I'm making a working conky of the keyboard:
2017-05-26_123342_Scrot11.th.png
... as you see, there is a lot of space.  The weather is done, CPU is in progress - will probably move those not sure.

I'm looking for commands like:

 26 May 17 @ 21:50:39 ~
   $ who -b | cut -c23-
2017-05-26 11:39
 
 26 May 17 @ 21:50:41 ~
   $ lsb_release -is
BunsenLabs
 
 26 May 17 @ 21:51:11 ~
   $ cat /etc/debian_version
8.8
 
 26 May 17 @ 21:51:26 ~
   $ env | grep DESKTOP_SESSION= |cut -c 17-
openbox
 
 26 May 17 @ 21:51:38 ~
   $ xdpyinfo | sed -n -r "s/^\s*dimensions:.*\s([0-9]+x[0-9]+).*/\1/p"
1920x1080

The results of these commands must fit on a "key".  So commands like: ls, or sl, or df, etc. won't do.
Also leaves out neat stuff like

fortune | cowthink -f eyes | lolcat

2017-05-26_151455_Scrot11.png
See, I don't want to do it over, want to get it right, therefore I need a little help filling this sucker in.  smile


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#2 2017-05-27 02:40:29

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 8,315
Website

Re: S11 needs Conky help.

So, S11 what actual results do you want, specifically?
Are the example you posted acceptable as-is?

Maybe post the desired output strings, rather than your suggested implementations, in case there's some other way of doing it?


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#3 2017-05-27 03:36:40

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,813

Re: S11 needs Conky help.

That's just it, I'm not sure.  That's why I'm asking.

who -b | cut -c23- is seen on the [spacebar] in the image above - "cut" I can use and understand ... but this:

xdpyinfo | sed -n -r "s/^\s*dimensions:.*\s([0-9]+x[0-9]+).*/\1/p"

someone else posted and I found it works for me. But I have no clue about "sed" and all that martian stuff on the right.  Been trying to figure that stuff out for years ... it's still spaghetti for me.

So ... hmmmmmmm
OH that worked ...

   $ xdpyinfo | sed -n -r "s/^\s*resolution:.*\s([0-9]+x[0-9]+).*/\1/p"
95x94

So

${goto 656}Res: ${pre_exec xdpyinfo | sed -n -r "s/^\s*resolution:.*\s([0-9]+x[0-9]+).*/\1/p"} DPI
will output

Res: 95x94 DPI

I could just type that in:

${goto 656}Res: 95x94 DPI

but that would be cheating.

$ xdpyinfo

by itself is pretty full!

I like this:

inxi

and HoaS popped this out there:

sudo lspci -knnvv

OH MY! - but sudo in a conky = no go!


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#4 2017-05-27 08:38:12

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 8,315
Website

Re: S11 needs Conky help.

Sorry, I'm still not sure exactly what you're asking here.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#5 2017-05-27 10:38:27

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: S11 needs Conky help.

Have a look at the stuff neofetch uses to get the system information, their scripting is pretty neat (but not POSIX):

https://github.com/dylanaraps/neofetch/ … r/neofetch


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#6 2017-05-27 12:38:34

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,469

Re: S11 needs Conky help.

So you're looking to put a bit of information on every key?

OH MY! - but sudo in a conky = no go!

Not necessarily - you could create the conky group, then edit the sudoers file so the group members can issue select commands without a password. Inherent security risk there, depends on how far you want to take this project.

What would want to see that you can't get from a conky setting?

Last edited by PackRat (2017-05-27 12:42:38)


You must unlearn what you have learned.
    -- yoda

Offline

#7 2017-05-27 12:49:49

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: S11 needs Conky help.

PackRat wrote:

# load average

uptime | grep -ohe 'load average[s:][: ].*' | awk '{ print $3" "$4" "$5"," }' | sed 's/,//g'

Simpler:

uptime | awk -F",|:" '{print $6" "$7" "$8}'

(Tested on OpenBSD)

EDIT: sorry PackRat, I think we cross-posted there.

Last edited by Head_on_a_Stick (2017-05-27 12:50:33)


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#8 2017-05-27 14:48:35

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,813

Re: S11 needs Conky help.

PackRat wrote:

So you're looking to put a bit of information on every key?

Something on all keys, even if it is only text.

for example this would use three keys, and I may need to stretch thing out to fill all keys:

[ CPU 1 ] next key -> [${cpu cpu1}% ] next -> [ ${freq 1} or ${freq_g 1} ]

Sector11 wrote:

OH MY! - but sudo in a conky = no go!

Not necessarily - you could create the conky group, then edit the sudoers file so the group members can issue select commands without a password. Inherent security risk there, depends on how far you want to take this project.

Inherent security risk there <-- no thank you.

As far as I can but doing my best to keep cpu usage down.  I know it will end up a percentage guzzler but I'd like it as low as possible.

PackRat wrote:

What would want to see that you can't get from a conky setting?

Take a look at the commands in the OP, they are not native conky commands  smile


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#9 2017-05-27 15:04:24

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,813

Re: S11 needs Conky help.

PackRat wrote:

# load average

uptime | grep -ohe 'load average[s:][: ].*' | awk '{ print $3" "$4" "$5"," }' | sed 's/,//g'
Head_on_a_Stick wrote:
uptime | awk -F",|:" '{print $6" "$7" "$8}'

You guys keep on cross-posting, great ideas come that way.

Both of those work in a BunsenLabs terminal and in conky.  But conky has a native command to do those without an ${execi} call.

exec command (execi and execpi similar)
Executes  a  shell command and displays the output in conky. warning: this takes a lot more resources than other variables. I'd recommend coding wanted behaviour in C and posting a patch.

2017-05-27_113133_Scrot11.th.png
Take a look at that image.

Another Not a Native Conky Command - that will end up on the keyboard.
See the @646 beside the UTC time?  That's a "beats-swatch" time bash script by brontosaurusrex:

#!/bin/bash

# beats - swatch time
# by brontosaurusrex - https://forums.bunsenlabs.org/viewtopic.php?pid=39518#p39518
# http://www.timeanddate.com/time/internettime.html
# https://www.swatch.com/en/internettime/
# https://en.wikipedia.org/wiki/Swatch_Internet_Time#Calculation_from_UTC.2B1

# required
command -v bc >/dev/null 2>&1 || { echo "I need bc" ; exit 1; }

# UTC to variables
export TZ=GMT-1 # Not sure why is this minus and not plus
read h m s <<<$(date "+%H %M %S")

# echo $h $m $s

# (UTC+1seconds + (UTC+1minutes * 60) + (UTC+1hours * 3600)) / 86.4
# btw: beats smaller than one are not in the standard
# bc is "rounding down", which seems to be the correct way in this case

# h=23
# m=59
# s=59

beats=$(bc -l <<< "scale=0; ($s + ($m * 60) + (($h) * 3600)) / 86.4")
echo "@$beats"

Another damn topy: sorry Head_od_a_Stick - I meant: _on_ - onest
{last typo on purpose - honest}


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#10 2017-05-27 15:23:08

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,813

Re: S11 needs Conky help.

Head_on_a_Stick wrote:

Have a look at the stuff neofetch uses to get the system information, their scripting is pretty neat (but not POSIX):

https://github.com/dylanaraps/neofetch/ … r/neofetch

That's got a few things in there that will fit nice if I can figure out how to get them**.


OS: BunsenLabs GNU/Linux 8.7 (Hydrogen) x86_64
Model: MCP61M-M3 7.0 **
Kernel: 3.16.0-4-amd64
Uptime: 1 hour, 5 mins
Packages: 1916 **
Shell: bash 4.3.30 **
Resolution: 1920x1080
WM: Openbox
WM Theme: S11-SR-71-Black **
Theme: S11-NS-brushed [GTK2/3] **
Icons: NouveGnomeGray [GTK2/3] **
Terminal: termin
CPU: AMD Athlon II X3 450 (3) @ 3.200GHz
GPU: NVIDIA GeForce 210
Memory: 670MiB / 5985MiB

The rest can be done in conky, or I know another way to get it.

BTW, neofetch, screenfetch, lsb_release and inxi are not reporting: BunsenLabs v8.8 they say v8.7

but (see OP)

cat /etc/debian_version

tells us: 8.8


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#11 2017-05-27 17:10:15

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: S11 needs Conky help.

Sector11 wrote:

Model: MCP61M-M3 7.0 **

That would be the get_model() function here:

https://github.com/dylanaraps/neofetch/ … fetch#L226

Packages: 1916 **

Not sure what neofetch are using but I would do

dpkg --list | grep -c ^i

Shell: bash 4.3.30 **

get_shell()

WM Theme: S11-SR-71-Black **

get_wm_theme(), particularly https://github.com/dylanaraps/neofetch/ … fetch#L739

Theme: S11-NS-brushed [GTK2/3] **

get_style(), the general section is applicable to Openbox: https://github.com/dylanaraps/neofetch/ … etch#L1529

Icons: NouveGnomeGray [GTK2/3] **

get_icons() which uses local variables set by get_style()

Hope this helps!

smile


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#12 2017-05-27 19:18:27

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,813

Re: S11 needs Conky help.

Oh I saw the code at the link you posted. And understood what you are pointing out above.

But outside the world of conky I'm like a fish out of water.  - well with this kind of stuff anyway.

${pre_exec neofetch get_icons_()} won't work  smile


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#13 2017-05-27 19:33:02

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: S11 needs Conky help.

OK, give me a bit and I'll break them down for you.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#14 2017-05-27 20:13:38

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: S11 needs Conky help.

Sector11 wrote:

Model: MCP61M-M3 7.0 **

$(pre_exec cat /sys/devices/virtual/dmi/id/product_name)

Shell: bash 4.3.30 **

$(pre_exec echo "$0" "$BASH_VERSION")

^ Doesn't work with other shells hmm

WM Theme: S11-SR-71-Black **

$(pre_exec awk -F "[<,>]" '/<theme/ {getline; print $3}' "${XDG_CONFIG_HOME}/openbox/rc.xml")

Theme: S11-NS-brushed [GTK2/3] **

$(pre_exec grep "^[^#]*${gtk-theme-name}" "$HOME/.gtkrc-2.0")

Icons: NouveGnomeGray [GTK2/3] **

As above but substitute "gtk-icon-name" in place of "gtk-theme-name".

These are all just crude approximations that should work with your system (perhaps).

A better solution would be to strip everything out of the neofetch script except the functions then add "$@" to the end of the script and source the file & call the function in the pre_exec command. But that would be quite a lot of work.

EDIT: I had unquoted variables yikes ops

Last edited by Head_on_a_Stick (2017-05-27 20:20:14)


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#15 2017-05-27 22:14:32

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,813

Re: S11 needs Conky help.

Where the heck do you find / How the heck do you know --> "all" this stuff?  yikes

ASCII version: Ø¿Ø

Thank you ...

the "cat" command I used in the OP and the one you just posted above

cat /sys/devices/virtual/dmi/id/product_name

gives me more clues as to where to look for things.

Thank you. THANK YOU. THANK YOU.


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#16 2017-05-28 02:31:03

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,469

Re: S11 needs Conky help.

@HOAS - must have - and thanks for the simplified command.

@S11 - must be getting slow with the backspace key, both you and HAOS got comments in before I could pull those commands. Remembered conky does uptime and loadavg natively just as I hit the "Reply" button.

@S11 - I'd have to dig through some backups to find it. but I'm sure you have seen it if not actually used it. There is an aptitude command that would show the number of available updates - probably an apt command that will work. Probably not as useful for Stable, but some information and you do have 100-some keys to cover  monkey

Edit - that was quicker than I thought, commented out in a conkyrc I still use:

aptitude search "~U" | wc -l

there a similar command with apt?

Last edited by PackRat (2017-05-28 02:40:40)


You must unlearn what you have learned.
    -- yoda

Offline

#17 2017-05-28 04:01:09

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,813

Re: S11 needs Conky help.

You use that aptitude line?  I got a PM today that led to that same command and this:

 28 May 17 @ 00:52:36 ~
   $ apt-get upgrade -s |grep -P '^\d+ upgraded'|cut -d" " -f1
0
 
 28 May 17 @ 00:52:38 ~
   $ 

But the fact that sucker does it's thing in 2 seconds flat leads me to believe - NOT!

 28 May 17 @ 00:55:13 ~
   $ apt-get upgrade -s
NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
 
 28 May 17 @ 00:55:15 ~
   $ 

I'm testing the aptitude line in a conky now ... can you confirm that it works?


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#18 2017-05-28 04:18:41

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,813

Re: S11 needs Conky help.

I have to say, I'm getting lot of things going here.  HoaS opened my eyes to " cat " while I posted an example on the OP it didn't hit me ... but not half an hour ago I use my "find text" alias (ftxt) because its easier for me to type and remember than: ack-grep

So I did a:

ftxt " cat " /media/5/Conky

I've got kittens all over the place.

Some samples:

/media/5/Conky/1a_accuweather_conkyweather_font/test/conkyrc_1a_int
6:# ${pre_exec cat /etc/issue}

/media/5/Conky/00_TIPS_N_STUFF/SearchOne_via_Claus/multimedia/conky-cpu.txt
4:     cat /proc/cpuinfo
6:     ${execi 99999 cat /proc/cpuinfo | grep "model name" -m1 | cut -d":" -f2 | cut -d" " -f2-}
8:     ${execi 99999 cat /proc/cpuinfo | grep "cpu MHz" -m1 | cut -d":" -f2 |cut -d" " -f2-} MHz
9:     ${execi 99999 cat /proc/cpuinfo | grep "cache size" -m1 | cut -d":" -f2 |cut -d" " -f2-} Cache

/media/5/Conky/convert-lua/test.10.conky
91:${color3}${alignc}${execi 86400 disp=${DISPLAY#:}; disp=${disp%.[0-9]}; cat $HOME/.desktop-session/desktop-code.$disp 2>/dev/null}

this seems to me the most popular and I didn't remember it:  ${pre_exec cat /etc/issue}

It's my forgetter kicking in again.

and I hit the motherload in /media/5/conky!  big_smile big_smile


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#19 2017-05-28 09:03:54

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: S11 needs Conky help.

PackRat wrote:

there a similar command with apt?

# apt update && apt list --upgradable

“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#20 2017-05-28 14:23:27

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,469

Re: S11 needs Conky help.

^ thanks

I'm testing the aptitude line in a conky now ... can you confirm that it works?

did last time I was running Debian Sid, but look one post above.

Last edited by PackRat (2017-05-28 14:24:06)


You must unlearn what you have learned.
    -- yoda

Offline

#21 2017-05-28 19:24:41

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,813

Re: S11 needs Conky help.

OK, thanks .... still checking here on Stable.  0 at the moment.

@ HoaS

 28 May 17 @ 16:20:04 ~
   $ apt update && apt list --upgradable
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
 
 28 May 17 @ 16:20:06 ~
   $ 

Needs root access. sad sad


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#22 2017-05-28 19:29:52

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: S11 needs Conky help.

Sector11 wrote:

Needs root access

Ah yes, apologies S11, I was using the "#" symbol to indicate that root privileges are required — stock Debian doesn't include `sudo` and I don't use it myself.

Last edited by Head_on_a_Stick (2017-05-28 19:30:44)


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#23 2017-05-28 19:35:06

DeepDayze
Like sands through an hourglass...
From: In Linux Land
Registered: 2017-05-28
Posts: 1,357

Re: S11 needs Conky help.

Head_on_a_Stick wrote:
Sector11 wrote:

Needs root access

Ah yes, apologies S11, I was using the "#" symbol to indicate that root privileges are required — stock Debian doesn't include `sudo` and I don't use it myself.

I set up sudo on my system to make it quick and easy to run something as root. I added only my main user to the sudo group in sudoers file.


Real Men Use Linux

Offline

#24 2017-05-28 19:42:48

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: S11 needs Conky help.

^ I remove `sudo` then edit /etc/pam.d/su to restrict `su` access to members of the wheel group, as it is in the BSDs.

Linux is too lax, IMO neutral


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#25 2017-05-28 19:55:53

damo
....moderator....
Registered: 2015-08-20
Posts: 6,718

Re: S11 needs Conky help.

Just leave out the update - sudo isn't needed for the list. As long as you can live with a possible error with the list of packages since the last update of course.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

Board footer

Powered by FluxBB