ENH generalize showkyes
This commit is contained in:
parent
394eca3ad2
commit
1cf9e3e8bd
|
@ -129,7 +129,7 @@ run = do
|
||||||
tt <- evalAlways $ fsTabbedTheme fs
|
tt <- evalAlways $ fsTabbedTheme fs
|
||||||
let conf =
|
let conf =
|
||||||
ewmh $
|
ewmh $
|
||||||
addKeymap dws sk kbs $
|
addKeymap dws (liftIO . runIO . sk) kbs $
|
||||||
docks $
|
docks $
|
||||||
def
|
def
|
||||||
{ terminal = myTerm
|
{ terminal = myTerm
|
||||||
|
@ -179,7 +179,7 @@ data FeatureSet = FeatureSet
|
||||||
, fsACPIHandler :: Always (String -> X ())
|
, fsACPIHandler :: Always (String -> X ())
|
||||||
, fsTabbedTheme :: Always Theme
|
, fsTabbedTheme :: Always Theme
|
||||||
, fsDynWorkspaces :: [Sometimes DynWorkspace]
|
, fsDynWorkspaces :: [Sometimes DynWorkspace]
|
||||||
, fsShowKeys :: Always ([((KeyMask, KeySym), NamedAction)] -> X ())
|
, fsShowKeys :: Always ([((KeyMask, KeySym), NamedAction)] -> XIO ())
|
||||||
}
|
}
|
||||||
|
|
||||||
tabbedFeature :: Always Theme
|
tabbedFeature :: Always Theme
|
||||||
|
|
|
@ -19,16 +19,18 @@ module XMonad.Internal.Command.DMenu
|
||||||
where
|
where
|
||||||
|
|
||||||
import DBus
|
import DBus
|
||||||
|
import qualified Data.ByteString.Char8 as BC
|
||||||
import Data.Internal.DBus
|
import Data.Internal.DBus
|
||||||
import Data.Internal.XIO
|
import Data.Internal.XIO
|
||||||
import Graphics.X11.Types
|
import Graphics.X11.Types
|
||||||
import RIO hiding (hClose)
|
import RIO
|
||||||
|
import qualified RIO.ByteString as B
|
||||||
import RIO.Directory
|
import RIO.Directory
|
||||||
( XdgDirectory (..)
|
( XdgDirectory (..)
|
||||||
, getXdgDirectory
|
, getXdgDirectory
|
||||||
)
|
)
|
||||||
import qualified RIO.Text as T
|
import qualified RIO.Text as T
|
||||||
import System.IO
|
-- import System.IO
|
||||||
import XMonad.Core hiding (spawn)
|
import XMonad.Core hiding (spawn)
|
||||||
import XMonad.Internal.Command.Desktop
|
import XMonad.Internal.Command.Desktop
|
||||||
import XMonad.Internal.DBus.Common
|
import XMonad.Internal.DBus.Common
|
||||||
|
@ -207,7 +209,9 @@ runClipMenu = sometimesIO_ "clipboard manager" "rofi greenclip" tree act
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- Shortcut menu
|
-- Shortcut menu
|
||||||
|
|
||||||
runShowKeys :: Always ([((KeyMask, KeySym), NamedAction)] -> X ())
|
runShowKeys
|
||||||
|
:: MonadUnliftIO m
|
||||||
|
=> Always ([((KeyMask, KeySym), NamedAction)] -> m ())
|
||||||
runShowKeys =
|
runShowKeys =
|
||||||
Always "keyboard menu" $
|
Always "keyboard menu" $
|
||||||
Option showKeysDMenu $
|
Option showKeysDMenu $
|
||||||
|
@ -220,18 +224,20 @@ runShowKeys =
|
||||||
spawnNotify $
|
spawnNotify $
|
||||||
defNoteError {body = Just $ Text "could not display keymap"}
|
defNoteError {body = Just $ Text "could not display keymap"}
|
||||||
|
|
||||||
showKeysDMenu :: SubfeatureRoot ([((KeyMask, KeySym), NamedAction)] -> X ())
|
showKeysDMenu
|
||||||
|
:: MonadUnliftIO m
|
||||||
|
=> SubfeatureRoot ([((KeyMask, KeySym), NamedAction)] -> m ())
|
||||||
showKeysDMenu =
|
showKeysDMenu =
|
||||||
Subfeature
|
Subfeature
|
||||||
{ sfName = "keyboard shortcut menu"
|
{ sfName = "keyboard shortcut menu"
|
||||||
, sfData = IORoot_ showKeys $ Only_ dmenuDep
|
, sfData = IORoot_ showKeys $ Only_ dmenuDep
|
||||||
}
|
}
|
||||||
|
|
||||||
showKeys :: [((KeyMask, KeySym), NamedAction)] -> X ()
|
showKeys :: MonadUnliftIO m => [((KeyMask, KeySym), NamedAction)] -> m ()
|
||||||
showKeys kbs = do
|
showKeys kbs = do
|
||||||
h <- spawnPipe cmd
|
h <- spawnPipe cmd
|
||||||
io $ hPutStr h $ unlines $ showKm kbs
|
B.hPut h $ BC.unlines $ BC.pack <$> showKm kbs
|
||||||
io $ hClose h
|
hClose h
|
||||||
where
|
where
|
||||||
cmd =
|
cmd =
|
||||||
fmtCmd myDmenuCmd $
|
fmtCmd myDmenuCmd $
|
||||||
|
|
Loading…
Reference in New Issue