From 0457d618e1c999e382761ad586f5770d457bbcab Mon Sep 17 00:00:00 2001 From: Jory Severijnse Date: Fri, 10 Jul 2026 22:59:18 +0200 Subject: [PATCH] Updated mainly terminal filchooser from browser --- home/packages/packages.nix | 8 ++++++++ home/packages/wayland/niri/_rules.nix | 4 ++++ home/services/wayland/gammastep.nix | 7 +------ home/terminal/software/xdg.nix | 28 +++++++++++++++++++++++++++ hosts/default.nix | 4 +++- system/programs/xdg.nix | 14 ++++++++++++-- system/services/location.nix | 27 +++++++++++++++++++++----- 7 files changed, 78 insertions(+), 14 deletions(-) diff --git a/home/packages/packages.nix b/home/packages/packages.nix index 3440e14..4e92ac7 100644 --- a/home/packages/packages.nix +++ b/home/packages/packages.nix @@ -35,6 +35,14 @@ qbittorrent weathr distrobox + ffmpeg + + ## DEV ## + # javascript + elmPackages.nodejs + # python + python314 + uv # gnome dconf-editor (papers.override {supportNautilus = true;}) diff --git a/home/packages/wayland/niri/_rules.nix b/home/packages/wayland/niri/_rules.nix index 34cc29f..92c1394 100644 --- a/home/packages/wayland/niri/_rules.nix +++ b/home/packages/wayland/niri/_rules.nix @@ -168,6 +168,10 @@ match._props = {title = "Error";}; open-floating = true; } + { + match._props = {app-id = "Yazi:";}; + open-floating = true; + } ]; layer-rule = [ diff --git a/home/services/wayland/gammastep.nix b/home/services/wayland/gammastep.nix index 13e8638..3443b00 100644 --- a/home/services/wayland/gammastep.nix +++ b/home/services/wayland/gammastep.nix @@ -30,16 +30,11 @@ in { }; xdg.configFile."${configFile}".source = toINI "config.ini" { - manual = { - lat = "-34.58"; - lon = "-58.64"; - }; - general = { brightness-day = "1.0"; brightness-night = "0.5"; adjustment-method = "wayland"; - location-provider = "manual"; + location-provider = "geoclue2"; temp-day = "5500"; temp-night = "3500"; }; diff --git a/home/terminal/software/xdg.nix b/home/terminal/software/xdg.nix index 324627b..83a5c90 100644 --- a/home/terminal/software/xdg.nix +++ b/home/terminal/software/xdg.nix @@ -48,6 +48,27 @@ XDG_PICTURES_DIR="$HOME/Pictures" XDG_VIDEOS_DIR="$HOME/Videos" ''; + + yaziWrapper = pkgs.writeShellScriptBin "yazi-wrapper" '' + set -e + + multiple="$1" + directory="$2" + save="$3" + path="$4" + out="$5" + + # We use alacritty directly to run yazi + # For saving (save=1), yazi is passed the directory and we write the final path output + # For directories (directory=1), we pass yazi the dir selection flag + if [ "$save" = "1" ]; then + exec ${pkgs.alacritty}/bin/alacritty -e ${pkgs.yazi}/bin/yazi --chooser-file="$out" "$path" + elif [ "$directory" = "1" ]; then + exec ${pkgs.alacritty}/bin/alacritty -e ${pkgs.yazi}/bin/yazi --chooser-file="$out" --cwd-file="$out"".1" "$path" + else + exec ${pkgs.alacritty}/bin/alacritty -e ${pkgs.yazi}/bin/yazi --chooser-file="$out" "$path" + fi + ''; in { users.users.someone.packages = with pkgs; [ xdg-utils @@ -59,6 +80,13 @@ in { enable = true; defaultApplications = associations; }; + configFile."xdg-desktop-portal-termfilechooser/config".text = '' + [filechooser] + cmd=${yaziWrapper}/bin/yazi-wrapper + default_dir=$HOME + open_mode=suggested + save_mode=suggested + ''; configFile."user-dirs.dirs".source = userDirsConfig; configFile."mimeapps.list".text = '' [Default Applications] diff --git a/hosts/default.nix b/hosts/default.nix index 3f5293a..2d018ef 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -39,7 +39,9 @@ in { # Laptop: laptop with GUI + battery + bluetooth laptop = nixosSystem { inherit specialArgs; - modules = laptop ++ sharedModules; + modules = laptop ++ sharedModules ++ [ + "${mod}/services/location.nix" + ]; }; }; } diff --git a/system/programs/xdg.nix b/system/programs/xdg.nix index b3913b7..223706a 100644 --- a/system/programs/xdg.nix +++ b/system/programs/xdg.nix @@ -2,7 +2,15 @@ lib, pkgs, ... -}: { +}: let + # Patch termfilechooser .portal to add Niri to UseIn + termfilechooser-niri = pkgs.xdg-desktop-portal-termfilechooser.overrideAttrs (old: { + postFixup = (old.postFixup or "") + '' + substituteInPlace $out/share/xdg-desktop-portal/portals/termfilechooser.portal \ + --replace-fail "wlroots;" "wlroots;Niri;" + ''; + }); +in { xdg.portal = { enable = true; config = { @@ -13,12 +21,14 @@ "org.freedesktop.impl.portal.RemoteDesktop" = "gnome"; "org.freedesktop.impl.portal.Secret" = ["gnome-keyring"]; "org.freedesktop.impl.portal.OpenURI" = "gtk"; - "org.freedesktop.impl.portal.OpenFile" = "gtk"; + # FileChooser covers both OpenFile and SaveFile use-cases + "org.freedesktop.impl.portal.FileChooser" = "termfilechooser"; }; }; extraPortals = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-gnome + termfilechooser-niri ]; }; diff --git a/system/services/location.nix b/system/services/location.nix index 4860172..c61a86c 100644 --- a/system/services/location.nix +++ b/system/services/location.nix @@ -5,13 +5,30 @@ # provide location services.geoclue2 = { enable = true; - geoProviderUrl = "https://beacondb.net/v1/geolocate"; - submissionUrl = "https://beacondb.net/v2/geosubmit"; + geoProviderUrl = "https://api.beacondb.net/v1/geolocate"; + submissionUrl = "https://api.beacondb.net/v2/geosubmit"; submissionNick = "geoclue"; - appConfig.gammastep = { - isAllowed = true; - isSystem = false; + appConfig = { + gammastep = { + isAllowed = true; + isSystem = false; + }; + "xdg-desktop-portal" = { + isAllowed = true; + isSystem = true; + }; + "gnome-weather" = { + isAllowed = true; + isSystem = true; + }; + "gnome-clocks" = { + isAllowed = true; + isSystem = true; + }; }; }; + + # Automatically update system timezone based on location + services.automatic-timezoned.enable = true; }