add DankMaterialShell

This commit is contained in:
2025-11-29 15:44:07 +02:00
parent f6e1b7c8ea
commit b2286df218
9 changed files with 640 additions and 132 deletions

View File

@@ -2,6 +2,7 @@
imports = [
# ./common
./cosmic
./dms
./gnome
./hyprland
./niri

View File

@@ -0,0 +1,369 @@
{
config,
inputs,
lib,
perSystem,
pkgs,
...
}:
with lib; let
cfg = config.desktop.dms;
# inherit (config.lib.stylix) colors;
binds = {
suffixes,
prefixes,
substitutions ? {},
}: let
replacer = replaceStrings (attrNames substitutions) (attrValues substitutions);
format = prefix: suffix: let
actual-suffix =
if isList suffix.action
then {
action = head suffix.action;
args = tail suffix.action;
}
else {
inherit (suffix) action;
args = [];
};
action = replacer "${prefix.action}-${actual-suffix.action}";
in {
name = "${prefix.key}+${suffix.key}";
value.action.${action} = actual-suffix.args;
};
pairs = attrs: fn:
concatMap (
key:
fn {
inherit key;
action = attrs.${key};
}
) (attrNames attrs);
in
listToAttrs (pairs prefixes (prefix: pairs suffixes (suffix: [(format prefix suffix)])));
in {
imports = [
# inputs.niri.homeModules.niri
inputs.dankMaterialShell.homeModules.dankMaterialShell.default
inputs.dankMaterialShell.homeModules.dankMaterialShell.niri
];
options = {
desktop.dms.enable =
mkEnableOption "enable DankMaterialShell";
};
config = mkIf cfg.enable {
stylix.targets.gtk.enable = false;
stylix.targets.qt.enable = false;
# stylix.targets.niri.enable = false;
services = {
gnome-keyring = {
enable = true;
components = ["secrets"];
};
kanshi = import ../niri/services/kanshi;
udiskie = {
enable = true;
automount = false;
notify = true;
tray = "auto";
};
};
home.packages = with pkgs; [
# gui libadwaita apps
celluloid # mpv gui in libadwaita
gnome-text-editor
helvum # pipewire patchbay in rust
junction # app chooser
loupe # image viewer and editor in rust
nautilus # file manager
papers # pdf reader in rust
pwvucontrol # pipewire gui in rust
wdisplays # wlroots display configurator
];
gtk = {
enable = true;
theme = {
name = "adw-gtk3";
package = pkgs.adw-gtk3;
};
};
xdg = {
configFile = {
# niri = import ./niri.nix commonArgs;
"mimeapps.list".force = true;
};
mime.enable = true;
mimeApps = {
enable = true;
defaultApplications = let
file_manager = ["org.gnome.Nautilus.desktop"];
image_viewer = ["org.gnome.Loupe.desktop"];
pdf_reader = ["org.gnome.Papers.desktop"];
video_player = ["io.github.celluloid_player.Celluloid.desktop"];
web_browser = ["re.sonny.Junction.desktop"];
in {
"application/pdf" = pdf_reader;
"image/jpeg" = image_viewer;
"image/png" = image_viewer;
"inode/directory" = file_manager;
"text/html" = web_browser;
"video/mp4" = video_player;
"video/mpeg" = video_player;
"video/x-matroska" = video_player;
"video/x-mpeg" = video_player;
"x-scheme-handler/about" = web_browser;
"x-scheme-handler/http" = web_browser;
"x-scheme-handler/https" = web_browser;
"x-scheme-handler/unknown" = web_browser;
};
};
};
programs.dankMaterialShell = {
enable = true;
systemd.enable = true;
niri = {
enableKeybinds = false; # Automatic keybinding configuration
# enableSpawn = true; # Auto-start DMS with niri
};
};
programs.niri.settings = {
input = {
keyboard = {
xkb = {
layout = "us,ua";
variant = "colemak_dh_ortho,";
};
repeat-delay = 200;
repeat-rate = 50;
track-layout = "window";
};
mouse = {
accel-speed = 0.0;
accel-profile = "flat";
};
touchpad = {
tap = true;
dwt = true;
natural-scroll = true;
click-method = "clickfinger";
};
tablet.map-to-output = "eDP-1";
touch.map-to-output = "eDP-1";
};
animations.enable = false;
clipboard.disable-primary = true;
hotkey-overlay.skip-at-startup = true;
prefer-no-csd = true;
xwayland-satellite.path = lib.getExe perSystem.xwst.xwayland-satellite;
screenshot-path = "${config.xdg.userDirs.pictures}/screenshots/screenshot-%Y-%m-%d-%H-%M-%S.png";
layout = {
gaps = 3;
struts.left = 32;
struts.right = 32;
always-center-single-column = true;
center-focused-column = "on-overflow";
default-column-width.proportion = 2.0 / 3.0;
preset-column-widths = [
{proportion = 1.0 / 3.0;}
{proportion = 1.0 / 2.0;}
{proportion = 2.0 / 3.0;}
];
background-color = "transparent";
empty-workspace-above-first = true;
focus-ring.enable = false;
border = {
enable = true;
width = 1;
# active.color = "#${colors.base03}";
# inactive.color = "#${colors.base02}";
# urgent.color = "#${colors.base08}";
};
# };
shadow.enable = false;
# default-column-display = "tabbed";
tab-indicator = {
position = "top";
gaps-between-tabs = 10;
# hide-when-single-tab = true;
# place-within-column = true;
# active.color = "red";
};
};
binds = with config.lib.niri.actions; let
dms-ipc = spawn "dms" "ipc";
sh = spawn "sh" "-c";
in
lib.attrsets.mergeAttrsList [
{
"Mod+Shift+Slash" = {action = show-hotkey-overlay;};
"Mod+Tab" = {action = focus-workspace-previous;};
"Mod+C" = {action = center-column;};
"Mod+M" = lib.mkForce {action = maximize-column;};
"Mod+H" = {action = set-column-width "50%";};
"Mod+T" = {action = set-column-width "33%";};
"Mod+Shift+T" = {action = set-column-width "67%";};
# "Mod+V" = {action = toggle-column-tabbed-display;};
"Mod+G" = {action = switch-focus-between-floating-and-tiling;};
"Mod+Space" = {action = switch-layout "next";};
"Mod+Ctrl+Comma" = {action = consume-or-expel-window-left;};
"Mod+Ctrl+Period" = {action = consume-or-expel-window-right;};
"Mod+Ctrl+Q" = {action = close-window;};
"Mod+Ctrl+M" = {action = fullscreen-window;};
"Mod+Ctrl+G" = {action = toggle-window-floating;};
"Mod+Shift+M" = {action = maximize-window-to-edges;};
"Mod+Ctrl+Shift+M" = {action = toggle-windowed-fullscreen;};
"Mod+Minus".action = set-column-width "-10%";
"Mod+Equal" = {action = set-column-width "+10%";};
"Mod+Plus".action = set-column-width "+10%";
"Mod+Shift+Minus".action = set-window-height "-10%";
"Mod+Shift+Plus".action = set-window-height "+10%";
"Mod+D" = {
action = dms-ipc "spotlight" "toggle";
hotkey-overlay.title = "Toggle Application Launcher";
};
# "Mod+N" = {
# action = dms-ipc "notifications" "toggle";
# hotkey-overlay.title = "Toggle Notification Center";
# };
# "Mod+Comma" = {
# action = dms-ipc "settings" "toggle";
# hotkey-overlay.title = "Toggle Settings";
# };
# "Mod+P" = {
# action = dms-ipc "notepad" "toggle";
# hotkey-overlay.title = "Toggle Notepad";
# };
"Super+Ctrl+L" = {
action = dms-ipc "lock" "lock";
hotkey-overlay.title = "Toggle Lock Screen";
};
"Mod+Alt+Q" = {
action = dms-ipc "powermenu" "toggle";
hotkey-overlay.title = "Toggle Power Menu";
};
"XF86AudioRaiseVolume" = {
allow-when-locked = true;
action = dms-ipc "audio" "increment" "3";
};
"XF86AudioLowerVolume" = {
allow-when-locked = true;
action = dms-ipc "audio" "decrement" "3";
};
"XF86AudioMute" = {
allow-when-locked = true;
action = dms-ipc "audio" "mute";
};
"XF86AudioMicMute" = {
allow-when-locked = true;
action = dms-ipc "audio" "micmute";
};
"Mod+Alt+N" = {
allow-when-locked = true;
action = dms-ipc "night" "toggle";
hotkey-overlay.title = "Toggle Night Mode";
};
"Mod+V" = {
action = dms-ipc "clipboard" "toggle";
hotkey-overlay.title = "Toggle Clipboard Manager";
};
"XF86MonBrightnessUp" = {
allow-when-locked = true;
action = dms-ipc "brightness" "increment" "5" "";
};
"XF86MonBrightnessDown" = {
allow-when-locked = true;
action = dms-ipc "brightness" "decrement" "5" "";
};
"Mod+Return" = {action = sh "$TERMINAL";};
"Mod+Ctrl+Space" = {
repeat = false;
action = toggle-overview;
};
}
(binds {
suffixes."Left" = "column-left";
suffixes."Down" = "window-down";
suffixes."Up" = "window-up";
suffixes."Right" = "column-right";
prefixes."Mod" = "focus";
prefixes."Mod+Ctrl" = "move";
prefixes."Mod+Shift" = "focus-monitor";
prefixes."Mod+Shift+Ctrl" = "move-window-to-monitor";
substitutions."monitor-column" = "monitor";
substitutions."monitor-window" = "monitor";
})
# {
# "Mod+V".action = switch-focus-between-floating-and-tiling;
# "Mod+Shift+V".action = toggle-window-floating;
# }
(binds {
suffixes."Home" = "first";
suffixes."End" = "last";
prefixes."Mod" = "focus-column";
prefixes."Mod+Ctrl" = "move-column-to";
})
(binds {
suffixes."Down" = "workspace-down";
suffixes."Up" = "workspace-up";
prefixes."Mod" = "focus";
prefixes."Mod+Ctrl" = "move-window-to";
prefixes."Mod+Shift" = "move";
})
(binds {
suffixes = builtins.listToAttrs (
map (n: {
name = toString n;
value = [
"workspace"
(n + 1)
]; # workspace 1 is empty; workspace 2 is the logical first.
}) (range 1 9)
);
prefixes."Mod" = "focus";
prefixes."Mod+Ctrl" = "move-window-to";
})
];
window-rules = [
{
geometry-corner-radius = let
r = 12.0;
in {
top-left = r;
top-right = r;
bottom-left = r;
bottom-right = r;
};
clip-to-geometry = true;
}
];
};
};
}

View File

@@ -154,6 +154,7 @@ in {
screenshot-path "${xdgPics}/screenshots/screenshot-%Y-%m-%d-%H-%M-%S.png"
animations {
off
slowdown 0.5
}
@@ -187,16 +188,17 @@ in {
width 6
}
focus-ring {
off
width 1
active-color "#${colors.base0D}"
inactive-color "#${colors.base03}"
active-color "#${colors.base03}"
inactive-color "#${colors.base02}"
urgent-color "#${colors.base08}"
}
border {
off
// off
width 1
active-color "#${colors.base0D}"
inactive-color "#${colors.base03}"
active-color "#${colors.base03}"
inactive-color "#${colors.base02}"
urgent-color "#${colors.base08}"
}
}

View File

@@ -21,13 +21,25 @@ in {
margin-right = 36 + 3;
margin-bottom = 3;
modules-left = [
"custom/launcher"
"wlr/taskbar"
# "custom/launcher"
"niri/language"
"niri/workspaces"
# "wlr/taskbar"
];
modules-center = [
"clock"
];
modules-right = [
"niri/workspaces"
"clock"
"niri/language"
"privacy"
"network"
"cpu"
"memory"
"wireplumber"
"wireplumber#source"
(ifLaptop "group/laptop")
"tray"
"idle_inhibitor"
"custom/notification"
];
"niri/workspaces" = {
format = "{index}";
@@ -49,34 +61,12 @@ in {
tooltip = false;
};
"wlr/taskbar" = {
format = "{icon} {name}";
format = "{icon}";
icon-size = 16;
icon-theme = "${config.dconf.settings."org/gnome/desktop/interface".icon-theme}";
tooltip-format = "{title}";
on-click = "activate";
};
};
settings.top = {
position = "top";
height = 34;
spacing = 0;
margin-left = 36 + 3;
margin-right = 36 + 3;
margin-top = 3;
modules-left = [
"custom/notification"
"tray"
"privacy"
];
modules-right = [
"network"
"cpu"
"memory"
"wireplumber"
"wireplumber#source"
(ifLaptop "group/laptop")
"idle_inhibitor"
];
"group/laptop" = {
orientation = "inherit";
modules = [
@@ -248,10 +238,14 @@ in {
color: @base05;
border-radius: 12px;
}
window#waybar {
border: 1px solid @base01;
}
.modules-left,
.modules-center,
.modules-right {
margin: 1px;
padding-left: 3px;
} /* for leftmost modules */
@@ -309,6 +303,9 @@ in {
margin: 3px 3px 3px 0;
padding: 0 0.42em;
}
#clock {
background-color: @base00;
}
#backlight,
#battery,

View File

@@ -9,12 +9,13 @@
in {
options = {
module.desktop.displayManager = mkOption {
default = "greetd";
default = null;
type = types.enum [
"cosmic"
"gdm"
"greetd"
"sddm"
null
];
};
};

View File

@@ -2,6 +2,7 @@
imports = [
./common
./cosmic
./dms
./gnome
./hyprland
./niri

View File

@@ -0,0 +1,44 @@
{
config,
inputs,
lib,
perSystem,
pkgs,
...
}:
with lib; let
cfg = config.desktop.dms;
in {
imports = with inputs; [
dankMaterialShell.nixosModules.dankMaterialShell
dankMaterialShell.nixosModules.greeter
niri-flake.nixosModules.niri
];
options = {
desktop.dms.enable =
mkEnableOption "enable DankMaterialShell";
};
config = mkIf cfg.enable {
xdg.portal = {
enable = true;
extraPortals = with pkgs; [xdg-desktop-portal-gnome xdg-desktop-portal-gtk];
config.niri.default = ["gnome" "gtk"];
};
module.desktop.gnome-keyring.enable = true;
sound.pipewire.enable = true;
programs.niri = {
enable = true;
package = perSystem.niri.niri;
};
programs.dankMaterialShell = {
enable = true;
greeter = {
enable = true;
compositor.name = "niri";
};
};
};
}