From d4ad0cedc2f6b947a1fd0c5cda43b0eef1e5f21b Mon Sep 17 00:00:00 2001 From: Michel Fedde Date: Fri, 11 Jul 2025 22:34:02 +0200 Subject: [PATCH] Adds gvfs support to yazi --- .../yadm/bootstrap.v2/applications/30-Yazi.sh | 3 +- .config/yazi/gvfs.private | 1 + .config/yazi/init.lua | 31 +++++++++++++++++ .config/yazi/keymap.toml | 26 ++++++++++++++- .config/yazi/package.toml | 33 +++++++++++-------- .config/yazi/yazi.toml | 4 +++ 6 files changed, 82 insertions(+), 16 deletions(-) create mode 100644 .config/yazi/gvfs.private diff --git a/.config/yadm/bootstrap.v2/applications/30-Yazi.sh b/.config/yadm/bootstrap.v2/applications/30-Yazi.sh index e4fd17e..803f490 100755 --- a/.config/yadm/bootstrap.v2/applications/30-Yazi.sh +++ b/.config/yadm/bootstrap.v2/applications/30-Yazi.sh @@ -1,7 +1,8 @@ #!/bin/env sh addApplications yazi p7zip jq poppler fd ripgrep fzf zoxide imagemagick fuse-archive zip \ - blobdrop-git ouch xdg-desktop-portal-termfilechooser-hunkyburrito-git + blobdrop-git ouch xdg-desktop-portal-termfilechooser-hunkyburrito-git \ + gvfs gvfs-smb setupYazi() { ya pack -i diff --git a/.config/yazi/gvfs.private b/.config/yazi/gvfs.private new file mode 100644 index 0000000..ff9ba60 --- /dev/null +++ b/.config/yazi/gvfs.private @@ -0,0 +1 @@ +[{"\\x6E\\x61\\x6D\\x65":"\\x6D\\x6F\\x76\\x69\\x65\\x73","\\x73\\x63\\x68\\x65\\x6D\\x65":"\\x73\\x6D\\x62","\\x69\\x73\\x5F\\x6D\\x61\\x6E\\x75\\x61\\x6C\\x6C\\x79\\x5F\\x61\\x64\\x64\\x65\\x64":true,"\\x73\\x65\\x72\\x76\\x69\\x63\\x65\\x5F\\x64\\x6F\\x6D\\x61\\x69\\x6E":"\\x57\\x4F\\x52\\x4B\\x47\\x52\\x4F\\x55\\x50","\\x75\\x72\\x69":"\\x73\\x6D\\x62\\x3A\\x2F\\x2F\\x6D\\x69\\x63\\x68\\x65\\x6C\\x40\\x68\\x6F\\x6D\\x65\\x2E\\x73\\x65\\x72\\x76\\x65\\x72\\x2F\\x6D\\x6F\\x76\\x69\\x65\\x73"}] \ No newline at end of file diff --git a/.config/yazi/init.lua b/.config/yazi/init.lua index 7c6dc6e..5a0c4ed 100644 --- a/.config/yazi/init.lua +++ b/.config/yazi/init.lua @@ -88,3 +88,34 @@ require("yatline"):setup({ }) require("git"):setup() + +require("gvfs"):setup({ + -- (Optional) Allowed keys to select device. + which_keys = "1234567890qwertyuiopasdfghjklzxcvbnm-=[]\\;',./!@#$%^&*()_+{}|:\"<>?", + + -- (Optional) Save file. + -- Default: ~/.config/yazi/gvfs.private + save_path = os.getenv("HOME") .. "/.config/yazi/gvfs.private", + + -- (Optional) input position. Default: { "top-center", y = 3, w = 60 }, + -- Position, which is a table: + -- `1`: Origin position, available values: "top-left", "top-center", "top-right", + -- "bottom-left", "bottom-center", "bottom-right", "center", and "hovered". + -- "hovered" is the position of hovered file/folder + -- `x`: X offset from the origin position. + -- `y`: Y offset from the origin position. + -- `w`: Width of the input. + -- `h`: Height of the input. + input_position = { "center", y = 0, w = 60 }, + + -- (Optional) Select where to save passwords. Default: nil + -- Available options: "keyring", "pass", or nil + password_vault = "keyring", + + -- (Optional) Only need if you set password_vault = "pass" + -- Read the guide at SECURE_SAVED_PASSWORD.md to get your key_grip + key_grip = "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", + + -- (Optional) save password automatically after mounting. Default: false + save_password_autoconfirm = true, +}) diff --git a/.config/yazi/keymap.toml b/.config/yazi/keymap.toml index f344dec..904baf8 100644 --- a/.config/yazi/keymap.toml +++ b/.config/yazi/keymap.toml @@ -10,7 +10,31 @@ prepend_keymap = [ { on = "", desc = "Move to the tab on the left", run = "tab_switch 1 --relative" }, { on = "", desc = "Move to the tab on the right", run = "tab_switch -1 --relative" }, { on = ["c", 'm'], desc = "Change file mod", run = "plugin chmod"}, - { on = ["", 'c'], desc = "Compress file", run = "plugin ouch" } + { on = ["", 'c'], desc = "Compress file", run = "plugin ouch" }, + + # gvfs plugin + { on = [ "M", "m" ], run = "plugin gvfs -- select-then-mount --jump", desc = "Select device to mount and jump to its mount point" }, + # This will remount device under cwd (e.g. cwd = /run/user/1000/gvfs/DEVICE_1/FOLDER_A, device mountpoint = /run/user/1000/gvfs/DEVICE_1) + { on = [ "M", "R" ], run = "plugin gvfs -- remount-current-cwd-device", desc = "Remount device under cwd" }, + { on = [ "M", "u" ], run = "plugin gvfs -- select-then-unmount", desc = "Select device then unmount" }, + + # Add|Edit|Remove mountpoint: smb, sftp, ftp, nfs, dns-sd, dav, davs, dav+sd, davs+sd, afp, afc, sshfs + # Read more about the schemes here: https://wiki.gnome.org/Projects(2f)gvfs(2f)schemes.html + # For example: smb://user@192.168.1.2/share, sftp://user@192.168.1.2/, ftp://192.168.1.2/ + # - Scheme/Mount URIs shouldn't contain password. + # - Google Drive, One drive are mounted automatically via GNOME Online Accounts (GOA). Avoid adding them. Use GOA instead: ./GNOME_ONLINE_ACCOUNTS_GOA.md + # - MTP, GPhoto2, AFC, Hard disk/drive are listed automatically. Avoid adding them + { on = [ "M", "a" ], run = "plugin gvfs -- add-mount", desc = "Add a GVFS mount URI" }, + # Edit or remove a GVFS mount URI will clear saved passwords for that mount URI. + { on = [ "M", "e" ], run = "plugin gvfs -- edit-mount", desc = "Edit a GVFS mount URI" }, + { on = [ "M", "r" ], run = "plugin gvfs -- remove-mount", desc = "Remove a GVFS mount URI" }, + + # Jump + { on = [ "g", "m" ], run = "plugin gvfs -- jump-to-device", desc = "Select device then jump to its mount point" }, + { on = [ "g", "p" ], run = "plugin gvfs -- jump-back-prev-cwd", desc = "Jump back to the position before jumped to device" }, + + { on = [ "`" ], run = "plugin command-palette", desc = "Command palette (fzf)"} + ] append_keymap = [ { on = ['c', 'v'], desc = "Drag selected files", run = "shell 'blobdrop -b \"$@\"'" }, diff --git a/.config/yazi/package.toml b/.config/yazi/package.toml index 4876f3d..c3c1000 100644 --- a/.config/yazi/package.toml +++ b/.config/yazi/package.toml @@ -1,37 +1,42 @@ [[plugin.deps]] use = "imsi32/yatline" -rev = "2ecf715" -hash = "38e2ea4703ea606d4eef574e8e8b8fd7" +rev = "88bd1c5" +hash = "981acbe9b758b1af3a8154c932bb936d" [[plugin.deps]] use = "yazi-rs/plugins:mount" -rev = "864a021" -hash = "dd97eede8e20e59cd2604e8006e470e2" +rev = "b886025" +hash = "f10a14e823382d90fab5b3ee54cb38fe" [[plugin.deps]] use = "yazi-rs/plugins:git" -rev = "864a021" -hash = "e0ada736ea676c2bbb3ec705a49526ef" +rev = "b886025" +hash = "63b6c222bf2103b3023389dde5e2ecfe" [[plugin.deps]] use = "yazi-rs/plugins:chmod" -rev = "864a021" -hash = "2f1053f89d1a301a648ab181d0948e38" +rev = "b886025" +hash = "1adc12c2b2b025411ab61eb8f0879574" [[plugin.deps]] use = "pirafrank/what-size" -rev = "f1c6b69" -hash = "6e789212eb41d937bab04877ca361099" +rev = "d896656" +hash = "62251f94eb67648d42cdfcfb8be0fad2" [[plugin.deps]] use = "Deepak22903/kdeconnect-send" -rev = "ac23a0e" -hash = "a1e38696a2ab2c607923b77f85f8058e" +rev = "5d8994a" +hash = "677ab6eeb06af916487b7b6c0f2a96fe" [[plugin.deps]] use = "ndtoan96/ouch" -rev = "2496cd9" -hash = "5b9dea47776a30946cfbf83232d18fb1" +rev = "bb941c4" +hash = "956b02fe8213e7b92e21a941b9abe764" + +[[plugin.deps]] +use = "boydaihungst/gvfs" +rev = "a21af9c" +hash = "f7273e62595318d3b2d5cb5eb4bea856" [flavor] deps = [] diff --git a/.config/yazi/yazi.toml b/.config/yazi/yazi.toml index e6a34ea..ff1d5cf 100644 --- a/.config/yazi/yazi.toml +++ b/.config/yazi/yazi.toml @@ -1,5 +1,9 @@ [opener] extract = [] +play = [ + { run = 'mpv "$@"', orphan = true, for = "unix", desc = "Open with MPV" }, + { run = 'vlc "file://$0"', orphan = true, for = "unix", desc = "Open with VLC" } +] [plugin] prepend_fetchers = [