ClipCleaner is a simple Linux clipboard monitor written in Go. It automatically detects YouTube short links (https://youtu.be/...
) with a ?si=
source identifier in your clipboard, cleans up the link by removing the source identifier and anything after it, and places the cleaned link back on your clipboard.
Example:
- Before:
https://youtu.be/q7kqrGC_sXE?si=Sw_ujHPztS4h7W7h
- After:
https://youtu.be/q7kqrGC_sXE
- Monitors clipboard for YouTube short links with tracking parameters
- Cleans and updates the clipboard with the pure link
- Runs as a background service
- Linux desktop using X11 (
DISPLAY=:0
) - Go 1.16+ (for building)
github.com/atotto/clipboard
Go package
Clone the repository and build the binary:
git clone https://github.com/yourusername/clipcleaner.git
cd clipcleaner
go build -o clipcleaner main.go
Install the binary to a system directory (e.g. /usr/local/bin
):
sudo mv clipcleaner /usr/local/bin/
This repository includes a service file: clipcleaner.service
.
Move it to /etc/systemd/system/
:
sudo cp clipcleaner.service /etc/systemd/system/clipcleaner.service
Edit the service file if necessary:
Ensure the User=rose
line matches your username, and that DISPLAY
and XAUTHORITY
are correct for your system.
Reload systemd to recognize the new service:
sudo systemctl daemon-reload
Enable ClipCleaner to start on boot:
sudo systemctl enable clipcleaner
Start the service:
sudo systemctl start clipcleaner
To view the status:
sudo systemctl status clipcleaner
To view logs:
sudo journalctl -u clipcleaner -f
Once running, just copy any YouTube short link containing a ?si=
parameter.
ClipCleaner will automatically clean it for you.
To remove ClipCleaner:
sudo systemctl stop clipcleaner
sudo systemctl disable clipcleaner
sudo rm /etc/systemd/system/clipcleaner.service
sudo rm /usr/local/bin/clipcleaner
sudo systemctl daemon-reload