Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open with ineractive menu from ~/.config/mimeapps.list #2373

Closed
2 of 3 tasks
moshpirit opened this issue Feb 21, 2025 · 2 comments
Closed
2 of 3 tasks

Open with ineractive menu from ~/.config/mimeapps.list #2373

moshpirit opened this issue Feb 21, 2025 · 2 comments
Labels
feature New feature request needs info

Comments

@moshpirit
Copy link

moshpirit commented Feb 21, 2025

yazi --debug output

Yazi
    Version: 0.4.2 (Arch Linux 2024-12-16)
    Debug  : false
    Triple : x86_64-unknown-linux-gnu (linux-x86_64)
    Rustc  : 1.83.0 (90b35a62 2024-11-26)

Ya
    Version: 0.4.2 (Arch Linux 2024-12-16)

Emulator
    Brand.from_env      : Some(Kitty)
    Emulator.detect     : Emulator { kind: Left(Kitty), light: false, cell_size: Some((9, 20)) }
    Emulator.detect_full: Ok(Emulator { kind: Left(Kitty), light: false, cell_size: Some((9, 20)) })

Adapter
    Adapter.matches: Kgp

Desktop
    XDG_SESSION_TYPE           : Some("wayland")
    WAYLAND_DISPLAY            : Some("wayland-1")
    DISPLAY                    : Some(":1")
    SWAYSOCK                   : Some("/run/user/1000/sway-ipc.1000.387162.sock")
    HYPRLAND_INSTANCE_SIGNATURE: None
    WAYFIRE_SOCKET             : None

SSH
    shared.in_ssh_connection: false

WSL
    WSL: false

NVIM
    NVIM          : false
    Neovim version: 0.10.4

Variables
    SHELL           : Some("/bin/bash")
    EDITOR          : Some("nvim")
    VISUAL          : None
    YAZI_FILE_ONE   : None
    YAZI_CONFIG_HOME: None
    YAZI_ZOXIDE_OPTS: None
    FZF_DEFAULT_OPTS: Some("--exact --color=16 --ansi --height=100%   --reverse --prompt \'\u{ec0d} \'  --preview \'[[ $(file --mime {}) =~ binary ]] && echo {} is a binary file || (highlight -O ansi -l {} || coderay {} || rougify {} || cat {}) 2> /dev/null | head -500\'")

Text Opener
    default     : Some(Opener { run: "$TERMINAL nvim \"$@\" &", block: false, orphan: true, desc: "Open in another terminal", for_: None, spread: true })
    block-create: Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "Open here", for_: None, spread: true })
    block-rename: Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "Open here", for_: None, spread: true })

Multiplexers
    TMUX               : 0
    tmux version       : tmux 3.5a
    tmux build flags   : enable-sixel=Unknown
    ZELLIJ_SESSION_NAME: None
    Zellij version     : 0.41.2

Dependencies
    file          : 5.46
    ueberzugpp    : No such file or directory (os error 2)
    ffmpeg/ffprobe: 7.1 / 7.1
    pdftoppm      : 25.01.0
    magick        : 7.1.1-43
    fzf           : 0.60.0
    fd/fdfind     : 10.2.0 / No such file or directory (os error 2)
    rg            : 14.1.1
    chafa         : 1.14.5
    zoxide        : 0.9.7
    7z/7zz        : 24.09 / No such file or directory (os error 2)
    jq            : 1.7.1

Clipboard
    wl-copy/paste: 2.2.1 / 2.2.1
    xclip        : 0.13
    xsel         : 1.2.1

I saw the idea of creating an "open with" interactive menu in #608 and #1163, and I was wondering if that would be possible to implement.
Since xdg uses ~/.config/mimeapps.list, there's might be some way to get some open with interactive menu that could follow each one's personal preferences.

Please describe the problem you're trying to solve

Right now, we can only use the first option associated with a mime type app, unless we manually create an alternative, such as:

open-image = [
  { run = 'feh -ZX --start-at "$@"', orphan = true, desc = "feh" },
]
open-pdf = [
  { run = 'zathura "$@" &', orphan = true, desc = "Zathura" },
]
open-video = [
  { run = 'vlc "$@" &', orphan = true, desc = "VLC" },
]

But doing this with each option is a colossal task, and we would need to modify it manually too.

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

Creating an "open with" that somehow reads this file to show other alternatives. This file has the following structure:

image/jpeg=gimp.desktop;org.kde.gwenview.desktop;org.inkscape.Inkscape.desktop;org.darktable.darktable.desktop;org.kde.kolourpaint.desktop;gimagereader-qt6.desktop;okularApplication_kimgio.desktop;org.kde.showfoto.desktop;org.kde.kdeconnect_open.desktop;

So when we are on a file, we can press O to get the "open" menu, go to the "open with" element and run the script that reads the type of the selected file, compare it to the list in ~/.config/mimeapps.list and showing each option separated by ; and ignoring the ".desktop" part.

If this requires too many resources, it could maybe be implemented as a plugin.

Additional context

No response

Checklist

  • I have searched the existing issues/discussions
  • The latest nightly build doesn't already have this feature
@moshpirit moshpirit added the feature New feature request label Feb 21, 2025
Copy link

Hey @moshpirit, I noticed that you did not correctly follow the feature request template. Please ensure that:

  • The requested feature does not exist in the newest nightly build.
  • The debug information (yazi --debug) is updated for the newest nightly.
  • All required fields in the checklist have been checked.

Issues marked with needs info will be closed if they have no activity within 2 days.

@sxyazi
Copy link
Owner

sxyazi commented Feb 21, 2025

Sorry, there's no plan to support this feature because it is Linux-specific, while Yazi is a cross-platform file manager (Linux, macOS, Windows, Android), and the opener is also designed to be cross-platform — using "for" to specify different commands for different platforms.

It is worth noting that the current "open with" already supports displaying multiple available apps — you can define multiple commands in the same opener rule or use multiple opener rules for the same open rule for flexible combinations.

@sxyazi sxyazi closed this as not planned Won't fix, can't repro, duplicate, stale Feb 21, 2025
@sxyazi sxyazi changed the title Open with ineractive menu Open with ineractive menu from ~/.config/mimeapps.list Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request needs info
Projects
None yet
Development

No branches or pull requests

2 participants