From 3efe10424003a38167438e5b6990375f1751e314 Mon Sep 17 00:00:00 2001 From: Matt Nish-Lapidus Date: Sun, 29 Jun 2025 20:58:23 -0400 Subject: [PATCH] trying filechooser nonsense again --- flake.lock | 131 ++++++++++++++++-- flake.nix | 3 + .../dot_local/bin/lock-power-off-monitors | 2 +- hosts/eddie/configuration.nix | 7 +- hosts/eddie/packages.nix | 1 + modules/home/desktop.nix | 40 +++--- modules/home/sway-idle-lock.nix | 10 +- 7 files changed, 155 insertions(+), 39 deletions(-) diff --git a/flake.lock b/flake.lock index 34562da..4e4b8b0 100644 --- a/flake.lock +++ b/flake.lock @@ -261,6 +261,24 @@ "type": "github" } }, + "flake-parts_4": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_4" + }, + "locked": { + "lastModified": 1722555600, + "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -458,11 +476,11 @@ ] }, "locked": { - "lastModified": 1751146119, - "narHash": "sha256-gvjG95TCnUVJkvQvLMlnC4NqiqFyBdJk3o8/RwuHeaU=", + "lastModified": 1751239699, + "narHash": "sha256-zA1uUdAq3c26fHm26xMWMuF5COhI18EzaH7az/P2OWM=", "owner": "nix-community", "repo": "home-manager", - "rev": "76d0c31fce2aa0c71409de953e2f9113acd5b656", + "rev": "f6deff178cc4d6049d30785dbfc831e6c6e3a219", "type": "github" }, "original": { @@ -604,11 +622,11 @@ "xwayland-satellite-unstable": "xwayland-satellite-unstable" }, "locked": { - "lastModified": 1751179061, - "narHash": "sha256-E3SA2IZf72CR3wklJM+cF1ZOVjy6r8ZqbsOPXodNjWo=", + "lastModified": 1751232679, + "narHash": "sha256-ljpyZxr5cHjJEXItXCoJVXJ+fiHTW1Ft0fPgEY72K5A=", "owner": "sodiboo", "repo": "niri-flake", - "rev": "cc5722e779f3b32bdd918e473777c39da67ab1b6", + "rev": "d9b7ff985e454c1b3d2af1c5d09e799ecd38902d", "type": "github" }, "original": { @@ -823,6 +841,18 @@ "type": "github" } }, + "nixpkgs-lib_4": { + "locked": { + "lastModified": 1722555339, + "narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1751048012, @@ -871,6 +901,22 @@ "type": "github" } }, + "nixpkgs_10": { + "locked": { + "lastModified": 1720957393, + "narHash": "sha256-oedh2RwpjEa+TNxhg5Je9Ch6d3W1NKi7DbRO1ziHemA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "693bc46d169f5af9c992095736e82c3488bf7dbb", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1735834308, @@ -983,6 +1029,22 @@ "type": "github" } }, + "nixpkgs_9": { + "locked": { + "lastModified": 1723362943, + "narHash": "sha256-dFZRVSgmJkyM0bkPpaYRtG/kRMRTorUIDj8BxoOt1T4=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a58bc8ad779655e790115244571758e8de055e3d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "pyproject-build-systems": { "inputs": { "nixpkgs": [ @@ -1054,6 +1116,7 @@ "sops-nix": "sops-nix", "waybar": "waybar", "wezterm": "wezterm", + "xdg-desktop-portal-termfilepickers": "xdg-desktop-portal-termfilepickers", "xwayland-satellite": "xwayland-satellite", "yazi": "yazi", "zen-browser": "zen-browser" @@ -1292,6 +1355,24 @@ "type": "github" } }, + "treefmt-nix_3": { + "inputs": { + "nixpkgs": "nixpkgs_10" + }, + "locked": { + "lastModified": 1723454642, + "narHash": "sha256-S0Gvsenh0II7EAaoc9158ZB4vYyuycvMGKGxIbERNAM=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "349de7bc435bdff37785c2466f054ed1766173be", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, "uv2nix": { "inputs": { "nixpkgs": [ @@ -1399,6 +1480,26 @@ "type": "github" } }, + "xdg-desktop-portal-termfilepickers": { + "inputs": { + "flake-parts": "flake-parts_4", + "nixpkgs": "nixpkgs_9", + "treefmt-nix": "treefmt-nix_3" + }, + "locked": { + "lastModified": 1750511941, + "narHash": "sha256-QB7TwZR31368HdQb4C9/s6ujiDtihwEbesTxKmz3Pbg=", + "owner": "guekka", + "repo": "xdg-desktop-portal-termfilepickers", + "rev": "1fe0479476465cc9061a8c7810a489e63ddc7fd7", + "type": "github" + }, + "original": { + "owner": "guekka", + "repo": "xdg-desktop-portal-termfilepickers", + "type": "github" + } + }, "xwayland-satellite": { "inputs": { "flake-utils": "flake-utils_3", @@ -1408,11 +1509,11 @@ "rust-overlay": "rust-overlay_2" }, "locked": { - "lastModified": 1751176151, - "narHash": "sha256-7bK5eoK0ySlct/cbehTrkGcTcSMOLXSnh+RJiswVzEU=", + "lastModified": 1751228685, + "narHash": "sha256-MENtauGBhJ+kDeFaawvWGXaFG3Il6qQzjaP0RmtfM0k=", "owner": "Supreeeme", "repo": "xwayland-satellite", - "rev": "91d463851e24c190cc912471861b5414ac8fe65c", + "rev": "557ebeb616e03d5e4a8049862bbbd1f02c6f020b", "type": "github" }, "original": { @@ -1441,11 +1542,11 @@ "xwayland-satellite-unstable": { "flake": false, "locked": { - "lastModified": 1751176151, - "narHash": "sha256-7bK5eoK0ySlct/cbehTrkGcTcSMOLXSnh+RJiswVzEU=", + "lastModified": 1751228685, + "narHash": "sha256-MENtauGBhJ+kDeFaawvWGXaFG3Il6qQzjaP0RmtfM0k=", "owner": "Supreeeme", "repo": "xwayland-satellite", - "rev": "91d463851e24c190cc912471861b5414ac8fe65c", + "rev": "557ebeb616e03d5e4a8049862bbbd1f02c6f020b", "type": "github" }, "original": { @@ -1484,11 +1585,11 @@ ] }, "locked": { - "lastModified": 1751200680, - "narHash": "sha256-sVep+p1XtL4tpArd1of+8mA3mJ9T0NsHNOCLGKxxRns=", + "lastModified": 1751224527, + "narHash": "sha256-Mihe18dBS7y13//qPn2LVnSMZdZXI1vvnpKpRCmJcfw=", "owner": "0xc000022070", "repo": "zen-browser-flake", - "rev": "35ba63ea42a57e8470e605b178e5228a29edbcbe", + "rev": "ee2ecf872fe6b7aa14ec90796ba610eeafdd17da", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index d2816c0..93e47f0 100644 --- a/flake.nix +++ b/flake.nix @@ -73,6 +73,8 @@ url = "github:wez/wezterm?dir=nix"; }; + xdg-desktop-portal-termfilepickers.url = "github:guekka/xdg-desktop-portal-termfilepickers"; + sops-nix = { url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; @@ -137,6 +139,7 @@ baseHomeModules = [ inputs.nix-flatpak.homeManagerModules.nix-flatpak inputs.sops-nix.homeManagerModules.sops + inputs.xdg-desktop-portal-termfilepickers.homeManagerModules.default ]; baseHomeManager = { diff --git a/homes/emenel/dotfiles/dot_local/bin/lock-power-off-monitors b/homes/emenel/dotfiles/dot_local/bin/lock-power-off-monitors index e069ef4..bebb2bc 100755 --- a/homes/emenel/dotfiles/dot_local/bin/lock-power-off-monitors +++ b/homes/emenel/dotfiles/dot_local/bin/lock-power-off-monitors @@ -1,2 +1,2 @@ #!/usr/bin/env sh -niri msg action power-off-monitors +/run/current-system/sw/bin/niri msg action power-off-monitors diff --git a/hosts/eddie/configuration.nix b/hosts/eddie/configuration.nix index 6823f08..a433e06 100644 --- a/hosts/eddie/configuration.nix +++ b/hosts/eddie/configuration.nix @@ -43,6 +43,10 @@ }); }) + (final: prev: { + xdg-desktop-portal-termfilepickers = inputs.xdg-desktop-portal-termfilepickers.packages.${pkgs.system}.default; + }) + (final: prev: { manifold = prev.manifold.overrideAttrs (old: { cmakeFlags = [ @@ -315,7 +319,6 @@ configPackages = [ pkgs.niri-unstable ]; config = { common.default = [ "niri" ]; - # common."org.freedesktop.impl.portal.FileChooser" = [ "xdg-desktop-portal-termfilechooser" ]; # xdg-? }; extraPortals = [ pkgs.xdg-desktop-portal-gnome @@ -323,7 +326,7 @@ pkgs.xdg-desktop-portal pkgs.xdg-desktop-portal-wlr pkgs.gnome-keyring - pkgs.xdg-desktop-portal-termfilechooser + pkgs.xdg-desktop-portal-termfilepickers ]; }; diff --git a/hosts/eddie/packages.nix b/hosts/eddie/packages.nix index d4f9220..4238cc3 100644 --- a/hosts/eddie/packages.nix +++ b/hosts/eddie/packages.nix @@ -34,5 +34,6 @@ gnome-themes-extra gnomeExtensions.appindicator gnome-settings-daemon + swayidle ]; } diff --git a/modules/home/desktop.nix b/modules/home/desktop.nix index 075317b..ca5c91a 100644 --- a/modules/home/desktop.nix +++ b/modules/home/desktop.nix @@ -1,4 +1,4 @@ -{ pkgs, nix-config, pkgs-local, lib, ... }: +{ pkgs, nix-config, inputs, lib, ... }: { @@ -211,6 +211,14 @@ }; services = { + xdg-desktop-portal-termfilepickers = { + enable = true; + package = pkgs.xdg-desktop-portal-termfilepickers; + desktopEnvironments = [ "common" "niri" ]; + config = { + terminal_command = lib.getExe pkgs.wezterm; + }; + }; flatpak = { enable = true; packages = [ @@ -267,24 +275,18 @@ # }; # }; - # xdg.portal = { - # enable = true; - # configPackages = [ pkgs.niri-unstable ]; - # extraPortals = with pkgs; [ - # xdg-desktop-portal-gnome - # xdg-desktop-portal-gtk - # xdg-desktop-portal - # xdg-desktop-portal-wlr - # gnome-keyring - # xdg-desktop-portal-termfilechooser - # ]; - # config = { - # common = { - # default = [ "gtk" ]; - # # "org.freedesktop.impl.portal.FileChooser" = "termfilechooser"; - # }; - # }; - # }; + xdg.portal = { + enable = true; + configPackages = [ pkgs.niri-unstable ]; + extraPortals = with pkgs; [ + xdg-desktop-portal-gnome + xdg-desktop-portal-gtk + xdg-desktop-portal + xdg-desktop-portal-wlr + gnome-keyring + xdg-desktop-portal-termfilepickers + ]; + }; # home.sessionVariables.TERMCMD = "wezterm --class=file_chooser"; diff --git a/modules/home/sway-idle-lock.nix b/modules/home/sway-idle-lock.nix index 7b4e230..bf4b5d2 100644 --- a/modules/home/sway-idle-lock.nix +++ b/modules/home/sway-idle-lock.nix @@ -2,13 +2,18 @@ { services.swayidle = { enable = true; - + systemdTarget = "graphical-session.target"; + extraArgs = [ "-w" ]; events = [ { event = "lock"; command = "/home/emenel/.local/bin/session-lock"; } + { + event = "before-sleep"; + command = "${pkgs.systemd}/bin/loginctl lock-session"; + } { event = "after-resume"; command = "/home/emenel/.local/bin/on-unlock"; @@ -19,6 +24,7 @@ { timeout = 60; command = "/home/emenel/.local/bin/dim-all-monitors"; + resumeCommand = "/home/emenel/.local/bin/on-unlock"; } # battery timers @@ -61,7 +67,7 @@ color = "000000"; font-size = 32; indicator-idle-visible = true; - indicator-radius = 250; + indicator-radius = 150; line-color = "cccccc"; show-failed-attempts = true; };