Arch Linux - How To Get Volume On Screen Display with XFCE Desktop Environment
Harry Tanama

Harry Tanama @harry_tanama_51571ebf90b6

About: Software Engineer building game engines from scratch using C/C++ with SDL2 and SFML, understanding Graphics APIs, 3D Math, data structures, and algorithms.

Joined:
Nov 17, 2024

Arch Linux - How To Get Volume On Screen Display with XFCE Desktop Environment

Publish Date: Aug 2
0 0

This is a very common scenario on Arch Linux, especially if you're not using a full-featured desktop environment like GNOME or KDE Plasma. On Arch, the philosophy is to provide the user with a minimal system and let them build it up with the components they want. The volume OSD (on-screen display) is not a core part of the system; it's a feature of your desktop environment or a separate utility you need to install and configure.

Here's a breakdown of why this happens and how to fix it, depending on your setup:

1. You're using a minimal window manager (e.g., i3, Openbox, dwm)

If you're using a window manager instead of a full desktop environment, the volume keys on your keyboard are likely not configured to do anything by default, or they are only configured to change the volume without sending a notification.

Solution: Install and configure a volume notification daemon.

You'll need a notification daemon to display the OSD and a tool to bind your volume keys to commands that change the volume and send a notification.

  • Install a notification daemon: A popular and lightweight choice is dunst.

    sudo pacman -S dunst
    
  • Install a tool to control volume: pamixer is a great command-line tool for controlling PulseAudio/PipeWire. amixer is the equivalent for ALSA.

    sudo pacman -S pamixer # For PulseAudio/PipeWire
    sudo pacman -S alsa-utils # For ALSA
    
  • Install a volume notification utility: The program volnoti is designed specifically for this purpose. It's often found in the AUR (Arch User Repository). You can install it with an AUR helper like yay.

    yay -S volnoti
    
  • Create keybindings: You need to configure your window manager to run a command when you press the volume keys. The exact method depends on your window manager.

    Example for i3: In your ~/.config/i3/config file, you would add lines like these:

    # Volume control with pamixer
    bindsym XF86AudioRaiseVolume exec --no-startup-id "pamixer -i 5 && dunstify -t 1000 'Volume' -h int:value:$(pamixer --get-volume)"
    bindsym XF86AudioLowerVolume exec --no-startup-id "pamixer -d 5 && dunstify -t 1000 'Volume' -h int:value:$(pamixer --get-volume)"
    bindsym XF86AudioMute exec --no-startup-id "pamixer -t && dunstify -t 1000 'Volume' -h int:value:$(pamixer --get-volume) $(pamixer --get-mute | xargs -I {} sh -c 'if [ {} = "true" ]; then echo " (Muted)"; fi')"
    

    This example uses dunstify to display a notification with a progress bar. You will need to check the Arch Wiki for your specific window manager's keybinding syntax.

    Example for xbindkeys: You would create a script that uses amixer or pamixer and then calls volnoti-show to display the OSD.

    # For a simple script
    #!/bin/bash
    amixer set Master 5%+ > /dev/null
    volnoti-show $(amixer get Master | grep -Po "[0-9]+(?=%)" | tail -1)
    

    You would then bind this script to your volume keys in your ~/.xbindkeysrc file.

2. You're using a desktop environment (e.g., XFCE, Cinnamon)

If you're using a full-fledged desktop environment and the volume OSD is not showing, it's often a configuration issue or a missing package.

  • Check settings: Go to your desktop environment's settings. Look for "Keyboard" or "Shortcuts." Ensure that the volume up/down keys are correctly mapped to the appropriate commands (e.g., amixer set Master 5%+ or pactl set-sink-volume @DEFAULT_SINK@ +5%).
  • Ensure the notification daemon is running: A desktop environment like XFCE uses its own notification daemon, xfce4-notifyd. Make sure it's installed and running.

    sudo pacman -S xfce4-notifyd
    
  • Check the panel plugin (if applicable): In environments like XFCE, the volume OSD is often tied to a panel plugin. Right-click on your panel, go to "Panel" -> "Add New Items," and add a "PulseAudio Plugin" (or similar). Then, right-click the new icon, go to "Properties," and check if "Show volume notifications" is enabled.

The key to fixing this on Arch Linux is to understand that the OSD is a separate component. You need three things:

  1. A command-line utility to actually change the volume (e.g., pamixer, amixer).
  2. A notification daemon to display the OSD (e.g., dunst, xfce4-notifyd, volnoti).
  3. A keybinding tool (like your window manager's config or xbindkeys) to link your volume keys to a command that executes both of the above.

By checking these three pieces of the puzzle, you should be able to get your volume OSD working again.

Methods for displaying volume notifications in XFCE:

To display volume changes graphically in XFCE on Arch Linux, you can choose from one of these the xfce4-pulseaudio-plugin or xfce4-volumed-pulse or dunst for the GUI volume notification

Dunst is a highly customizable notification daemon.
You can use it with xfce4-notifyd to display volume notifications. https://github.com/dunst-project/dunst

sudo pacman -S xfce4-pulseaudio-plugin
Enter fullscreen mode Exit fullscreen mode

or

sudo pacman -S xfce4-volumed-pulse
Enter fullscreen mode Exit fullscreen mode

Restart your Arch Linux and one of these will be in your Session and Startup

Comments 0 total

    Add comment