Skip to content

Conversation

@Profiidev
Copy link

@Profiidev Profiidev commented Oct 18, 2025

Add an applet for the Cosmic Desktop. Closes #11

Functionality:

  • Search with modes: plain, regex, mime-type
  • Click entry to paste
  • Detail view when right clicking an entry
  • Delete or Favorite an entry from the detail view
  • Keyboard navigation using tabs and enter for paste
  • Settings menu when right clicking the icon to configure position and search mode
  • Toggle with global keyboard shortcut using ringboard-cosmic-applet toggle

Known Issues (also documented in the README of the applet):

  • When the search field is focused you need to press "Esc" 2 times to close the window. This is due to the first "Esc" being captured by the search field and not propagated as keyboard event
  • Text can not be selected in the detail view. This is due to the text widget in cosmic not supporting this
  • Search field is not automatically focused when opening the window. The command to focus the search is send but it seems like that when sending it before the window gets rendered for the first time it does nothing. This could be solved with a delay which could focus the search to late when the user starts typing to early or focus the search to early when the applet is not rendered

@SUPERCILEX
Copy link
Owner

This is awesome, thank you! I'll start digging into it next week.

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
Copy link
Owner

Choose a reason for hiding this comment

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

All the icons have a weird box shadow thing going, is that normal for cosmic?

Copy link
Author

Choose a reason for hiding this comment

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

Can you send a screenshot because i don't see any shadow

Copy link
Owner

Choose a reason for hiding this comment

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

Image

I'm talking about the stacked corner in the bottom left and top right. There's an extra offset box in the background. But I think this is just what cosmic icons look like? So seems fine.

Copy link
Author

@Profiidev Profiidev Oct 31, 2025

Choose a reason for hiding this comment

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

could also be just a rasteriser issuer / artifact

Copy link
Owner

Choose a reason for hiding this comment

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

Is this necessary? On X11, the startup latency is just terrible so keeping the application around is necessary to avoid the stuttery feeling of opening the clipboard. IIRC on Wayland startup was so fast that it didn't make a difference. If that's the case, I think I'd prefer to avoid keeping the application around to not hog memory (for example image buffers).

Copy link
Author

Choose a reason for hiding this comment

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

The application keeps running anyway, because the icon in the top panel wouldn't show up otherwise. I could clear the data saved in memory when closing the popup do reduce the memory usage in idle. The IPC is also required to make it possible to open the clipboard with a global keyboard shortcut, because it is running in the panel continuously and not exited when the popup is closed.

Copy link
Owner

Choose a reason for hiding this comment

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

Cool, that makes sense. I'll switch to using egui's notification mechanism with your toggle idea which is quite nice.

Copy link
Owner

Choose a reason for hiding this comment

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

Note to self: get rid of watcher utils crate and move into SDK under feature gate. Move startup code from egui into SDK under feature gate. Use toggle command to try and open existing instance with PID check.

Copy link
Author

Choose a reason for hiding this comment

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

You need to keep in mind that cosmic applets are launched once per screen where the panel is enabled and the toggle needs to be received by multiple apps and not just by one

Copy link
Owner

Choose a reason for hiding this comment

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

Damn, I thought that sounded crazy but you're right, I see every applet duplicated. Like surely it can't be that hard to make clicking the icon open one process and move the window around appropriately? Maybe there's an issue with dpi changes? Seems like a waste of resources.

Anyway, the current approach is broken though: if I have 3 monitors, I don't want the shortcut to open up the popup on all 3 monitors. Do you know if there's a way to detect which display you're on? Or more accurately which status bar?

Copy link
Owner

Choose a reason for hiding this comment

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

Hmmm, one insane idea would be to make the main GUI not an applet but rather just be a normal libcosmic app. And then the applet is actually just a thin wrapper that launches said GUI. This is maybe nice because you can then keep the clipboard open and move it around rather than having it pinned to the panel?

Copy link
Author

Choose a reason for hiding this comment

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

The weird part is it only opens on one monitor when pressing the shortcut at the moment. And i checked, the toggle is received by every instance of the application.

Copy link
Author

Choose a reason for hiding this comment

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

And even weirder it always opens on the correct monitor

@SUPERCILEX
Copy link
Owner

SUPERCILEX commented Oct 23, 2025 via email

@Profiidev
Copy link
Author

You don't need a seperate app for the icon because there is https://github.com/pop-os/cosmic-applets/tree/master/cosmic-panel-button which takes a desktop file as an argument and just is a simple app that displayes an icon in the panel. The cosmic-launcher and also other apps in cosmic work like this. The only big thing you need to change for that would be to integrate the settings into the main window because there is no right click for the cosmic-panel-button when you use it.

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
Copy link
Author

Choose a reason for hiding this comment

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

Why did you remove the journald logging? When the app is running in normal release model an is installed on a system you can't get any logs from it.

Copy link
Owner

Choose a reason for hiding this comment

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

I'm planning on getting rid of all logging. Anything worth logging in a GUI should be surfaced to the user IMO. The rest is just for devs and you can add pruntlns as neede when debugging stuff.

Copy link
Author

Choose a reason for hiding this comment

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

but printlns are useless when testing the application launched by cosmic directly in the panel, because you don't have the stdout of the process

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add COSMIC applet

2 participants