Skip to content

Latest commit

 

History

History
247 lines (185 loc) · 7.49 KB

File metadata and controls

247 lines (185 loc) · 7.49 KB

KDE Desktop Context Menu Limitations

Overview

This document explains why custom service menus (desktop files) cannot be added to the KDE Plasma desktop background context menu (right-click on wallpaper) and provides alternative solutions.

Why Desktop Context Menus Are Not Supported

Technical Limitation

KDE Plasma desktop background context menus are not handled by the same system as Dolphin file manager context menus:

  • Dolphin Context Menus: Use ServiceTypes=KonqPopupMenu/Plugin and are processed by Dolphin
  • Desktop Background Context: Handled directly by the Plasma shell, not Dolphin
  • No Bridge: There is no mechanism to connect ServiceMenus to the desktop background context

Architecture Differences

Dolphin File Manager Context:
┌─────────────────┐    ┌─────────────────────┐    ┌─────────────────┐
│ Right-click     │───▶│ Dolphin ServiceMenu │───▶│ Your Script     │
│ on file/folder  │    │ System              │    │ Execution       │
└─────────────────┘    └─────────────────────┘    └─────────────────┘

Desktop Background Context:
┌─────────────────┐    ┌─────────────────────┐
│ Right-click     │───▶│ Plasma Shell        │
│ on wallpaper    │    │ (No ServiceMenu)    │
└─────────────────┘    └─────────────────────┘

Historical Context

This limitation has existed since KDE 4 and continues through Plasma 5 and 6:

  • KDE Bug 179678: Longstanding request for desktop context ServiceMenus
  • KDE Forums: Multiple discussions about this limitation
  • No Official Solution: KDE developers have not implemented this feature

What Works vs What Doesn't

Supported Context Menus

Location ServiceMenu Works? ServiceTypes Notes
Dolphin file/folder ✅ Yes KonqPopupMenu/Plugin,all/allfiles Standard support
Dolphin empty area ✅ Sometimes KonqPopupMenu/Plugin,all/allfiles If configured correctly
Folder View desktop ⚠️ Maybe KonqPopupMenu/Plugin,all/allfiles Only if using Folder View mode
Dolphin directory ✅ Yes KonqPopupMenu/Plugin,inode/directory Directory-specific actions

Not Supported

Location Reason
Desktop background (wallpaper) Plasma shell limitation
Plasma panel context Different system
Desktop icons context Limited customization

Alternative Solutions

1. Global Keyboard Shortcuts

Pros:

  • Works from anywhere
  • Fast access
  • No context menu needed

Implementation:

# Create custom shortcuts in KDE Settings
# System Settings → Shortcuts → Custom Shortcuts
# Add new shortcut for each clipboard action:
# Command: ydmenu-py-env ClipboardPublish
# Trigger: Ctrl+Alt+P (or your preferred key)

Example Shortcuts:

  • Ctrl+Alt+P - Publish clipboard (.ru)
  • Ctrl+Alt+Shift+P - Publish clipboard (.com)
  • Ctrl+Alt+S - Save clipboard to stream

2. Plasma Widget/Applet

Pros:

  • Visual interface
  • Always visible
  • Customizable

Implementation:

  • Create a QML-based Plasma widget
  • Add buttons for clipboard actions
  • Install as a custom plasmoid

Basic QML Structure:

import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore

PlasmaCore.ToolTipArea {
    mainText: "Yandex Disk Clipboard"
    subText: "Click to access clipboard actions"
    
    MouseArea {
        onClicked: {
            // Call your script
            Qt.openUrlExternally("ydmenu-py-env ClipboardPublish")
        }
    }
}

3. KRunner Integration

Pros:

  • Search-based access
  • Fast execution
  • Integrates with KDE workflow

Implementation:

  • Create a KRunner plugin
  • Register commands like "yandisk publish"
  • Execute clipboard actions via search

4. Application Menu Integration

Pros:

  • Standard KDE integration
  • Easy to find
  • Consistent with other apps

Implementation:

  • Add your script to Applications menu
  • Create desktop files for each action
  • Place in ~/.local/share/applications/

Example Desktop File:

[Desktop Entry]
Type=Application
Name=Yandex Disk - Publish Clipboard
Exec=ydmenu-py-env ClipboardPublish
Icon=yandex-disk
Categories=Utility;

5. Dolphin Toolbar Integration

Pros:

  • Available in file manager
  • Quick access during file operations
  • Context-aware

Implementation:

  • Create Dolphin service menu actions
  • Add toolbar buttons
  • Integrate with file operations

6. Notification Area Integration

Pros:

  • Always accessible
  • System tray integration
  • Non-intrusive

Implementation:

  • Create a system tray applet
  • Add context menu to tray icon
  • Execute clipboard actions

Recommended Approach

For Yandex Disk Clipboard Actions

Primary Solution: Global Shortcuts

# Recommended keyboard shortcuts:
Ctrl+Alt+P     # Publish clipboard (.ru)
Ctrl+Alt+Shift+P # Publish clipboard (.com)  
Ctrl+Alt+S     # Save clipboard to stream

Secondary Solution: Application Menu

  • Add to Applications → Utilities
  • Create desktop files for each action
  • Easy to find and use

Implementation Steps

  1. Set up Global Shortcuts:

    # Open KDE System Settings
    # Navigate to: Shortcuts → Custom Shortcuts
    # Add new shortcut group: "Yandex Disk Clipboard"
    # Add commands for each action
  2. Create Application Menu Entries:

    # Create desktop files in ~/.local/share/applications/
    # Name them: yandisk-clipboard-publish.desktop
    # Add to Utilities category
  3. Test and Document:

    • Test each shortcut
    • Document for users
    • Add to project README

Technical Details

Why This Limitation Exists

  1. Plasma Architecture: Desktop shell is separate from file manager
  2. Security: Desktop context is highly restricted
  3. Performance: Desktop context needs to be fast
  4. Design Philosophy: KDE focuses on file manager integration

KDE Bug Reports

  • Bug 179678: "Allow ServiceMenus on desktop background"
  • Status: WONTFIX (by design)
  • Reason: Architectural limitation, not a bug

Community Discussions

  • KDE Forums: Multiple threads about this limitation
  • Reddit: r/kde discussions about desktop context menus
  • GitHub: Various workarounds and solutions

Conclusion

While KDE Plasma does not support custom service menus on the desktop background, there are several effective alternatives:

  1. Global Shortcuts - Most practical solution
  2. Application Menu - Standard KDE integration
  3. Plasma Widgets - Advanced customization
  4. KRunner Integration - Search-based access

For the Yandex Disk clipboard functionality, global shortcuts provide the best user experience and are the most reliable solution.

References