Arch Linux Forums

Discussion forums for Arch Linux, a simple, lightweight linux distribution.

You are not logged in.

#1 2009-04-10 11:29:13

abarilla
Member
From: Colorado Springs, CO
Registered: 2006-12-06
Posts: 15
Website

Fancy New Onscreen Volume Display for Openbox, et al

I created a script for handling my volume control which uses the notify-osd package from AUR.  This is the newfangled notifications from Ubuntu.  It's nothing fancy so the notify-osd-bzr package will probably work fine as well.

http://mozicodo.s3.amazonaws.com/screensm20090410.png

This is for alsa but with some minor mods it should work with oss.

You can download the script here: http://mozicodo.s3.amazonaws.com/vol.sh

The format for the command is: vol.sh {up|down|mute} [-i increment] [-m mixer]

Increment is either a percent or number just like you would pass to amixer.  Defaults to 5%
Mixer is the name of the control to change.  Defaults to Master

For example to increase the volume of PCM by 10% you would do:

Code:

vol.sh up -i 10% -m PCM

Let me know of any suggestions for improvements.

Edit: fixed the urls

Last edited by abarilla (2009-10-27 11:07:40)


Arch64 // Facebook // Twitter // Identica
Sic gorgiamus allos subjectatos nunc

Offline

 

#2 2009-04-10 11:32:12

kalasmannen
Member
From: Örebro, Sweden
Registered: 2008-02-26
Posts: 20
Website

Re: Fancy New Onscreen Volume Display for Openbox, et al

This looks really nice. I would like to try this out when i get home, wich is in a few hours. But again, looks like something i would like to use. Great work!

Offline

 

#3 2009-04-10 12:50:12

flowheat
Member
From: Pittsburgh, PA
Registered: 2008-09-23
Posts: 86

Re: Fancy New Onscreen Volume Display for Openbox, et al

Using it now.  Works well.  Thanks

Offline

 

#4 2009-04-10 12:59:15

superchango
Member
Registered: 2009-01-21
Posts: 31

Re: Fancy New Onscreen Volume Display for Openbox, et al

Geat!!!

I'm searching some program for this but old xosd don't work with Fluxbox.


Si lo tocas lo compras

Offline

 

#5 2009-04-28 19:18:33

andrew123456
Member
Registered: 2008-08-31
Posts: 27

Re: Fancy New Onscreen Volume Display for Openbox, et al

wooooow, this is really pretty. i had a hacked-together script i used that worked with the old libnotify, but this new one didn't play all that nicely. thanks for this!

Offline

 

#6 2009-07-13 09:36:18

lswest
Member
From: Munich, Germany
Registered: 2008-06-14
Posts: 201
Website

Re: Fancy New Onscreen Volume Display for Openbox, et al

Can someone post the script here?  The link to the script is "under construction", and I was thinking of doing something similar, which (since it has already been done) saves me some work!

Offline

 

#7 2009-07-13 09:48:20

seiichiro0185
Member
From: Berlin/Germany
Registered: 2009-04-09
Posts: 49
Website

Re: Fancy New Onscreen Volume Display for Openbox, et al

I also only get a blank page with "under constructions" as a title when trying to open the screenshot or the script. It would be really nice if someone could fix the links or post the script again.

Offline

 

#8 2009-07-13 09:49:48

lswest
Member
From: Munich, Germany
Registered: 2008-06-14
Posts: 201
Website

Re: Fancy New Onscreen Volume Display for Openbox, et al

I've emailed the OP, and I will (if he doesn't mind), post the script here if I get it from him.

Offline

 

#9 2009-07-13 10:40:06

wujaklija
Member
From: /Serbia/Ruma
Registered: 2009-02-13
Posts: 41

Re: Fancy New Onscreen Volume Display for Openbox, et al

i made a little change on a script
http://www.4shared.com/file/117790213/59106c1f/vol.html

Offline

 

#10 2009-07-13 10:58:36

lswest
Member
From: Munich, Germany
Registered: 2008-06-14
Posts: 201
Website

Re: Fancy New Onscreen Volume Display for Openbox, et al

I have tested the script out, but yet I seem to be having issues with notify-osd displaying the stuff.

What I get is this:
http://omploader.org/tMXl3eA

It seems as if notify-osd isn't drawing anything but the bubble.  Has anyone had this issue with the script?  (Notify-osd works fine for all the other things I use it for, save for the fact that it doesn't seem to show icons for anything but Dropbox...maybe I'm missing the icon package for it?)

Below are the notify-osd related packages I have installed:

Code:

┌─[lswest@Monster:~]-[16:57:11 on 09-07-13]
└─> yaourt -Ss notify-osd|grep installed
aur/gnome-mount-notify-osd 0.8-2 [installed] (31)
aur/gnome-settings-daemon-notify-osd 2.26.1-2 [installed] (15)
aur/notify-osd-bzr 311-1 [342-1 installed] (73)
aur/pidgin-libnotify-notify-osd 0.14-3 [installed] (60)

Thanks in advance for any ideas,
Lswest

Also, below is the original vol.sh script from Abarilla:

Code:

#!/bin/sh

usage="usage: $0 -c {up|down|mute} [-i increment] [-m mixer]"
command=
increment=5%
mixer=Master

while getopts i:m:h o
do case "$o" in
    i) increment=$OPTARG;;
    m) mixer=$OPTARG;;
    h) echo "$usage"; exit 0;;
    ?) echo "$usage"; exit 0;;
esac
done

shift $(($OPTIND - 1))
command=$1

if [ "$command" = "" ]; then
    echo "usage: $0 {up|down|mute} [increment]"
    exit 0;
fi

display_volume=0

if [ "$command" = "up" ]; then
    display_volume=$(amixer set $mixer $increment+ unmute | grep -m 1 "%]" | cut -d "[" -f2|cut -d "%" -f1)
fi

if [ "$command" = "down" ]; then
    display_volume=$(amixer set $mixer $increment- unmute | grep -m 1 "%]" | cut -d "[" -f2|cut -d "%" -f1)
fi

icon_name=""

if [ "$command" = "mute" ]; then
    if amixer get Master | grep "\[on\]"; then
        display_volume=0
        icon_name="notification-audio-volume-muted"
        amixer set $mixer mute
    else
        display_volume=$(amixer set $mixer unmute | grep -m 1 "%]" | cut -d "[" -f2|cut -d "%" -f1)
    fi
fi

if [ "$icon_name" = "" ]; then
    if [ "$display_volume" = "0" ]; then
        icon_name="notification-audio-volume-off"
    else
        if [ "$display_volume" -lt "33" ]; then
            icon_name="notification-audio-volume-low"
        else
            if [ "$display_volume" -lt "67" ]; then
                icon_name="notification-audio-volume-medium"
            else
                icon_name="notification-audio-volume-high"
            fi
        fi
    fi
fi
notify-send " " -i $icon_name -h int:value:$display_volume -h string:synchronous:volume

Last edited by lswest (2009-07-13 11:07:17)

Offline

 

#11 2009-07-13 12:37:24

Dieter@be
Release Engineer
From: Belgium
Registered: 2006-11-05
Posts: 1265
Website

Re: Fancy New Onscreen Volume Display for Openbox, et al

screenshot.working = false;

Code:

dieter@dieter-ws-a7n8x-arch ~ curl -I http://exit66.com/static/screen20090410.png
HTTP/1.1 404 Not Found
Date: Mon, 13 Jul 2009 16:36:52 GMT
Server: Apache/2.2.9 (Fedora)
X-Powered-By: PHP/4.4.9
Content-Length: 839
Connection: close
Content-Type: text/html; charset=UTF-8

< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

 

#12 2009-07-18 08:36:41

Jedipottsy
Member
Registered: 2008-05-22
Posts: 5

Re: Fancy New Onscreen Volume Display for Openbox, et al

Im using wicd and batterymon which both use libnotify and notification-daemon. I have removed libnotify and notification-daemon and used notify-osd and the volume works, but wicd and batterymon don't. Using libnotify i can get the other 2 to work but not this script, i get the popup but then no text just the volume icon. Thanks

Offline

 

#13 2009-07-19 13:55:36

Allamgir
Member
Registered: 2009-06-11
Posts: 168

Re: Fancy New Onscreen Volume Display for Openbox, et al

Awesome! This is working perfectly! I just have one question:

How can I center the notify-osd window? It always seems to appear in the top right of my screen, covering my status bar. I would prefer a centered notification.


дɭɭɑӎɠїɾ

Offline

 

#14 2009-10-27 11:00:22

abarilla
Member
From: Colorado Springs, CO
Registered: 2006-12-06
Posts: 15
Website

Re: Fancy New Onscreen Volume Display for Openbox, et al

FYI, I updated the urls in the first post so they are working again.

Thanks,
Andy


Arch64 // Facebook // Twitter // Identica
Sic gorgiamus allos subjectatos nunc

Offline

 

#15 2009-10-29 15:38:01

synorgy
Member
Registered: 2005-07-11
Posts: 166

Re: Fancy New Onscreen Volume Display for Openbox, et al

Allamgir: you can't center the notify-osd popups. Ubuntu's notify-osd dev team (or single dev, I'm not sure) has decided that 'sane defaults' are the best way to go and have foregone any ability to change position of the notifications. (This is the reason I'm not using notify-osd at the moment. I also won't be using it until they understand that, while adding configuration makes the program more difficult to test, it's the only way to truly satisfy any sizeable audience.)


"Unix is basically a simple operating system, but you have to be a genius to understand the simplicity."
--Dennis Ritchie

Offline

 

#16 2009-11-07 06:22:49

zephyrus17
Member
Registered: 2008-06-15
Posts: 321

Re: Fancy New Onscreen Volume Display for Openbox, et al

This is going to be a pretty silly question, but how exactly do I use it? How do I identify the keystoke from the keyboard?

Offline

 

#17 2009-11-07 11:01:30

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 212
Website

Re: Fancy New Onscreen Volume Display for Openbox, et al

You can edit rc.xml to add keymaps for vol.sh.


Phenom II | 4GB RAM | Intel X25-M SSD: arch64 | dwm | tmux | zsh
Wii: archii | tmux | zsh

Online

 

#18 2009-11-16 08:36:02

Berseker
Member
From: Near Lecco, Italy
Registered: 2008-04-24
Posts: 139

Re: Fancy New Onscreen Volume Display for Openbox, et al

great job mate. I'm using it right now with xbindkeys in place of setting directly the volume scrollwheel of my laptop to change the volume of alsamixer. Thanks

Offline

 

#19 2010-01-16 10:36:49

scrawl
Member
Registered: 2010-01-14
Posts: 13

Re: Fancy New Onscreen Volume Display for Openbox, et al

Awesome, thanks for sharing!

Offline

 

#20 2010-01-20 14:16:11

nonickknown
Member
Registered: 2009-01-26
Posts: 15

Re: Fancy New Onscreen Volume Display for Openbox, et al

very awesome script... thank you for sharing!

Offline

 

#21 2010-01-23 16:58:54

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 139
Website

Re: Fancy New Onscreen Volume Display for Openbox, et al

uhm...doesn't work for me.
I've just got a blank notification sad
(Maybe because I'm trying to use it with xfce4-notifyd?)

The links in the first post are not working.

Thanks!

Last edited by rent0n (2010-01-23 17:34:39)


rent0n@deviantART | rent0n@identi.ca | Linux Registered User #337812
aspire: Acer Aspire 5920 ArchLinux x86_64 | beetle: Gericom Beetle G733 ArchLinux i686

Online

 

#22 2010-01-23 19:19:43

Gusar
Member
Registered: 2009-08-25
Posts: 60

Re: Fancy New Onscreen Volume Display for Openbox, et al

It won't work with xfce4-notifyd, because xfce4-notifyd doesn't support the "synchronous" hint. You shouldn't get a blank notification though, what you should get is a new bubble with each volume change. Oh, I just remembered - even this only works with the git version of xfce4-notifyd. But basically, you're out of luck; this script only works correctly with notify-osd.

Offline

 

#23 2010-01-24 04:00:06

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 139
Website

Re: Fancy New Onscreen Volume Display for Openbox, et al

Well, I really don't like notify-osd; xfce4-notifyd is much better and more customizable (and is not ubuntu's)! wink

So I've modified the script to work with my Volume config (I use PCM mainly + Master to toggle mute/unmute) and to work with xfce4-notifyd. It's much simpler because it has no icons or bars and just displays "Volume: 50%" for example. So it's not that fancy anymore, but fits perfectly on a minimal desktop. big_smile

Code:

#!/bin/bash

command=$1

if [ "$command" = "" ]; then
    echo "usage: $0 {up|down|toggle}"
    exit 0;
fi

display_volume=0

if [ "$command" = "up" ]; then
    amixer sset Master unmute
    display_volume=$(amixer sset PCM 4+ unmute | grep -m 1 "%]" | cut -d "[" -f2|cut -d "%" -f1)
fi

if [ "$command" = "down" ]; then
    amixer sset Master unmute
    display_volume=$(amixer sset PCM 4- unmute | grep -m 1 "%]" | cut -d "[" -f2|cut -d "%" -f1)
fi

icon_name=""

if [ "$command" = "toggle" ]; then
            if amixer get Master | grep "\[on\]"; then
         amixer sset Master mute
                 display_volume=0
            else
         amixer sset Master unmute
                 display_volume=$(amixer get PCM | grep -m 1 "%]" | cut -d "[" -f2|cut -d "%" -f1)
    fi
fi

notify-send "Volume: $display_volume%"
exit 1

rent0n@deviantART | rent0n@identi.ca | Linux Registered User #337812
aspire: Acer Aspire 5920 ArchLinux x86_64 | beetle: Gericom Beetle G733 ArchLinux i686

Online

 

#24 2010-01-24 05:06:15

Chokkan
Member
Registered: 2009-04-06
Posts: 101

Re: Fancy New Onscreen Volume Display for Openbox, et al

I'm using the original script. Works great! rent0n, can you explain how xfce4-notifyd is more customizable?


< Daenyth> tomkx: my girlfriend is linux
< Daenyth> srsly
< Daenyth> she loves the way I «make install»
< Daenyth> all her /dev entries are mode 7 for me

Offline

 

#25 2010-01-24 07:14:49

rent0n
Member
From: Italy
Registered: 2009-10-29
Posts: 139
Website

Re: Fancy New Onscreen Volume Display for Openbox, et al

Well, basically you can decide pretty everything (colors, style, font, borders, transparency, time before disappearance) using a simple gtkrc file.
This way it can follow the color and the style of your gtk theme (very cool).
And another good thing is that it has a normal notification behaviour. I never liked how notify-osd behave, it's so weird! wink


rent0n@deviantART | rent0n@identi.ca | Linux Registered User #337812
aspire: Acer Aspire 5920 ArchLinux x86_64 | beetle: Gericom Beetle G733 ArchLinux i686

Online

 

Board footer

Powered by FluxBB