1{ config, lib, pkgs, options, modulesPath, ... }:
2
3with lib;
4let
5 inherit (lib) mkOption mkIf singleton;
6 cfg = config.services.xserver.windowManager.wmii;
7 wmii = pkgs.wmii_hg;
8in
9{
10 options = {
11 services.xserver.windowManager.wmii.enable = mkEnableOption "wmii";
12 };
13
14 config = mkIf cfg.enable {
15 services.xserver.windowManager.session = singleton
16 # stop wmii by
17 # $wmiir xwrite /ctl quit
18 # this will cause wmii exiting with exit code 0
19 # (or "mod+a quit", which is bound to do the same thing in wmiirc
20 # by default)
21 #
22 # why this loop?
23 # wmii crashes once a month here. That doesn't matter that much
24 # wmii can recover very well. However without loop the X session
25 # terminates and then your workspace setup is lost and all
26 # applications running on X will terminate.
27 # Another use case is kill -9 wmii; after rotating screen.
28 # Note: we don't like kill for that purpose. But it works (->
29 # subject "wmii and xrandr" on mailinglist)
30 { name = "wmii";
31 start = ''
32 while :; do
33 ${wmii}/bin/wmii && break
34 done
35 '';
36 };
37
38 environment.systemPackages = [ wmii ];
39 };
40}