You are not logged in.

#1 2010-04-18 23:40:41

Horris
Member
Registered: 2009-04-05
Posts: 30

How to get this information for Conky

Hi people,

My question is how to get this information for show in Conky:

- KDE version.
- Last sync (pacman -Sy) and Last update (pacman -Su)

For the first point could be use a script that execute $ kdesu --version and get information from there.
I have no idea how get information from pacman (may be logs?).

Any ideas?

Thank you.

Offline

#2 2010-04-19 01:16:27

splittercode
Member
From: WI, USA
Registered: 2010-03-16
Posts: 203

Re: How to get this information for Conky

grep 'system upgrade' /var/log/pacman.log | tail -1 | sed -e 's/s.*//'
grep 'synchronizing' /var/log/pacman.log | tail -1 | sed -e 's/s.*//'

There might be a more elegant way of doing that, but it's what I do.

btw, this probably shouldn't be in the Artwork and Screenshots section...

Last edited by splittercode (2010-04-19 01:22:41)

Offline

#3 2010-04-19 01:36:21

Horris
Member
Registered: 2009-04-05
Posts: 30

Re: How to get this information for Conky

Thank you, I will try on.

For the kde version I did this:

kdesu --version print this:

$ kdesu --version
Qt: 4.6.2
KDE Development Platform: 4.4.2 (KDE 4.4.2)
KDE su: 1.0

Then I make a script with

#!/usr/bin/perl

use strict;
use warnings;
my @lines = (`kdesu --version` );
my $temp = substr("$lines[1]",37,5);
print $temp
4.4.2

How move this topic to the right place?. Wich would be?

Last edited by Horris (2010-04-19 01:38:02)

Offline

#4 2010-04-19 01:47:11

splittercode
Member
From: WI, USA
Registered: 2010-03-16
Posts: 203

Re: How to get this information for Conky

Horris wrote:

How move this topic to the right place?. Wich would be?

I dunno, I've never made a thread before.. I think maybe a moderator will have to do it hmm

Offline

#5 2010-04-19 01:49:16

empthollow
Member
Registered: 2009-09-26
Posts: 168

Re: How to get this information for Conky

here is a modification of the previous command that will give you year-mo-day

grep 'system upgrade' /var/log/pacman.log | tail -1 | grep -oe [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]
2010-04-13
grep 'synchronizing' /var/log/pacman.log | tail -1 | grep -oe [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]
2010-04-13

--empthollow
Check out my Arch based live distro http://fluxcapacity.99k.org

Offline

#6 2010-04-19 02:03:00

splittercode
Member
From: WI, USA
Registered: 2010-03-16
Posts: 203

Re: How to get this information for Conky

How bout this? lol

#!/bin/bash
TODAY=$(date +"%Y-%m-%d")
LASTUPDATE=$(grep 'synchronizing' /var/log/pacman.log | tail -1 | grep -oe [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])
    tmpDays=$( printf '%s' $(( $(date -u -d"$TODAY" +%s) - $(date -u -d"$LASTUPDATE" +%s)))  )
    days=$(( $tmpDays / 60 / 60 / 24 ))
    echo "$days" &

Stuck empthollow's command into a bash script I already use for other purposes, should give you days since last update as output (which for me is zero right now).

Obviously, you can replace 'synchronizing'  with 'system upgrade' for -Su.

Last edited by splittercode (2010-04-19 03:09:09)

Offline

#7 2010-04-19 03:58:23

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: How to get this information for Conky

Side concern, don't you think grepping through /var/log/pacman.log (1.1MB on my current machine) repeatedly would both kill your hard disk as well as your battery?

Some type of pacman 'hook' which is run on every pacman command to update a file to the latest date-stamp would be easier on resources I think. No idea if pacman has any support for hooks.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#8 2010-04-19 04:19:32

Kiwi
Member
Registered: 2008-02-24
Posts: 153

Re: How to get this information for Conky

Use tail on the logfile before doing the grep if you are that worried? Though even on the worst computer arch could run on grep does pretty well on that 'large' of file.

You could also use a file alteration library to check the file, such as those in inotify-tools (which includes the programs inotifywait and inotifywatch) instead of polling it with greps/tails/whatever.

Offline

#9 2010-04-19 12:56:10

splittercode
Member
From: WI, USA
Registered: 2010-03-16
Posts: 203

Re: How to get this information for Conky

Well, in conky and most other system monitor tools that you'd use these in(ex. status bars in tiling wm's) you can set scripts to run/update however often you want.  I can't imagine running it once every 2-3 hours would have any noticeable effect.

Offline

#10 2010-04-20 00:39:45

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: How to get this information for Conky

@splittercode - you're absolutely right, but I'm operating from the geek perspective of 'if it changes I want to know NOW', where 2-3 hours polling interval basically means 2-3 hours potential delay in being informed.

@Kiwi - Didn't think about file alteration notifications, that's a real cool idea.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#11 2010-04-21 03:46:08

Kiwi
Member
Registered: 2008-02-24
Posts: 153

Re: How to get this information for Conky

I started writing a script that does this using lua + linotify-git but then realized I do not know exactly how conky works. Do all you need to do is write a script that prints what you want to display and then it runs it and displays what you printed? hmm What happens if the script returns more than one result per run (and runs constantly), as in each time the system is upgraded it would print a new last update time?

Last edited by Kiwi (2010-04-21 03:47:25)

Offline

#12 2010-04-22 13:09:25

splittercode
Member
From: WI, USA
Registered: 2010-03-16
Posts: 203

Re: How to get this information for Conky

Kiwi wrote:

I started writing a script that does this using lua + linotify-git but then realized I do not know exactly how conky works. Do all you need to do is write a script that prints what you want to display and then it runs it and displays what you printed? hmm What happens if the script returns more than one result per run (and runs constantly), as in each time the system is upgraded it would print a new last update time?

Yes, conky just outputs whatever the script prints.  As for the second question, I'm not really sure, I've never tried that.  I suspect conky would just stack all the prints on top of each other in its display.

Offline

#13 2010-04-22 14:03:41

Kiwi
Member
Registered: 2008-02-24
Posts: 153

Re: How to get this information for Conky

I cannot get this stupid program (conky) to even print just "HI" without any fancy things from a Lua script. hmm I have found there is Lua integration but A. it looks like a pain to use and B. it is disabled in Arch....

Anyone ever had luck with it?

Offline

#14 2010-04-22 17:50:04

kittykatt
Member
From: Missouri, USA
Registered: 2009-11-04
Posts: 260
Website

Re: How to get this information for Conky

I have had tremendous success with LUA in Conky on Arch. And all you need to to is put the text HI after the "TEXT" line. ^^;

Examples of my LUA usage:

http://fc02.deviantart.net/fs71/i/2010/ … usLink.png

http://kittykatt.silverirc.com/screens/conky-HUD.png

EDIT:  Also, I've had success with getting the KDE version by doing the following...

kwin --version | awk '/^Qt/ {data="Qt v" $2};/^KDE/ {data=$2 " (" data ")"};END{print data}'

This is the method I'm currently using in screenFetch. Tested it a couple of times myself, but besides that, I'm not sure if it will work or not.

Last edited by kittykatt (2010-04-22 17:52:25)


- [ My Blog ] | [ AUR Packages ] | [ My deviantART ] | [ screenFetch ] | [ SilverIRC ] -

Offline

#15 2010-04-22 18:03:52

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: How to get this information for Conky

<self_plug shame='false'>

In addition to inotify-tools, you might also try FCM.

</self_plug>

Offline

#16 2010-04-22 20:06:13

Kiwi
Member
Registered: 2008-02-24
Posts: 153

Re: How to get this information for Conky

It is Lua not LUA.

And I tried it again with an even simpler script and it showed the text...does it not print what comes from the script until the script returns? hmm

Offline

#17 2010-04-22 22:41:55

Horris
Member
Registered: 2009-04-05
Posts: 30

Re: How to get this information for Conky

My Desktop with Conky:

KDE version and Last sync and Last upgrades

http://danhorris.deviantart.com/art/MyA … -161628921

Thank you!

Offline

#18 2010-04-23 01:51:56

empthollow
Member
Registered: 2009-09-26
Posts: 168

Re: How to get this information for Conky

Looks nice, similar to one I use actually.  could you post the code you used for grabbing your public ip?
Here's mine.
http://yfrog.com/j1desktopbqp


--empthollow
Check out my Arch based live distro http://fluxcapacity.99k.org

Offline

#19 2010-04-23 02:13:35

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: How to get this information for Conky

@empthollow, I use ${execi 3600 wget -O - http://ip.tupeux.com | tail}


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

Board footer

Powered by FluxBB