ENH use dunstctl directly in xmonad

This commit is contained in:
Nathan Dwarshuis 2021-10-24 13:30:30 -04:00
parent 081959081a
commit 2a866f9877
2 changed files with 32 additions and 9 deletions

View File

@ -432,15 +432,6 @@ internalBindings c =
, KeyBinding "M-S-l" "shift workspace up screen" $ swapNextScreen >> nextScreen
, KeyBinding "M-S-h" "shift workspace down screen" $ swapPrevScreen >> prevScreen
]
-- dummy map for dunst commands (defined separately but this makes them show
-- up in the help menu)
, KeyGroup "Dunst"
[ KeyBinding "M-`" "dunst history" skip
, KeyBinding "M-S-`" "dunst close" skip
, KeyBinding "M-M1-`" "dunst context menu" skip
, KeyBinding "M-C-`" "dunst close all" skip
]
]
mkNamedSubmap :: XConfig Layout -> KeyGroup (X ()) -> [((KeyMask, KeySym), NamedAction)]
@ -521,6 +512,13 @@ externalBindings bc sc ts =
, KeyBinding "<XF86AudioMute>" "volume mute" runVolumeMute
]
, KeyGroup "Dunst"
[ KeyBinding "M-`" "dunst history" runNotificationHistory
, KeyBinding "M-S-`" "dunst close" runNotificationClose
, KeyBinding "M-M1-`" "dunst context menu" runNotificationContext
, KeyBinding "M-C-`" "dunst close all" runNotificationCloseAll
]
, KeyGroup "System"
[ KeyBinding "M-." "backlight up" $ runMaybe bc backlightUp
, KeyBinding "M-," "backlight down" $ runMaybe bc backlightDown

View File

@ -27,6 +27,10 @@ module XMonad.Internal.Command.Desktop
, runCaptureBrowser
, runStartISyncTimer
, runStartISyncService
, runNotificationClose
, runNotificationCloseAll
, runNotificationHistory
, runNotificationContext
) where
import Control.Monad (void)
@ -70,6 +74,9 @@ myCapture = "flameshot"
myImageBrowser :: String
myImageBrowser = "feh"
myNotificationCtrl :: String
myNotificationCtrl = "dunstctl"
--------------------------------------------------------------------------------
-- | Misc constants
@ -135,6 +142,24 @@ runVolumeUp = spawnSound volumeChangeSound (return ()) $ void (raiseVolume 2)
runVolumeMute :: IO MaybeX
runVolumeMute = spawnSound volumeChangeSound (void toggleMute) $ return ()
--------------------------------------------------------------------------------
-- | Notification control
runNotificationCmd :: String -> IO MaybeX
runNotificationCmd cmd = spawnCmdIfInstalled myNotificationCtrl [cmd]
runNotificationClose :: IO MaybeX
runNotificationClose = runNotificationCmd "close"
runNotificationCloseAll :: IO MaybeX
runNotificationCloseAll = runNotificationCmd "close-all"
runNotificationHistory :: IO MaybeX
runNotificationHistory = runNotificationCmd "history-pop"
runNotificationContext :: IO MaybeX
runNotificationContext = runNotificationCmd "context"
--------------------------------------------------------------------------------
-- | System commands