-
Notifications
You must be signed in to change notification settings - Fork 137
/
README
86 lines (57 loc) · 3.17 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Minimalistic amixer-based volume control for the window manager StumpWM
-----------------------------------------------------------------------
Just support the three volume control keys on many keyboards.
Depends on amixer (which is executed via RUN-SHELL-COMMAND).
Hacked by Max-Gerd Retzlaff. The primary source for this module
is https://github.com/m-g-r/stumpwm-modules-mgr
loading and configuration
-------------------------
You can automatically load the module by adding this to your StumpWM
init file:
(load-module "stump-volume-control")
Then assign the three commands volume-up, volume-down, and
volume-toggle-mute globally to some keys. If your keyboards has got
them you can use the typical volume control keys:
(define-key *top-map* (kbd "XF86AudioRaiseVolume") "volume-up")
(define-key *top-map* (kbd "XF86AudioLowerVolume") "volume-down")
(define-key *top-map* (kbd "XF86AudioMute") "volume-toggle-mute")
You have to add it yourself to your StumpWM init file as I consider it
bad manners to define global keys in a module.
selecting the sound card
------------------------
The module uses the sound card that ALSA considers to be your first one
(that is, sound card number 0) by default. You can change this by
altering the value of the variable STUMP-VOLUME-CONTROL:*SOUND-CARD*.
For example, by adding to your StumpWM init file:
(setf stump-volume-control:*sound-card* 1)
Alternatively, you can try to set the variable to NIL to not select
any specific sound card explicitly:
(setf stump-volume-control:*sound-card* nil)
Or you can set it to a device name, for example "default":
(setf stump-volume-control:*sound-card* "default")
Note, internally device numbers are translated to the device name
of pattern "hw:<number>", so these two calls have the same effect:
(setf stump-volume-control:*sound-card* 1)
(setf stump-volume-control:*sound-card* "hw:1")
PulseAudio compatibility
------------------------
This minimalistic volume control module works mainly for ALSA as it uses
amixer, the "command-line mixer for [the] ALSA sound card driver".
It might work also for PulseAudio as there are compatibility layers
but there might be some shortcomings.
Here is a little workaround to address one problem that was observed:
PulseAudio mutes more than it unmutes. So this module includes a hack
that will explicitly unmute the audio outputs when toggling audio back
on. It can be controlled by the list of audio outputs stored in the
variable STUMP-VOLUME-CONTROL:*PULSE-AUDIO-UNMUTE-OUTPUTS*.
By default, it is set to '("Speaker" "Headphone") as "Speaker" and
"Headphone" are the generic output names and thus it might just work.
But if your hardware uses special names, such as, for example,
"Megaphone" and "Leslie speaker", add this to your StumpWM init file:
(setf stump-volume-control:*pulse-audio-unmute-outputs*
'("Megaphone" "Leslie speaker"))
Change to NIL if you just use ALSA and do not want the extra calls to
be executed (which will fail silently if you do not have the outputs),
by adding to your StumpWM init file instead:
(setf stump-volume-control:*pulse-audio-unmute-outputs* nil)
(And now I have again spend more time on the dreaded PulseAudio...)