You are not logged in.
OK, I'm working on a conky project and need some help from script guru's and CLI geeks
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:
... 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
See, I don't want to do it over, want to get it right, therefore I need a little help filling this sucker in.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
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), now on Bluesky, there's also some GitStuff )
Offline
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!
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
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), now on Bluesky, there's also some GitStuff )
Offline
Have a look at the stuff neofetch uses to get the system information, their scripting is pretty neat (but not POSIX):
Offline
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
# 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)
Offline
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.
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
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
# load average
uptime | grep -ohe 'load average[s:][: ].*' | awk '{ print $3" "$4" "$5"," }' | sed 's/,//g'
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.
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}
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
Have a look at the stuff neofetch uses to get the system information, their scripting is pretty neat (but not POSIX):
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
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
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 **
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!
Offline
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
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
OK, give me a bit and I'll break them down for you.
Offline
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
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 :8
Last edited by Head_on_a_Stick (2017-05-27 20:20:14)
Offline
Where the heck do you find / How the heck do you know --> "all" this stuff?
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.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
@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 8o
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
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?
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
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!
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Offline
there a similar command with apt?
# apt update && apt list --upgradable
Offline
^ 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