HowTo create a volume mixer for IceWM

Share your own howto's etc. Not for support questions!

HowTo create a volume mixer for IceWM

Postby Soul Singin' » 2018-08-14 22:01

IceWM has a lot of great features, but a volume mixer for your system tray is not one of them. This HowTo describes a simple way to create one in TK. It is based on a Python script by Ashley Mills. The script was later adapted for FreeBSD by Knoba. And I adapted it for Debian.


Step One: Install Tkinter

Code: Select all
apt-get install python-tk


Step Two: Save the following Python script as /usr/bin/local/mixerapp and save a nice speaker icon to /usr/local/share/icons/audio-speakers.png

Code: Select all
#!/usr/bin/python2
import commands
from Tkinter import Tk,IntVar,Scale,PhotoImage

def adjustVol(vol):
   commands.getoutput('/usr/bin/amixer -c 0 set Master '+vol+'%')
   return

root = Tk(className='mixerapp')
root.geometry('50x100')
root.wm_title("Volume")
imgicon = PhotoImage(file='/usr/local/share/icons/audio-speakers.png')
root.call('wm', 'iconphoto', root._w, imgicon)
vol = IntVar()
scale = Scale(root,variable=vol,from_=100,to=0,command=adjustVol)
scale.set(commands.getoutput("/usr/bin/amixer -c 0 get Master | tail -n1 | sed 's/\[//g;s/\]//g;s/%.*$//g;s/^.*\s//'"))
scale.pack()
root.mainloop()


Step Three: To make the volume mixer appear in the tray, add the following lines to: ~/.icewm/winoptions, adjusting the geometry so that it appears in the appropriate location on your screen.

Code: Select all
mixerapp.tray: Exclusive
mixerapp.dTitleBar: 0
mixerapp.dBorder: 0
mixerapp.startMinimized: 1
mixerapp.geometry: 50x100+1151+26


Step Four: To make the volume mixer appear in the tray at startup, add the following line to: ~/.icewm/startup

Code: Select all
mixerapp &


Step Five: Restart IceWM and enjoy!
.
User avatar
Soul Singin'
 
Posts: 1483
Joined: 2008-12-21 07:02

Re: HowTo create a volume mixer for IceWM

Postby Bloom » 2018-08-14 23:01

Have you tried the pnmixer package?
User avatar
Bloom
 
Posts: 69
Joined: 2017-11-11 12:23

Re: HowTo create a volume mixer for IceWM

Postby Soul Singin' » 2018-08-15 01:59

Bloom wrote:Have you tried the pnmixer package?

Works like a charm. Thanks for the tip! :D
.
User avatar
Soul Singin'
 
Posts: 1483
Joined: 2008-12-21 07:02

Re: HowTo create a volume mixer for IceWM

Postby None1975 » 2018-08-16 14:21

If you do not have a pulseaudio in the system, try volumeicon-alsa. Just do not forget add it to your startup file
Code: Select all
sleep 1 &&
volumeicon &
OS: Debian 9.4 / WM: Xmonad
Debian Wiki | DontBreakDebian, My config files in github
Linux User #607425
User avatar
None1975
 
Posts: 625
Joined: 2015-11-29 18:23
Location: Lithuania, Vilnius

Re: HowTo create a volume mixer for IceWM

Postby Soul Singin' » 2018-08-16 18:31

None1975 wrote:volumeicon-alsa

Also good. Thanks!

Image

For a battery monitor, I backported cbatticon. I've got network-manager-gnome to manage my wireless. For a clipboard, I've got clipit. ... And my tray is getting full! . :D
.
User avatar
Soul Singin'
 
Posts: 1483
Joined: 2008-12-21 07:02


Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 3 guests

fashionable