Results 1 to 8 of 8

Thread: Volume indicator in Xfce

  1. #1
    Join Date
    May 2008
    Location
    México
    Beans
    108
    Distro
    Ubuntu 12.04 Precise Pangolin

    [SOLVED] Volume indicator in Xfce

    When I used Gnome, I lıked the volume ındıcator: when I pressed the volume keys on my keyboard, volume appeared graphıcally. Now I use Xfce, and the keys work and everythıng, but I don't see any ındıcator (besıdes that small one on the panel, of course).

    AFAIK, the volume ındıcator ıs managed by gnome-settıngs-daemon, and ıf I run ıt on Xfce, I can have the volume ındıcator, but ıs there a natıve applıcatıon for Xfce?

    —Ilhuıtemoc δ
    Last edited by R2D2!; May 30th, 2009 at 04:47 AM.

  2. #2
    Join Date
    Jan 2009
    Beans
    Hidden!

    Re: Volume indicator in Xfce

    I've searched around a bit, and I can't seem to find a built-in way to get the notifications, so ... I wrote a script that wraps around amixer. It throws up a notification bubble whenever it's run to indicate the resulting mixer settings.

    Here's the script:
    Code:
    $ cat bin/volume_ctl 
    #!/bin/sh
    
    if [ $1 = 'up' ]; then
        amixer set Master 2+
    elif [ $1 = 'down' ]; then
        amixer set Master 2-
    elif [ $1 = 'mute' ]; then
        amixer set Master toggle
    else
        echo "Unknown control command: $1" >&2
        exit 1
    fi
    
    STATUS=$(amixer sget Master | awk '$1 == "Mono:" { print $NF; }')
    if [ $STATUS = '[off]' ]; then
        VOLUME=MUTED
        ICON=notification-audio-volume-muted
    else
        VOLUME=$(amixer sget Master | sed '/^ *Mono: /{s/^.*\[\(.*\)%\].*/\1/;p;};d;')
        if [ $VOLUME -eq 0 ]; then
            ICON=notification-audio-volume-off
        elif [ $VOLUME -lt 33 ]; then
            ICON=notification-audio-volume-low
        elif [ $VOLUME -lt 66 ]; then
            ICON=notification-audio-volume-medium
        else
            ICON=notification-audio-volume-high
        fi
        VOLUME="${VOLUME}%"
    fi
    /usr/bin/notify-send "Volume Control" "$VOLUME" -i $ICON
    It works well for me with xfce4-notifyd, not so well with notify-osd, since xfce4-notifyd stacks up the bubbles, making it possible to see continuing changes to the mixer setting if I continue changing the volume. The new notify-osd only throws up one bubble at a time, so I have to wait a few seconds between key presses.

    I added keyboard bindings that call this script whenever I press the up, down, or mute volume control buttons on the keyboard.

  3. #3
    Join Date
    May 2008
    Location
    México
    Beans
    108
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Volume indicator in Xfce

    Thank you. Actually I found your solutıon before ın a google search, but the problem remaıns wıth notıfy-osd. It doesn't obey the -t command

    —Ilhuıtemoc δ

  4. #4
    Join Date
    Oct 2005
    Beans
    14
    Distro
    Xubuntu 9.04 Jaunty Jackalope

    Re: Volume indicator in Xfce

    You can also use gnome-osd-client in that script.

  5. #5
    Join Date
    May 2008
    Location
    México
    Beans
    108
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Volume indicator in Xfce

    Yeah, but that's not Notify-OSD

    —Ilhuıtemoc δ

  6. #6
    Join Date
    Jul 2005
    Beans
    161
    Distro
    Dapper Drake Testing/

    Re: Volume indicator in Xfce

    Awesome, thanks. I was about to try and write this but it was already done

    I changed from Mono: to Left: so I actually got an ouptu (the line for Mono is totally blank...)

    Thanks. This works nicely with xfce4-notify - any idea how to use notify-osd to give the text-less popups with volume icons?

    Also, any idea how to make the brightness notification use notification daemon not the ugly window? If notify-osd is running it works but not if I have xfce40notify.

    Who
    http://compiz.blogspot.com/ - All the latest plugin and patch news for Compiz!

  7. #7
    Join Date
    Jul 2005
    Beans
    161
    Distro
    Dapper Drake Testing/

    Re: Volume indicator in Xfce

    Righty, I'm using this, which plays nicely with notify-osd

    Code:
    #!/bin/sh
    
    if [ $1 = 'up' ]; then
        amixer set Master 2+
    elif [ $1 = 'down' ]; then
        amixer set Master 2-
    elif [ $1 = 'mute' ]; then
        amixer set Master toggle
    else
        echo "Unknown control command: $1" >&2
        exit 1
    fi
    VOLUME=$(amixer sget Master | sed '/^ *Front\ Left: /{s/^.*\[\(.*\)%\].*/\1/;p;};d;')
    STATUS=$(amixer sget Master | awk '$2 == "Left:" { print $NF; }')
    if [ $STATUS = '[off]' ]; then
        ICON=notification-audio-volume-muted
    else
        echo $VOLUME
        if [ $VOLUME -eq 0 ]; then
            ICON=notification-audio-volume-off
        elif [ $VOLUME -lt 33 ]; then
            ICON=notification-audio-volume-low
        elif [ $VOLUME -lt 66 ]; then
            ICON=notification-audio-volume-medium
        else
            ICON=notification-audio-volume-high
        fi
        VOLUME="${VOLUME}%"
    fi
    notify-send "Volume" -i $ICON -h int:value:$VOLUME -h string:x-canonical-private-synchronous:
    http://compiz.blogspot.com/ - All the latest plugin and patch news for Compiz!

  8. #8
    Join Date
    May 2008
    Location
    México
    Beans
    108
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Volume indicator in Xfce

    Quote Originally Posted by Who View Post
    Righty, I'm using this, which plays nicely with notify-osd
    [...]
    That worked perfectly, thanks

    BTW, how do I mark thıs thread as [Solved]?

    —Ilhuıtemoc δ

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •