From 07040cbd585b1b72e566b621c457c11efe0497aa Mon Sep 17 00:00:00 2001 From: Tomas Janousek Date: Sat, 7 Aug 2021 22:04:09 +0100 Subject: [PATCH] Use xmessage from core Related: https://github.com/xmonad/xmonad/pull/318 --- XMonad/Actions/TopicSpace.hs | 10 ---------- XMonad/Actions/TreeSelect.hs | 3 +-- XMonad/Hooks/DynamicLog.hs | 2 +- XMonad/Hooks/StatusBar.hs | 2 +- XMonad/Util/EZConfig.hs | 4 ++-- XMonad/Util/NamedActions.hs | 5 +---- xmonad-contrib.cabal | 2 +- 7 files changed, 7 insertions(+), 21 deletions(-) diff --git a/XMonad/Actions/TopicSpace.hs b/XMonad/Actions/TopicSpace.hs index c5b6be06..895ba96a 100644 --- a/XMonad/Actions/TopicSpace.hs +++ b/XMonad/Actions/TopicSpace.hs @@ -76,7 +76,6 @@ import qualified XMonad.Hooks.DynamicLog as DL import qualified XMonad.StackSet as W import Data.Map (Map) -import System.IO (hClose, hPutStr) import XMonad.Prompt (XPConfig) import XMonad.Prompt.Workspace (workspacePrompt) @@ -91,8 +90,6 @@ import XMonad.Hooks.WorkspaceHistory , workspaceHistoryModify ) -import XMonad.Util.Run (spawnPipe) - -- $overview -- This module allows to organize your workspaces on a precise topic basis. So -- instead of having a workspace called `work' you can setup one workspace per @@ -383,13 +380,6 @@ checkTopicConfig tags tg = do check diffTopic "Seen but missing topics/workspaces" check dups "Duplicate topics/workspaces" --- | Display the given message using the @xmessage@ program. -xmessage :: String -> IO () -xmessage s = do - h <- spawnPipe "xmessage -file -" - hPutStr h s - hClose h - -- | Convenience type for specifying topics. data TopicItem = TI { tiName :: !Topic -- ^ 'Topic' ≡ 'String' diff --git a/XMonad/Actions/TreeSelect.hs b/XMonad/Actions/TreeSelect.hs index b017b6b3..9a9df882 100644 --- a/XMonad/Actions/TreeSelect.hs +++ b/XMonad/Actions/TreeSelect.hs @@ -68,7 +68,6 @@ import Control.Monad.State import Data.Tree import Foreign (shiftL, shiftR, (.&.)) import System.IO -import System.Posix.Process (forkProcess, executeFile) import XMonad hiding (liftX) import XMonad.Prelude import XMonad.StackSet as W @@ -409,7 +408,7 @@ treeselectWorkspace c xs f = do , "XConfig.workspaces: " ] ++ map tag ws hPutStrLn stderr msg - _ <- forkProcess $ executeFile "xmessage" True [msg] Nothing + xmessage msg return () where mkNode n w = do diff --git a/XMonad/Hooks/DynamicLog.hs b/XMonad/Hooks/DynamicLog.hs index 5fe8cf9c..1612068c 100644 --- a/XMonad/Hooks/DynamicLog.hs +++ b/XMonad/Hooks/DynamicLog.hs @@ -135,7 +135,7 @@ import XMonad.Hooks.StatusBar -- changes, you could make a keybinding to cycle the layout and -- display the current status: -- --- > , ((mod1Mask, xK_a ), sendMessage NextLayout >> (dynamicLogString myPP >>= \d->spawn $"xmessage "++d)) +-- > , ((mod1Mask, xK_a ), sendMessage NextLayout >> (dynamicLogString myPP >>= xmessage)) -- ------------------------------------------------------------------------ diff --git a/XMonad/Hooks/StatusBar.hs b/XMonad/Hooks/StatusBar.hs index cc98eb1a..750a0968 100644 --- a/XMonad/Hooks/StatusBar.hs +++ b/XMonad/Hooks/StatusBar.hs @@ -205,7 +205,7 @@ import qualified XMonad.StackSet as W -- the current layout when it changes, you could make a keybinding to cycle the -- layout and display the current status: -- --- > ((mod1Mask, xK_a), sendMessage NextLayout >> (dynamicLogString myPP >>= \d -> spawn $ "xmessage " ++ d)) +-- > ((mod1Mask, xK_a), sendMessage NextLayout >> (dynamicLogString myPP >>= xmessage)) -- -- If you use a status bar that does not support reading from a property -- (like dzen), and you don't want to use the 'statusBar' function, you can, diff --git a/XMonad/Util/EZConfig.hs b/XMonad/Util/EZConfig.hs index d86fe96a..c5935c50 100644 --- a/XMonad/Util/EZConfig.hs +++ b/XMonad/Util/EZConfig.hs @@ -710,9 +710,9 @@ multimediaKeys = filter ((/= noSymbol) . snd) . map (id &&& stringToKeysym) $ checkKeymap :: XConfig l -> [(String, a)] -> X () checkKeymap conf km = warn (doKeymapCheck conf km) where warn ([],[]) = return () - warn (bad,dup) = spawn $ "xmessage 'Warning:\n" + warn (bad,dup) = xmessage $ "Warning:\n" ++ msg "bad" bad ++ "\n" - ++ msg "duplicate" dup ++ "'" + ++ msg "duplicate" dup msg _ [] = "" msg m xs = m ++ " keybindings detected: " ++ showBindings xs showBindings = unwords . map (("\""++) . (++"\"")) diff --git a/XMonad/Util/NamedActions.hs b/XMonad/Util/NamedActions.hs index 2af15d74..fe811b28 100644 --- a/XMonad/Util/NamedActions.hs +++ b/XMonad/Util/NamedActions.hs @@ -48,7 +48,6 @@ module XMonad.Util.NamedActions ( import XMonad.Actions.Submap(submap) import XMonad.Prelude (groupBy) import XMonad -import System.Posix.Process(executeFile) import Control.Arrow(Arrow((&&&), second, (***))) import Data.Bits(Bits((.&.), complement)) import System.Exit(exitSuccess) @@ -204,9 +203,7 @@ showKm keybindings = padding $ do -- | An action to send to 'addDescrKeys' for showing the keybindings. See also 'showKm' and 'showKmSimple' xMessage :: [((KeyMask, KeySym), NamedAction)] -> NamedAction -xMessage x = addName "Show Keybindings" $ io $ do - xfork $ executeFile "xmessage" True ["-default", "okay", unlines $ showKm x] Nothing - return () +xMessage x = addName "Show Keybindings" $ xmessage $ unlines $ showKm x -- | Merge the supplied keys with 'defaultKeysDescr', also adding a keybinding -- to run an action for showing the keybindings. diff --git a/xmonad-contrib.cabal b/xmonad-contrib.cabal index 3946c684..f6c0a8db 100644 --- a/xmonad-contrib.cabal +++ b/xmonad-contrib.cabal @@ -58,7 +58,7 @@ library mtl >= 1 && < 3, unix, X11 >= 1.10 && < 1.11, - xmonad >= 0.16.9999 && < 0.18, + xmonad >= 0.16.99999 && < 0.18, utf8-string ghc-options: -Wall -Wno-unused-do-bind