2016-10-23 09:45:30 +00:00
|
|
|
# Global configuration for oblogout.
|
|
|
|
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let cfg = config.programs.oblogout;
|
|
|
|
|
|
|
|
in
|
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
programs.oblogout = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Whether to install OBLogout and create <filename>/etc/oblogout.conf</filename>.
|
|
|
|
See <filename>${pkgs.oblogout}/share/doc/README</filename>.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
opacity = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 70;
|
|
|
|
description = ''
|
2017-08-24 21:10:32 +00:00
|
|
|
Opacity percentage of Cairo rendered backgrounds.
|
2016-10-23 09:45:30 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
bgcolor = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "black";
|
|
|
|
description = ''
|
2017-08-24 21:10:32 +00:00
|
|
|
Colour name or hex code (#ffffff) of the background color.
|
2016-10-23 09:45:30 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
buttontheme = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "simplistic";
|
|
|
|
description = ''
|
2017-08-24 21:10:32 +00:00
|
|
|
Icon theme for the buttons, must be in the themes folder of
|
|
|
|
the package, or in
|
2017-08-25 12:08:11 +00:00
|
|
|
<filename>~/.themes/<name>/oblogout/</filename>.
|
2016-10-23 09:45:30 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
buttons = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "cancel, logout, restart, shutdown, suspend, hibernate";
|
|
|
|
description = ''
|
2017-08-24 21:10:32 +00:00
|
|
|
List and order of buttons to show.
|
2016-10-23 09:45:30 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
cancel = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "Escape";
|
|
|
|
description = ''
|
2017-08-24 21:10:32 +00:00
|
|
|
Cancel logout/shutdown shortcut.
|
2016-10-23 09:45:30 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
shutdown = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "S";
|
|
|
|
description = ''
|
2017-08-24 21:10:32 +00:00
|
|
|
Shutdown shortcut.
|
2016-10-23 09:45:30 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
restart = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "R";
|
|
|
|
description = ''
|
2017-08-24 21:10:32 +00:00
|
|
|
Restart shortcut.
|
2016-10-23 09:45:30 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
suspend = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "U";
|
|
|
|
description = ''
|
2017-08-24 21:10:32 +00:00
|
|
|
Suspend shortcut.
|
2016-10-23 09:45:30 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
logout = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "L";
|
|
|
|
description = ''
|
2017-08-24 21:10:32 +00:00
|
|
|
Logout shortcut.
|
2016-10-23 09:45:30 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
lock = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "K";
|
|
|
|
description = ''
|
2017-08-24 21:10:32 +00:00
|
|
|
Lock session shortcut.
|
2016-10-23 09:45:30 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
hibernate = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "H";
|
|
|
|
description = ''
|
2017-08-24 21:10:32 +00:00
|
|
|
Hibernate shortcut.
|
2016-10-23 09:45:30 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
clogout = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "openbox --exit";
|
|
|
|
description = ''
|
2017-08-24 21:10:32 +00:00
|
|
|
Command to logout.
|
2016-10-23 09:45:30 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
clock = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "";
|
|
|
|
description = ''
|
2017-08-24 21:10:32 +00:00
|
|
|
Command to lock screen.
|
2016-10-23 09:45:30 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
cswitchuser = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "";
|
|
|
|
description = ''
|
2017-08-24 21:10:32 +00:00
|
|
|
Command to switch user.
|
2016-10-23 09:45:30 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
environment.systemPackages = [ pkgs.oblogout ];
|
|
|
|
|
|
|
|
environment.etc."oblogout.conf".text = ''
|
|
|
|
[settings]
|
|
|
|
usehal = false
|
|
|
|
|
|
|
|
[looks]
|
|
|
|
opacity = ${toString cfg.opacity}
|
|
|
|
bgcolor = ${cfg.bgcolor}
|
|
|
|
buttontheme = ${cfg.buttontheme}
|
|
|
|
buttons = ${cfg.buttons}
|
|
|
|
|
|
|
|
[shortcuts]
|
|
|
|
cancel = ${cfg.cancel}
|
|
|
|
shutdown = ${cfg.shutdown}
|
|
|
|
restart = ${cfg.restart}
|
|
|
|
suspend = ${cfg.suspend}
|
|
|
|
logout = ${cfg.logout}
|
|
|
|
lock = ${cfg.lock}
|
|
|
|
hibernate = ${cfg.hibernate}
|
|
|
|
|
|
|
|
[commands]
|
|
|
|
shutdown = systemctl poweroff
|
|
|
|
restart = systemctl reboot
|
|
|
|
suspend = systemctl suspend
|
|
|
|
hibernate = systemctl hibernate
|
|
|
|
logout = ${cfg.clogout}
|
|
|
|
lock = ${cfg.clock}
|
|
|
|
switchuser = ${cfg.cswitchuser}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|