Skip to content

feat(clipboard): add startup cleanup and automatic paste options#922

Open
alepspizzetti wants to merge 2 commits into
noctalia-dev:mainfrom
alepspizzetti:feature/clipboard-startup-cleanup-auto-paste
Open

feat(clipboard): add startup cleanup and automatic paste options#922
alepspizzetti wants to merge 2 commits into
noctalia-dev:mainfrom
alepspizzetti:feature/clipboard-startup-cleanup-auto-paste

Conversation

@alepspizzetti

Copy link
Copy Markdown

Summary

  • add an opt-in setting to clear regular clipboard history whenever Noctalia Shell starts or restarts
  • add an opt-in setting to automatically paste the selected clipboard entry into the previously focused window
  • preserve pinned entries when startup cleanup is enabled
  • document wtype as an optional dependency for automatic paste
  • add English and Portuguese settings translations

Motivation

Clipboard history can grow across shell sessions, and selecting a previous entry currently requires a separate paste action. These options let users choose a more private startup behavior and a faster selection workflow without changing the default behavior for existing installations.

Both options default to false. Existing user settings continue to take precedence over manifest defaults and are preserved by Noctalia plugin updates.

Implementation

Automatic paste closes the plugin panel first, waits briefly for focus to return to the previous window, and then emits Ctrl+V through wtype. Startup cleanup reuses the existing cliphist wipe path, so pinned entries remain untouched.

The plugin version is bumped from 1.0.3 to 1.1.0.

Testing

Tested locally on Noctalia Shell 4.7.7 with Niri:

  • enabled startup cleanup and confirmed regular history is cleared after restarting Noctalia
  • confirmed pinned entries are preserved by the cleanup path
  • enabled automatic paste and confirmed text and image entries paste into the previously focused application
  • confirmed settings persist across shell restarts
  • validated all modified JSON files with jq

Add opt-in settings to clear regular clipboard history when Noctalia starts and to paste selected entries into the previously focused window.

Preserve pinned entries during startup cleanup, defer Ctrl+V until the panel closes, document the optional wtype dependency, and add English and Portuguese translations.
@github-actions

Copy link
Copy Markdown
Contributor

@yanekyuk - this PR modifies your plugin. Please review when you have a chance.

@alepspizzetti alepspizzetti marked this pull request as ready for review June 12, 2026 20:46
Copilot AI review requested due to automatic review settings June 12, 2026 20:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds two new Clipboard plugin settings to control startup history clearing and optional auto-paste behavior after selecting an entry.

Changes:

  • Bumped plugin version and added new default settings (clearHistoryOnStartup, autoPasteOnSelect) to the manifest.
  • Exposed the new settings in the Settings UI and updated i18n strings (EN/PT).
  • Implemented auto-paste by invoking wtype after the panel closes, and added optional startup history wipe.

Reviewed changes

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

Show a summary per file
File Description
clipboard/manifest.json Version bump and new default settings flags.
clipboard/i18n/en.json Adds English strings for the new settings.
clipboard/i18n/pt.json Adds Portuguese strings for the new settings.
clipboard/Settings.qml Adds toggles + settings persistence for the new flags; uses manifest defaults as fallback.
clipboard/Panel.qml Sets a “paste after close” flag based on settings and triggers paste after closing the panel.
clipboard/Main.qml Adds a Process and helper to run wtype for auto-paste; clears history on startup when configured.
clipboard/README.md Documents the new settings and optional wtype dependency.

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

Comment thread clipboard/Panel.qml
Comment on lines +1167 to +1172
onCopied: {
const cfg = root.pluginApi?.pluginSettings || ({});
const defaults = root.pluginApi?.manifest?.metadata?.defaultSettings || ({});
root.pasteAfterClose = cfg.autoPasteOnSelect ?? defaults.autoPasteOnSelect ?? false;
closePanelTimer.restart();
}
Comment thread clipboard/Main.qml
Comment on lines +105 to +110
const runtimeDir = Quickshell.env("XDG_RUNTIME_DIR") || "";
const waylandDisplay = Quickshell.env("WAYLAND_DISPLAY") || "";
pasteProc.command = ["bash", "-c",
'sleep 0.5; XDG_RUNTIME_DIR="$1" WAYLAND_DISPLAY="$2" wtype -M ctrl -P v -p v -m ctrl',
"--", runtimeDir, waylandDisplay];
pasteProc.running = true;
Comment thread clipboard/i18n/pt.json Outdated
Comment on lines +33 to +36
"clear-history-on-startup": "Limpar historico ao iniciar",
"clear-history-on-startup-description": "Limpar o historico comum sempre que o Noctalia Shell iniciar ou reiniciar. Itens fixados sao preservados.",
"auto-paste-on-select": "Colar automaticamente ao selecionar",
"auto-paste-on-select-description": "Fechar o painel e enviar Ctrl+V para a janela anterior depois de selecionar uma entrada.",
Centralize the automatic-paste setting lookup, add a configurable 200-5000 ms focus restoration delay with a 500 ms default, and correct Portuguese diacritics.
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