# enable volume control on keyboard



## Rita G. (Jun 21, 2016)

FreeBSD 10.3 KDE
keyboard: Logitech MK300 cordless

Does anyone know how to enable volume control on keyboard? It worked with windows and linux systems.


----------



## DiscmanDaemon (Jun 21, 2016)

So kind of a hackish solution that works for me a while back with a (non-logitech) keyboard is to keybind the volume control key stroke events from the keyboard to the mixer audio utility. The guide I used can be found here

*edit I just remembered this guide was for openbox. The general process for determining the key code with xev should still work, but I do not know off the top of my head how to configure key-bindings for KDE...


----------



## aragats (Jun 21, 2016)

Rita G. said:


> Does anyone know how to enable volume control on keyboard? It worked with windows and linux systems.


Fisrt of all determine the keycodes using xev(1) (as mentioned by DiscmanDaemon), then create/modify file ~/.Xmodmap:

```
keycode XXX = XF86AudioLowerVolume
keycode YYY = XF86AudioRaiseVolume
```
This is a universal solution, not just for KDE. If KDE doesn't use ~/.Xmodmap automatically, you should add it to $KDEDIR/share/config/kdm/Xsession.


----------



## unique name (Aug 20, 2021)

aragats said:


> Fisrt of all determine the keycodes using xev(1) (as mentioned by DiscmanDaemon), then create/modify file ~/.Xmodmap:
> 
> ```
> keycode XXX = XF86AudioLowerVolume
> ...


xev doen't recognize my volume button press. It recognizes mouse movements and other buttons but not media buttons.


----------



## Menelkir (Aug 20, 2021)

unique name said:


> xev doen't recognize my volume button press. It recognizes mouse movements and other buttons but not media buttons.


Try loading iichid module (you'll probably need ig4, iicbus and iichid modules, YMMV). FreeBSD have this on base, for FreeBSD 12 and older, install sysutils/iichid.


----------



## Tieks (Aug 20, 2021)

unique name said:


> it says " iichid-0.0.6 Is a part of base system."


That comes from the Makefile: "IGNORE_FreeBSD_13=  is a part of base system". Please take a look at `man iichid` when you run FBSD13 or 14.


----------



## macondo (Aug 20, 2021)

USB Logitech K120 using IceWM on .icewm/keys:

  #Sound
  key "Ctrl+Down"      amixer -q set Master 9%-            # lower volume
  key "Ctrl+Up"        amixer -q set Master 9%+             # raise volume


----------



## unique name (Aug 21, 2021)

Tieks said:


> That comes from the Makefile: "IGNORE_FreeBSD_13=  is a part of base system". Please take a look at `man iichid` when you run FBSD13 or 14.


I loaded the module in kernel by adding it in loader.conf. now what? How do I know the keycode? tried xev but still not getting it.


----------



## unique name (Aug 21, 2021)

found this thread, if anyone is having any problems... https://forums.freebsd.org/threads/multimedia-keys.6253/page-2


----------



## Menelkir (Aug 21, 2021)

unique name said:


> found this thread, if anyone is having any problems... https://forums.freebsd.org/threads/multimedia-keys.6253/page-2


And that is exactly what was said here.


----------



## unique name (Aug 21, 2021)

Menelkir said:


> And that is exactly what was said here.


I am sorry I am not tech savvy. I was just told which tool to use but I didn't know what to do with it. I don't have much knowledge about OS.


----------



## sidetone (Aug 21, 2021)

This thread is more specific to the newer ichiid which is in base.


----------



## unique name (Aug 21, 2021)

sidetone said:


> This thread is more specific to the newer ichiid which is in base.


Ohh okay, I am sorry...


----------



## unique name (Aug 23, 2021)

found an alternative way.








						Finding keycode which is not recognized by xev.
					

can't delete this post




					forums.freebsd.org


----------



## unique name (Aug 25, 2021)

aragats said:


> Fisrt of all determine the keycodes using xev(1) (as mentioned by DiscmanDaemon), then create/modify file ~/.Xmodmap:
> 
> ```
> keycode XXX = XF86AudioLowerVolume
> ...


I created .Xmodmap but it is not working. I am using dwm.


----------



## aragats (Aug 25, 2021)

unique name said:


> I created .Xmodmap but it is not working. I am using dwm.


I'm using dwm for many years. Actually, it doesn't matter. How do you launch it?
I run `startx`, so I added to my ~/.xinitrc:
	
	



```
xmodmap -display :0 /home/myuser/.Xmodmap
```
Probably _-display_ flag is unnecessary.


----------

