From 49b0f04fda83479d1c2db6471b362ce3ba1674ae Mon Sep 17 00:00:00 2001 From: Emmet Date: Sat, 4 Nov 2023 14:00:41 -0500 Subject: [PATCH] Ranger dnd optimization + qb filepicker --- user/app/browser/qutebrowser.nix | 7 +++++++ user/app/ranger/ranger.nix | 6 +++++- user/app/ranger/rc.conf | 2 ++ user/pkgs/ranger.nix | 7 +++++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/user/app/browser/qutebrowser.nix b/user/app/browser/qutebrowser.nix index e39fbfe..48c9876 100644 --- a/user/app/browser/qutebrowser.nix +++ b/user/app/browser/qutebrowser.nix @@ -82,6 +82,13 @@ c.url.searchengines = {'DEFAULT': 'https://startpage.com/do/search?query={}', config.set('completion.open_categories',["searchengines","quickmarks","bookmarks"]) +config.set('downloads.location.directory', '~/Downloads') + +config.set('fileselect.handler', 'external') +config.set('fileselect.single_file.command', ['kitty','-e','ranger','--choosefile={}']) +config.set('fileselect.multiple_files.command', ['kitty','-e','ranger','--choosefiles={}']) +config.set('fileselect.folder.command', ['kitty','-e','ranger','--choosedir={}']) + config.bind('t', 'open -t') config.bind('x', 'tab-close') config.bind('yf', 'hint links yank') diff --git a/user/app/ranger/ranger.nix b/user/app/ranger/ranger.nix index c69ff03..11c414c 100644 --- a/user/app/ranger/ranger.nix +++ b/user/app/ranger/ranger.nix @@ -1,5 +1,6 @@ { config, lib, pkgs, ... }: let myCbxScript = '' + # TODO fix this for wayland #!/bin/sh if [ "$#" -le "2" ]; then if [ "$1" = "copy" -o "$1" = "cut" ]; then @@ -14,10 +15,13 @@ in home.packages = with pkgs; [ ranger - xdragon + ripdrag highlight (pkgs.writeScriptBin "cbx" myCbxScript) ]; + xdg.mimeApps.associations.added = { + "inode/directory" = "ranger.desktop"; + }; home.file.".config/ranger/rc.conf".source = ./rc.conf; home.file.".config/ranger/rifle.conf".source = ./rifle.conf; home.file.".config/ranger/scope.sh" = { diff --git a/user/app/ranger/rc.conf b/user/app/ranger/rc.conf index 9c83ae7..83302df 100644 --- a/user/app/ranger/rc.conf +++ b/user/app/ranger/rc.conf @@ -503,6 +503,8 @@ map ud uncut map da cut mode=add map dr cut mode=remove map dt cut mode=toggle +map do shell -w ripdrag -x %s +map dO shell -w ripdrag -x * map yy chain copy; shell cbx copy %s map uy uncut diff --git a/user/pkgs/ranger.nix b/user/pkgs/ranger.nix index 3228509..5f579c7 100644 --- a/user/pkgs/ranger.nix +++ b/user/pkgs/ranger.nix @@ -17,9 +17,16 @@ # fixes a bug for kitty users that use image previews substituteInPlace ranger/ext/img_display.py \ --replace "self.image_id -= 1" "self.image_id = max(0, self.image_id - 1)" + + # fixes the .desktop file + substituteInPlace doc/ranger.desktop \ + --replace "Terminal=true" "Terminal=false" + substituteInPlace doc/ranger.desktop \ + --replace "Exec=ranger" "Exec=kitty -e ranger %U" ''; }); } ) ]; + }