Behoblog

Logo

My personal software-engineering/dev(-op)/business blog

Share this page:

View My GitHub Profile View My LinkedIn Profile

9 July 2021

Linux Mint Cinnamon 20.xx - How to increment volume by 2% (or any %) using media keys

This post contains too much hardware-related content, but hardware is what I like, so here you have: TLDR; to #How to

Problem

In Cinnamon volume increase (and decrease) step is 5%, Windows has 2% steps, Mate has 2% steps, and probably many more environments have the same 2% volume step. There is no easy way to change this value in Cinnamon (Windows too).

Why do I need this

For a long time, I’ve ben using mouse like A4Tech Oscar X-748K (earlier DeLux M555, and another Laser Oscar X-7xx) with two programmable buttons under thumb. BTW it’s the best fitting mouse I ever use - you should try any of X-7xx. I always program it to act like media volume+ and volume- it’s super handy to me.

A4Tech X-748K

Some time ago I bought a USB sound card/DAC with a headphone amplifier. My previous SMSL M2 have a problem with waking up (noise at 100% volume sometimes for first sound after a long silence). I found Audioquest Dragonfly Black for about 50 zł on allegro.pl with a damaged jack, easy to fix by replacing the whole jack. This one was even easier: resolder jack to pads and align contacts inside the jack, and it works fine :D (excluding case, damaged by force opening by me…)

Audioquest Dragonfly Black

This DAC has no volume potentiometer, no buttons. It’s raw. Here we have a minor problem: when I use speakers I can adjust the volume on speakers and tune it using the 5% volume step in Linux, and it’s fine and accurate. This does not apply to headphones witch has no own volume control, just amplified signal from DAC going directly to headphones. So, 10% is a little too quiet but 15% is sometimes too loud.

Furthermore, I’ve got a keyboard (to replace my lovely blue switches :( coz it’s too noisy…) which has volume wheel above arrow keys - Ajazz K870T. It’s not easy to change volume only by one step using this roll, and it’s easy to swipe it up by accident. So, increase volume by 10% or even more percent can be painful.

Ajazz keyboard

How to

Sources

First, you need to enable sources in packet manager.

  1. Update Manager
  2. Edit
  3. Software Sources

packet manager

Then click OK and go to terminal to download sources of settings daemon.

xx - by convention will be any number or prefix/suffix, just check what you have here, because it changes in different releases of Cinnamon.

apt source cinnamon-settings-daemon
cd cinnamon-settings-daemon-xx

Configuration

Edit file cinnamon-settings-daemon-xx/plugins/media-keys/csd-media-keys-manager.c Find line with (should be on top of file):

#define VOLUME_STEP 5           /* percents for one volume button press */

and change to 2 or any value you want. Do not remove #.

Build

You may need those libraries:

sudo apt-get install lib32z1 lib32ncurses-dev lib32ncurses6 

If any error appear during the build, try googling it, 90% will be missing dependency.

Ok, lets build and install packet with our adjustment.

apt build-dep cinnamon-settings-daemon
apt build --no-sign
cd ../
apt deb cinnamon-settings-daemon_xx_amd64.deb

Then restart your PC (maybe logout and login will do the job, restarting Cinnamon doesn’t seem to work).

Done!

gif with 2% step

Konwon issues

  • When volume is maxed-out, you cannot lower volume using media buttons. IDK why, but volume jumps from 96% to 100% in one step (when step set to 2), so going backward is impossible. It can be fixed by settig max volume to 93%. You can try different values, maybe allow to pass 100% works too.
Share this post:
tags: PL | linux | tweaks