Skip to content

Instantly share code, notes, and snippets.

@ZiTAL
Last active December 4, 2024 09:09
Show Gist options
  • Save ZiTAL/9d6a967e46b405b9250b756ec590cf75 to your computer and use it in GitHub Desktop.
Save ZiTAL/9d6a967e46b405b9250b756ec590cf75 to your computer and use it in GitHub Desktop.
gnu/linux: sync clipboard
#!/bin/bash
# /usr/local/bin/xclip-sync
while true; do
xclip -o -selection primary | xclip -selection clipboard
sleep 0.5
done
# /etc/systemd/system/xclip-sync.service
[Unit]
Description=xclip: Sync Primary and Clipboard Selections
After=display-manager.service
Requires=display-manager.service
[Service]
ExecStart=/usr/local/bin/xclip-sync
Restart=always
User=zital
# echo $DISPLAY
Environment=DISPLAY=:1.0
Environment=XAUTHORITY=/home/zital/.Xauthority
[Install]
WantedBy=default.target
@ZiTAL
Copy link
Author

ZiTAL commented Dec 4, 2024

apt-get install xclip
systemctl enable xclip-sync
systemctl start xclip-sync
systemctl status xclip-sync

@ZiTAL
Copy link
Author

ZiTAL commented Dec 4, 2024

echo $DISPLAY

:1.0

beraz:

Environment=DISPLAY=:1.0 

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