summaryrefslogtreecommitdiffstats
path: root/tv/5pkgs/simple
diff options
context:
space:
mode:
authornin <nineinchnade@gmail.com>2017-12-14 21:13:46 +0100
committernin <nineinchnade@gmail.com>2017-12-14 21:13:46 +0100
commit37771ad34e18e0657636c8d0eb5b7392e3b89ba6 (patch)
tree8abda683b425494d2a273fc42d7573499b97a657 /tv/5pkgs/simple
parent7ed6fd18bb99884889a76ad9f597193861f44dc9 (diff)
parent04f7ae22d6d0720d06f78c712eb9cd245cefce82 (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'tv/5pkgs/simple')
-rw-r--r--tv/5pkgs/simple/xmonad-tv/default.nix23
1 files changed, 7 insertions, 16 deletions
diff --git a/tv/5pkgs/simple/xmonad-tv/default.nix b/tv/5pkgs/simple/xmonad-tv/default.nix
index f73175bb1..94c70153d 100644
--- a/tv/5pkgs/simple/xmonad-tv/default.nix
+++ b/tv/5pkgs/simple/xmonad-tv/default.nix
@@ -3,6 +3,7 @@ pkgs.writeHaskell "xmonad-tv" {
executables.xmonad = {
extra-depends = [
"containers"
+ "extra"
"unix"
"X11"
"xmonad"
@@ -19,11 +20,12 @@ pkgs.writeHaskell "xmonad-tv" {
module Main where
import Control.Exception
+import Control.Monad.Extra (whenJustM)
import Graphics.X11.ExtraTypes.XF86
import Text.Read (readEither)
import XMonad
import System.IO (hPutStrLn, stderr)
-import System.Environment (getArgs, withArgs, getEnv, getEnvironment)
+import System.Environment (getArgs, withArgs, getEnv, getEnvironment, lookupEnv)
import System.Posix.Process (executeFile)
import XMonad.Actions.DynamicWorkspaces ( addWorkspacePrompt, renameWorkspace
, removeEmptyWorkspace)
@@ -69,7 +71,7 @@ main = getArgs >>= \case
mainNoArgs :: IO ()
mainNoArgs = do
workspaces0 <- getWorkspaces0
- xmonad'
+ xmonad
-- $ withUrgencyHookC dzenUrgencyHook { args = ["-bg", "magenta", "-fg", "magenta", "-h", "2"], duration = 500000 }
-- urgencyConfig { remindWhen = Every 1 }
-- $ withUrgencyHook borderUrgencyHook "magenta"
@@ -84,26 +86,15 @@ mainNoArgs = do
-- , handleEventHook = myHandleEventHooks <+> handleTimerEvent
--, handleEventHook = handleTimerEvent
, manageHook = placeHook (smart (1,0)) <+> floatNextHook
- , startupHook = do
- path <- liftIO (getEnv "XMONAD_STARTUP_HOOK")
- forkFile path [] Nothing
+ , startupHook =
+ whenJustM (liftIO (lookupEnv "XMONAD_STARTUP_HOOK"))
+ (\path -> forkFile path [] Nothing)
, normalBorderColor = "#1c1c1c"
, focusedBorderColor = "#f000b0"
, handleEventHook = handleShutdownEvent
}
-xmonad' :: (LayoutClass l Window, Read (l Window)) => XConfig l -> IO ()
-xmonad' conf = do
- path <- getEnv "XMONAD_STATE"
- try (readFile path) >>= \case
- Right content -> do
- hPutStrLn stderr ("resuming from " ++ path)
- withArgs ("--resume" : lines content) (xmonad conf)
- Left e -> do
- hPutStrLn stderr (displaySomeException e)
- xmonad conf
-
getWorkspaces0 :: IO [String]
getWorkspaces0 =
try (getEnv "XMONAD_WORKSPACES0_FILE") >>= \case