Skip to content

Add applet clipboard@chmodmasx#8247

Open
chmodmasx wants to merge 10 commits intolinuxmint:masterfrom
chmodmasx:master
Open

Add applet clipboard@chmodmasx#8247
chmodmasx wants to merge 10 commits intolinuxmint:masterfrom
chmodmasx:master

Conversation

@chmodmasx
Copy link
Contributor

Adds the clipboard@chmodmasx applet, a clipboard history manager for Cinnamon with a searchable menu, quick actions to clear history/clipboard, optional tracking of primary selection, and persistent storage.

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 adds a new clipboard history manager applet for Cinnamon Desktop. The applet provides a searchable clipboard history with configurable tracking options, persistent storage, and support for both clipboard and primary (mouse) selection.

Changes:

  • New clipboard history applet with search functionality and configurable history size
  • Spanish translation files (POT and PO)
  • Comprehensive settings schema with history, tracking, and menu customization options

Reviewed changes

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

Show a summary per file
File Description
clipboard@chmodmasx/screenshot.png Screenshot of the applet in action
clipboard@chmodmasx/info.json Spices metadata with author information
clipboard@chmodmasx/files/clipboard@chmodmasx/stylesheet.css CSS styling for menu, search box, and history items
clipboard@chmodmasx/files/clipboard@chmodmasx/settings-schema.json Settings definition with history, tracking, and menu sections
clipboard@chmodmasx/files/clipboard@chmodmasx/po/es.po Spanish translation file
clipboard@chmodmasx/files/clipboard@chmodmasx/po/clipboard@chmodmasx.pot Translation template file
clipboard@chmodmasx/files/clipboard@chmodmasx/metadata.json Applet metadata with version and Cinnamon compatibility
clipboard@chmodmasx/files/clipboard@chmodmasx/icon.png Applet icon for the panel
clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js Main applet implementation with clipboard monitoring, menu building, and history management
clipboard@chmodmasx/README.md Comprehensive documentation with features, usage, configuration, and troubleshooting

@github-actions
Copy link
Contributor

Best-practices scanner

This is a regex-based check for API usage that can pose security, performance or
maintainability issues, or that may already be provided by Cinnamon. Having code flagged
by it doesn't automatically disqualify a pull request.

This check is not perfect will not replace a normal review.


Found 14 potential issue(s):

⚠️ sync_file_get_contents

clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js:136

let [ok, contents] = GLib.file_get_contents(this._historyPath);

Synchronous file_get_contents() blocks the main loop.
Use Gio.File.load_contents_async() instead.

clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js:730

let [ok, contents] = GLib.file_get_contents(schemaPath);

Synchronous file_get_contents() blocks the main loop.
Use Gio.File.load_contents_async() instead.

⚠️ sync_file_test

clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js:122

if (!GLib.file_test(dataDir, GLib.FileTest.IS_DIR)) {

file_test() is a synchronous stat call that can block on slow/network filesystems.
Prefer attempting the operation and handling a Gio.IOErrorEnum.NOT_FOUND error instead.

clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js:132

if (!GLib.file_test(this._historyPath, GLib.FileTest.EXISTS)) {

file_test() is a synchronous stat call that can block on slow/network filesystems.
Prefer attempting the operation and handling a Gio.IOErrorEnum.NOT_FOUND error instead.

clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js:713

if (GLib.file_test(configPath, GLib.FileTest.EXISTS)) {

file_test() is a synchronous stat call that can block on slow/network filesystems.
Prefer attempting the operation and handling a Gio.IOErrorEnum.NOT_FOUND error instead.

clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js:716

if (!GLib.file_test(configDir, GLib.FileTest.IS_DIR)) {

file_test() is a synchronous stat call that can block on slow/network filesystems.
Prefer attempting the operation and handling a Gio.IOErrorEnum.NOT_FOUND error instead.

clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js:721

if (!GLib.file_test(schemaPath, GLib.FileTest.EXISTS)) {

file_test() is a synchronous stat call that can block on slow/network filesystems.
Prefer attempting the operation and handling a Gio.IOErrorEnum.NOT_FOUND error instead.

clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js:724

if (!GLib.file_test(schemaPath, GLib.FileTest.EXISTS)) {

file_test() is a synchronous stat call that can block on slow/network filesystems.
Prefer attempting the operation and handling a Gio.IOErrorEnum.NOT_FOUND error instead.

⚠️ hardcoded_data_dir

clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js:26

Gettext.bindtextdomain(AppletUUID, GLib.get_home_dir() + "/.local/share/locale");

Avoid hardcoding .local/share in paths. Use GLib.get_user_data_dir() instead,
which respects the XDG_DATA_HOME environment variable.

clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js:720

let schemaPath = GLib.build_filenamev([GLib.get_home_dir(), ".local/share/cinnamon/applets", uuid, "settings-schema.json"]);

Avoid hardcoding .local/share in paths. Use GLib.get_user_data_dir() instead,
which respects the XDG_DATA_HOME environment variable.

⚠️ gtk_forbidden

clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js:513

this._clipboard = Gtk.Clipboard.get_default(this._display);

Most Gtk APIs cannot be used in the Cinnamon runtime.
Use St (Shell Toolkit) equivalents instead.
Allowed Gtk APIs: IconTheme, DirectionType, TextDirection, PositionType,
accelerator_parse, accelerator_get_label, accelerator_name,
Settings, Widget.get_default_direction.

clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js:515

this._primary = Gtk.Clipboard.get_for_display(this._display, this._primaryAtom);

Most Gtk APIs cannot be used in the Cinnamon runtime.
Use St (Shell Toolkit) equivalents instead.
Allowed Gtk APIs: IconTheme, DirectionType, TextDirection, PositionType,
accelerator_parse, accelerator_get_label, accelerator_name,
Settings, Widget.get_default_direction.

⚠️ gdk_display

clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js:509

this._display = Gdk.Display.get_default();

Do not use Gdk.Display in the Cinnamon runtime.
Use Meta.Display (via global.display) instead.

ℹ️ shell_string_spawn

clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js:704

Util.spawnCommandLine(command);

Prefer argument vector spawn functions over shell command strings.
This is especially important when arguments include untrusted input (user data,
filenames, settings values, etc.) as shell strings are vulnerable to injection.
Static command strings are generally fine, but argv is always safer.
Use Util.spawn(["cmd", "arg1", "arg2"]) or Util.trySpawn() instead.


Automated pattern check.

@github-actions
Copy link
Contributor

Best-practices scanner

This is a regex-based check for API usage that can pose security, performance or
maintainability issues, or that may already be provided by Cinnamon. Having code flagged
by it doesn't automatically disqualify a pull request.

This check is not perfect will not replace a normal review.


Found 4 potential issue(s):

⚠️ sync_file_query_exists

clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js:775

if (!schemaFile.query_exists(null)) {

query_exists() is a synchronous call that can block on slow/network filesystems.
Prefer attempting the operation and handling a Gio.IOErrorEnum.NOT_FOUND error instead.

clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js:779

if (!schemaFile.query_exists(null)) {

query_exists() is a synchronous call that can block on slow/network filesystems.
Prefer attempting the operation and handling a Gio.IOErrorEnum.NOT_FOUND error instead.

⚠️ gtk_forbidden

clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js:543

// forbidden Gtk.Clipboard and Gdk.Display APIs.

Most Gtk APIs cannot be used in the Cinnamon runtime.
Use St (Shell Toolkit) equivalents instead.
Allowed Gtk APIs: IconTheme, DirectionType, TextDirection, PositionType,
accelerator_parse, accelerator_get_label, accelerator_name,
Settings, Widget.get_default_direction.

clipboard@chmodmasx/files/clipboard@chmodmasx/applet.js:549

// Without Gtk.Clipboard's owner-change signal, clipboard monitoring is

Most Gtk APIs cannot be used in the Cinnamon runtime.
Use St (Shell Toolkit) equivalents instead.
Allowed Gtk APIs: IconTheme, DirectionType, TextDirection, PositionType,
accelerator_parse, accelerator_get_label, accelerator_name,
Settings, Widget.get_default_direction.


Automated pattern check.

chmodmasx and others added 3 commits February 28, 2026 15:41
- Changed synchronous query_exists() to Gio asynchronous query_info_async() in _ensureSettingsFile to prevent UI blocks on slow network filesystems.
- Removed legacy "Gtk" and "Gdk" string references from source comments to pass automated regex checker.
- Bumped applet version to 1.0.2 in metadata and translations.
- Add debounce to search input (150ms) to avoid rebuild on every keystroke
- Add debounce to settings changes (200ms) to prevent multiple rebuilds
- Increase minimum polling interval from 1 to 5 seconds to reduce system load
- Cleanup timers when applet is removed to prevent memory leaks
- Version bump to 1.0.3
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.

2 participants