summaryrefslogtreecommitdiff
path: root/i3status.c
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2010-07-20 19:30:27 +0200
committerMichael Stapelberg <michael@stapelberg.de>2010-07-20 19:33:41 +0200
commiteb46963d4c88a75f1ac336275daf3d0d72a904ba (patch)
treef1f898c76925ec8c6cd1dcc9ad2af1b7f1b77a99 /i3status.c
parentd8b6f031447434c88bc7d5eb1303c14d51e14238 (diff)
Implement ALSA volume support
Diffstat (limited to 'i3status.c')
-rw-r--r--i3status.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/i3status.c b/i3status.c
index eabcd6c..e0139eb 100644
--- a/i3status.c
+++ b/i3status.c
@@ -151,6 +151,14 @@ int main(int argc, char *argv[]) {
CFG_END()
};
+ cfg_opt_t volume_opts[] = {
+ CFG_STR("format", "♪: %volume", CFGF_NONE),
+ CFG_STR("device", "default", CFGF_NONE),
+ CFG_STR("mixer", "Master", CFGF_NONE),
+ CFG_INT("mixer_idx", 0, CFGF_NONE),
+ CFG_END()
+ };
+
cfg_opt_t opts[] = {
CFG_STR_LIST("order", "{ipv6,\"run_watch DHCP\",\"wireless wlan0\",\"ethernet eth0\",\"battery 0\",\"cpu_temperature 0\",load,time}", CFGF_NONE),
CFG_SEC("general", general_opts, CFGF_NONE),
@@ -160,6 +168,7 @@ int main(int argc, char *argv[]) {
CFG_SEC("battery", battery_opts, CFGF_TITLE | CFGF_MULTI),
CFG_SEC("cpu_temperature", temp_opts, CFGF_TITLE | CFGF_MULTI),
CFG_SEC("disk", disk_opts, CFGF_TITLE | CFGF_MULTI),
+ CFG_SEC("volume", volume_opts, CFGF_TITLE | CFGF_MULTI),
CFG_SEC("ipv6", ipv6_opts, CFGF_NONE),
CFG_SEC("time", time_opts, CFGF_NONE),
CFG_SEC("ddate", ddate_opts, CFGF_NONE),
@@ -260,6 +269,12 @@ int main(int argc, char *argv[]) {
CASE_SEC("ddate")
print_ddate(cfg_getstr(sec, "format"));
+ CASE_SEC("volume")
+ print_volume(cfg_getstr(sec, "format"),
+ cfg_getstr(sec, "device"),
+ cfg_getstr(sec, "mixer"),
+ cfg_getint(sec, "mixer_idx"));
+
CASE_SEC_TITLE("cpu_temperature")
print_cpu_temperature_info(atoi(title), cfg_getstr(sec, "format"));
}