From e42a3b8982e3a3959ef38386405d57e060bc1c96 Mon Sep 17 00:00:00 2001 From: AsciiMoth Date: Fri, 29 Sep 2023 17:15:04 +0400 Subject: [PATCH] Unsuccessful attempt to setup ranger as systemwide file picker --- machines/pcLexell/controlbox.nix | 2 +- machines/pcLexell/default.nix | 2 + machines/pcLexell/gui.nix | 75 ++++++++++++++++++++++++++++++++ machines/pcLexell/ranger.nix | 9 ++++ 4 files changed, 87 insertions(+), 1 deletion(-) diff --git a/machines/pcLexell/controlbox.nix b/machines/pcLexell/controlbox.nix index 979d959..bcf1f28 100644 --- a/machines/pcLexell/controlbox.nix +++ b/machines/pcLexell/controlbox.nix @@ -14,7 +14,7 @@ ... }: let controlbox = pkgs.writeShellScriptBin "controlbox" '' - ${pkgs.alacritty}/bin/alacritty --class CONTROLBOX -o "scale_with_dpi=True" -o "dpi.x=144" -o "dpi.y=144" -o "font.size=8" -o "window.dimensions.lines=15" -o "window.dimensions.columns=30" -e ${pkgs.fish}/bin/fish -c "source /etc/theme.fish && base16-load && $*" + ${pkgs.wezterm}/bin/wezterm start --class CONTROLBOX -e ${pkgs.fish}/bin/fish -c "source /etc/theme.fish && base16-load && $*" ''; in { environment.systemPackages = with pkgs; [controlbox]; diff --git a/machines/pcLexell/default.nix b/machines/pcLexell/default.nix index 1cdcb01..086974e 100644 --- a/machines/pcLexell/default.nix +++ b/machines/pcLexell/default.nix @@ -155,6 +155,8 @@ in { cpufetch pulseaudio + nix-tree + tmate thefuck #perl diff --git a/machines/pcLexell/gui.nix b/machines/pcLexell/gui.nix index d9f0c67..f918957 100644 --- a/machines/pcLexell/gui.nix +++ b/machines/pcLexell/gui.nix @@ -14,6 +14,12 @@ ... }: let constants = import ./constants.nix; + wezterm-desktop = pkgs.makeDesktopItem { + name = "wezterm"; + desktopName = "wezterm"; + exec = "${pkgs.wezterm}/bin/wezterm"; + terminal = false; + }; in { imports = [ ./x.nix @@ -38,6 +44,70 @@ in { enable = true; }; }; + xdg = { + portal = { + enable = true; + extraPortals = with pkgs; [ + pass-secret-service + ]; + }; + mime = let + defaultApplications = { + browser = { + cmd = "${pkgs.firefox}/bin/firefox"; + desktop = "firefox"; + }; + matrix = { + cmd = "${pkgs.nheko}/bin/nheko"; + desktop = "nheko"; + }; + editor = { + cmd = "${pkgs.micro}/bin/micro ${pkgs.micro}/bin/micro"; + desktop = "micro"; + }; + fm = { + cmd = "ranger"; + desktop = "ranger"; + }; + terminal = { + cmd = "${pkgs.wezterm}/bin/wezterm"; + desktop = "WezTerm"; + }; + }; + in { + enable = true; + defaultApplications = with defaultApplications; + builtins.mapAttrs + (name: value: + if value ? desktop + then ["${value.desktop}.desktop"] + else value) + { + "x-terminal-emulator" = terminal; + "inode/directory" = fm; + "text/html" = browser; + #"image/*" = { desktop = "org.gnome.eog"; }; + #"application/zip" = archive; + #"application/rar" = archive; + #"application/7z" = archive; + #"application/*tar" = archive; + "x-scheme-handler/http" = browser; + "x-scheme-handler/https" = browser; + "x-scheme-handler/about" = browser; + "x-www-browser" = browser; + #"x-scheme-handler/mailto" = mail; + "x-scheme-handler/matrix" = matrix; + #"application/pdf" = { desktop = "org.kde.okular"; }; + #"application/vnd.openxmlformats-officedocument.wordprocessingml.document" = + # text_processor; + #"application/msword" = text_processor; + #"application/vnd.oasis.opendocument.text" = text_processor; + #"text/csv" = spreadsheet; + #"application/vnd.oasis.opendocument.spreadsheet" = spreadsheet; + "text/plain" = editor; + }; + }; + }; home-manager.users."${constants.MainUser}" = { systemd.user.services.graphical-notify = { Service = { @@ -57,6 +127,7 @@ in { rofi = { enable = true; font = lib.mkForce "FiraCode Nerd Font Mono 14"; + #terminal = "wezterm"; }; wezterm = { enable = true; @@ -67,5 +138,9 @@ in { pkgs.tdesktop ]; home.file.".icons/default".source = "${pkgs.vanilla-dmz}/share/icons/Vanilla-DMZ"; + home.sessionVariables = { + TERMINAL = "wezterm"; + TERM = "wezterm"; + }; }; } diff --git a/machines/pcLexell/ranger.nix b/machines/pcLexell/ranger.nix index 7919e4c..60366d4 100644 --- a/machines/pcLexell/ranger.nix +++ b/machines/pcLexell/ranger.nix @@ -57,6 +57,13 @@ HEIGTH=$(echo -n $DIM | cut -d 'x' -f 2) echo "$WIDTH $HEIGTH" ''; + ranger-desktop = pkgs.makeDesktopItem { + name = "ranger"; + desktopName = "ranger"; + #exec = "${my-ranger}/bin/ranger"; + exec = "controlbox ranger"; + terminal = false; + }; in { environment.systemPackages = with pkgs; [ my-ranger #ranger @@ -81,6 +88,8 @@ in { pick get-main-img-dimension get-img-dimension + # + ranger-desktop ]; home-manager.users.${constants.MainUser} = {pkgs, ...}: { home.file.".config/ranger_nix".source = ./ranger;