home: autostart xdg implementation (plasma only)
TODO make this more generic
This commit is contained in:
parent
e12c843bb0
commit
94e19036c7
@ -2,5 +2,6 @@
|
|||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./hyprland
|
./hyprland
|
||||||
|
./plasma.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
35
home/sessions/plasma.nix
Normal file
35
home/sessions/plasma.nix
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
{ pkgs, config, lib, osConfig ? {}, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib) mkOption mkEnableOption;
|
||||||
|
cfg = config.nixfiles.sessions.plasma;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.nixfiles.sessions.plasma = {
|
||||||
|
enable = lib.mkOption {
|
||||||
|
description = "Whether to enable the Plasma session home configuration.";
|
||||||
|
type = with lib.types; bool;
|
||||||
|
default = osConfig.nixfiles.sessions.plasma.enable or false;
|
||||||
|
example = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
|
||||||
|
# TODO make this a generic implementation
|
||||||
|
home.packages = let
|
||||||
|
startupScript = pkgs.writeShellScript "autostart-script"
|
||||||
|
(lib.concatStringsSep "\n"
|
||||||
|
(builtins.map (x: "sh -c ${lib.escapeShellArg x} &") config.nixfiles.common.wm.autostart));
|
||||||
|
|
||||||
|
name = "home-manager-autostart";
|
||||||
|
desktopFilePkg = pkgs.makeDesktopItem {
|
||||||
|
inherit name;
|
||||||
|
desktopName = "Home Manager Autostart";
|
||||||
|
exec = startupScript;
|
||||||
|
};
|
||||||
|
autostartPkg = pkgs.runCommand name {} ''
|
||||||
|
mkdir -p $out/etc/xdg/autostart
|
||||||
|
ln -s "${desktopFilePkg}/share/applications/${name}.desktop" "$out/etc/xdg/autostart/"
|
||||||
|
'';
|
||||||
|
in [ autostartPkg ];
|
||||||
|
};
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user