You are not logged in.

#1 2008-11-17 18:04:01

initbox
Member
Registered: 2008-09-27
Posts: 168

Possible with Conky?

Hey, I was just wondering if anyone has come up with a way to display some irssi-information in your Conky?

I just figured it might be cool to have Conky display the last message said in irssi or a notification when you get highlighted. It just seems like Conky lacks such a feature by default and getting information out of irssi is kind of out of my league, even though it might be possible to do with some command (seems like you can do anything with a fitting command.)

It just seems amazing that Conky *gasp* lacks a feature!

On another note, maybe I'm not creative enough, but it seems like there is no easy way to implement this either:

I want to make my MPC: "$mpc_artist - $mpc_title [$mpc_elapsed / $mpc_duration]"-string something like just MPC: "not playing" when it's stopped. Since when stopped, it just shows " - [0:00 / 0:00]" it would be neater if it would just clean itself up.

Though, there doesn't seem to be a way to implement this without an if-condition, and the if_empty condition needs to have some interesting logic if it's doable at all (and I'd rather stay with Conky variables if possible, it would be somewhat easy to configure with a single script or exec.) How much more resource-demanding is it to use external commands anyway? The Conky documentation mentions that it's more resource intensive but that seems like a subjective term.

Offline

#2 2008-11-18 02:22:18

Megamixman
Member
Registered: 2008-05-04
Posts: 73

Re: Possible with Conky?

Well...
You could do it by having a script in irssi that outputs that to a file.
Conky could look for that file. If exists, echo and delete.

As for using an external command. It is probably more resource intensive, but really, we're probably talking about a few kb more max + the resources the command itself uses. So as long as you're not running big scripts, you should be fine. Probably stick to bash scripts.

Offline

#3 2008-11-18 02:29:15

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,418
Website

Re: Possible with Conky?

I might work on something for you in a bit, but as for displaying when you get highlighted you could do that simply with something like 'cat /path/to/irc.log | tail | grep <username>' and output that through conky...

Maybe not the best solution, but it's a simple one off the top of my head.

Offline

#4 2008-11-18 02:44:54

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: Possible with Conky?

This is an excerpt from my .conkyrc:

${execi 5 nice -n19 /home/filip/scripts/mpd.sh}${if_existing /tmp/mpd.tmp}${font glispbold}MPD: ${color0}$font${execi 2 cat /tmp/mpd.tmp}$color  ::  $endif

What it does is:
1. Run mpd.sh script (see below) which basically saves the current mpd status to /tmp/mpd.tmp file (if music is playing)
2. if_existing condition checks if the file /tmp/mpd.tmp exists (it only exists when music is playing or paused) -- if the file exists then mpd info is displayed, if it doesn't exist then the whole mpd section in conky doesn't appear at all

Here is the mpd.sh script that I use -- you'll notice that it also makes sure that the Arist/Title info is no longer than a certain number of characters (80), because my conky is a single horizontal line at the top of the screen:

#!/bin/bash

is_playing_music=$(mpc | grep -e ^\\[p[al][ua][sy][ei].*\\])

echo "$is_playing_music" | grep -qe ^\\[paused\\] && echo "paused" > /tmp/mpd.tmp && exit

if [ ! -n "$is_playing_music" ]; then
  [ -f /tmp/mpd.tmp ] && rm -r /tmp/mpd.tmp && exit
else
  disp=`mpc --format "%artist% ## %title%" | head -1`
  if [ ${#disp} -gt 80 ]; then
    echo "${disp:0:77}..." > /tmp/mpd.tmp
  else
    echo "${disp}" > /tmp/mpd.tmp
  fi
fi

Offline

#5 2008-11-18 02:49:40

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,418
Website

Re: Possible with Conky?

Nice script fwojciec, I might adapt that tongue

Offline

#6 2008-11-18 03:30:48

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: Possible with Conky?

Ghost1227 wrote:

Nice script fwojciec, I might adapt that tongue

Let me know if you make any intersting/fun improvements smile

Offline

#7 2008-11-18 05:24:31

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,418
Website

Re: Possible with Conky?

Quick conky script to grab IRC output - requires logging enabled.

${exec cat /path/to/irc.log | tail -n 5}

Offline

#8 2008-11-18 06:14:20

initbox
Member
Registered: 2008-09-27
Posts: 168

Re: Possible with Conky?

Thanks guys yikes

Offline

#9 2008-11-18 06:28:40

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,418
Website

Re: Possible with Conky?

any other scripts needed, please let me know, i'm looking for things to do tongue

Offline

#10 2009-05-06 21:54:14

riivo
Member
Registered: 2008-08-25
Posts: 112

Re: Possible with Conky?

A rather old topic, but I would like to post my current solution.

.conkyrc

MPD ${hr 2}
${voffset 4}${font Webdings:size=14}U${font}   Status: $alignr$mpd_status
${execpi 5 /home/riivo/scripts/mpd.awk}

mpd.awk

#!/bin/awk -f

BEGIN {

    MPD_CMD = "mpc"; # mpd
    MPD_CMD | getline;
    MPD_CMD | getline;
    mpd_state = $1;
    close(MPD_CMD);

    if ( mpd_state == "[playing]" )
        print "${voffset 4}${font Webdings:size=14}4${font}   Song: $alignr$mpd_artist\n${voffset 6}$alignr$mpd_title\n${voffset 8}$mpd_elapsed/$mpd_length $alignr${mpd_bar 8,120}";
    else {
        if ( mpd_state == "[paused]" )
            print "${voffset 4}${font Webdings:size=14};${font}   Song: $alignr$mpd_artist\n${voffset 6}$alignr$mpd_title\n${voffset 8}$mpd_elapsed/$mpd_length $alignr${mpd_bar 8,120}";
    }

}

A way to make the strings in mpd.awk look nicer is welcomed.

Offline

Board footer

Powered by FluxBB