diff options
author | Michal Minar <mic.liamg@gmail.com> | 2015-11-01 19:46:26 +0100 |
---|---|---|
committer | Michal Minar <mic.liamg@gmail.com> | 2015-11-01 19:46:26 +0100 |
commit | 3a08a732d7cf48ca34337ca6115acb43e29717bc (patch) | |
tree | bb33b678ac4839b7b6b7fd1c5c7411cb232712ba | |
parent | ba6123aa885bb33cc1a9185ec03a9b6cd7a65371 (diff) | |
download | xminad-3a08a732d7cf48ca34337ca6115acb43e29717bc.tar.gz xminad-3a08a732d7cf48ca34337ca6115acb43e29717bc.tar.xz xminad-3a08a732d7cf48ca34337ca6115acb43e29717bc.zip |
Allow to stop/cont process of current window
New keybindings group:
<Super>-x
+ s - send SIGKILL
+ c - send SIGCONT
+ x - spawn xkill
Signed-off-by: Michal Minar <mic.liamg@gmail.com>
-rw-r--r-- | src/XMonad/Local/Actions.hs | 13 | ||||
-rw-r--r-- | src/XMonad/Local/Keys.hs | 45 | ||||
-rw-r--r-- | src/XMonad/Local/ManageHook.hs | 3 | ||||
-rw-r--r-- | src/XMonad/Local/TopicSpace.hs | 3 | ||||
-rw-r--r-- | xminad.cabal | 1 |
5 files changed, 44 insertions, 21 deletions
diff --git a/src/XMonad/Local/Actions.hs b/src/XMonad/Local/Actions.hs index baf738b..c667179 100644 --- a/src/XMonad/Local/Actions.hs +++ b/src/XMonad/Local/Actions.hs @@ -2,8 +2,13 @@ module XMonad.Local.Actions where +import Control.Monad +import Data.Maybe +import System.Posix.Signals (Signal, signalProcess) + import XMonad import qualified XMonad.Actions.TopicSpace as TS +import qualified XMonad.Util.WindowProperties as WP -- local modules ************************************************************** import qualified XMonad.Local.Config as Local @@ -26,6 +31,14 @@ spawnShellIn dir command = do cmd' t | dir == "" = t ++ run command | otherwise = "cd " ++ dir ++ " && " ++ t ++ run command +killWindowPID :: Signal -> Window -> X() +killWindowPID s w = do + pid <- WP.getProp32s "_NET_WM_PID" w + when (isJust pid) (liftIO $ mapM_ (signalProcess s . fromIntegral) (fromJust pid)) + +signalCurrentWindow :: Signal -> X() +signalCurrentWindow s = withFocused (killWindowPID s) + mateRun :: X () mateRun = withDisplay $ \dpy -> do rw <- asks theRoot diff --git a/src/XMonad/Local/Keys.hs b/src/XMonad/Local/Keys.hs index 8681371..8d9329c 100644 --- a/src/XMonad/Local/Keys.hs +++ b/src/XMonad/Local/Keys.hs @@ -10,6 +10,8 @@ import qualified Data.Map as M import Data.Maybe import qualified Network.MPD as MPD import qualified Network.MPD.Commands.Extensions as MPD +import System.Posix.Signals (sigCONT, sigSTOP) + import XMonad hiding (modMask, keys) import XMonad.Actions.CycleWS import qualified XMonad.Actions.DynamicWorkspaces as DW @@ -122,7 +124,14 @@ genericKeys conf = [ -- Windows , ("S-c", kill) , ("C-S-c", WithAll.killAll) - , ("x", spawn "xkill") + + , ("x", SUB.submap $ EZ.mkKeymap conf $ concat + [ [(k, a), (modm ++ k, a)] + | (k, a) <- [ ("s", Local.signalCurrentWindow sigSTOP) + , ("c", Local.signalCurrentWindow sigCONT) + , ("x", spawn "xkill") + ] + ]) -- Compositing , ("S-x", SUB.submap $ EZ.mkKeymap conf $ concat @@ -194,16 +203,16 @@ genericKeys conf = [ --, ("<Print>", spawn "xfce4-screenshooter") , ("y", SUB.submap $ EZ.mkKeymap conf $ concat [ [(k, a), (modm ++ "-" ++ k, a)] - | (k, a) <- [ ("n", io $ return . fromRight =<< MPD.withMPD MPD.next) - , ("p", io $ return . fromRight =<< MPD.withMPD MPD.previous) - , ("S-.", io $ return . fromRight =<< MPD.withMPD MPD.next) - , ("S-,", io $ return . fromRight =<< MPD.withMPD MPD.previous) - , ("y", io $ return . fromRight =<< MPD.withMPD (MPD.play Nothing)) - , ("s", io $ return . fromRight =<< MPD.withMPD MPD.stop) - , ("r", io $ return . fromRight =<< MPD.withMPD Local.toggleRepeat) - , ("*", io $ return . fromRight =<< MPD.withMPD Local.toggleRandom) - , ("S-8", io $ return . fromRight =<< MPD.withMPD Local.toggleRandom) - , ("<Space>", io $ return . fromRight =<< MPD.withMPD MPD.toggle) + | (k, a) <- [ ("n", io $ liftM fromRight (MPD.withMPD MPD.next)) + , ("p", io $ liftM fromRight (MPD.withMPD MPD.previous)) + , ("S-.", io $ liftM fromRight (MPD.withMPD MPD.next)) + , ("S-,", io $ liftM fromRight (MPD.withMPD MPD.previous)) + , ("y", io $ liftM fromRight (MPD.withMPD (MPD.play Nothing))) + , ("s", io $ liftM fromRight (MPD.withMPD MPD.stop)) + , ("r", io $ liftM fromRight (MPD.withMPD Local.toggleRepeat)) + , ("*", io $ liftM fromRight (MPD.withMPD Local.toggleRandom)) + , ("S-8", io $ liftM fromRight (MPD.withMPD Local.toggleRandom)) + , ("<Space>", io $ liftM fromRight (MPD.withMPD MPD.toggle)) ] ]) , ("<Print>", spawn "mate-screenshot") @@ -213,10 +222,8 @@ genericKeys conf = [ -- MPD -- mov current playing song in mpd to thrash , ("<Delete>", spawn "mpcrm") - , ("<XF86Forward>", - io $ return . fromRight =<< MPD.withMPD MPD.next) - , ("<XF86Back>", - io $ return . fromRight =<< MPD.withMPD MPD.previous) + , ("<XF86Forward>", io $ liftM fromRight (MPD.withMPD MPD.next)) + , ("<XF86Back>", io $ liftM fromRight (MPD.withMPD MPD.previous)) ] @@ -248,10 +255,10 @@ unprefixedKeys = [ , ("<XF86HomePage>", TS.switchTopic topicConfig "web") -- mpc - , ("<XF86AudioPlay>", io $ return . fromRight =<< MPD.withMPD MPD.toggle) - , ("<XF86AudioStop>", io $ return . fromRight =<< MPD.withMPD MPD.stop) - , ("<XF86AudioNext>", io $ return . fromRight =<< MPD.withMPD MPD.next) - , ("<XF86AudioPrev>", io $ return . fromRight =<< MPD.withMPD MPD.previous) + , ("<XF86AudioPlay>", io $ liftM fromRight (MPD.withMPD MPD.toggle)) + , ("<XF86AudioStop>", io $ liftM fromRight (MPD.withMPD MPD.stop)) + , ("<XF86AudioNext>", io $ liftM fromRight (MPD.withMPD MPD.next)) + , ("<XF86AudioPrev>", io $ liftM fromRight (MPD.withMPD MPD.previous)) -- volume , ("<XF86AudioMute>", void toggleMute) diff --git a/src/XMonad/Local/ManageHook.hs b/src/XMonad/Local/ManageHook.hs index 3c46d28..365c527 100644 --- a/src/XMonad/Local/ManageHook.hs +++ b/src/XMonad/Local/ManageHook.hs @@ -36,7 +36,8 @@ manageHook = composeOne (concat -?> doMaster <+> doCenterFloat] , [className =? c -?> doMaster <+> doFloat | c <- myCFloats ] , [title =? t -?> doMaster <+> doFloat | t <- myTFloats ] - , [ className =? "BaldursGate" -?> doMyShift "BG" <+> doMaster] + , [className =? "BaldursGate" -?> doMyShift "BG" <+> doMaster] + , [className =? "witcher.exe" -?> doMyShift "witcher" <+> doMaster] , [NS.query c -?> hook c | c <- namedScratchpads]]) --, [className =? "dzen" -?> transparency 0.4]]) <+> diff --git a/src/XMonad/Local/TopicSpace.hs b/src/XMonad/Local/TopicSpace.hs index 43683b5..d842591 100644 --- a/src/XMonad/Local/TopicSpace.hs +++ b/src/XMonad/Local/TopicSpace.hs @@ -41,7 +41,7 @@ topicDirs = M.fromList $ ] ++ map (\w -> (w, "~")) [ "music", "p2p", "gimp", "graphics" , "web", "remote", "earth", "bank", "admin", "ebook" - , "ciV", "scrum", "BG", "calendar"] + , "ciV", "scrum", "BG", "witcher", "calendar"] topicConfig :: TS.TopicConfig topicConfig = TS.defaultTopicConfig @@ -94,6 +94,7 @@ topicConfig = TS.defaultTopicConfig , ("scrum", spawn "firefox https://bluejeans.com/3046463974/") , ("BG", spawn "steam steam://rungameid/228280" >> spawn "firefox http://slovnik.seznam.cz/de-cz/") + , ("witcher", spawn "wine C:\\windows\\command\\start.exe steam://rungameid/20900") , ("calendar", spawn "california") ] ++ map (\w -> (w, spawnShell Nothing >> spawnShell Nothing)) [ "ae", "aet", "aes", "aea" ] diff --git a/xminad.cabal b/xminad.cabal index 2ef2783..ad015c6 100644 --- a/xminad.cabal +++ b/xminad.cabal @@ -78,6 +78,7 @@ Library , MissingH >=1.2 && <1.4 , regex-compat >=0.90 && <1.0 , regex-posix >=0.90 && <1.0 + , unix >=2.0 && <3.0 , utf8-string >=0.3 && <1.1 , xmonad >=0.11 && <0.12 , xmonad-contrib >=0.11 && <0.12 |