From 04a4ffd63ab6b98b60794e8ad32c52fb96a39731 Mon Sep 17 00:00:00 2001 From: coast Date: Mon, 14 Sep 2026 16:32:33 +0330 Subject: update --- configuration/default.nix | 16 +- configuration/hardware.nix | 44 ++-- flake.lock | 112 +++++----- flake.nix | 12 +- home-configuration/config/niri/config.kdl | 2 +- .../modules/notifications/NotificationFocus.qml | 234 +++++++++++++++------ home-configuration/default.nix | 3 +- 7 files changed, 290 insertions(+), 133 deletions(-) diff --git a/configuration/default.nix b/configuration/default.nix index 5630cf6..41ecf44 100644 --- a/configuration/default.nix +++ b/configuration/default.nix @@ -14,7 +14,6 @@ nix.package = pkgs.lixPackageSets.stable.lix; - boot.kernelPackages = pkgs.linuxPackages_latest; boot.initrd.compressor = "zstd"; boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.editor = false; @@ -61,6 +60,16 @@ programs.throne.enable = true; programs.throne.tunMode.enable = true; programs.nix-ld.enable = true; + programs.nix-ld.libraries = with pkgs; [ + wayland + xz + bzip2 + libadwaita + gtk4 + pango + cairo + glib + ]; programs.appimage.enable = true; programs.nm-applet.enable = true; programs.neovim.enable = true; @@ -93,14 +102,17 @@ environment.shells = with pkgs; [ zsh ]; environment.systemPackages = with pkgs; [ + git + p7zip + imagemagick wineWow64Packages.stable + vkd3d-proton wget adwaita-icon-theme rofi iptables mesa-demos wl-clipboard - inputs.fetchit.packages.${pkgs.system}.default gparted polkit_gnome woeusb-ng diff --git a/configuration/hardware.nix b/configuration/hardware.nix index bac2abd..d3b8923 100644 --- a/configuration/hardware.nix +++ b/configuration/hardware.nix @@ -2,24 +2,32 @@ { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelParams = [ "kvm-amd" "snd_hda_intel.probe_mask=1" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/".device = "/dev/nvme0n1p2"; - fileSystems."/".fsType = "ext4"; - - fileSystems."/boot".device = "/dev/nvme0n1p1"; - fileSystems."/boot".fsType = "vfat"; - fileSystems."/boot".options = [ "fmask=0022" "dmask=0022" ]; - - fileSystems."/media/drive".device = "/dev/sda2"; - fileSystems."/media/drive".fsType = "btrfs"; - - swapDevices = [{ device = "/dev/nvme0n1p3"; }]; - + boot = { + initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + initrd.kernelModules = [ ]; + kernelParams = [ "kvm-amd" "snd_hda_intel.probe_mask=1" ]; + extraModulePackages = [ ]; + }; + fileSystems = { + "/" = { + device = "UUID=721879c7-fed3-458d-bace-6a7e0a4f96b4"; + fsType = "ext4"; + }; + "/boot" = { + device = "UUID=91CC-4E7B"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + "/media/drive" = { + device = "UUID=93428d05-b7b8-7ba5-b81a-a8c393c787d8"; + fsType = "btrfs"; + }; + }; + swapDevices = [ + { + device = "UUID=203c900b-100e-4352-aa6e-947cc4001271"; + } + ]; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/flake.lock b/flake.lock index f22f2b5..db0bee9 100644 --- a/flake.lock +++ b/flake.lock @@ -1,22 +1,19 @@ { "nodes": { - "fetchit": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" - }, + "flake-compat": { + "flake": false, "locked": { - "lastModified": 1788556344, - "narHash": "sha256-ilSUHXBq2vAi5WDnpUAB0gC7BofmpO4mHXLHnUEvMyI=", - "ref": "refs/heads/master", - "rev": "dd025571156ef40443d2b55b823acc21c37f2103", - "revCount": 4, - "type": "git", - "url": "https://git.coasteen.xyz/coast/fetchit.git" + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "NixOS", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "type": "github" }, "original": { - "type": "git", - "url": "https://git.coasteen.xyz/coast/fetchit.git" + "owner": "NixOS", + "repo": "flake-compat", + "type": "github" } }, "flake-parts": { @@ -24,11 +21,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1762040540, - "narHash": "sha256-z5PlZ47j50VNF3R+IMS9LmzI5fYRGY/Z5O5tol1c9I4=", + "lastModified": 1788450739, + "narHash": "sha256-glZLQlzIn1fXH6PazR2iUmTo7kzzyYSshrWhLS9TqCU=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "0010412d62a25d959151790968765a70c436598b", + "rev": "31729ca8cbdb4fa927b34e5f4353e6a83f39e993", "type": "github" }, "original": { @@ -37,21 +34,21 @@ "type": "github" } }, - "flake-utils": { + "flake-parts_2": { "inputs": { - "systems": "systems" + "nixpkgs-lib": "nixpkgs-lib_2" }, "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "lastModified": 1762040540, + "narHash": "sha256-z5PlZ47j50VNF3R+IMS9LmzI5fYRGY/Z5O5tol1c9I4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "0010412d62a25d959151790968765a70c436598b", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "hercules-ci", + "repo": "flake-parts", "type": "github" } }, @@ -76,23 +73,59 @@ "type": "github" } }, + "nix-cachyos-kernel": { + "inputs": { + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1789241994, + "narHash": "sha256-kY+k8kGBd8w4kxrw8IPzQGpnYZQV4mik2ZNHtGN0eHI=", + "owner": "xddxdd", + "repo": "nix-cachyos-kernel", + "rev": "444d135dde71c1de547cf7bfd73e67145e67aebb", + "type": "github" + }, + "original": { + "owner": "xddxdd", + "ref": "release", + "repo": "nix-cachyos-kernel", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1788531059, - "narHash": "sha256-hLD4l3QOGBQhkVp3mQ2lJ/YbEi99qUgKapb40KovZ88=", + "lastModified": 1789181251, + "narHash": "sha256-8yaO1XLoObzYgb6Uj+0IkUxbkCI6kBLuImoZAuAHzB4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "801bef6abd86b91e51083066b83fb354a11fc640", + "rev": "f496248152e1ad8c61b59a6739cc499b447168e4", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", + "ref": "nixos-unstable-small", "repo": "nixpkgs", "type": "github" } }, "nixpkgs-lib": { + "locked": { + "lastModified": 1788057806, + "narHash": "sha256-DTQSMxzDWmT0zhguthvegnVkn7CFqGCv4IHCzk5ZUpM=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "596e2e3940e09b2abbeb03f75fa1828c57fcd72c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-lib_2": { "locked": { "lastModified": 1761765539, "narHash": "sha256-b0yj6kfvO8ApcSE+QmA6mUfu8IYG6/uU28OFn4PaC8M=", @@ -157,7 +190,7 @@ }, "qml-niri": { "inputs": { - "flake-parts": "flake-parts", + "flake-parts": "flake-parts_2", "nixpkgs": [ "nixpkgs" ], @@ -203,29 +236,14 @@ }, "root": { "inputs": { - "fetchit": "fetchit", "home-manager": "home-manager", + "nix-cachyos-kernel": "nix-cachyos-kernel", "nixpkgs": "nixpkgs_2", "old-nixpkgs": "old-nixpkgs", "qml-niri": "qml-niri", "quickshell": "quickshell" } }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "treefmt-nix": { "inputs": { "nixpkgs": "nixpkgs_3" diff --git a/flake.nix b/flake.nix index 6d759c6..954da2a 100644 --- a/flake.nix +++ b/flake.nix @@ -5,15 +5,15 @@ nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; home-manager.url = "github:nix-community/home-manager/release-26.05"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; - fetchit.url = "git+https://git.coasteen.xyz/coast/fetchit.git"; quickshell.url = "git+https://git.outfoxxed.me/outfoxxed/quickshell"; quickshell.inputs.nixpkgs.follows = "nixpkgs"; qml-niri.url = "github:imiric/qml-niri/main"; qml-niri.inputs.nixpkgs.follows = "nixpkgs"; qml-niri.inputs.quickshell.follows = "quickshell"; + nix-cachyos-kernel.url = "github:xddxdd/nix-cachyos-kernel/release"; }; - outputs = { self, old-nixpkgs, nixpkgs, home-manager, fetchit, ... }@inputs: { + outputs = { self, old-nixpkgs, nixpkgs, home-manager, ... }@inputs: { nixosConfigurations.unix = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { @@ -22,13 +22,17 @@ modules = [ ./configuration home-manager.nixosModules.home-manager - { + ({ pkgs, ... }: { nixpkgs.overlays = [ (final: prev: { xdg-desktop-portal = old-nixpkgs.legacyPackages.x86_64-linux.xdg-desktop-portal; }) + inputs.nix-cachyos-kernel.overlays.pinned ]; + + boot.kernelPackages = pkgs.cachyosKernels.linuxPackages-cachyos-latest; + home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.users.coast = @@ -37,7 +41,7 @@ home-manager.extraSpecialArgs = { inherit inputs; }; - } + }) ]; }; }; diff --git a/home-configuration/config/niri/config.kdl b/home-configuration/config/niri/config.kdl index e8fe85c..06aea17 100644 --- a/home-configuration/config/niri/config.kdl +++ b/home-configuration/config/niri/config.kdl @@ -1,5 +1,5 @@ spawn-sh-at-startup "XDG_DATA_DIRS=/etc/profiles/per-user/coast/share:/run/current-system/sw/share:$HOME/.nix-profile/share:$XDG_DATA_DIRS" -spawn-at-startup "quickshell -c ~/.config/quickshell" +spawn-at-startup "qs" spawn-at-startup "dbus-update-activation-environment" "--systemd" "WAYLAND_DISPLAY" "XDG_CURRENT_DESKTOP" input { diff --git a/home-configuration/config/quickshell/modules/notifications/NotificationFocus.qml b/home-configuration/config/quickshell/modules/notifications/NotificationFocus.qml index af52eaa..ce59b2a 100644 --- a/home-configuration/config/quickshell/modules/notifications/NotificationFocus.qml +++ b/home-configuration/config/quickshell/modules/notifications/NotificationFocus.qml @@ -1,13 +1,120 @@ import QtQuick import Quickshell import Quickshell.Io -import "../../config.js" as Config Item { id: root property string pendingApp: "" + function normalize(value) { + if (!value) + return "" + + var result = String(value).toLowerCase().trim() + + result = result.replace(/^org\./, "") + result = result.replace(/^com\./, "") + result = result.replace(/^net\./, "") + result = result.replace(/^app\./, "") + + result = result.replace(/\.desktop$/, "") + result = result.replace(/\.desktop$/i, "") + + result = result.replace(/[^a-z0-9]+/g, "") + + return result + } + + function candidates(value) { + var result = [] + var raw = String(value || "").toLowerCase().trim() + + function add(candidate) { + if (!candidate) + return + + candidate = normalize(candidate) + + if (candidate && result.indexOf(candidate) === -1) + result.push(candidate) + } + + add(raw) + + if (raw.indexOf(".") !== -1) { + var parts = raw.split(".") + + add(parts[parts.length - 1]) + + for (var i = 0; i < parts.length; i++) + add(parts[i]) + } + + if (raw.indexOf("/") !== -1) + add(raw.split("/").pop()) + + if (raw.indexOf("-") !== -1) { + var dashParts = raw.split("-") + + for (var j = 0; j < dashParts.length; j++) + add(dashParts[j]) + } + + if (raw.indexOf("_") !== -1) { + var underscoreParts = raw.split("_") + + for (var k = 0; k < underscoreParts.length; k++) + add(underscoreParts[k]) + } + + return result + } + + function matchScore(notificationApp, windowAppId, windowTitle) { + var notificationCandidates = candidates(notificationApp) + var windowCandidates = candidates(windowAppId) + + var best = 0 + + for (var i = 0; i < notificationCandidates.length; i++) { + var notificationCandidate = notificationCandidates[i] + + for (var j = 0; j < windowCandidates.length; j++) { + var windowCandidate = windowCandidates[j] + + if (notificationCandidate === windowCandidate) + best = Math.max(best, 100) + + else if ( + notificationCandidate.length >= 4 && + windowCandidate.length >= 4 && + ( + notificationCandidate.indexOf(windowCandidate) !== -1 || + windowCandidate.indexOf(notificationCandidate) !== -1 + ) + ) { + best = Math.max(best, 60) + } + } + } + + var titleCandidates = candidates(windowTitle) + + for (var n = 0; n < notificationCandidates.length; n++) { + for (var t = 0; t < titleCandidates.length; t++) { + if ( + notificationCandidates[n].length >= 4 && + notificationCandidates[n] === titleCandidates[t] + ) { + best = Math.max(best, 30) + } + } + } + + return best + } + Process { id: windowsProcess @@ -23,7 +130,7 @@ Item { windows = JSON.parse(this.text) } catch (error) { console.error( - "Failed to parse niri windows:", + "Failed to parse Niri windows:", error ) @@ -31,74 +138,74 @@ Item { return } - var app = root.pendingApp.toLowerCase() + var notificationApp = root.pendingApp root.pendingApp = "" - if (Config.notificationVesktopNames.indexOf(app) !== -1) { - for (var i = 0; i < windows.length; i++) { - var niriWindow = windows[i] - var appId = (niriWindow.app_id || "").toLowerCase() - - if (appId === Config.notificationVesktopAppId) { - console.log( - "FOCUSING VESKTOP WINDOW:", - niriWindow.id, - niriWindow.title - ) - - focusProcess.exec([ - "niri", - "msg", - "action", - "focus-window", - "--id", - String(niriWindow.id) - ]) - - return - } - } + if (!notificationApp) { + console.warn("Notification focus: empty app name") + return + } - console.log( - "No matching Niri window found for:", - app + if (!Array.isArray(windows)) { + console.error( + "Niri windows response is not an array" ) - return } - for (var j = 0; j < windows.length; j++) { - var window = windows[j] - var windowAppId = (window.app_id || "").toLowerCase() - - if ( - windowAppId === app || - windowAppId === app + ".desktop" - ) { - console.log( - "FOCUSING WINDOW:", - window.id, - window.app_id, - window.title - ) - - focusProcess.exec([ - "niri", - "msg", - "action", - "focus-window", - "--id", - String(window.id) - ]) - - return + var bestWindow = null + var bestScore = 0 + + for (var i = 0; i < windows.length; i++) { + var window = windows[i] + + if (!window || window.id === undefined) + continue + + var appId = window.app_id || "" + var title = window.title || "" + + var score = matchScore( + notificationApp, + appId, + title + ) + + if (score > bestScore) { + bestScore = score + bestWindow = window } } + if (!bestWindow) { + console.log( + "No matching Niri window found:", + notificationApp + ) + return + } + console.log( - "No matching Niri window found for:", - app + "FOCUSING WINDOW:", + bestWindow.id, + "notification app:", + notificationApp, + "app_id:", + bestWindow.app_id, + "title:", + bestWindow.title, + "score:", + bestScore ) + + focusProcess.exec([ + "niri", + "msg", + "action", + "focus-window", + "--id", + String(bestWindow.id) + ]) } } } @@ -111,7 +218,16 @@ Item { if (!notification) return - root.pendingApp = notification.appName + var app = notification.appName || "" + + if (!app) { + console.warn( + "Notification has no application name" + ) + return + } + + root.pendingApp = app windowsProcess.exec([ "niri", diff --git a/home-configuration/default.nix b/home-configuration/default.nix index caf2f76..62cf671 100644 --- a/home-configuration/default.nix +++ b/home-configuration/default.nix @@ -17,7 +17,7 @@ in ./managed/prismlauncher ./managed/obs-studio ./managed/xserver - ./managed/fetchit + #./managed/fetchit ./managed/mindustry ]; @@ -100,7 +100,6 @@ in pkgs.qbittorrent pkgs.nautilus pkgs.xray - pkgs.git pkgs.gnumake pkgs.gcc pkgs.clang-tools -- cgit v1.3