Skip to content

Drop hard xclip dependency#68

Open
tom-mi wants to merge 2 commits intoTNG:mainfrom
tom-mi:feat-drop-xclip-dependency
Open

Drop hard xclip dependency#68
tom-mi wants to merge 2 commits intoTNG:mainfrom
tom-mi:feat-drop-xclip-dependency

Conversation

@tom-mi
Copy link
Copy Markdown

@tom-mi tom-mi commented Apr 24, 2026

As discussed in #67

  • adapt debian dependencies
  • allow xsel as well (adapting both Debian & Arch dependencies again)

Works locally installing the .deb in Debian 13 (I did not test it on Arch, but the package is also called xsel in Arch, so I don't expect any surprises)


Note

Low Risk
Low risk: packaging metadata and a small Linux clipboard fallback change; main command-generation logic is untouched.

Overview
Drops the hard Debian dependency on xclip by moving clipboard tools to suggested/optional dependencies (Suggests: xsel, xclip, wl-clipboard) and updating the Arch PKGBUILD optdepends to prefer xsel with xclip as fallback.

Updates please.sh clipboard handling on Linux/X11 to try xsel first, then xclip, and improves the error message when neither is installed.

Reviewed by Cursor Bugbot for commit fb21779. Bugbot is set up for automated code reviews on this repo. Configure here.

* move to suggests (similar to the optional dependency of the Arch
  PKGBUILD)

Signed-off-by: Thomas Reifenberger <thomas.reifenberger@tngtech.com>
Copy link
Copy Markdown

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

Updates packaging and clipboard integration to remove a hard dependency on xclip, allowing xsel/xclip/wl-clipboard to be optional and used as available.

Changes:

  • Linux/X11 clipboard fallback now tries xsel first, then xclip, with an updated error message when neither is available.
  • Arch packaging metadata updated to prefer xsel with xclip as a fallback.
  • Debian package metadata updated to drop xclip from Depends and add clipboard tools under Suggests.

Reviewed changes

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

File Description
please.sh Updates X11 clipboard handling to prefer xsel and improves missing-tool messaging.
PKGBUILD Adjusts optdepends to list xsel preferred and xclip as fallback.
.github/workflows/create-release.yml Updates Debian control metadata to move clipboard tools to Suggests.

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

Comment thread please.sh
;;
Linux*)
if [ "$XDG_SESSION_TYPE" == "wayland" ]; then
echo -n "${command}" | wl-copy --primary
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

On Wayland, this calls wl-copy unconditionally. Since wl-clipboard is now an optional dependency (Suggests/optdepends), this can fail with a plain "command not found". Consider mirroring the X11 logic by checking for wl-copy (and optionally wl-paste) with command -v and emitting a clear error message when missing.

Suggested change
echo -n "${command}" | wl-copy --primary
if command -v wl-copy &> /dev/null; then
echo -n "${command}" | wl-copy --primary
else
echo "wl-copy is not installed. Please install wl-clipboard to copy to the clipboard on Wayland. Exiting."
exit 1
fi

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This seems like an obvious improvement to me. If nobody objects, I'll incorporate this change next week.

Comment thread please.sh Outdated
Comment on lines 411 to 412
echo "Neither xsel nor xclip is installed. Exiting."
exit 1
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

This error message is written to stdout. For an error path that exits non-zero, it should go to stderr (e.g., redirect the echo) so users can pipe/parse normal output reliably.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sounds reasonable. If nobody objects, I'll incorporate this change next week.

@thomas-endres-tng
Copy link
Copy Markdown
Contributor

@tom-mi, can you have a look at the changes suggested by Copilot?

Comment thread please.sh Outdated
echo -n "${command}" | wl-copy --primary
else
if command -v xclip &> /dev/null; then
if command -v xsel &> /dev/null; then
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What I'm not sure about here is that this changes the default command that is used. Previously, we always used xclip, and didn't support xsel at all, and now we are preferring xsel.

This means that for some users who previously used xclip, but also have xsel installed, the behavior would now change. In terms of keeping behavior consistent, I would prefer xclip as the first option. But I'm not knowledgeable enough about the Unix ecosystem of clipboard managers to judge the differences.

@tom-mi did you have a specific reason for putting xsel first?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Well my reasoning was that as xclip is banned on certain machines in our organization, xsel might be the better choice altogether. But I don't have a strong opinion. I'll update the PR accordingly to keep the default behaviour

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I updated the last commit

Signed-off-by: Thomas Reifenberger <thomas.reifenberger@tngtech.com>
@tom-mi tom-mi force-pushed the feat-drop-xclip-dependency branch from fb21779 to 94577cf Compare May 8, 2026 18:00
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.

4 participants