d2phap/ImageGlass · warning · NotSupportedException

IGE: This feature is not supported on macOS.

Error message

IGE: This feature is not supported on macOS.

What it means

Thrown by MacShellProvider.SetDefaultPhotoViewerAsync. Unlike Windows (which can write the registry / Default Apps associations) there is no supported public macOS API to programmatically register an app as the default handler for a set of file extensions; macOS requires the user to confirm via System Settings. ImageGlass therefore hard-rejects the operation on macOS with NotSupportedException. The method is part of the IShellProvider contract and returns Task<DefaultAppScope?>, but on Mac it never produces a scope.

Source

Thrown at source/ImageGlass.Mac/Common/ServiceProviders/MacShellProvider.cs:177

        if (string.IsNullOrWhiteSpace(dirPath)) return;

        try
        {
            Directory.CreateDirectory(dirPath);
        }
        catch { }

        BHelper.RunProcess("open", $"\"{dirPath}\"");
    }


    /// <summary>
    /// <inheritdoc/>
    /// </summary>
    /// <exception cref="NotSupportedException"></exception>
    public Task<DefaultAppScope?> SetDefaultPhotoViewerAsync(string[] extensions, bool enable)
    {
        throw new NotSupportedException("IGE: This feature is not supported on macOS.");
    }


    /// <summary>
    /// <inheritdoc/>
    /// </summary>
    public Task SetLockScreenAsync(string filePath)
    {
        throw new NotSupportedException("IGE: This feature is not supported on macOS.");
    }


    /// <summary>
    /// <inheritdoc/>
    /// </summary>
    public void SetWallpaper(string filePath)
    {
        // use AppleScript via System Events (works on macOS Ventura+)

View on GitHub (pinned to 4a3c4fecef)

Solutions

  1. Hide the 'Set as default photo viewer' UI on macOS via XAML OnPlatform or OperatingSystem.IsMacOS() so the call is never issued.
  2. Introduce a capability property on IShellProvider (e.g. SupportsDefaultPhotoViewer) that returns false on Mac and branch on it.
  3. If macOS support is required, implement a fallback that opens System Settings > Desktop & Dock / the relevant pane and instructs the user to set the association manually, instead of throwing.
  4. At minimum, catch NotSupportedException at the call site and show an informational message instead of crashing.

Example fix

// before
await Core.ShellProvider.SetDefaultPhotoViewerAsync(exts, enable: true);

// after
if (!OperatingSystem.IsMacOS())
{
    await Core.ShellProvider.SetDefaultPhotoViewerAsync(exts, enable: true);
}
Defensive patterns

Strategy: validation

Validate before calling

// macOS has no public API to set the default photo viewer.
if (!OperatingSystem.IsMacOS())
{
    _ = Core.ShellProvider.SetDefaultPhotoViewerAsync(exts, enable: true);
}

Type guard

// Capability gate:
// bool SupportsDefaultPhotoViewer => !OperatingSystem.IsMacOS();
if (Core.ShellProvider is { SupportsDefaultPhotoViewer: true } shell)
    await shell.SetDefaultPhotoViewerAsync(exts, enable: true);

Try / catch

try { await Core.ShellProvider.SetDefaultPhotoViewerAsync(exts, true); }
catch (NotSupportedException) when (OperatingSystem.IsMacOS())
{ /* expected on macOS */ }

Prevention

When it happens

Trigger: Invoking the 'Set as default photo viewer' command or calling Core.ShellProvider.SetDefaultPhotoViewerAsync(extensions, enable) on the ImageGlass.Mac build. Any plugin or settings flow that assumes default-app registration works cross-platform.

Common situations: A settings page exposes the 'default photo viewer' toggle without hiding it on macOS; porting the Windows default-app flow and assuming every IShellProvider implements it; an automation/script calling the API on Mac.

Related errors


AI-assisted analysis of d2phap/ImageGlass@4a3c4fecef (2026-08-13). Data as JSON: /api/errors/fa6dbdb7fad8c86a. Report an issue: GitHub.