aboutsummaryrefslogtreecommitdiffstats
path: root/modules/image/volume.jsonc
blob: 17886437fcb5c4f4aa1e35cc9c9cf811dbaaa88b (plain)
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
// Volume, as a drawer: the output icon is always visible and the microphone
// slides out on hover, the same shape as the current bar's wireplumber group.
//
// These are `image` modules rather than wireplumber ones because wireplumber
// draws its state with format-icons, which is text. `image` runs a command and
// reads a path, so wb-icon resolves the state to a themed icon instead. The
// cost is that the percentage is in the tooltip rather than on the bar, which
// is the trade an icons-only bar makes.
//
// signal 8 is raised by volume.sh after every change, so the icon updates on
// the keypress rather than up to two seconds later.
{
	"group/volume": {
		"orientation": "horizontal",
		"modules": [
			"image#volume",
			"image#mic"
		],
		"drawer": {
			"transition-left-to-right": false
		}
	},

	"image#volume": {
		"exec": "$HOME/bin/wb-icon volume",
		"size": 22,
		"interval": 2,
		"signal": 8,
		"on-click": "$HOME/.config/waybar/scripts/volume.sh output mute",
		"on-click-right": "pavucontrol-qt",
		"on-scroll-up": "$HOME/.config/waybar/scripts/volume.sh output raise",
		"on-scroll-down": "$HOME/.config/waybar/scripts/volume.sh output lower"
	},

	"image#mic": {
		"exec": "$HOME/bin/wb-icon mic",
		"size": 22,
		"interval": 2,
		"signal": 8,
		"on-click": "$HOME/.config/waybar/scripts/volume.sh input mute",
		"on-scroll-up": "$HOME/.config/waybar/scripts/volume.sh input raise",
		"on-scroll-down": "$HOME/.config/waybar/scripts/volume.sh input lower"
	}
}