summaryrefslogtreecommitdiffstats
path: root/lass/5pkgs/xephyrify/default.nix
blob: 8b18ea949f14eb4fa24096b546fcee3dbf4f577e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{ writeDashBin, writeHaskell, coreutils, xorg, virtualgl, ... }:

let

  minimalXmonad = writeHaskell "minimalXmonad" {
    executables.xmonad = {
      extra-depends = [
        "containers"
        "xmonad"
      ];
      text = /* haskell */ ''
        module Main where
        import XMonad
        import qualified Data.Map as Map

        main :: IO ()
        main = do
          xmonad def
            { workspaces = [ "1" ]
            , layoutHook = myLayoutHook
            , keys = myKeys
            , normalBorderColor  = "#000000"
            , focusedBorderColor = "#000000"
            }

        myLayoutHook = Full
        myKeys _ = Map.fromList []
      '';
    };
  };

in writeDashBin "xephyrify" ''
  NDISPLAY=:$(${coreutils}/bin/shuf -i 100-65536 -n 1)
  echo "using DISPLAY $NDISPLAY"
  ${xorg.xorgserver}/bin/Xephyr -br -ac -reset -terminate -resizeable $NDISPLAY &
  XEPHYR_PID=$!
  DISPLAY=$NDISPLAY ${minimalXmonad}/bin/xmonad &
  XMONAD_PID=$!
  DISPLAY=$NDISPLAY ${virtualgl}/bin/vglrun "$@"
  kill $XMONAD_PID
  kill $XEPHYR_PID
''