LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 08-18-2019, 12:10 AM   #1
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 836
Blog Entries: 3

Rep: Reputation: 297Reputation: 297Reputation: 297
How are the XF86Audio* function keys mapped? Confused.


A problem i've been having for years on various distributions, is that all of my function keys related to audio never work as you'd expect.

When loading up a "barebones" desktop, something such as Fluxbox, AwesomeWM etc, these keys will fail to do anything;

* XF86AudioMute
* XF86AudioRaiseVolume
* XF86AudioLowerVolume

The tool `xev` will not display any keysym/keycode values at all, so i cannot map them correctly using `xmodmap`.

However, when launching something such as `kmix` in the background, the keys are suddenly recognized, also showing useful information within `xev`...

* XF86AudioMute
Code:
KeyRelease event, serial 38, synthetic NO, window 0x3600001,
    root 0x1ce, subw 0x0, time 869236, (956,323), root:(958,341),
    state 0x0, keycode 121 (keysym 0x1008ff12, XF86AudioMute), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False
* XF86AudioRaiseVolume
Code:
KeyRelease event, serial 36, synthetic NO, window 0x3600001,
    root 0x1ce, subw 0x0, time 926386, (638,441), root:(640,459),
    state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False
* XF86AudioLowerVolume
Code:
KeyRelease event, serial 36, synthetic NO, window 0x3600001,
    root 0x1ce, subw 0x0, time 929258, (638,441), root:(640,459),
    state 0x0, keycode 122 (keysym 0x1008ff11, XF86AudioLowerVolume), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False
Given that useful output, where `kmix` is doing something to get the keys working, i place this into my ~/.Xmodmap and run `xmodmap ~/.Xmodmap` when my window manager starts;

Code:
keycode 121 =  XF86AudioMute
keycode 123 =  XF86AudioRaiseVolume
keycode 122 =  XF86AudioLowerVolume
And in my AwesomeWM config i am using this for setting/muting volume;
Code:
    awful.key({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("pactl set-sink-mute 0 false ; pactl set-sink-volume 0 +5%") end),
    awful.key({ }, "XF86AudioLowerVolume", function () awful.util.spawn("pactl set-sink-mute 0 false ; pactl set-sink-volume 0 -5%") end),
    awful.key({ }, "XF86AudioMute", function () awful.util.spawn("pactl set-sink-mute 0 toggle") end),
Yet, this doesn't solve / change anything. As long as a tray utility such as `kmix` isn't running, the keys simply don't register.

Is there something i can do to get these function keys to work correctly without the use of something such as `kmix` ? It seems `kmix` is doing something to properly map these keys, which is simply not set beforehand.
 
Old 08-18-2019, 02:31 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
You already identified the problem: kmix (or the K desktop environment) does something to initialise these keys.
I suspect this "something" has something to do with udev or dbus.

Maybe you can try xbindkeys instead of xmodmap:
https://wiki.archlinux.org/index.php/Xbindkeys
Also read:
https://wiki.archlinux.org/index.php..._keyboard_keys

How do you start fluxbox et. al.? through your display manager? or startx?
How do you start KDE? through your display manager? or startx?
 
Old 08-18-2019, 04:11 AM   #3
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 836

Original Poster
Blog Entries: 3

Rep: Reputation: 297Reputation: 297Reputation: 297
Quote:
Originally Posted by ondoho View Post
You already identified the problem: kmix (or the K desktop environment) does something to initialise these keys.
I suspect this "something" has something to do with udev or dbus.
Well yes, but i'm probably asking what exactly it is doing, whether it's something that can be set permanently.


I have had a look at xbindkeys, although that seems to control binds/commands directly, i'd much prefer keybinds to be set from my actual window manager config in the case of AwesomeWM.

All desktop/wm is launched using `startx` also.

On Slackware there is a proper initialisation /etc/X11/xinit/xinitrc.awesome eg;

Code:
#!/bin/sh
# $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps
[ -f $sysresources ] && xrdb -merge $sysresources
[ -f $sysmodmap ] && xmodmap $sysmodmap
[ -f $userresources ] && xrdb -merge $userresources
[ -f $usermodmap ] && xmodmap $usermodmap

# Start the window manager:
if [ -z "$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then
  ck-launch-session dbus-launch --exit-with-session awesome
else
  awesome
fi
 
Old 08-18-2019, 04:26 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by coralfang View Post
All desktop/wm is launched using `startx` also.

On Slackware there is a proper initialisation /etc/X11/xinit/xinitrc.awesome eg;
"e.g." meaning you're not actually using it?
Does Slackware use ~/.xinitrc?
On my arch system, I had to add this stanza at some point, otherwise some functionality was missing:
Code:
if [ -d /etc/X11/xinit/xinitrc.d ]
then
  for f in /etc/X11/xinit/xinitrc.d/*
  do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi
 
Old 08-18-2019, 09:03 AM   #5
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 836

Original Poster
Blog Entries: 3

Rep: Reputation: 297Reputation: 297Reputation: 297
Quote:
Originally Posted by ondoho View Post
"e.g." meaning you're not actually using it?
Does Slackware use ~/.xinitrc?
On my arch system, I had to add this stanza at some point, otherwise some functionality was missing:
Code:
if [ -d /etc/X11/xinit/xinitrc.d ]
then
  for f in /etc/X11/xinit/xinitrc.d/*
  do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi
Yes i am using it. Slackware has a tool called xwmconfig to switch. When you select, for eg; "KDE" or "Awesome", it will copy over the correct xinitrc.{plasma,awesome,xfce} to /etc/X11/xinit/xinitrc , so it's contents are being run on my system as for dbus/ck/xmodmap etc.

Code:
$ diff /etc/X11/xinit/xinitrc /etc/X11/xinit/xinitrc.awesome -s
Files /etc/X11/xinit/xinitrc and /etc/X11/xinit/xinitrc.awesome are identical
edit; I also do not personally use a local ~/.xinitrc -- only rely on the /etc/X11/xinitrc/* file.

edit 2; You mention you have an Arch system, do you get the same problem with barebones window managers? As for the WM supporting keybind customization yet XF86Audio* not responding to xev? I recall having the same issue on Arch when i last ran it (although this may be ~2011-2012, a long time ago). Oddly, i've always had the other keys such as XF86Tools, XF86Mail etc, these all work without any additional software.

I might have to skim through kmix source, or even the xfce mixer, to see what's being done to map these key/symbols. I can't see it being much more than a simple udev/dbus command which you previously suggested may be the cause.

Last edited by coralfang; 08-18-2019 at 09:10 AM.
 
Old 08-19-2019, 01:09 AM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by coralfang View Post
/etc/X11/xinit/xinitrc , so it's contents are being run
I think you should take a closer look at these contents; compare the content of the KDE one with the content of the one that does NOT work as expected.
Otherwise, it's simply kmix itself - or KDE itself - doing the magic. How to research that?

Quote:
do you get the same problem with barebones window managers? As for the WM supporting keybind customization yet XF86Audio* not responding to xev?
No.
But this is often hardware specific.
Could also be kernel specific (even though KDE does recognize the keys).
 
  


Reply

Tags
keymap, xf86audio, xmodmap



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
XF86Audio key's not working in Gnome merciful Slackware 4 09-27-2010 02:16 AM
memory mapped i/o and i/o mapped i/o shilpa rangappa General 1 12-14-2009 10:27 PM
Network device Memory mapped or Port mapped ?? Bignon Linux - Hardware 0 10-20-2009 08:36 AM
function keys and gnome-terminal function keys and gnome-terminal fakie_flip Linux - Software 1 10-23-2007 11:22 PM
Keyboard keys not mapped. Clumsy Slackware 1 12-15-2004 10:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 03:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration