feat(prog/xmonad): add control for volume
feat(prog/xmobar): show volume
This commit is contained in:
parent
74f7e461c9
commit
d6857d4cd5
3 changed files with 87 additions and 75 deletions
3
programs/xmonad/xmobar/scripts/get_volume.sh
Executable file
3
programs/xmonad/xmobar/scripts/get_volume.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
echo $(amixer -D pulse sget Master | egrep -o "[0-9]+%" | head -n 1)
|
||||
exit 0
|
|
@ -52,7 +52,7 @@ config n = defaultConfig
|
|||
, alignSep = "}{"
|
||||
, template = "%XMonadLog%"
|
||||
<> "} %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]
|
||||
|
@ -73,7 +73,6 @@ myCommands =
|
|||
, Run $ Date "%a %d %b %Y" "date" (10 `seconds`)
|
||||
, Run $ Date "%H:%M:%S" "time" (1 `seconds`)
|
||||
, Run $ Kbd [("us(dvorak)", "us"), ("ru", "ru")]
|
||||
, Run $ XMonadLog
|
||||
, Run $
|
||||
Wireless
|
||||
"wlxd03745e1e87b"
|
||||
|
@ -86,6 +85,8 @@ myCommands =
|
|||
, "--high" , colorGreen
|
||||
]
|
||||
(10 `seconds`)
|
||||
, Run $ Com "/bin/bash" ["-c", "~/.config/xmobar/scripts/get_volume.sh"] "volume" 1
|
||||
, Run XMonadLog
|
||||
]
|
||||
where
|
||||
seconds, minutes :: Int -> Int
|
||||
|
|
|
@ -66,96 +66,100 @@ myFocusedBorderColor = "#f00"
|
|||
--
|
||||
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
|
||||
|
||||
-- launch a terminal
|
||||
[ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
|
||||
-- launch a terminal
|
||||
[ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
|
||||
|
||||
-- launch a 'flameshot' to screenshot
|
||||
, ((modm .|. shiftMask, xK_s ), safeSpawn "flameshot" ["gui"])
|
||||
-- launch a 'flameshot' to screenshot
|
||||
, ((modm .|. shiftMask, xK_s ), safeSpawn "flameshot" ["gui"])
|
||||
|
||||
-- launch 'dmenu_run' to choose applications
|
||||
, ((modm, xK_p ), spawn "dmenu_run")
|
||||
-- launch 'dmenu_run' to choose applications
|
||||
, ((modm, xK_p ), spawn "dmenu_run")
|
||||
|
||||
-- close focused window
|
||||
, ((modm .|. shiftMask, xK_c ), kill)
|
||||
-- close focused window
|
||||
, ((modm .|. shiftMask, xK_c ), kill)
|
||||
|
||||
-- Rotate through the available layout algorithms
|
||||
, ((modm, xK_space ), sendMessage NextLayout)
|
||||
-- Rotate through the available layout algorithms
|
||||
, ((modm, xK_space ), sendMessage NextLayout)
|
||||
|
||||
-- Reset the layouts on the current workspace to default
|
||||
, ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
|
||||
-- Reset the layouts on the current workspace to default
|
||||
, ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
|
||||
|
||||
-- Resize viewed windows to the correct size
|
||||
, ((modm, xK_n ), refresh)
|
||||
-- Resize viewed windows to the correct size
|
||||
, ((modm, xK_n ), refresh)
|
||||
|
||||
-- Move focus to the next window
|
||||
, ((modm, xK_j ), windows W.focusDown)
|
||||
-- Move focus to the next window
|
||||
, ((modm, xK_j ), windows W.focusDown)
|
||||
|
||||
-- Move focus to the previous window
|
||||
, ((modm, xK_k ), windows W.focusUp)
|
||||
-- Move focus to the previous window
|
||||
, ((modm, xK_k ), windows W.focusUp)
|
||||
|
||||
-- Move focus to the master window
|
||||
, ((modm, xK_m ), windows W.focusMaster)
|
||||
-- Move focus to the master window
|
||||
, ((modm, xK_m ), windows W.focusMaster)
|
||||
|
||||
-- Swap the focused window and the master window
|
||||
, ((modm, xK_Return), windows W.swapMaster)
|
||||
-- Swap the focused window and the master window
|
||||
, ((modm, xK_Return), windows W.swapMaster)
|
||||
|
||||
-- Swap the focused window with the next window
|
||||
, ((modm .|. shiftMask, xK_j ), windows W.swapDown)
|
||||
-- Swap the focused window with the next window
|
||||
, ((modm .|. shiftMask, xK_j ), windows W.swapDown)
|
||||
|
||||
-- Swap the focused window with the previous window
|
||||
, ((modm .|. shiftMask, xK_k ), windows W.swapUp)
|
||||
-- Swap the focused window with the previous window
|
||||
, ((modm .|. shiftMask, xK_k ), windows W.swapUp)
|
||||
|
||||
-- Shrink the master area
|
||||
, ((modm, xK_h ), sendMessage Shrink)
|
||||
-- Shrink the master area
|
||||
, ((modm, xK_h ), sendMessage Shrink)
|
||||
|
||||
-- Expand the master area
|
||||
, ((modm, xK_l ), sendMessage Expand)
|
||||
-- Expand the master area
|
||||
, ((modm, xK_l ), sendMessage Expand)
|
||||
|
||||
-- Push window back into tiling
|
||||
, ((modm, xK_t ), withFocused $ windows . W.sink)
|
||||
-- Push window back into tiling
|
||||
, ((modm, xK_t ), withFocused $ windows . W.sink)
|
||||
|
||||
-- Increment the number of windows in the master area
|
||||
, ((modm , xK_comma ), sendMessage $ IncMasterN 1)
|
||||
-- Increment the number of windows in the master area
|
||||
, ((modm , xK_comma ), sendMessage $ IncMasterN 1)
|
||||
|
||||
-- Deincrement the number of windows in the master area
|
||||
, ((modm , xK_period), sendMessage $ IncMasterN (-1))
|
||||
-- Deincrement the number of windows in the master area
|
||||
, ((modm , xK_period), sendMessage $ IncMasterN (-1))
|
||||
|
||||
-- Toggle the status bar gap
|
||||
-- Use this binding with avoidStruts from Hooks.ManageDocks.
|
||||
-- See also the statusBar function from Hooks.DynamicLog.
|
||||
--
|
||||
-- , ((modm , xK_b ), sendMessage ToggleStruts)
|
||||
-- Toggle the status bar gap
|
||||
-- Use this binding with avoidStruts from Hooks.ManageDocks.
|
||||
-- See also the statusBar function from Hooks.DynamicLog.
|
||||
--
|
||||
-- , ((modm , xK_b ), sendMessage ToggleStruts)
|
||||
|
||||
-- Quit xmonad
|
||||
, ((mod4Mask .|. shiftMask, xK_q ), io exitSuccess)
|
||||
-- Lock screen
|
||||
, ((mod4Mask , xK_l ), spawn "i3lock -e -c 000000")
|
||||
-- Quit xmonad
|
||||
, ((mod4Mask .|. shiftMask, xK_q ), io exitSuccess)
|
||||
-- Lock screen
|
||||
, ((mod4Mask , xK_l ), spawn "i3lock -e -c 000000")
|
||||
|
||||
-- Restart xmonad
|
||||
, ((modm , xK_q ), spawn "xmonad --recompile; xmonad --restart")
|
||||
-- Change volume
|
||||
, ((mod4Mask , xK_Up ), spawn "amixer -D pulse sset Master 1%+")
|
||||
, ((mod4Mask , xK_Down), spawn "amixer -D pulse sset Master 1%-")
|
||||
|
||||
-- Run xmessage with a summary of the default keybindings (useful for beginners)
|
||||
, ((modm .|. shiftMask, xK_slash ), xmessage help)
|
||||
-- Restart xmonad
|
||||
, ((modm , xK_q ), spawn "xmonad --recompile; xmonad --restart")
|
||||
|
||||
]
|
||||
++
|
||||
-- Run xmessage with a summary of the default keybindings (useful for beginners)
|
||||
, ((modm .|. shiftMask, xK_slash ), xmessage help)
|
||||
|
||||
--
|
||||
-- mod-[1..9], Switch to workspace N
|
||||
-- mod-shift-[1..9], Move client to workspace N
|
||||
--
|
||||
[((m .|. modm, k), windows $ f i)
|
||||
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
|
||||
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
|
||||
++
|
||||
]
|
||||
++
|
||||
|
||||
--
|
||||
-- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
|
||||
-- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
|
||||
--
|
||||
[((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
|
||||
| (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
|
||||
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
|
||||
--
|
||||
-- mod-[1..9], Switch to workspace N
|
||||
-- mod-shift-[1..9], Move client to workspace N
|
||||
--
|
||||
[((m .|. modm, k), windows $ f i)
|
||||
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
|
||||
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
|
||||
++
|
||||
|
||||
--
|
||||
-- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
|
||||
-- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
|
||||
--
|
||||
[((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
|
||||
| (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
|
||||
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
@ -215,13 +219,13 @@ myLayout = avoidStruts
|
|||
-- 'className' and 'resource' are used below.
|
||||
--
|
||||
myManageHook = composeAll
|
||||
[ className =? "MPlayer" --> doFloat
|
||||
, className =? "Gimp" --> doFloat
|
||||
, resource =? "desktop_window" --> doIgnore
|
||||
, resource =? "kdesktop" --> doIgnore
|
||||
-- my libs
|
||||
, resource =? "hwt" --> doFloat
|
||||
]
|
||||
[ className =? "MPlayer" --> doFloat
|
||||
, className =? "Gimp" --> doFloat
|
||||
, resource =? "desktop_window" --> doIgnore
|
||||
, resource =? "kdesktop" --> doIgnore
|
||||
-- my libs
|
||||
, resource =? "hwt" --> doFloat
|
||||
]
|
||||
|
||||
------------------------------------------------------------------------
|
||||
-- Event handling
|
||||
|
@ -335,4 +339,8 @@ help = unlines
|
|||
, "mod-button1 Set the window to floating mode and move by dragging"
|
||||
, "mod-button2 Raise the window to the top of the stack"
|
||||
, "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%"
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue