Add DMS plugins for rbw lock and wvkbd toggle

- Introduced new DMS plugins: `rbw-lock-toggle` for managing Bitwarden vault state and `wvkbd-toggle` for showing/hiding the on-screen keyboard.
- Updated `flake.lock` and `flake.nix` to include the new plugins and their configurations.
- Removed legacy options and files related to the rbw lock toggle, streamlining the DMS configuration.
- Enhanced the home-manager module to support the new plugins and their integration into the DMS environment.
This commit is contained in:
2026-06-22 12:26:25 -03:00
parent 662d24a89c
commit 1524100ff5
16 changed files with 155 additions and 305 deletions
@@ -14,14 +14,6 @@
discordEnabled = lib.attrByPath [ "chiasson" "home" "apps" "discord" "enable" ] false config;
ohMyPoshEnabled = config.programs.oh-my-posh.enable or false;
obsidianSnippetDirs = map (v: v + "/snippets") (dmsOs.obsidianVaults or [ ]);
seedBarWidgets =
lib.optionals (dmsOs.enableWvkbdToggle or false) [
{ id = "wvkbdToggle"; enabled = true; }
]
++ lib.optionals (dmsOs.enableRbwLockToggle or false) [
{ id = "rbwLockToggle"; enabled = true; }
]
++ (dmsOs.extraRightBarWidgets or [ ]);
matugenOutputDirs =
lib.optionals hyprlandEnabled [ "${home}/.config/hypr" ]
++ lib.optionals ohMyPoshEnabled [ "${home}/.config/oh-my-posh" ]
@@ -30,10 +22,9 @@
"${home}/.config/qt6ct/colors"
"${home}/.config/qt5ct/colors"
];
ensureMatugenOutputDirsScript = pkgs.writeShellScript "dms-ensure-matugen-output-dirs" ''
set -euo pipefail
${lib.concatStringsSep "\n" (map (dir: "mkdir -p ${lib.escapeShellArg dir}") matugenOutputDirs)}
${lib.concatStringsSep "\n" (map (dir: ''
ensureMatugenBody =
lib.concatStringsSep "\n" (map (dir: "mkdir -p ${lib.escapeShellArg dir}") matugenOutputDirs)
+ lib.concatStringsSep "\n" (map (dir: ''
snippetDir=${lib.escapeShellArg dir}
parentDir="$(dirname "$snippetDir")"
if [ -d "$snippetDir" ]; then
@@ -43,8 +34,8 @@
else
mkdir -p "$snippetDir"
fi
'') obsidianSnippetDirs)}
${lib.optionalString ohMyPoshEnabled ''
'') obsidianSnippetDirs)
+ lib.optionalString ohMyPoshEnabled ''
dest="$HOME/.config/oh-my-posh/theme.omp.json"
template="$HOME/.config/matugen/templates/ohmyposh-theme.omp.json"
if [ -L "$dest" ] || { [ -e "$dest" ] && ! [ -f "$dest" ]; }; then
@@ -53,19 +44,21 @@
if [ ! -f "$dest" ]; then
cp -L "$template" "$dest"
fi
''}
'';
ensureMatugenOutputDirsScript = pkgs.writeShellScript "dms-ensure-matugen-output-dirs" ''
set -euo pipefail
${ensureMatugenBody}
'';
# Clears Quickshell QML bytecode cache so bar plugins reload (stale *.qmlc keeps old UI).
dmsRestartOnceScript = pkgs.writeShellScript "dms-rbw-plugin-restart-once" ''
set -euo pipefail
rt="''${XDG_RUNTIME_DIR:-/run/user/$(id -u)}"
exec 9>"$rt/dms-rbw-plugin-restart.lock"
${pkgs.util-linux}/bin/flock -n 9 || exit 0
cache="''${XDG_CACHE_HOME:-''$HOME/.cache}/quickshell/qmlcache"
rm -rf "$cache"
${pkgs.systemd}/bin/systemctl --user try-restart dms.service 2>/dev/null || true
'';
dmsRestartOnceScript = pkgs.writeShellScript "dms-plugin-restart-once" (
builtins.replaceStrings
[ "@FLOCK@" "@SYSTEMCTL@" ]
[
"${pkgs.util-linux}/bin/flock"
"${pkgs.systemd}/bin/systemctl"
]
(builtins.readFile ./scripts/dms-restart-once.sh)
);
jsonFormat = pkgs.formats.json { };
dmsConfigDir = "${config.xdg.configHome}/DankMaterialShell";
@@ -84,11 +77,45 @@
"settings.json" = jsonFormat.generate "dms-settings-seed.json" (
import ../_private/default-settings.nix {
inherit lib gpuTempEnabled;
extraRightBarWidgets = seedBarWidgets;
extraRightBarWidgets = dmsOs.extraRightBarWidgets or [ ];
}
);
};
dmsSeedBody = lib.concatMapStringsSep "\n" (
fileName:
let
dest = "${dmsConfigDir}/${fileName}";
src = dmsSeedSources.${fileName};
in
''
dest=${lib.escapeShellArg dest}
mkdir -p "$(dirname "$dest")"
if [ -L "$dest" ]; then
${pkgs.coreutils}/bin/cp --remove-destination -L "$dest" "$dest"
fi
if [ ! -e "$dest" ]; then
${pkgs.coreutils}/bin/cp ${lib.escapeShellArg src} "$dest"
chmod u+w "$dest"
fi
''
) (lib.attrNames dmsSeedSources);
dmsSeedConfigScript = pkgs.writeShellScript "dms-seed-config" ''
set -euo pipefail
${dmsSeedBody}
'';
matugenConfigText = import ../_private/matugen-config.nix {
inherit
lib
home
hyprlandEnabled
ohMyPoshEnabled
discordEnabled
obsidianSnippetDirs
;
};
# Directory name must match each plugin's `id` in plugin.json.
thirdPartyPlugins = {
dankVault = inputs.dms-plugin-dank-vault;
@@ -107,6 +134,8 @@
wallpaperCarousel = inputs.dms-plugin-wallpaper-carousel;
ephemera = inputs.dms-plugin-ephemera;
appShortcut = inputs.dms-plugin-app-shortcut;
wvkbdToggle = inputs.dms-plugin-wvkbd-toggle;
rbwLockToggle = inputs.dms-plugin-rbw-lock-toggle;
};
shipThirdPartyPlugin =
@@ -123,29 +152,6 @@ in {
];
config = lib.mkIf dmsEnabled (lib.mkMerge [
(lib.mkIf (dmsOs.enableWvkbdToggle or false) {
xdg.configFile."DankMaterialShell/plugins/wvkbd-toggle/plugin.json".source =
../plugins/wvkbd-toggle/plugin.json;
xdg.configFile."DankMaterialShell/plugins/wvkbd-toggle/WvkbdToggle.qml".source =
../plugins/wvkbd-toggle/WvkbdToggle.qml;
xdg.configFile."DankMaterialShell/plugins/wvkbd-toggle/WvkbdToggleSettings.qml".source =
../plugins/wvkbd-toggle/WvkbdToggleSettings.qml;
})
(lib.mkIf (dmsOs.enableRbwLockToggle or false) {
# Directory name matches plugin id (same idea as NixMonitor / ideapad wvkbdToggle).
xdg.configFile."DankMaterialShell/plugins/rbwLockToggle/plugin.json" = {
source = ../plugins/rbw-lock-toggle/plugin.json;
onChange = "${dmsRestartOnceScript}";
};
xdg.configFile."DankMaterialShell/plugins/rbwLockToggle/RbwLockToggleSettings.qml" = {
source = ../plugins/rbw-lock-toggle/RbwLockToggleSettings.qml;
onChange = "${dmsRestartOnceScript}";
};
xdg.configFile."DankMaterialShell/plugins/rbwLockToggle/RbwLockToggle.qml" = {
source = ../plugins/rbw-lock-toggle/RbwLockToggle.qml;
onChange = "${dmsRestartOnceScript}";
};
})
(lib.mkIf (dmsOs.bundleThirdPartyPlugins or true) {
xdg.configFile =
lib.mapAttrs (id: src: shipThirdPartyPlugin id src) thirdPartyPlugins;
@@ -211,25 +217,7 @@ in {
};
# Detach store symlinks so UI edits survive rebuilds; seed defaults only on a fresh profile.
home.activation.dmsSeedConfig = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
${lib.concatMapStringsSep "\n" (
fileName:
let
dest = "${dmsConfigDir}/${fileName}";
src = dmsSeedSources.${fileName};
in ''
dest=${lib.escapeShellArg dest}
mkdir -p "$(dirname "$dest")"
if [ -L "$dest" ]; then
${pkgs.coreutils}/bin/cp --remove-destination -L "$dest" "$dest"
fi
if [ ! -e "$dest" ]; then
${pkgs.coreutils}/bin/cp ${lib.escapeShellArg src} "$dest"
chmod u+w "$dest"
fi
''
) (lib.attrNames dmsSeedSources)}
'';
home.activation.dmsSeedConfig = lib.hm.dag.entryAfter [ "writeBoundary" ] "${dmsSeedConfigScript}";
# matugen won't create missing output_path parents; run before DMS theme generation.
systemd.user.services.dms.serviceConfig.ExecStartPre =
@@ -238,38 +226,7 @@ in {
# DMS / matugen custom templates.
#
# DMS docs (custom templates): https://danklinux.com/docs/dankmaterialshell/application-themes#custom-matugen-templates
xdg.configFile."matugen/config.toml".text =
''
[config]
''
+ lib.optionalString hyprlandEnabled ''
[templates.hyprland]
input_path = '${home}/.config/matugen/templates/hyprland-colors.conf'
output_path = '${home}/.config/hypr/colors.conf'
''
+ lib.optionalString ohMyPoshEnabled ''
[templates.ohmyposh]
input_path = '${home}/.config/matugen/templates/ohmyposh-theme.omp.json'
output_path = '${home}/.config/oh-my-posh/theme.omp.json'
''
+ lib.optionalString discordEnabled ''
[templates.dank-discord]
input_path = '${home}/.config/matugen/templates/dank-discord.css'
output_path = '${home}/.config/vesktop/themes/dank-discord.css'
''
+ lib.optionalString (obsidianSnippetDirs != []) (
lib.concatStringsSep "\n" (
lib.lists.imap0 (i: snippetDir: ''
[templates.Obsidian${toString i}]
input_path = '${home}/.config/matugen/templates/obsidian-minimal-matugen-colors.css'
output_path = '${snippetDir}/matugen.css'
'') obsidianSnippetDirs
)
)
;
xdg.configFile."matugen/config.toml".text = matugenConfigText;
xdg.configFile."matugen/templates/dank-discord.css".source = ../templates/dank-discord.css;
xdg.configFile."matugen/templates/hyprland-colors.conf".source = ../templates/hyprland-colors.conf;
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
rt="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}"
exec 9>"$rt/dms-plugin-restart.lock"
@FLOCK@ -n 9 || exit 0
cache="${XDG_CACHE_HOME:-$HOME/.cache}/quickshell/qmlcache"
rm -rf "$cache"
@SYSTEMCTL@ --user try-restart dms.service 2>/dev/null || true