Use xmessage from core

Related: https://github.com/xmonad/xmonad/pull/318
This commit is contained in:
Tomas Janousek 2021-08-07 22:04:09 +01:00
parent 8d557c6954
commit 07040cbd58
7 changed files with 7 additions and 21 deletions

View File

@ -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'

View File

@ -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

View File

@ -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))
--
------------------------------------------------------------------------

View File

@ -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,

View File

@ -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 (("\""++) . (++"\""))

View File

@ -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.

View File

@ -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