By SWAT (User), on Sat
Oct 29 19:07:56 2005: Volume control.
Since I'm not a programmer or scripter and I would love to
see a desklet like this, I'm posting it here. I don't know if
it's possible, but I hope so.
A small applet, with a plain volume control bar (example: for
ALSA) and with a mute button. This would be great!
By mbokil (Desklet
Author), on Sun Dec 11 16:30:32 2005: volume control desklet
almost ready.
I have a basic volume control in development for adesklets.
It is still too rough to test release yet. I have image
buffering to add, config options. Maybe by next week I will
upload the code for peer review.
I plan to post the development progress on my web site:
http://markbokil.org/index.php?section=desklets&content=c_desklets.php
-mark
By syfou (Core Developer
& Desklet Author), on Sun Dec 11 19:22:13 2005.
It is already looking good, Mark.
:-)
This is unfortunate timing, though: I will be out of the
country for a whole month (from December the 13th to January
the 14th), which means there will be no update of any sort to
the "official" desklets list; I will at least add you to my
list of external resources before leaving... Regards,
By mbokil (Desklet
Author), on Sun Dec 11 21:55:42 2005.
Well, have a good time. It will be ready when you get back. I
plan to upload the source to my site next week sometime to
get some peer testing. I got the image buffering code in and
now I am just adding a transparent background to increase the
eye-candy appeal factor. 8) I created a toggling button state
using the image blending methods to give the user persisted
feedback as to what the volume strength.
It has been interesting to learn more about how adesklets
works. I mostly work on Firefox extensions where the Gecko
engine does the image buffering for me. I learned something
doing it by hand and looking at the developer's examples.
By mbokil (Desklet
Author), on Mon Dec 12 10:42:03 2005: working version of
volume desklet running!.
Okay, I have a working version of the volume desklet running.
There are a couple more tweaks I want to add like repeater
logic to the increase, decrease buttons. Give it a test.
:)
http://markbokil.org/index.php?section=desklets&content=c_desklets.php
-mark
By syfou (Core Developer
& Desklet Author), on Mon Dec 12 15:13:51 2005.
Hi Mark,
I had a look at your code; it is already pretty usable, but I
have a couple of comments, classified by importance.
Important:
Your package does not follow the convention for directory
naming (see the appendix on Submitting desklets in the
documentation):
the base directory should be
name-version; also, I see you borrowed
an older makefile from asimpleclock -- just use what I
provide in the doc, it makes things easier.
Midly annoying:
- The exception trace thrown
when testing your desklet without having aumix installed is
too cryptic to be understood without looking at the code...
Some preliminary test of just a good old exception catching
could be put in place -- believe me, some users will just
not read your requirements, unless you stick them under
their nose. ;-)
- So you based your script
around aumix; Why? It is not that aumix is a bad
application, but it is not present "out of the box" on most
systems, while amixer is (for alsa), and python support oss
mixers by itself. In fact, it also supports alsa mixers
with extensions module such as pyalsaaudio.
Using python modules has two additional benefits: you do
not fork yet another process every time you want to change
the volume, that's merely a library call, and you don't
have to parse anything yourself.
Not important, but worth
mentioning:
- Python is a dynamic language;
why doing:
# Python alas doesn't have a simple way to do this.
def system_readline(self,cmdstr) :
fp = os.popen(cmdstr)
s = fp.readline()
return s
when is is enough to do:
def system_readline(self, cmdstr): return os.popen(cmdstr).readline()
- An about that:
Python is unbelievably bad at parsing integers! There's apparently no built-in way to pull 70 out of the string "70,".
There are plenty of ways, here is one:
Just look to the re module if you want something more
generic.
- For the moment, everything
graphical in your desklet is hard-coded, making it
difficult to customize... But I guess it is just your first
release, so it is not important for now.
Thanks for your work! Regards,
By mbokil (Desklet
Author), on Mon Dec 12 21:48:52 2005.
Thanks for the code review. In terms of using aumix I used it
since it was the only python volume code I had on hand and I
am not very familiar with the python libraries out there. I
replaced it with amixer to make it more standard.
The current desklet is just a prototype to test out the idea
of the basic design I had in my head. I will use your
feedback to modify it as I continue to tighten up the code. I
will look at using some of the python audio controls you
mentioned. I would like to keep the dependencies low since I
know most users will avoid installing them unless it is easy
to do. I initially had some problems with the network and
cpuload desklets since they had the pystatgrab dependency and
I couldn't 'yum install' or 'apt get' it in an easy way for
the Fedora. I am leary of adding in any other
dependencies.
This is actually the first application I ever wrote in python
coming from a Java, javascript, php background.
-mark
By syfou (Core Developer
& Desklet Author), on Tue Dec 13 02:29:08 2005.
Mark,
I am just leaving now, but I just wanted to say that for a
first time with Python, this is very, very good. As promised,
I added your site to the
external
links page. Do not hesitate to post your comments or
questions -- I am not the only one who read them. ;-)
By mbokil (Desklet
Author), on Thu Dec 15 00:26:29 2005: volume desklet
0.0.1.
I updated my current volume desklet to incorporate the
features:
o Flicker free image updating
o volume repeater code on volume up, down
o aumixer switched to amixer to make it more standard
o exception handling added
http://markbokil.org/index.php?section=desklets&content=c_desklets.php
-mark
By mbokil (Desklet
Author), on Sat Dec 17 22:43:08 2005: Volume desklet version
0.0.3.
Volume desklet version 0.0.3
o 4 themes included
o rollover animation on volume slider buttons
o 3 themes support desktop transparency
http://markbokil.org/index.php?section=desklets&content=c_desklets.php
-mark
By mbokil (Desklet
Author), on Mon Dec 19 08:58:10 2005.
volume desklet 0.0.6
o added charcoal theme
o removed amixer dependency
o fixed major memory leak
http://markbokil.org/index.php?section=desklets&content=c_desklets.php
-mark
By mbokil (Desklet
Author), on Sat Jan 7 14:46:39 2006: volume desklet
0.0.7.
volume desklet 0.0.7 is ready:
+ Right-click theme change menu
+ 5 themes to choose from
+ no additional dependencies but Python
http://markbokil.org/index.php?section=desklets&content=c_desklets.php
By cs-cam (Desklet
Author), on Sun Jan 8 03:23:22 2006.
Wow! Really nice desklet :lol:
EDIT: I made some changes to it, as
it was the desklet wouldn't start outside of it's basedir
because it couldn't find the images. I changed it so it'll
use absolute paths to find the image and it'll dynamically
update. For example, if I'm running the desklet and I use
alsamixer to change my volume the desklet wouldn't reflect
the changes. It will with this patch but I've just got it
running Events.ready() every second, I'm sure if you wanted
you could optimise that a lot if you wanted :)
http://www.camdaniel.com/media/code/volume-suggest.patch
By mbokil (Desklet
Author), on Sun Jan 8 11:09:25 2006.
Those are some good suggestions. I had noticed that problem
of external programs changing the volume and then the volume
desklet getting out of synch. Refreshing every second is a
good solution if it keeps the processing down. I will
incorporate these changes and one final OSX-ish type theme
for the 1.0 release.
-mark
By mbokil (Desklet
Author), on Sun Jan 8 13:40:54 2006.
Okay I incorporated your image changes and added an alarm
update with one second as you suggested. I optimized it as
much as I could but the call to ossaudiodev mixer will
produce a small CPU spike of about 2% but that is pretty
small. I also added a new 'Brushed' metal theme to please the
OSX fans out there. I hope people find it useful.
http://markbokil.org/index.php?section=desklets&content=c_desklets.php
Thanks for your help.
-mark
By gravedigga (User), on
Tue Jan 17 08:12:16 2006.
Hey Mark a very nice Desklet!
I would use it, but it uses the wrong sounddevice.
I looked at the code but i never programm python and so i
wasnt able to switch the device.
Is there a way at the moment?
By mbokil (Desklet
Author), on Tue Jan 17 22:01:55 2006.
The volume desklet currently uses device
ossaudiodev.SOUND_MIXER_VOLUME
I am not certain which devices the Python sound library
supports but I could look into it. Which device would you
like it to support?
-mark
By gravedigga (User), on
Wed Jan 18 01:19:20 2006.
thx for ur answer!
i have three mixer devices, the desklet now use the first
(hw:0). it would be nice if it could use hw:2, on this mixer
runs a artsd server i dont know if this could be a problem.