From 662c2c6f9070a4f69d647f9a516fc537a7d01fa3 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 20 Feb 2021 13:08:12 +0100 Subject: =?UTF-8?q?tv=20xmonad:=20queryPrefix=20->=20(=3D=3F=3F)?= --- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tv/5pkgs/haskell/xmonad-tv/src') diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index e5a4473fe..177f313c5 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -60,9 +60,8 @@ main = getArgs >>= \case args -> hPutStrLn stderr ("bad arguments: " <> show args) >> exitFailure -queryPrefix :: Query String -> String -> Query Bool -queryPrefix query prefix = - fmap (Data.List.isPrefixOf prefix) query +(=??) :: Query a -> (a -> Bool) -> Query Bool +(=??) x p = fmap p x mainNoArgs :: IO () @@ -88,7 +87,7 @@ mainNoArgs = do , manageHook = composeAll [ appName =? "fzmenu-urxvt" --> doCenterFloat - , appName `queryPrefix` "pinentry" --> doCenterFloat + , appName =?? Data.List.isPrefixOf "pinentry" --> doCenterFloat , title =? "Upload to Imgur" --> doRectFloat (W.RationalRect 0 0 (1 % 8) (1 % 8)) , placeHook (smart (1,0)) -- cgit v1.2.3 From 009b9f735e9305d0e1c1e5678252b172f36fb449 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 28 Feb 2021 21:09:55 +0100 Subject: tv xmonad: doFloatCenter if appName ~ /Float/ --- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 1 + 1 file changed, 1 insertion(+) (limited to 'tv/5pkgs/haskell/xmonad-tv/src') diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index 177f313c5..c93a94735 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -88,6 +88,7 @@ mainNoArgs = do composeAll [ appName =? "fzmenu-urxvt" --> doCenterFloat , appName =?? Data.List.isPrefixOf "pinentry" --> doCenterFloat + , appName =?? Data.List.isInfixOf "Float" --> doCenterFloat , title =? "Upload to Imgur" --> doRectFloat (W.RationalRect 0 0 (1 % 8) (1 % 8)) , placeHook (smart (1,0)) -- cgit v1.2.3 From 1f7fabbd272581d10576f86e7d6b64570e05518e Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 28 Feb 2021 21:08:39 +0100 Subject: tv xmonad: add xdeny --- tv/5pkgs/haskell/xmonad-tv/src/Paths.hs | 3 +++ tv/5pkgs/haskell/xmonad-tv/src/main.hs | 13 +++++++++++++ 2 files changed, 16 insertions(+) (limited to 'tv/5pkgs/haskell/xmonad-tv/src') diff --git a/tv/5pkgs/haskell/xmonad-tv/src/Paths.hs b/tv/5pkgs/haskell/xmonad-tv/src/Paths.hs index b2ad01ae7..2569b60c3 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/Paths.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/Paths.hs @@ -32,3 +32,6 @@ xcalib = findExecutable "xcalib" xdpychvt :: FilePath xdpychvt = findExecutable "xdpychvt" + +xterm :: FilePath +xterm = findExecutable "xterm" diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index c93a94735..532f3ed16 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -218,6 +218,19 @@ myKeys conf = Map.fromList $ def { XMonad.Prompt.font = myFont } +xdeny :: X () +xdeny = + forkFile + Paths.xterm + [ "-fn", myFont + , "-geometry", "300x100" + , "-name", "AlertFloat" + , "-bg", "#E4002B" + , "-e", "sleep", "0.05" + ] + Nothing + + pagerConfig :: PagerConfig pagerConfig = def { pc_font = myFont -- cgit v1.2.3 From 7e158f1c533de5ddc3a3cf77d360338c60ee3724 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 28 Feb 2021 21:12:46 +0100 Subject: tv xmonad: no layout changes while focusing floats --- tv/5pkgs/haskell/xmonad-tv/src/XMonad/Extra.hs | 14 ++++++++++++++ tv/5pkgs/haskell/xmonad-tv/src/main.hs | 7 ++++--- 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 tv/5pkgs/haskell/xmonad-tv/src/XMonad/Extra.hs (limited to 'tv/5pkgs/haskell/xmonad-tv/src') diff --git a/tv/5pkgs/haskell/xmonad-tv/src/XMonad/Extra.hs b/tv/5pkgs/haskell/xmonad-tv/src/XMonad/Extra.hs new file mode 100644 index 000000000..74222712d --- /dev/null +++ b/tv/5pkgs/haskell/xmonad-tv/src/XMonad/Extra.hs @@ -0,0 +1,14 @@ +module XMonad.Extra where + +import XMonad +import qualified Data.Map as Map +import qualified XMonad.StackSet as W + + +isFloating :: Window -> WindowSet -> Bool +isFloating w = + Map.member w . W.floating + +isFloatingX :: Window -> X Bool +isFloatingX w = + isFloating w <$> gets windowset diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index 532f3ed16..48127a594 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -7,11 +7,12 @@ module Main (main) where import System.Exit (exitFailure) import Control.Exception -import Control.Monad.Extra (whenJustM) +import Control.Monad.Extra (ifM, whenJustM) import qualified Data.List import Graphics.X11.ExtraTypes.XF86 import Text.Read (readEither) import XMonad +import XMonad.Extra (isFloatingX) import System.IO (hPutStrLn, stderr) import System.Environment (getArgs, getEnv, getEnvironment, lookupEnv) import System.Posix.Process (executeFile) @@ -154,8 +155,8 @@ myKeys conf = Map.fromList $ , ((_S , xK_Menu ), gets windowset >>= allWorkspaceNames >>= pager pagerConfig (windows . W.shift) ) , ((_C , xK_Menu ), toggleWS) - , ((_4 , xK_space ), sendMessage NextLayout) - , ((_4M , xK_space ), resetLayout) + , ((_4 , xK_space ), withFocused $ \w -> ifM (isFloatingX w) xdeny $ sendMessage NextLayout) + , ((_4M , xK_space ), withFocused $ \w -> ifM (isFloatingX w) xdeny $ resetLayout) , ((_4 , xK_m ), windows W.focusMaster) , ((_4 , xK_j ), windows W.focusDown) -- cgit v1.2.3