You are not logged in.

#1 2010-08-12 16:24:26

valvet
Member
From: Denmark
Registered: 2009-06-06
Posts: 147

[SOLVED] xmonad and dzen2 - clickable areas

Hey

I'm trying to execute a function (rather than a program), when I click an icon in dzen2, using ^ca() - but to no avail.

I do rougly this:

!#/bin/sh

test() {
  echo "Yay.."
}

echo "^ca(test)^i(/path/to/icon/icon.xbm)click me^ca()"

It tells me test, no such command.. because it's trying to execute a binary called "test", rathern than my function inside the script. Is it even possible to execute script functions, in ^ca()?

Thanks :-)

- m

Last edited by valvet (2010-11-08 14:49:46)

Offline

#2 2010-08-12 19:01:11

Knute
Member
From: Minot, ND
Registered: 2009-03-17
Posts: 604

Re: [SOLVED] xmonad and dzen2 - clickable areas

If you are trying to call the test function, then don't you need the parenthesis and call it with:

^ca(test())

??


Knute

Offline

#3 2010-08-12 19:16:07

valvet
Member
From: Denmark
Registered: 2009-06-06
Posts: 147

Re: [SOLVED] xmonad and dzen2 - clickable areas

Knute wrote:

If you are trying to call the test function, then don't you need the parenthesis and call it with:

^ca(test())

??

I would expect so, but then again no.. if you call $(test) from like: echo "$(test)" it works fine (no parenthesis).. if I put parenthesis in the ^ca() function, it errors. It might not be possible, I'm hoping someone knows :-).

Thanks for replying.

Offline

#4 2010-08-12 22:54:17

Knute
Member
From: Minot, ND
Registered: 2009-03-17
Posts: 604

Re: [SOLVED] xmonad and dzen2 - clickable areas

So what exactly are you trying to have execute when you click the link anyway?

Another option that you would have is to just make a script that gets called when you click the link.

However, if you are trying to use a haskell function to say.... Oh, I don't know, change workspaces by clicking, then that would be a horse of a different color.

Last edited by Knute (2010-08-12 22:56:37)


Knute

Offline

#5 2010-08-13 09:17:21

valvet
Member
From: Denmark
Registered: 2009-06-06
Posts: 147

Re: [SOLVED] xmonad and dzen2 - clickable areas

Knute wrote:

So what exactly are you trying to have execute when you click the link anyway?

Another option that you would have is to just make a script that gets called when you click the link.

However, if you are trying to use a haskell function to say.... Oh, I don't know, change workspaces by clicking, then that would be a horse of a different color.

I'm trying to call a function that checks for mail on my gmail account - because it only updates every 10 minutes, and if I've read my mail it  ontinues to say "You've got new mail.." for 10 minutes obviously - when I click the mail icon, it should call the function that checks mail so it'll update as it would normally :-)

- m

Offline

#6 2010-08-14 13:08:44

Knute
Member
From: Minot, ND
Registered: 2009-03-17
Posts: 604

Re: [SOLVED] xmonad and dzen2 - clickable areas

So this is an external script that you are trying to have run it's checkmail function?

If so, then you may need to call that script with the appropriate option to check mail, assuming, of course that it has such an option.


Knute

Offline

#7 2010-08-14 13:31:46

valvet
Member
From: Denmark
Registered: 2009-06-06
Posts: 147

Re: [SOLVED] xmonad and dzen2 - clickable areas

Knute wrote:

So this is an external script that you are trying to have run it's checkmail function?

If so, then you may need to call that script with the appropriate option to check mail, assuming, of course that it has such an option.

Hey

No, it's not an external script.. it's the "test" function my first post, just called something else :-)

- m

Offline

#8 2010-11-04 13:12:18

valvet
Member
From: Denmark
Registered: 2009-06-06
Posts: 147

Re: [SOLVED] xmonad and dzen2 - clickable areas

Still working on this one. Anyone care to give their 8 cents? :-)

Offline

#9 2010-11-04 13:54:00

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: [SOLVED] xmonad and dzen2 - clickable areas

valvet: You need to export the function before it can be called with dzen2. Place the test function in your .bashrc or somewhere you find appropiate, source it and try again. The function you're trying run with dzen2 only exists locally in your script.

You could also store the command in a variable instead of a function like so:

#!/bin/bash
mycom="echo 'Arch er fanme KISS'|dzen2 -p 10 -y 600" 

echo "^ca(1,$mycom)^i(/path/to/icon/icon.xbm)click me^ca()"|dzen2 -p -y 50

Either this or create script that does what you want and place it in your path and use that instead of a function.

Offline

#10 2010-11-04 19:45:21

valvet
Member
From: Denmark
Registered: 2009-06-06
Posts: 147

Re: [SOLVED] xmonad and dzen2 - clickable areas

Oh that's awsome. I was actually wondering about that, if I needed to export something.. after my exporting ~/bin folder, so scratchpad could use it, was fixed. Thanks alot.

Offline

Board footer

Powered by FluxBB