dotfiles

Obligatory dotfiles repo
git clone git://git.danielmoch.com/dotfiles.git
Log | Files | Refs

commit 873cce3492077ad96ae67b037ef4e29d13058d25
parent 41f7024fdb7a6a31ef6b9400728ab36e3470aa32
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Sun, 21 Jan 2018 19:38:30 -0500

Add volume status

Diffstat:
M.config/awesome/rc.lua | 10+++++++++-
M.local/bin/my | 24++++++++++++++++++++++--
2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua @@ -93,6 +93,14 @@ local function client_menu_toggle_fn() end end end + +local function sound_status() + awful.spawn.easy_async('my sound status', + function (stdout, stderr, reason, exit_code) + -- Use string.sub to trim the trailing carriage return + naughty.notify { text = string.sub(stdout, 1, -2) } + end) +end -- }}} -- {{{ Menu @@ -256,7 +264,7 @@ globalkeys = gears.table.join( {description = "view next", group = "tag"}), awful.key({ modkey, }, "Escape", awful.tag.history.restore, {description = "go back", group = "tag"}), - + awful.key({ modkey, }, "v", sound_status), awful.key({ modkey, }, "j", function () awful.client.focus.byidx( 1) diff --git a/.local/bin/my b/.local/bin/my @@ -46,7 +46,7 @@ case $command in if [ -n "$term" ] then - exec $term $@ + exec $term "$@" else __mylog "my term" "No terminal emulator found" fi @@ -95,7 +95,27 @@ case $command in sound) if type pactl > /dev/null 2>&1 then - exec pactl $@ + [ -z "$1" ] && exit 1 + if [ $1 = "status" ] + then + sink_status=`pactl list sinks | grep ^[[:space:]]*Volume | awk '{print $5}'` + source_status=`pactl list sources | grep ^[[:space:]]*Volume | awk '{print $5}'` + echo -n "Sinks: " + for sink in $sink_status + do + echo -n "$sink " + done + echo "" + echo -n "Sources: " + for source in $source_status + do + echo -n "$source " + done + echo "" + exit 0 + else + exec pactl "$@" + fi else __mylog "my sound" "No handler found" fi