402 lines
12 KiB
Nix
402 lines
12 KiB
Nix
{
|
|
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 = {
|
|
"DankMaterialShell/stylix.json".source = with config.lib.stylix.colors.withHashtag;
|
|
lib.mkIf config.stylix.enable (
|
|
pkgs.writers.writeJSON "dms-stylix-theme.json" {
|
|
"name" = "Stylix";
|
|
"primary" = base0C;
|
|
"primaryText" = base00;
|
|
"primaryContainer" = base0D;
|
|
"secondary" = base0E;
|
|
"surface" = base00;
|
|
"surfaceText" = base05;
|
|
"surfaceVariant" = base01;
|
|
"surfaceVariantText" = base04;
|
|
"surfaceTint" = base0C;
|
|
"background" = base00;
|
|
"backgroundText" = base07;
|
|
"outline" = base03;
|
|
"surfaceContainer" = base01;
|
|
"surfaceContainerHigh" = base02;
|
|
"error" = base08;
|
|
"warning" = base0A;
|
|
"info" = base0D;
|
|
}
|
|
);
|
|
|
|
# niri = import ./niri.nix commonArgs;
|
|
"mimeapps.list".force = true;
|
|
};
|
|
xdg = {
|
|
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";
|
|
};
|
|
"Shift+XF86AudioMute" = {
|
|
allow-when-locked = true;
|
|
action = dms-ipc "audio" "micmute";
|
|
};
|
|
"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";};
|
|
|
|
"Print" = {action = dms-ipc "niri" "screenshot";};
|
|
"Ctrl+Print" = {action = dms-ipc "niri" "screenshotScreen";};
|
|
"Shift+Print" = {action = dms-ipc "niri" "screenshotWindow";};
|
|
|
|
"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;
|
|
}
|
|
];
|
|
};
|
|
};
|
|
}
|