-
-
Notifications
You must be signed in to change notification settings - Fork 39
Add keyboard shortcut feature #160
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
base: master
Are you sure you want to change the base?
Conversation
wiiznokes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for this pr. This is a good work arround while waiting for the flatpak portal implementation.
I have some questions/suggestions. I understand you're not familiar with rust, so you can ask me if you don't understand something.
- Did you test your code? Does it works?
get_signal_file_pathis duplicated- You seems to write the timestamp but never actually use it in the code
- It would be nice if these change be in one module, e.i, the functions to read/write the signal file, and the subscription
- The subscription should be a file watcher, especially if we are doing io every 100ms
- why you define a shortcut in the app code? If i understand correctly, it should only be in the cosmic-comp config
|
Note that the approach looks good otherwise |
|
Thanks @wiiznokes -- I believe I addressed everything, please let me know if not. Tested fully on my local machine-- able to activate, start typing to search, use arrow keys to select, and enter to populate clipboard with selection and close the UI. Escape also exits the UI without altering the clipboard. |
|
So i wanted to make some minor modif before merging the pr (see this branch https://github.com/cosmic-utils/clipboard-manager/tree/pr160-modif), but i've realised that the popup doesn't show near the applet icon now. Maybe @wash2 have some insight about this problem 🙏 |
|
Yep, I noticed the positioning as well- I think it's due to how Wayland treats the layers, so I'm not sure how to align it with the applet icon if it goes that route. Whatever you think is best-- I have a local copy that works for me, so I'm happy to do anything else needed to get the functionality available to others. |
|
I LOVEE this, is it possible to have the selection This would help someone transitioning from windows with my muscle memory. |
|
There's an issue where having more items in history than length and using down arrow to scroll doesn't actually scroll them into view. |
|
Been testing this for a week. functions fine on pop-os 24.04. Could it be that it's missing a pause somewhere? |
Added a 10ms to file watcher to reduce CPU stress.
Implement delay in signal_file_watcher function
|
i'm not sure but i think the line that block us to use a regular xdg shell popup is this one: https://github.com/pop-os/cosmic-panel/blob/8eb8a1b6305213ec7402cb2ec24bef6b501b978a/cosmic-panel-bin/src/xdg_shell_wrapper/server/handlers/xdg_shell.rs#L45 Maybe we could add a check to bypass this if the client is not sandboxed |
|
sorry, i use this now and want to pull in the latest greatest changes so excuse me for butting in but hopefully this can help move this along:
|
- Add --toggle/-t CLI flag to toggle popup via keyboard shortcut - Add --help/-h with setup instructions for COSMIC custom shortcuts - Add file-based IPC (polling) for external toggle signaling - Fix popup positioning: icon click uses XDG popup (anchored), --toggle uses centered layer surface - Fix close_popup to correctly destroy layer surfaces vs XDG popups - Switch clipboard pipe reads from blocking std::io to async tokio with 500ms timeout (based on PR cosmic-utils#170) - Fix search input to support Enter-to-copy focused item - Add db lock file to .gitignore Incorporates and fixes issues from PR cosmic-utils#170 and PR cosmic-utils#160: - Replaces notify-based file watcher with simple 250ms polling to prevent CPU busy-loop caused by inotify on busy /run/user/ dir - Uses Anchor::empty() for centered popup instead of edge-anchored Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
I decided to go more with a dbus approach -> https://github.com/Lcstyle/clipboard-manager/tree/feat/dbus-toggle for a oneshot event based trigger rather than polling - reason being :
|
This adds the ability to assign keyboard shortcuts via the Cosmic keyboard custom settings to activate, search, select, and copy from the UI.
The command to add is:
and you can assign it to any shortcut. This will show/hide the clipboard manager, and allow you to type to search, use the arrow keys to select an item, and enter to copy and close the interface. Escape also works to exit without selecting anything.
Full disclosure: I am not an expert in Rust; I'm scratching my own itch to add this feature, so there may be a more suitable way of doing this.