feat(prog/xmonad): add control for volume

feat(prog/xmobar): show volume
This commit is contained in:
Dmitriy Pleshevskiy 2022-04-12 19:13:35 +03:00
parent 74f7e461c9
commit d6857d4cd5
3 changed files with 87 additions and 75 deletions

View file

@ -0,0 +1,3 @@
#!/bin/bash
echo $(amixer -D pulse sget Master | egrep -o "[0-9]+%" | head -n 1)
exit 0

View file

@ -52,7 +52,7 @@ config n = defaultConfig
, alignSep = "}{" , alignSep = "}{"
, template = "%XMonadLog%" , template = "%XMonadLog%"
<> "} %date% <hspace=60/> %cpu% | %memory% * %swap% | %wlxd03745e1e87bwi%" <> "} %date% <hspace=60/> %cpu% | %memory% * %swap% | %wlxd03745e1e87bwi%"
<> "{ <fn=1><box> %kbd% </box> <fc=#ee9a00>%time%</fc></fn>" <> "{ Vol: %volume% <fn=1><box> %kbd% </box> <fc=#ee9a00>%time%</fc></fn>"
} }
myCommands :: [Runnable] myCommands :: [Runnable]
@ -73,7 +73,6 @@ myCommands =
, Run $ Date "%a %d %b %Y" "date" (10 `seconds`) , Run $ Date "%a %d %b %Y" "date" (10 `seconds`)
, Run $ Date "%H:%M:%S" "time" (1 `seconds`) , Run $ Date "%H:%M:%S" "time" (1 `seconds`)
, Run $ Kbd [("us(dvorak)", "us"), ("ru", "ru")] , Run $ Kbd [("us(dvorak)", "us"), ("ru", "ru")]
, Run $ XMonadLog
, Run $ , Run $
Wireless Wireless
"wlxd03745e1e87b" "wlxd03745e1e87b"
@ -86,6 +85,8 @@ myCommands =
, "--high" , colorGreen , "--high" , colorGreen
] ]
(10 `seconds`) (10 `seconds`)
, Run $ Com "/bin/bash" ["-c", "~/.config/xmobar/scripts/get_volume.sh"] "volume" 1
, Run XMonadLog
] ]
where where
seconds, minutes :: Int -> Int seconds, minutes :: Int -> Int

View file

@ -131,6 +131,10 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
-- Lock screen -- Lock screen
, ((mod4Mask , xK_l ), spawn "i3lock -e -c 000000") , ((mod4Mask , xK_l ), spawn "i3lock -e -c 000000")
-- Change volume
, ((mod4Mask , xK_Up ), spawn "amixer -D pulse sset Master 1%+")
, ((mod4Mask , xK_Down), spawn "amixer -D pulse sset Master 1%-")
-- Restart xmonad -- Restart xmonad
, ((modm , xK_q ), spawn "xmonad --recompile; xmonad --restart") , ((modm , xK_q ), spawn "xmonad --recompile; xmonad --restart")
@ -335,4 +339,8 @@ help = unlines
, "mod-button1 Set the window to floating mode and move by dragging" , "mod-button1 Set the window to floating mode and move by dragging"
, "mod-button2 Raise the window to the top of the stack" , "mod-button2 Raise the window to the top of the stack"
, "mod-button3 Set the window to floating mode and resize by dragging" , "mod-button3 Set the window to floating mode and resize by dragging"
, ""
, "-- Volume"
, "mod4-Up Increase volume by 1%"
, "mod4-Down Decrease volume by 1%"
] ]