diff --git a/bin/xmonad.hs b/bin/xmonad.hs index 3bc927c..0f7df75 100644 --- a/bin/xmonad.hs +++ b/bin/xmonad.hs @@ -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 "" "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 diff --git a/lib/XMonad/Internal/Command/Desktop.hs b/lib/XMonad/Internal/Command/Desktop.hs index 93daaea..6d89b41 100644 --- a/lib/XMonad/Internal/Command/Desktop.hs +++ b/lib/XMonad/Internal/Command/Desktop.hs @@ -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