Skip to content

Add support for system shell context menu extensions (7zip, etc.) #202

@BrianLeishman

Description

@BrianLeishman

Summary

Add support for integrating third-party shell context menu extensions (like 7-Zip, WinRAR, "Open with Code", etc.) into Marlin's file context menu. These are the custom menu items that applications register with the operating system to appear in native file explorers.

Current State

The app currently uses a hybrid context menu approach:

  • Native Tauri menus as primary (show_native_context_menu in src-tauri/src/commands.rs:4438-4688)
  • React fallback component (src/components/ContextMenu.tsx)

Current menu items are all internal to Marlin:

  • File operations (Rename, Copy, Cut, Paste, Delete, Trash)
  • View preferences (Hidden files, Sort options)
  • Utilities (Copy path, Calculate size, Reveal symlink)

No integration exists with OS-level shell extensions - the context menu only shows Marlin's own actions.

Proposed Changes

Windows (Primary target - most common use case)

Windows shell extensions are registered in the registry under:

  • HKEY_CLASSES_ROOT\*\shell\ - All files
  • HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\ - COM-based handlers
  • HKEY_CLASSES_ROOT\Directory\shell\ - Folders
  • HKEY_CLASSES_ROOT\<extension>\shell\ - Specific file types

Approach options:

  1. Registry parsing - Read registry keys to discover shell commands and add them to our menu
  2. IContextMenu COM interface - Use Windows COM APIs to invoke the actual shell context menu (more complete but complex)
  3. Hybrid - Parse registry for simple commands, provide "Show in Explorer" for complex handlers

macOS

  • Finder extensions use the FinderSync framework
  • Services menu items are registered in ~/Library/Services/ and /Library/Services/
  • Quick Actions appear in Finder's context menu
  • Consider: Reading services plist files and/or providing "Reveal in Finder" for full native menu access

Linux

  • Desktop files in /usr/share/applications/ define actions
  • Nautilus/Dolphin/Thunar each have their own extension mechanisms
  • *.desktop files can specify MimeType associations and custom actions
  • freedesktop.org specifications for file manager integration

Technical Notes

Relevant files:

  • src-tauri/src/commands.rs - Native context menu builder (lines 4438-4688)
  • src-tauri/src/menu.rs - Menu event handling
  • src/components/MainPanel.tsx - Right-click detection (lines 94-179)

Platform abstraction pattern already exists:

#[cfg(target_os = "macos")]
mod native_drag;

#[cfg(target_os = "windows")]
use windows::...

Existing Windows dependencies in Cargo.toml:

[target.'cfg(target_os = "windows")'.dependencies]
windows = { version = "0.62", features = ["Win32_Storage_FileSystem", ...] }

Would need to add registry and potentially shell features to the Windows crate.

Acceptance Criteria

  • Windows: Discover and display common shell extensions (7-Zip, VS Code "Open with Code", etc.)
  • Clicking shell extension items executes the associated command
  • Graceful fallback when shell extensions can't be loaded
  • macOS: At minimum, provide easy access to native Finder context menu (stretch: parse Services)
  • Linux: At minimum, parse .desktop file actions for common apps (stretch: file manager integration)
  • Shell extension items visually distinguished from Marlin's built-in items (separator or submenu)
  • Performance: Shell extension discovery should be cached, not block UI

Additional Context

This is a common expectation for power users switching from native file explorers. Windows is the highest priority since shell extensions are most prevalent there (7-Zip, WinRAR, TortoiseSVN/Git, VS Code, etc.).

Research links:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions