stockholm/lass/5pkgs/xephyrify/default.nix

43 lines
1.0 KiB
Nix
Raw Normal View History

2018-03-06 20:30:05 +00:00
{ writeDashBin, writeHaskell, coreutils, xorg, virtualgl, ... }:
2018-03-03 17:28:05 +00:00
2018-03-06 20:30:05 +00:00
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" ''
2018-03-03 17:28:05 +00:00
NDISPLAY=:$(${coreutils}/bin/shuf -i 100-65536 -n 1)
2018-03-06 20:30:05 +00:00
echo "using DISPLAY $NDISPLAY"
2018-03-03 17:28:05 +00:00
${xorg.xorgserver}/bin/Xephyr -br -ac -reset -terminate -resizeable $NDISPLAY &
XEPHYR_PID=$!
2018-03-06 20:30:05 +00:00
DISPLAY=$NDISPLAY ${minimalXmonad}/bin/xmonad &
XMONAD_PID=$!
2018-03-03 17:28:05 +00:00
DISPLAY=$NDISPLAY ${virtualgl}/bin/vglrun "$@"
2018-03-06 20:30:05 +00:00
kill $XMONAD_PID
2018-03-03 17:28:05 +00:00
kill $XEPHYR_PID
''