Explorar el Código

add vol_perc notes, add braces to singleline statements

master
parazyd hace 7 años
padre
commit
62f4016430
No se encontró ninguna clave conocida en la base de datos para esta firma ID de clave GPG: F0CB28FCF78637DE
Se han modificado 3 ficheros con 19 adiciones y 5 borrados
  1. +10
    -0
      README.md
  2. +1
    -1
      config.def.h
  3. +8
    -4
      slstatus.c

+ 10
- 0
README.md Ver fichero

@@ -50,6 +50,16 @@ If you use any other status bar or window manager you will have to figure it out

slstatus -o | other_status_bar &

### Specific function quirks

- Volume percentage

If there is no `/dev/mixer` on your system and you use ALSA, it means you have to load the OSS compatibility module by issuing:

```
# modprobe snd-pcm-oss
```

## Contributing

Hunt FIXME's in the code or do WTF you want! If it is useful, I will merge.


+ 1
- 1
config.def.h Ver fichero

@@ -34,7 +34,7 @@
- uid (uid of current user) [argument: NULL]
- uptime (uptime) [argument: NULL]
- username (username of current user) [argument: NULL]
- vol_perc (oss/alsa volume and mute status in percent) [argument: /dev/mixer]
- vol_perc (oss/alsa volume status (see README)) [argument: /dev/mixer]
- wifi_perc (wifi signal in percent) [argument: wifi card interface name]
- wifi_essid (wifi essid) [argument: wifi card interface name] */
static const struct arg args[] = {


+ 8
- 4
slstatus.c Ver fichero

@@ -628,14 +628,18 @@ vol_perc(const char *card)
}

ioctl(afd, MIXER_READ(SOUND_MIXER_DEVMASK), &devmask);
for (i = 0; i < (sizeof(vnames) / sizeof((vnames[0]))); i++)
if (devmask & (1 << i))
if (!strcmp("vol", vnames[i]))
for (i = 0; i < (sizeof(vnames) / sizeof((vnames[0]))); i++) {
if (devmask & (1 << i)) {
if (!strcmp("vol", vnames[i])) {
ioctl(afd, MIXER_READ(i), &v);
}
}
}

close(afd);
if (v == 0)
if (v == 0) {
return smprintf("mute");
}
return smprintf("%d%%", v & 0xff);
}



Cargando…
Cancelar
Guardar