1769288238

This commit is contained in:
2026-01-24 22:57:18 +02:00
parent fa32ae5510
commit 84020b1572
94 changed files with 1428 additions and 1024 deletions

View File

@@ -0,0 +1,10 @@
{
dconf.settings = {
"org/gnome/desktop/wm/preferences" = {
button-layout = "icon:minimize,maximize,close";
};
# "org/gnome/desktop/interface" = {
# icon-theme = config.gtk.iconTheme.name;
# };
};
}

View File

@@ -0,0 +1,15 @@
{
lib,
importWithArgs,
...
}:
lib.mkMerge [
(import ./dconf.nix)
(importWithArgs ./mimeapps.nix)
(importWithArgs ./packages.nix)
# (importWithArgs ./programs/niri.nix)
# (import ./programs/satty.nix)
(importWithArgs ./programs/wl-kbptr.nix)
(importWithArgs ./services.nix)
(importWithArgs ./stylix.nix)
]

View File

@@ -0,0 +1,54 @@
{
# config,
# lib,
pkgs,
...
}: {
home.packages = with pkgs; [
browsers # app chooser in rust (and without bugs)
celluloid # mpv gui in libadwaita
file-roller # archive manager
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
];
xdg = {
configFile."mimeapps.list".force = true;
mime.enable = true;
mimeApps = {
enable = true;
defaultApplications = let
archive_manager = ["org.gnome.FileRoller.desktop"];
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 = ["software.Browsers.desktop"];
in {
# TODO: add text/ mimetypes for gnome-editor
"application/pdf" = pdf_reader;
"application/vnd.rar" = archive_manager;
"application/x-7z-compressed" = archive_manager;
"application/x-bzip2-compressed-tar" = archive_manager;
"application/x-compressed-tar" = archive_manager;
"application/x-xz-compressed-tar" = archive_manager;
"application/zip" = archive_manager;
"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;
};
};
};
}

View File

@@ -0,0 +1,9 @@
{pkgs, ...}: {
home.packages = with pkgs; [
# gui libadwaita utilities
helvum # pipewire patchbay in rust
pwvucontrol # pipewire gui in rust
wdisplays # wlroots display configurator
wlrctl
];
}

View File

@@ -0,0 +1,7 @@
{
imports = [
# ./niri.nix
# ./satty.nix
./wl-kbptr.nix
];
}

View File

@@ -0,0 +1,423 @@
{
config,
lib,
pkgs,
perSystem,
...
}:
with lib; let
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 {
programs.niri.settings = {
environment = {
DMS_SCREENSHOT_EDITOR = "satty";
ELECTRON_OZONE_PLATFORM_HINT = "auto";
QT_QPA_PLATFORM = "wayland";
QT_QPA_PLATFORMTHEME = "gtk3";
QT_QPA_PLATFORMTHEME_QT6 = "gtk3";
XDG_CURRENT_DESKTOP = "niri";
};
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 = true;
animations.slowdown = 0.4;
clipboard.disable-primary = true;
hotkey-overlay.skip-at-startup = true;
prefer-no-csd = true;
xwayland-satellite.path = lib.getExe perSystem.xwst.xwayland-satellite;
overview.workspace-shadow.enable = false;
# TODO: enable when implemented in github:sodiboo/niri-flake
# recent-windows.highlight.corner-radius = 12;
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-display = "tabbed";
empty-workspace-above-first = true;
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";
border.enable = true;
border.width = 1;
focus-ring.enable = false;
shadow.enable = false;
tab-indicator = let
i = 4;
in {
position = "bottom";
gaps-between-tabs = i;
corner-radius = i;
width = i;
place-within-column = true;
# hide-when-single-tab = true;
# place-within-column = true;
};
};
binds = with config.lib.niri.actions; let
dms-ipc = spawn "dms" "ipc";
sh = spawn "sh" "-c";
focus = spawn "wlrctl" "window" "focus";
focus-meet = pkgs.writeShellApplication {
name = "focus-zen-google-meet";
runtimeInputs = with pkgs; [wlrctl jq gnugrep config.programs.niri.package];
text = ''
wlrctl window focus app_id:app.zen_browser.zen \
title:"$(niri msg --json windows \
| jq -r '.[].title' \
| grep -E 'Meet: "[a-zA-Z0-9-]+?"')"
'';
};
focus-equicord = pkgs.writeShellApplication {
name = "focus-equicord";
runtimeInputs = with pkgs; [wlrctl jq gnugrep config.programs.niri.package];
text = ''
wlrctl window focus app_id:equibop \
title:"$(niri msg --json windows \
| jq -r '.[].title' \
| grep -E 'Meet: "[a-zA-Z0-9-]+?"')"
'';
};
in
lib.attrsets.mergeAttrsList [
{
"Mod+Shift+Slash".action = show-hotkey-overlay;
"Mod+Tab".action = focus-workspace-previous;
"Mod+C".action = center-column;
"Mod+Q".action = close-window;
"Mod+M".action = maximize-column;
"Mod+Ctrl+M".action = fullscreen-window;
"Mod+Shift+M".action = maximize-window-to-edges;
"Mod+Ctrl+Shift+M".action = toggle-windowed-fullscreen;
"Mod+S".action = set-column-width "50%";
"Mod+Shift+S".action = set-column-width "33%";
"Mod+Ctrl+S".action = set-column-width "67%";
"Mod+T" = {action = toggle-column-tabbed-display;};
"Mod+F".action = switch-focus-between-floating-and-tiling;
"Mod+Ctrl+F".action = toggle-window-floating;
"Mod+Ctrl+Comma".action = consume-or-expel-window-left;
"Mod+Ctrl+Period".action = consume-or-expel-window-right;
"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%";
"Print".action = dms-ipc "niri" "screenshot";
"Ctrl+Print".action = dms-ipc "niri" "screenshotScreen";
"Shift+Print".action = dms-ipc "niri" "screenshotWindow";
"Mod+Space" = {action = switch-layout "next";};
"Mod+Ctrl+Space" = {
repeat = false;
action = toggle-overview;
};
"Mod+Return" = {action = sh "$TERMINAL";};
"Mod+R".action = sh "wl-kbptr -o modes=floating,click";
"Mod+Ctrl+R".action = sh "while wl-kbptr -o modes=split,click; do :; done";
"Mod+Shift+R".action = sh "wl-kbptr -o modes=tile,bisect,click";
"Super+Alt+G".action = spawn "${lib.getExe focus-meet}";
"Super+Alt+G".hotkey-overlay.title = "Focus Google Meet";
"Super+Alt+U".action = focus "app.zen_browser.zen" "state:inactive";
"Super+Alt+B".action = focus "io.github.ungoogled_software.ungoogled_chromium" "state:inactive";
"Super+Alt+D".action = focus "equibop";
"Super+Alt+T".action = focus "io.github.kukuruzka165.materialgram";
"Mod+D" = {
action = spawn "vicinae" "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";
# };
"Mod+Ctrl+L" = {
action = dms-ipc "lock" "lock";
hotkey-overlay.title = "Toggle Lock Screen";
};
"Mod+Ctrl+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";
};
"XF86AudioPlay".action = dms-ipc "mpris" "playPause";
"XF86AudioPause".action = dms-ipc "mpris" "pause";
"XF86AudioPrev".action = dms-ipc "mpris" "previous";
"XF86AudioNext".action = dms-ipc "mpris" "next";
"Mod+Alt+N" = {
allow-when-locked = true;
action = dms-ipc "night" "toggle";
hotkey-overlay.title = "Toggle Night Mode";
};
"Mod+V" = {
action = spawn "vicinae" "vicinae://extensions/vicinae/clipboard/history";
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" "";
};
}
(let
left = "N";
down = "E";
up = "I";
right = "O";
in
binds rec {
suffixes = {
"Left" = "column-left";
"Down" = "window-or-workspace-down";
"Up" = "window-or-workspace-up";
"Right" = "column-right";
${left} = suffixes."Left";
${down} = suffixes."Down";
${up} = suffixes."Up";
${right} = suffixes."Right";
};
prefixes = {
"Mod" = "focus";
"Mod+Ctrl" = "move";
"Mod+Shift" = "focus-monitor";
"Mod+Shift+Ctrl" = "move-window-to-monitor";
};
substitutions = {
"monitor-column" = "monitor";
"monitor-window-or-workspace" = "monitor";
"move-window-or-workspace" = "move-window";
};
})
# {
# "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 {
# PageDown and PageUp
suffixes."Prior" = "workspace-up";
suffixes."Next" = "workspace-down";
suffixes."WheelScrollUp" = "workspace-up";
suffixes."WheelScrollDown" = "workspace-down";
prefixes."Mod" = "focus";
prefixes."Mod+Ctrl" = "move-column-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 = [
{
clip-to-geometry = true;
geometry-corner-radius = let
r = 12.0;
in {
top-left = r;
top-right = r;
bottom-left = r;
bottom-right = r;
};
}
# {
# matches = [{is-active = false;}];
# draw-border-with-background = false;
# opacity = 0.9;
# }
{
matches = [
{title = "Picture-in-Picture";}
{title = "Картинка в картинці";}
{
# telegram's picture-in-picture mode
app-id = "io.github.kukuruzka165.materialgram";
title = "materialgram";
}
];
open-floating = true;
}
# {
# matches = [
# {
# # telegram's picture-in-picture mode
# app-id = "io.github.kukuruzka165.materialgram";
# title = "materialgram";
# }
# ];
# }
{
matches = [
{app-id = "re.sonny.Junction";}
{app-id = "com.github.hluk.copyq";}
{title = "Zen - Choose User Profile";}
];
open-floating = true;
open-focused = true;
}
{
matches = [
{app-id = "org.keepassxc.KeePassXC";}
{app-id = "org.gnome.World.Secrets";}
{app-id = "Bitwarden";}
{app-id = "io.github.kukuruzka165.materialgram";}
{app-id = "org.telegram.desktop";}
{app-id = "org.signal.Signal";}
{app-id = "WebCord";}
{app-id = "equibop";}
];
block-out-from = "screencast";
}
{
matches = [
{app-id = "Alacritty";}
{app-id = "com.mitchellh.ghostty";}
{app-id = "org.wezfurlong.wezterm";}
{app-id = "app.zen_browser.zen";}
];
# default-column-width = {proportion = 1.0;};
draw-border-with-background = false;
}
{
matches = [{app-id = "org.quickshell";}];
open-floating = true;
}
];
layer-rules = [
{
matches = [{namespace = "^quickshell$";}];
place-within-backdrop = true;
}
];
};
}

View File

@@ -0,0 +1,3 @@
{
programs.satty.enable = true;
}

View File

@@ -0,0 +1,51 @@
{config, ...}: {
programs.wl-kbptr = {
enable = true;
settings = with config.lib.stylix.colors.withHashtag; rec {
general.cancellation_status_code = 1;
mode_floating = {
source = "detect";
label_color = base05;
label_select_color = base0A;
unselectable_bg_color = "#2222";
selectable_bg_color = base01 + "66";
selectable_border_color = base01;
label_font_family = config.stylix.fonts.sansSerif.name;
label_font_size = "12 50% 100";
label_symbols = "abcdefghijklmnopqrstuvwxyz";
};
mode_tile = {
label_font_size = "8 50% 100";
inherit
(mode_floating)
label_color
label_select_color
unselectable_bg_color
selectable_bg_color
selectable_border_color
label_font_family
label_symbols
;
};
mode_bisect = {
inherit (mode_floating) label_color unselectable_bg_color label_font_family;
label_font_size = 20;
label_padding = "12";
pointer_size = 24;
pointer_color = base08;
even_area_bg_color = base0C + "aa";
even_area_border_color = base0C;
odd_area_bg_color = base0D + "aa";
odd_area_border_color = base0D;
history_border_color = base01;
};
mode_split = {
inherit (mode_bisect) pointer_size pointer_color history_border_color;
bg_color = mode_floating.unselectable_bg_color;
area_bg_color = mode_floating.selectable_bg_color;
vertical_color = base09;
horizontal_color = mode_bisect.odd_area_border_color;
};
};
};
}

View File

@@ -0,0 +1,44 @@
{
# config,
pkgs,
lib,
...
}: {
services = {
gnome-keyring = {
enable = true;
components = ["secrets"];
};
# kanshi = import ../../niri/services/kanshi;
# udiskie = {
# enable = true;
# automount = false;
# notify = true;
# tray = "auto";
# };
};
# systemd.user.services = let
# mkGraphicalService = config: lib.attrsets.recursiveUpdate graphicalService config;
# graphicalService = {
# Install.WantedBy = ["niri.service"];
# Unit = {
# Requisite = ["graphical-session.target"];
# PartOf = ["graphical-session.target"];
# After = ["graphical-session.target"];
# };
# Service = {
# Restart = "on-failure";
# TimeoutStopSec = 10;
# RestartSec = 1;
# };
# };
# in {
# polkit-agent = mkGraphicalService {
# Service = {
# Type = "simple";
# ExecStart = pkgs.mate.mate-polkit + "/libexec/polkit-mate-authentication-agent-1";
# };
# };
# };
}

View File

@@ -0,0 +1,52 @@
{
config,
pkgs,
lib,
...
}: {
# dconf.settings = {
# "org/gnome/desktop/interface" = {
# icon-theme = config.gtk.iconTheme.name;
# color-scheme =
# if config.stylix.polarity == "dark"
# then lib.mkDefault "prefer-dark"
# else lib.mkDefault "prefer-light";
# };
# };
# stylix.targets.niri.enable = false;
# stylix.targets.gtk.enable = false;
# gtk = {
# enable = true;
# theme = {
# name = "adw-gtk3";
# package = pkgs.adw-gtk3;
# };
# };
#
# stylix.targets.qt.enable = false;
qt = {
enable = true;
platformTheme.name = "gtk3";
};
stylix.targets = {
qt.enable = false;
# gtk.enable = false;
};
gtk = {
enable = true;
# iconTheme = {
# name =
# if config.stylix.polarity == "dark"
# then "Papirus-Dark"
# else "Papirus-Light";
# package =
# if (removeSuffix "-light" theme) == "nord"
# then pkgs.papirus-nord
# else pkgs.papirus-icon-theme;
# };
};
}

View File

@@ -1,94 +1,21 @@
{
osConfig,
perSystem,
config,
pkgs,
lib,
...
}:
with lib; let
inherit (osConfig.module.stylix) theme;
# inherit (osConfig.module.stylix) theme;
cfg = config.desktop.cosmic;
in {
options = {
desktop.cosmic.enable =
mkEnableOption "enable cosmic desktop";
};
config = mkIf cfg.enable {
stylix.targets = {
qt.enable = false;
gtk.enable = false;
};
home.packages = with pkgs; [
helvum
loupe
papers
junction
celluloid
mission-center
dconf
libnotify
playerctl
wdisplays
pwvucontrol
wl-clipboard
];
gtk = {
enable = true;
iconTheme = {
name =
if config.stylix.polarity == "dark"
then "Papirus-Dark"
else "Papirus-Light";
package =
if (removeSuffix "-light" theme) == "nord"
then pkgs.papirus-nord
else pkgs.papirus-icon-theme;
};
};
qt = {
enable = true;
platformTheme.name = "gtk3";
};
services = {
gnome-keyring = {
enable = true;
components = ["secrets"];
};
};
dconf.settings = {
"org/gnome/desktop/wm/preferences" = {
button-layout = "icon:minimize,maximize,close";
};
"org/gnome/desktop/interface" = {
icon-theme = config.gtk.iconTheme.name;
};
};
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;
};
};
};
};
config = let
importWithArgs = file: import file {inherit config inputs lib perSystem pkgs importWithArgs;};
in
mkIf cfg.enable (importWithArgs ./config);
}