Skip to content

permissions: add permission management for clipboard#10740

Open
littleblack111 wants to merge 6 commits intohyprwm:mainfrom
littleblack111:clip-perm
Open

permissions: add permission management for clipboard#10740
littleblack111 wants to merge 6 commits intohyprwm:mainfrom
littleblack111:clip-perm

Conversation

@littleblack111
Copy link
Contributor

Describe your PR, what does it fix/add?

fixes #10654

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

n/a

Is it ready for merging, or does it need work?

ready

Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO clip should be enabled-by-default. (Like keyboards)

Also add it to the default config.

Furthermore, I can think of some gaps: what about clipboard managers? I don't think you handled the zwlr clipboard protocol.

Use Log::INFO instead of Log::LOG (which doesn't exist) in DataDeviceWlr.cpp
and DataDevice.cpp. Also use the new Log::logger->log() style in XWM.cpp
instead of the deprecated Debug::log().
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements permission management for clipboard operations in Hyprland, addressing issue #10654. It adds two new permission types (PERMISSION_TYPE_CLIPBOARD_READ and PERMISSION_TYPE_CLIPBOARD_WRITE) that allow users to control which applications can read from or write to the clipboard. The permissions default to "allow" mode to maintain backward compatibility, but can be configured to "ask" or "deny" modes via configuration.

Changes:

  • Added clipboard read/write permission types to the dynamic permission system
  • Implemented permission checks in wayland data device protocols (wl_data_device and zwlr_data_control)
  • Added permission checks for XWayland clipboard operations
  • Added configuration support for clipboard permissions with aliases (clipboard-read/clip-read, clipboard-write/clip-write)

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/managers/permissions/DynamicPermissionManager.hpp Added PERMISSION_TYPE_CLIPBOARD_READ and PERMISSION_TYPE_CLIPBOARD_WRITE enum values
src/managers/permissions/DynamicPermissionManager.cpp Added string representations for clipboard permissions, set them to allow-by-default like keyboard permissions, added unused permissionToHumanString cases
src/protocols/core/DataDevice.cpp Added permission checks with async promise handling for clipboard read/write operations in wl_data_device protocol
src/protocols/DataDeviceWlr.cpp Added permission checks for clipboard read/write in zwlr_data_control protocol, but without async handling for pending state
src/xwayland/XWM.cpp Added permission checks for XWayland clipboard read/write with TODO comments about async operations
src/config/ConfigManager.cpp Added config parsing for clipboard-read and clipboard-write permission rules
example/hyprland.conf Added example permission configurations for clipboard managers

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Fix log level from INFO to DEBUG in DataDevice.cpp for offer operations
- Remove unused permissionToHumanString function
- Add I18n keys for clipboard read/write permissions
- Add primary selection permission check in XWM.cpp (was only checking clipboard)
- Add async permission handling in DataDeviceWlr.cpp for zwlr protocol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a clipboard permission

2 participants