diff options
Diffstat (limited to 'lass/5pkgs')
-rw-r--r-- | lass/5pkgs/xmonad-lass.nix | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/lass/5pkgs/xmonad-lass.nix b/lass/5pkgs/xmonad-lass.nix index 86e69b10c..7d1f44fb7 100644 --- a/lass/5pkgs/xmonad-lass.nix +++ b/lass/5pkgs/xmonad-lass.nix @@ -9,7 +9,7 @@ pkgs.writeHaskell "xmonad-lass" { "xmonad-contrib" "xmonad-stockholm" ]; - text = '' + text = /* haskell */ '' {-# LANGUAGE DeriveDataTypeable #-} -- for XS {-# LANGUAGE FlexibleContexts #-} -- for xmonad' {-# LANGUAGE LambdaCase #-} @@ -24,6 +24,7 @@ import Control.Exception import Data.List (isInfixOf) import System.Environment (getArgs, withArgs, getEnv) import System.IO (hPutStrLn, stderr) +import System.Posix.Process (executeFile) import Text.Read (readEither) import XMonad.Actions.CopyWindow (copy, kill1) import XMonad.Actions.CycleWS (toggleWS) @@ -41,13 +42,13 @@ import XMonad.Layout.Minimize (minimize, minimizeWindow, MinimizeMsg(RestoreNext import XMonad.Layout.NoBorders (smartBorders) import XMonad.Prompt (autoComplete, searchPredicate, XPConfig) import XMonad.Prompt.Window (windowPromptGoto, windowPromptBringCopy) -import XMonad.Stockholm.Shutdown (sendShutdownEvent, handleShutdownEvent) import XMonad.Util.EZConfig (additionalKeysP) import XMonad.Layout.SimpleFloat (simpleFloat) +import XMonad.Stockholm.Shutdown -myTerm :: String -myTerm = "${pkgs.rxvt_unicode}/bin/urxvtc" +urxvtcPath :: FilePath +urxvtcPath = "${pkgs.rxvt_unicode}/bin/urxvtc" myFont :: String myFont = "-schumacher-*-*-*-*-*-*-*-*-*-*-*-iso10646-*" @@ -63,12 +64,14 @@ mainNoArgs = do xmonad' $ withUrgencyHook (SpawnUrgencyHook "echo emit Urgency ") $ def - { terminal = myTerm + { terminal = urxvtcPath , modMask = mod4Mask , workspaces = workspaces0 , layoutHook = smartBorders $ myLayoutHook , manageHook = placeHook (smart (1,0)) <+> floatNextHook - , startupHook = spawn "echo emit XMonadStartup" + , startupHook = do + path <- liftIO (getEnv "XMONAD_STARTUP_HOOK") + forkFile path [] Nothing , normalBorderColor = "#1c1c1c" , focusedBorderColor = "#f000b0" , handleEventHook = handleShutdownEvent @@ -84,7 +87,7 @@ xmonad' conf = do path <- getEnv "XMONAD_STATE" try (readFile path) >>= \case Right content -> do - hPutStrLn stderr ("resuming from " ++ path ++ "; state = " ++ show content) + hPutStrLn stderr ("resuming from " ++ path) withArgs ("--resume" : lines content) (xmonad conf) Left e -> do hPutStrLn stderr (displaySomeException e) @@ -124,8 +127,8 @@ myKeyMap = , ("M4-S-<Backspace>", removeEmptyWorkspace) , ("M4-S-c", kill1) , ("M4-<Esc>", toggleWS) - , ("M4-S-<Enter>", spawn myTerm) - , ("M4-x", floatNext True >> spawn myTerm) + , ("M4-S-<Enter>", spawn urxvtcPath) + , ("M4-x", floatNext True >> spawn urxvtcPath) , ("M4-f", floatNext True) , ("M4-b", sendMessage ToggleStruts) @@ -142,6 +145,10 @@ myKeyMap = , ("M4-S-q", return ()) ] +forkFile :: FilePath -> [String] -> Maybe [(String, String)] -> X () +forkFile path args env = + xfork (executeFile path False args env) >> return () + autoXPConfig :: XPConfig autoXPConfig = def { autoComplete = Just 5000 @@ -160,8 +167,6 @@ gridConfig = def , gs_navigate = navNSearch , gs_font = myFont } - ''; }; } - |