Print result from exec?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Print result from exec?

duncan_bayne
Hi All,

Beginner question here:  I am using amixer to control the sound volume
via accelerator keys, using the following:

(define-key *top-map* (kbd "XF86AudioRaiseVolume") "exec amixer set
Master 5+ | grep '%'")
(define-key *top-map* (kbd "XF86AudioLowerVolume") "exec amixer set
Master 5- | grep '%'")
(define-key *top-map* (kbd "XF86AudioMute") "exec amixer set Master
toggle | grep '%'")

When run from console the output looks like this:

duncan@duncan-netbook ~ $ amixer set Master 5- | grep '%'
  Mono: Playback 59 [92%] [-5.00dB] [on]

I'd like to display that to the user to notify them of the new volume
setting, using the StumpWM print function or similar.

Could someone please point me in the right direction here?  I suspect
this is a reasonably common thing, so perhaps I'm just failing to find
some documentation ...

--
Duncan Bayne
ph: +61 420 817 082 | web: http://duncan-bayne.github.com/ | skype: duncan_bayne

_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Reply | Threaded
Open this post in threaded view
|

Re: Print result from exec?

Lucas Pandolfo

On 23 January 2012 19:14, Duncan Bayne <[hidden email]> wrote:
Hi All,

Beginner question here:  I am using amixer to control the sound volume
via accelerator keys, using the following:

(define-key *top-map* (kbd "XF86AudioRaiseVolume") "exec amixer set
Master 5+ | grep '%'")
(define-key *top-map* (kbd "XF86AudioLowerVolume") "exec amixer set
Master 5- | grep '%'")
(define-key *top-map* (kbd "XF86AudioMute") "exec amixer set Master
toggle | grep '%'")

When run from console the output looks like this:

duncan@duncan-netbook ~ $ amixer set Master 5- | grep '%'
 Mono: Playback 59 [92%] [-5.00dB] [on]

I'd like to display that to the user to notify them of the new volume
setting, using the StumpWM print function or similar.

Could someone please point me in the right direction here?  I suspect
this is a reasonably common thing, so perhaps I'm just failing to find
some documentation ...

Try something like

(defcommand raise-volume () ()
   "Raise volume via amixer"
   (message (run-shell-command "amixer set Master 5+ | grep '\[*%\]'" t)))



_______________________________________________
Stumpwm-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel