1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-30 00:12:50 -05:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Lucas
e573bdba92 nix: add QML dependencies to dms-shell package (#967) 2025-12-11 09:19:43 +01:00
Lucas
d8cd15d361 nix: add plugins in NixOS module (#970)
* nix: remove unnecessary /etc/xdg/quickshell/dms and .config/quickshell/dms

* nix: add plugins in NixOS module
2025-12-11 09:03:22 +01:00
Lucas
1db3907838 nix: fix greeter per-monitor and per-mode wallpapers (#974) 2025-12-11 09:01:14 +01:00
6 changed files with 89 additions and 30 deletions

View File

@@ -9,8 +9,6 @@ let
cfg = config.programs.dankMaterialShell;
in
{
qmlPath = "${dmsPkgs.dms-shell}/share/quickshell/dms";
packages = [
dmsPkgs.dms-shell
]
@@ -25,6 +23,9 @@ in
]
++ lib.optional cfg.enableDynamicTheming pkgs.matugen
++ lib.optional cfg.enableAudioWavelength pkgs.cava
++ lib.optional cfg.enableCalendarEvents pkgs.khal
++ lib.optional cfg.enableSystemSound pkgs.kdePackages.qtmultimedia;
++ lib.optional cfg.enableCalendarEvents pkgs.khal;
plugins = lib.mapAttrs (name: plugin: {
source = plugin.src;
}) (lib.filterAttrs (n: v: v.enable) cfg.plugins);
}

View File

@@ -139,10 +139,32 @@ in
)}
if [ -f session.json ]; then
if cp "$(${jq} -r '.wallpaperPath' session.json)" wallpaper.jpg; then
mv session.json session.orig.json
${jq} '.wallpaperPath = "${cacheDir}/wallpaper.jpg"' session.orig.json > session.json
fi
copy_wallpaper() {
local path=$(${jq} -r ".$1 // empty" session.json)
if [ -f "$path" ]; then
cp "$path" "$2"
${jq} ".$1 = \"${cacheDir}/$2\"" session.json > session.tmp
mv session.tmp session.json
fi
}
copy_monitor_wallpapers() {
${jq} -r ".$1 // {} | to_entries[] | .key + \":\" + .value" session.json 2>/dev/null | while IFS=: read monitor path; do
local dest="$2-$(echo "$monitor" | tr -c '[:alnum:]' '-')"
if [ -f "$path" ]; then
cp "$path" "$dest"
${jq} --arg m "$monitor" --arg p "${cacheDir}/$dest" ".$1[\$m] = \$p" session.json > session.tmp
mv session.tmp session.json
fi
done
}
copy_wallpaper "wallpaperPath" "wallpaper"
copy_wallpaper "wallpaperPathLight" "wallpaper-light"
copy_wallpaper "wallpaperPathDark" "wallpaper-dark"
copy_monitor_wallpapers "monitorWallpapers" "wallpaper-monitor"
copy_monitor_wallpapers "monitorWallpapersLight" "wallpaper-monitor-light"
copy_monitor_wallpapers "monitorWallpapersDark" "wallpaper-monitor-dark"
fi
if [ -f settings.json ]; then

View File

@@ -48,7 +48,6 @@ in
plugins = lib.mkOption {
type = attrsOf (
types.submodule (
{ config, ... }:
{
options = {
enable = lib.mkOption {
@@ -73,8 +72,6 @@ in
programs.quickshell = {
enable = true;
inherit (cfg.quickshell) package;
configs.dms = common.qmlPath;
};
systemd.user.services.dms = lib.mkIf cfg.systemd.enable {
@@ -82,7 +79,6 @@ in
Description = "DankMaterialShell";
PartOf = [ config.wayland.systemd.target ];
After = [ config.wayland.systemd.target ];
X-Restart-Triggers = lib.optional cfg.systemd.restartIfChanged common.qmlPath;
};
Service = {

View File

@@ -22,8 +22,6 @@ in
];
config = lib.mkIf cfg.enable {
environment.etc."xdg/quickshell/dms".source = "${dmsPkgs.dms-shell}/share/quickshell/dms";
systemd.user.services.dms = lib.mkIf cfg.systemd.enable {
description = "DankMaterialShell";
path = lib.mkForce [ ];
@@ -31,7 +29,7 @@ in
partOf = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
wantedBy = [ "graphical-session.target" ];
restartTriggers = lib.optional cfg.systemd.restartIfChanged common.qmlPath;
restartIfChanged = cfg.systemd.restartIfChanged;
serviceConfig = {
ExecStart = lib.getExe dmsPkgs.dms-shell + " run --session";

View File

@@ -16,6 +16,9 @@ in
imports = [
(lib.mkRemovedOptionModule (path ++ [ "enableBrightnessControl" ]) builtInRemovedMsg)
(lib.mkRemovedOptionModule (path ++ [ "enableColorPicker" ]) builtInRemovedMsg)
(lib.mkRemovedOptionModule (
path ++ [ "enableSystemSound" ]
) "qtmultimedia is now included on dms-shell package.")
];
options.programs.dankMaterialShell = {
@@ -58,15 +61,46 @@ in
default = true;
description = "Add calendar events support via khal";
};
enableSystemSound = lib.mkOption {
type = types.bool;
default = true;
description = "Add needed dependencies to have system sound support";
};
quickshell = {
package = lib.mkPackageOption dmsPkgs "quickshell" {
extraDescription = "The quickshell package to use (defaults to be built from source, in the commit 26531f due to unreleased features used by DMS).";
};
};
plugins = lib.mkOption {
type = types.attrsOf (
types.submodule {
options = {
enable = lib.mkOption {
type = types.bool;
default = true;
description = "Whether to enable this plugin";
};
src = lib.mkOption {
type = types.package;
description = "Source of the plugin package or path";
};
};
}
);
default = { };
description = "DMS Plugins to install and enable";
example = lib.literalExpression ''
{
DockerManager = {
src = pkgs.fetchFromGitHub {
owner = "LuckShiba";
repo = "DmsDockerManager";
rev = "v1.2.0";
sha256 = "sha256-VoJCaygWnKpv0s0pqTOmzZnPM922qPDMHk4EPcgVnaU=";
};
};
AnotherPlugin = {
enable = true;
src = pkgs.another-plugin;
};
}
'';
};
};
}

View File

@@ -40,6 +40,16 @@
(import path (args // { dmsPkgs = buildDmsPkgs pkgs; }))
];
};
mkQmlImportPath =
pkgs: qmlPkgs:
pkgs.lib.concatStringsSep ":" (map (o: "${o}/${pkgs.qt6.qtbase.qtQmlPrefix}") qmlPkgs);
qmlPkgs =
pkgs: with pkgs.kdePackages; [
kirigami.unwrapped
sonnet
qtmultimedia
];
in
{
packages = forEachSystem (
@@ -96,7 +106,9 @@
install -D ${rootSrc}/core/assets/danklogo.svg \
$out/share/hicolor/scalable/apps/danklogo.svg
wrapProgram $out/bin/dms --add-flags "-c $out/share/quickshell/dms"
wrapProgram $out/bin/dms \
--add-flags "-c $out/share/quickshell/dms" \
--prefix "NIXPKGS_QT6_QML_IMPORT_PATH" ":" "${mkQmlImportPath pkgs (qmlPkgs pkgs)}"
install -Dm644 ${rootSrc}/assets/systemd/dms.service \
$out/lib/systemd/user/dms.service
@@ -143,15 +155,11 @@
devShells = forEachSystem (
system: pkgs:
let
qmlPkgs = [
devQmlPkgs = [
quickshell.packages.${system}.default
pkgs.kdePackages.qtdeclarative
]
++ (with pkgs.kdePackages; [
qtdeclarative
kirigami.unwrapped
sonnet
qtmultimedia
]);
++ (qmlPkgs pkgs);
in
{
default = pkgs.mkShell {
@@ -164,13 +172,13 @@
go-tools
gnumake
]
++ qmlPkgs;
++ devQmlPkgs;
shellHook = ''
touch quickshell/.qmlls.ini 2>/dev/null
'';
QML2_IMPORT_PATH = pkgs.lib.concatStringsSep ":" (map (o: "${o}/lib/qt-6/qml") qmlPkgs);
QML2_IMPORT_PATH = mkQmlImportPath pkgs devQmlPkgs;
};
}
);