1# Global configuration for oblogout.
2
3{ config, lib, pkgs, ... }:
4
5with lib;
6
7let cfg = config.programs.oblogout;
8
9in
10{
11 ###### interface
12
13 options = {
14
15 programs.oblogout = {
16
17 enable = mkOption {
18 type = types.bool;
19 default = false;
20 description = ''
21 Whether to install OBLogout and create <filename>/etc/oblogout.conf</filename>.
22 See <filename>${pkgs.oblogout}/share/doc/README</filename>.
23 '';
24 };
25
26 opacity = mkOption {
27 type = types.int;
28 default = 70;
29 description = ''
30 Opacity percentage of Cairo rendered backgrounds.
31 '';
32 };
33
34 bgcolor = mkOption {
35 type = types.str;
36 default = "black";
37 description = ''
38 Colour name or hex code (#ffffff) of the background color.
39 '';
40 };
41
42 buttontheme = mkOption {
43 type = types.str;
44 default = "simplistic";
45 description = ''
46 Icon theme for the buttons, must be in the themes folder of
47 the package, or in
48 <filename>~/.themes/<name>/oblogout/</filename>.
49 '';
50 };
51
52 buttons = mkOption {
53 type = types.str;
54 default = "cancel, logout, restart, shutdown, suspend, hibernate";
55 description = ''
56 List and order of buttons to show.
57 '';
58 };
59
60 cancel = mkOption {
61 type = types.str;
62 default = "Escape";
63 description = ''
64 Cancel logout/shutdown shortcut.
65 '';
66 };
67
68 shutdown = mkOption {
69 type = types.str;
70 default = "S";
71 description = ''
72 Shutdown shortcut.
73 '';
74 };
75
76 restart = mkOption {
77 type = types.str;
78 default = "R";
79 description = ''
80 Restart shortcut.
81 '';
82 };
83
84 suspend = mkOption {
85 type = types.str;
86 default = "U";
87 description = ''
88 Suspend shortcut.
89 '';
90 };
91
92 logout = mkOption {
93 type = types.str;
94 default = "L";
95 description = ''
96 Logout shortcut.
97 '';
98 };
99
100 lock = mkOption {
101 type = types.str;
102 default = "K";
103 description = ''
104 Lock session shortcut.
105 '';
106 };
107
108 hibernate = mkOption {
109 type = types.str;
110 default = "H";
111 description = ''
112 Hibernate shortcut.
113 '';
114 };
115
116 clogout = mkOption {
117 type = types.str;
118 default = "openbox --exit";
119 description = ''
120 Command to logout.
121 '';
122 };
123
124 clock = mkOption {
125 type = types.str;
126 default = "";
127 description = ''
128 Command to lock screen.
129 '';
130 };
131
132 cswitchuser = mkOption {
133 type = types.str;
134 default = "";
135 description = ''
136 Command to switch user.
137 '';
138 };
139 };
140 };
141
142 ###### implementation
143
144 config = mkIf cfg.enable {
145 environment.systemPackages = [ pkgs.oblogout ];
146
147 environment.etc."oblogout.conf".text = ''
148 [settings]
149 usehal = false
150
151 [looks]
152 opacity = ${toString cfg.opacity}
153 bgcolor = ${cfg.bgcolor}
154 buttontheme = ${cfg.buttontheme}
155 buttons = ${cfg.buttons}
156
157 [shortcuts]
158 cancel = ${cfg.cancel}
159 shutdown = ${cfg.shutdown}
160 restart = ${cfg.restart}
161 suspend = ${cfg.suspend}
162 logout = ${cfg.logout}
163 lock = ${cfg.lock}
164 hibernate = ${cfg.hibernate}
165
166 [commands]
167 shutdown = systemctl poweroff
168 restart = systemctl reboot
169 suspend = systemctl suspend
170 hibernate = systemctl hibernate
171 logout = ${cfg.clogout}
172 lock = ${cfg.clock}
173 switchuser = ${cfg.cswitchuser}
174 '';
175 };
176}