aboutsummaryrefslogtreecommitdiffstats
path: root/home
diff options
context:
space:
mode:
authorPetri Hienonen <petri.hienonen@gmail.com>2025-12-01 12:54:26 +0200
committerPetri Hienonen <petri.hienonen@gmail.com>2025-12-01 14:23:36 +0200
commit426b868b168d0fbad72405a474b008022c0a16d4 (patch)
tree25d7663302c3ae72594bfcb1e6d91e70ebb02a33 /home
parente736ed88f4b94047c2f5f9db2412aa227562287d (diff)
downloadnixos-426b868b168d0fbad72405a474b008022c0a16d4.tar.zst
Remove termfilechooser as it causes problems
Diffstat (limited to 'home')
-rw-r--r--home/default.nix87
1 files changed, 68 insertions, 19 deletions
diff --git a/home/default.nix b/home/default.nix
index 48d0e8b..083b428 100644
--- a/home/default.nix
+++ b/home/default.nix
@@ -163,9 +163,12 @@ in
enableNushellIntegration = true;
enableFishIntegration = true;
settings = {
- manager = {
+ mgr = {
show_hidden = true;
show_symlink = true;
+ sort_by = "mtime";
+ sort_dir_first = true;
+ sort_reverse = true;
};
preview = {
image_filter = "lanczos3";
@@ -215,6 +218,9 @@ in
pistol.enable = true;
ghostty = {
enable = true;
+ systemd = {
+ enable = true;
+ };
installVimSyntax = true;
enableFishIntegration = true;
settings = {
@@ -365,6 +371,7 @@ in
OPENAI_API_KEY = "$(${pkgs.coreutils}/bin/cat ${config.age.secrets.openai_auth_token.path})";
SHIORI_PASSWORD = "$(${pkgs.coreutils}/bin/cat ${config.age.secrets.shiori_password.path})";
UNSPLASH_ACCESS_KEY = "$(${pkgs.coreutils}/bin/cat ${config.age.secrets.unsplash_access_key.path})";
+ TERMCMD = "${pkgs.ghostty}/bin/ghostty";
};
pointerCursor = {
@@ -390,7 +397,6 @@ in
tenere # llm tui
ticker # stock ticker
wthrr # weather forecast from openmeteo
- yazi # file manager
# gui
bitwarden-desktop # password mananger
@@ -508,11 +514,11 @@ in
autostart.enable = true;
portal = {
enable = true;
- xdgOpenUsePortal = true;
config.common = {
default = [ "*" ];
"org.freedesktop.impl.portal.FileChooser" = "termfilechooser";
};
+ xdgOpenUsePortal = true;
extraPortals = with pkgs; [
xdg-desktop-portal-wlr
xdg-desktop-portal-termfilechooser
@@ -596,25 +602,68 @@ in
};
};
- xdg.configFile."xdg-desktop-portal-termfilechooser/config".text =
- let
- launcherDeps = pkgs.buildEnv {
- name = "yazi-launcher-dependencies";
- paths = with pkgs; [
- coreutils
- yazi
- gnused
- bashInteractive
- ];
- };
- in
- ''
+ xdg.configFile."xdg-desktop-portal-termfilechooser/config" = {
+ force = true;
+ text = ''
[filechooser]
- env=PATH='${launcherDeps}/bin'
- env=TERMCMD='${pkgs.ghostty}/bin/ghostty'
- cmd='${pkgs.xdg-desktop-portal-termfilechooser}/share/xdg-desktop-portal-termfilechooser/yazi-wrapper.sh'
+ cmd=yazi-wrapper.sh
+ open_mode=suggested
+ save_mode=last
default_dir=$HOME/Downloads
'';
+ };
+
+ xdg.configFile."xdg-desktop-portal-termfilechooser/yazi-wrapper.sh" = {
+ force = true;
+ executable = true;
+ text = ''
+ #!/usr/bin/env sh
+ # This wrapper script is invoked by xdg-desktop-portal-termfilechooser.
+ #
+ # For more information about input/output arguments read `xdg-desktop-portal-termfilechooser(5)`
+
+ set -e
+
+ if [ "$6" -ge 4 ]; then
+ set -x
+ fi
+
+ multiple="$1"
+ directory="$2"
+ save="$3"
+ path="$4"
+ out="$5"
+
+ # Build yazi arguments
+ yazi_args=""
+ if [ "$save" = "1" ]; then
+ # save a file
+ yazi_args="--chooser-file=$out $path"
+ elif [ "$directory" = "1" ]; then
+ # upload files from a directory
+ yazi_args="--chooser-file=$out --cwd-file=$out.1 $path"
+ elif [ "$multiple" = "1" ]; then
+ # upload multiple files
+ yazi_args="--chooser-file=$out $path"
+ else
+ # upload only 1 file
+ yazi_args="--chooser-file=$out $path"
+ fi
+
+ # Execute ghostty with yazi
+ ${pkgs.ghostty}/bin/ghostty -e ${pkgs.yazi}/bin/yazi $yazi_args
+
+ # Handle directory case output
+ if [ "$directory" = "1" ]; then
+ if [ ! -s "$out" ] && [ -s "$out.1" ]; then
+ ${pkgs.coreutils}/bin/cat "$out.1" > "$out"
+ rm -f "$out.1"
+ else
+ rm -f "$out.1"
+ fi
+ fi
+ '';
+ };
systemd.user.services.bt-notify = {
Unit = {