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