2010/2/22 Sergey Mironov <[email protected]>:
> 2010/2/21 Gerry LaMontagne <[email protected]>:
>> On Sun, Feb 21, 2010 at 01:37:16PM +0300, Sergey Mironov wrote:
>>> Hi community! I use bashets [1] as data source for my awesome widgets.
>>> I like the idea, but this library uses timer-based polling design and
>>> i found it quite bad. So i am searching for better solution. I think
>>> about following:
>>>
>>> 1. FIle descriptor event notifications. Unfortunately, awesome lucks
>>> poll-like capi notification function.
>>> 2. dbus-driven event notifications, kind of "script X has new data to
>>> display". These could solve a problem, so my question is:
>>>   how to send custom dbus message with shell script and catch ones in
>>> awesome? Does anyone use things like that?
>>>
>>> [1] - http://awesome.naquadah.org/wiki/Bashets
>>> --
>>> Thanks,
>>> Sergey
>>>
>>> --
>>> To unsubscribe, send mail to [email protected].
>>>
>>
>> I do something like this to integrate uzbl with awesome.  Uzbl uses a
>> sockets for communications.  I use a python script in uzbl, bound to a key,
>> to send the socket descriptor of the uzbl instance to awesome.  This
>> allows me to trigger a pop-up address bar (a textbox widget) which I
>> then can enter a URL into for uzbl.  To facilitate this, I just created
>> a function in my awesome.rc that my uzbl-script invokes via dbus.
>>
>> I can't say if this is exactly what you're after- but it seems close as
>> I'm pushing a piece of data into awesome using a python script.  The
>> awesome-client is just a bash script, perhaps that would be a place to
>> start.
>>
>> Regards-
>> Gerry LaMontagne
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.10 (GNU/Linux)
>>
>> iF4EAREIAAYFAkuBL+oACgkQuZVaBQlJuPEtngD/dCjts9c0AcORgF/pZHnUTXP6
>> K+Zh7g8U1g0zwLpHK4YA/1mATP21+BMfWXgwPNUMYnUKtMcWQ5bA+mRz+aG2Ge3j
>> =3OQB
>> -----END PGP SIGNATURE-----
>>
>>
>
> Thanks for awesome-client pointing. I simply didn't know that it is a plain
> bash. I'll try to implement 'async' bashets on top of it.
>
>
> --
> Thanks,
> Sergey
>

i've implemented those 'async' bashets. Link [1]. The toolset contains
lib - "pipelets.lua" and monitor script - "pipeman".
pipeman uses awesome-client to update specific widgets as suggested
above. It is like a gateway between shell and lua.

To setup this thing user should
1) Create widget scripts. Like this

ier...@vault awesomerc % cat pipelets/date
#!/bin/sh

# Script _should_ loop forever and print smth
# to stdout line-by-line
export LANG=ru_RU.utf-8
while true ; do
        date +'%a %d %b, %H:%M'
        sleep 60
done

will print date&time in non-system language with custom format

2) Initialize the lib, create widgets, register them as pipelets
(specify source script name)
Like this

require("pipelets")

-- ...

-- Pipelets
pipelets.config.script_path = awful.util.getdir("config").."/pipelets/"

pipelets.init() -- will launch pipeman

-- Clock
mytextclock = {}
mytextclock = widget({ type = "textbox", align="right" })
pipelets.register_fmt(mytextclock, "date", " $1 ") -- "date" is a
script's filename

-- Use mytextclock in wibox.

Thats all.

The thing i dont like - is huge number of /bin/sh processes in system.
But imho having 10 (sleeping) processes is better than 1 process
restarting every second.

[1] - http://git.ierton.ru/?p=awesomerc.git;a=tree;h=refs/heads/master;hb=master

-- 
Thanks,
Sergey

--
To unsubscribe, send mail to [email protected].

Reply via email to