mirror of
https://github.com/pjones/plasma-manager.git
synced 2024-09-11 15:56:02 +03:00
Add kscreenlocker module (#221)
This commit is contained in:
parent
0537704f79
commit
ef64e5da3b
@ -30,6 +30,7 @@ At the moment `plasma-manager` supports configuring the following:
|
||||
- Shortcuts (via the `shortcuts` module)
|
||||
- Hotkeys (via the `hotkeys` module)
|
||||
- Panels (via the `panels` module)
|
||||
- Screen locker (via the `kscreenlocker` module)
|
||||
- Fonts (via the `fonts` module)
|
||||
- KDE apps (via the `apps` module). In particular the following kde apps have
|
||||
modules in `plasma-manager`:
|
||||
|
30
lib/wallpapers.nix
Normal file
30
lib/wallpapers.nix
Normal file
@ -0,0 +1,30 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
wallpaperPictureOfTheDayType = with lib.types; submodule {
|
||||
options = {
|
||||
provider = lib.mkOption {
|
||||
type = nullOr (enum [ "apod" "bing" "flickr" "natgeo" "noaa" "wcpotd" "epod" "simonstalenhag" ]);
|
||||
description = "The provider for the Picture of the Day plugin.";
|
||||
};
|
||||
updateOverMeteredConnection = lib.mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Whether to update the wallpaper on a metered connection.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
wallpaperSlideShowType = with lib.types; submodule {
|
||||
options = {
|
||||
path = lib.mkOption {
|
||||
type = either path (listOf path);
|
||||
description = "The path(s) where the wallpapers are located.";
|
||||
};
|
||||
interval = lib.mkOption {
|
||||
type = int;
|
||||
default = 300;
|
||||
description = "The length between wallpaper switches.";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -2,17 +2,18 @@
|
||||
|
||||
{
|
||||
imports = [
|
||||
./apps
|
||||
./files.nix
|
||||
./fonts.nix
|
||||
./hotkeys.nix
|
||||
./kscreenlocker.nix
|
||||
./kwin.nix
|
||||
./panels.nix
|
||||
./shortcuts.nix
|
||||
./spectacle.nix
|
||||
./startup.nix
|
||||
./windows.nix
|
||||
./workspace.nix
|
||||
./kwin.nix
|
||||
./startup.nix
|
||||
./panels.nix
|
||||
./fonts.nix
|
||||
./apps
|
||||
];
|
||||
|
||||
options.programs.plasma.enable = lib.mkEnableOption ''
|
||||
|
71
modules/kscreenlocker.nix
Normal file
71
modules/kscreenlocker.nix
Normal file
@ -0,0 +1,71 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
cfg = config.programs.plasma;
|
||||
inherit (import ../lib/wallpapers.nix { inherit lib; }) wallpaperPictureOfTheDayType wallpaperSlideShowType;
|
||||
in
|
||||
{
|
||||
options.programs.plasma.kscreenlocker = {
|
||||
wallpaper = lib.mkOption {
|
||||
type = with lib.types; nullOr path;
|
||||
default = null;
|
||||
example = "${pkgs.kdePackages.plasma-workspace-wallpapers}/share/wallpapers/Kay/contents/images/1080x1920.png";
|
||||
description = ''
|
||||
The wallpaper for the lockscreen. Can be either be the path to an image file or a kpackage.
|
||||
'';
|
||||
};
|
||||
wallpaperPictureOfTheDay = lib.mkOption {
|
||||
type = lib.types.nullOr wallpaperPictureOfTheDayType;
|
||||
default = null;
|
||||
example = { provider = "apod"; };
|
||||
description = ''
|
||||
Allows you to set wallpaper using the picture of the day plugin. Needs the provider.
|
||||
'';
|
||||
};
|
||||
wallpaperSlideShow = lib.mkOption {
|
||||
type = lib.types.nullOr wallpaperSlideShowType;
|
||||
default = null;
|
||||
example = { path = "${pkgs.kdePackages.plasma-workspace-wallpapers}/share/wallpapers/"; };
|
||||
description = ''
|
||||
Allows you to set wallpaper using the slideshow plugin. Needs the path
|
||||
to at least one directory.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
assertions = [
|
||||
{
|
||||
assertion =
|
||||
let
|
||||
wallpapers = with cfg.workspace; [ wallpaperSlideShow wallpaper wallpaperPictureOfTheDay ];
|
||||
in
|
||||
lib.count (x: x != null) wallpapers <= 1;
|
||||
message = "Can set only one of wallpaper, wallpaperSlideShow and wallpaperPictureOfTheDay for kscreenlocker.";
|
||||
}
|
||||
];
|
||||
programs.plasma.configFile.kscreenlockerrc = (lib.mkMerge [
|
||||
(lib.mkIf (cfg.kscreenlocker.wallpaper != null) {
|
||||
Greeter.WallpaperPlugin = "org.kde.image";
|
||||
"Greeter/Wallpaper/org.kde.image/General".Image = cfg.kscreenlocker.wallpaper;
|
||||
})
|
||||
(lib.mkIf (cfg.kscreenlocker.wallpaperPictureOfTheDay != null) {
|
||||
Greeter.WallpaperPlugin = "org.kde.potd";
|
||||
"Greeter/Wallpaper/org.kde.potd/General" = {
|
||||
Provider = cfg.kscreenlocker.wallpaperPictureOfTheDay.provider;
|
||||
UpdateOverMeteredConnection = with cfg.kscreenlocker.wallpaperPictureOfTheDay;
|
||||
(lib.mkIf (updateOverMeteredConnection != null) (if updateOverMeteredConnection then 1 else 0));
|
||||
};
|
||||
})
|
||||
(lib.mkIf (cfg.kscreenlocker.wallpaperSlideShow != null) {
|
||||
Greeter.WallpaperPlugin = "org.kde.slideshow";
|
||||
"Greeter/Wallpaper/org.kde.slideshow/General" = {
|
||||
SlidePaths = with cfg.kscreenlocker.wallpaperSlideShow;
|
||||
(if ((builtins.isPath path) || (builtins.isString path)) then
|
||||
(builtins.toString cfg.kscreenlocker.wallpaperSlideShow.path) else
|
||||
(builtins.concatStringsSep "," cfg.kscreenlocker.wallpaperSlideShow.path));
|
||||
SlideInterval = cfg.kscreenlocker.wallpaperSlideShow.interval;
|
||||
};
|
||||
})
|
||||
]);
|
||||
};
|
||||
}
|
@ -167,9 +167,9 @@ in
|
||||
var desktop = allDesktops[desktopIndex];
|
||||
desktop.wallpaperPlugin = "org.kde.slideshow";
|
||||
desktop.currentConfigGroup = Array("Wallpaper", "org.kde.slideshow", "General");
|
||||
desktop.writeConfig("SlidePaths", ${if (builtins.isPath cfg.workspace.wallpaperSlideShow.path) then
|
||||
"\"" + cfg.workspace.wallpaperSlideShow.path + "\"" else
|
||||
"[" + (builtins.concatStringsSep "," (map (s: "\"" + s + "\"") cfg.workspace.wallpaperSlideShow.path)) + "]"});
|
||||
desktop.writeConfig("SlidePaths", ${with cfg.workspace.wallpaperSlideShow; if ((builtins.isPath path) || (builtins.isString path)) then
|
||||
"\"" + (builtins.toString path) + "\"" else
|
||||
"[" + (builtins.concatStringsSep "," (map (s: "\"" + s + "\"") path)) + "]"});
|
||||
desktop.writeConfig("SlideInterval", "${builtins.toString cfg.workspace.wallpaperSlideShow.interval}");
|
||||
}
|
||||
'' else "");
|
||||
|
@ -3,34 +3,7 @@
|
||||
|
||||
let
|
||||
cfg = config.programs.plasma;
|
||||
|
||||
wallpaperSlideShowType = with lib.types; submodule {
|
||||
options = {
|
||||
path = lib.mkOption {
|
||||
type = either path (listOf path);
|
||||
description = "The path(s) where the wallpapers are located.";
|
||||
};
|
||||
interval = lib.mkOption {
|
||||
type = int;
|
||||
default = 300;
|
||||
description = "The length between wallpaper switches.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
wallpaperPictureOfTheDayType = with lib.types; submodule {
|
||||
options = {
|
||||
provider = lib.mkOption {
|
||||
type = nullOr (enum [ "apod" "bing" "flickr" "natgeo" "noaa" "wcpotd" "epod" "simonstalenhag" ]);
|
||||
description = "The provider for the Picture of the Day plugin.";
|
||||
};
|
||||
updateOverMeteredConnection = lib.mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Whether to update the wallpaper on a metered connection.";
|
||||
};
|
||||
};
|
||||
};
|
||||
inherit (import ../lib/wallpapers.nix { inherit lib; }) wallpaperPictureOfTheDayType wallpaperSlideShowType;
|
||||
|
||||
cursorType = with lib.types; submodule {
|
||||
options = {
|
||||
@ -137,7 +110,7 @@ in
|
||||
wallpaperSlideShow = lib.mkOption {
|
||||
type = lib.types.nullOr wallpaperSlideShowType;
|
||||
default = null;
|
||||
example = "${pkgs.kdePackages.plasma-workspace-wallpapers}/share/wallpapers/";
|
||||
example = { path = "${pkgs.kdePackages.plasma-workspace-wallpapers}/share/wallpapers/"; };
|
||||
description = ''
|
||||
Allows you to set wallpaper slideshow. Needs a directory of your wallpapers and an interval length.
|
||||
'';
|
||||
|
Loading…
Reference in New Issue
Block a user