You are not logged in.

#1 2025-10-24 18:20:55

mr_kaddy
Member
Registered: 2025-10-24
Posts: 12

[SOLVED]Visual UI to display volume levels on changing volume

Original title: Visual UI to display volume levels on changing volume using keyboard

I am using ALSA to manage the sound on my laptop. The desktop environment I am using is XFCE4. To control the volume keys on my keyboard, I followed the instructions given at Xbindkeys Wiki Page . Since I am using ALSA, my keybindings were instead:

~/.xbindkeysrc
## Custom Keybindinds
# Volume Up
"amixer set Master 5%+"
	XF86AudioRaiseVolume
# Volume Down
"amixer set Master 5%-"
	XF86AudioLowerVolume
# Mute
"amixer set Master toggle"
	XF86AudioMute

This works perfectly, but I am used to seeing a visual confirmation for the volume levels as one sees in Windows/Ubuntu/Mint ( here's an example )

I do get such a visual feedback when I modify my screen brightness by default, without using xbindkeys or manual setup in the top right corner.
Brightness Icon popup on pressing Fn+F11

I have tried using PulseAudio and pavucontrol which do give such a visual feedback on changing the volume, but the problem was that they just showed the volume being changed but the actual volume was never changed. I could not get that to work, so I stuck with ALSA, but the volume bar it showed was what I wanted.

So, how can I see the feedback for volume control with my current setup?

Last edited by mr_kaddy (2025-10-25 08:27:35)

Offline

#2 2025-10-24 19:22:07

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,086

Re: [SOLVED]Visual UI to display volume levels on changing volume

https://wiki.archlinux.org/title/Xfce#K … me_buttons
If you want to stick w/ xbindkeys and custom actions, here's the current volume section form my awctl script for inspiration.

volume)
    if [[ $2 == notify ]]; then
        # find a nice title
        players=(mpv mplayer vlc)


        get_title() {
        #    shopt -s lastpipe # bash pipe ./. read

            while read line; do
                if [ -z $windowpid ]; then
                    windowpid="$line"
                elif [ -z $windowname ]; then
                    windowname="$line"
                else # multiline title, fuck this shit
                    break
                fi
            done < <(xdotool getactivewindow getwindowpid getwindowname)

            windowexe="$(basename $(realpath /proc/$windowpid/exe))"
            if [[ " ${players[@]} " =~ " $windowexe " ]]; then
                shopt -s nocaseglob
                if [[ " ${windowname# -*} " =~ " $windowexe " ]]; then
                    title="${windowname% -*}"
                else
                    title="${windowname}"
                fi
                shopt -u nocaseglob
            elif [[ "$windowname" =~ " - YouTube" ]]; then
                title="${windowname% - YouTube*}"
            elif mpd_status=$(mpc status 2>/dev/null); then
                while read line; do
                    if [ -z "$title" ]; then
                        title="$line"
                    else
                        [[ "$line" =~ "[paused]" ]] && unset title
                        break
                    fi
                done <<< $mpd_status
                [[ "$title" = "volume:"* ]] && unset title # mpd stopped
            fi
            if [ -n "$title" ]; then
                [[ " $(echo "$title" | file -b -) " =~ " ISO-8859 " ]] && # id3 tags in iso-8859. happens…
                                title="$(iconv -f ISO-8859-1 -t utf-8 <<< "$title")"
                bar="$title
"
            fi
        }

        # generate the bar

        if [ $3 = 0 ]; then
            icon=""
            bar="Mute"
        else
            get_title
            icon="♫"
            bar="$bar  "
            ((chunks=${3}/10))
            for ((i=0;i<chunks;++i)); do
                bar="${bar} ●"
            done
            if (($3-10*chunks > 4)); then
                bar="${bar} ◉"
                ((++chunks))
            fi
            for ((i=chunks;i<10;++i)); do
                bar="${bar} ○"
            done
            #bar="${bar} (${1}%)"
        fi
        dunstify "$icon" "$bar" -a Volume -u low -t 1000 -h int:value:"$1" -h string:synchronous:"$bar" --replace=555
        exit
    fi
    [ -e /tmp/.notify.vol.lock ] && exit
    updown=''
    [ $2 = down ] && updown='5%-'
    [ $2 = up ] && updown='5%+'
    [ $2 = toggle ] && updown='toggle'

    [ -z $updown ] && exit
    touch /tmp/.notify.vol.lock
    $0 volume notify $(amixer -M sset Master ${updown} | sed -e '/[[:digit:]]*%/!d; s/.*\[off\].*/0/g; s/.*\[\([[:digit:]]*\)%\].*/\1/g')
    rm /tmp/.notify.vol.lock
    exit
    ;;

Offline

#3 2025-10-25 04:33:42

mr_kaddy
Member
Registered: 2025-10-24
Posts: 12

Re: [SOLVED]Visual UI to display volume levels on changing volume

I had missed this section. I am not committed to using xbindkeys, especially if the custom actions get too complicated, I would prefer the simplest working solution. Based on the the link provided, I installed xfce4-mixer and added it to my panel. However, I don't see any item in the top right corner of my panel. The volume keys don't work.

When I directly execute xfce4-mixer from my terminal, the process does run in foreground until I kill it. To see if any plugin is running, I check the list of running processes:

$ ps aux | grep mixer
kaddy      11011  0.0  0.3 468268 38536 tty1     Sl   09:48   0:00 /usr/lib/xfce4/panel/wrapper-2.0 /usr/lib/xfce4/panel/plugins/libmixer.so 19 14705677 mixer Audio Mixer Adjust volume levels  # If this is a plugin, why don't I see it?
kaddy      12651  0.0  0.3 468268 38536 tty1     Sl   09:50   0:00 /usr/lib/xfce4/panel/wrapper-2.0 /usr/lib/xfce4/panel/plugins/libmixer.so 24 14723919 mixer Audio Mixer Adjust volume levels  # Is this a duplicate process for the same plugin???
kaddy      13299  0.0  0.0   6432  4512 pts/3    S+   09:55   0:00 alsamixer  # Ignore this, I've run this in another terminal for monitoring
kaddy      13384  0.0  0.3 468292 38840 pts/2    Sl+  09:57   0:00 xfce4-mixer  # This is the process I ran by simply executing xfce4-mixer
kaddy      13560  0.0  0.0   4284  2528 pts/4    S+   09:58   0:00 grep mixer  # Of course

Based on the xfce4-documentation, I should be seeing the speaker icon, context menu etc SOMEWHERE but I am not. So what exactly is happening here?

Offline

#4 2025-10-25 08:13:56

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,086

Re: [SOLVED]Visual UI to display volume levels on changing volume

https://docs.xfce.org/apps/xfce4-mixer/start says the shortcuts are optional

added it to my panel. However, I don't see any item in the top right corner of my panel

??
https://docs.xfce.org/apps/xfce4-mixer/start#debugging

I'm not running xfce and have no experience w/ the panel setup or the particular plugin, sorry.

Offline

#5 2025-10-25 08:23:05

mr_kaddy
Member
Registered: 2025-10-24
Posts: 12

Re: [SOLVED]Visual UI to display volume levels on changing volume

I believe your reply does answer the original question, thanks a lot!  smile

For problems with the xfce4-mixer, it would be best to start a new thread.

Offline

Board footer

Powered by FluxBB