Volume in Status Bar (simpler way)

From awesome
Jump to: navigation, search

I'm using Ubuntu 7.10.

We'll start by installing amixer

sudo apt-get install amixer

Then, we add these 2 textboxes to the "statusbar" part of our .awesomerc

textbox "vol_up" {
  text = " UP "
  mouse {
    modkey = {}
    button = "1"
    command = "spawn"
    arg = "amixer -q -c 0 sset PCM,0 10%+"
  }
}

and

textbox "vol_down" {
  text = " DOWN "
  mouse {
    modkey = {}
    button = "1"
    command = "spawn"
    arg = "amixer -q -c 0 sset PCM,0 10%-"
  }
}

Et voilĂ  ! You will probably have to adjust "arg" to suit your config. Anyway, here is a description of the important stuff in mine:

-q     : quiet
-c 0   : the sound card, "0" if only one card or for the first, "1" for the second and so on...
PCM,0  : depends on your config, man amixer for more on this
10%+   : increment by appending "+" to the value or decrement with a "-"

amixer has lots of options for you to play with. You definetly should have a look at

man amixer

If you don't have a fancy multimedia keyboard you can use the same commands from the keyboard by adding these definitions to the "keys" part of your .awesomerc

key{
  modkey = {"Mod4"}
  key = "KP_Add"
  command = "spawn"
  arg = "amixer -q -c 0 sset PCM,0 10%+"
}

and

key{
  modkey = {"Mod4"}
  key = "KP_Subtract"
  command = "spawn"
  arg = "amixer -q -c 0 sset PCM,0 10%-"
}

Cool.

question:

everything works for me except for the last part -

what is key = "KP_Add" ?

even when I replace it with + sign, nothing happened.

any clue?

Personal tools