clipse --listen on login starts but doesnt listen to system copy events
Closed this issue ยท 7 comments
I am on Linux/gnome. I love this tool btw
I have a systemd user service that does successfully start clipse, but clipse doesn't record system copy events. If I run clipse --listen
on the terminal, it works as expected and records all copy events.
This is my systemd service.
[Service]
Type=oneshot
RemainAfterExit=true
StandardOutput=journal
ExecStart=/home/brayan/Applications/bin/clipse/clipse_0.0.71_linux_amd64/clipse --listen
[Install]
WantedBy=default.target
Thank you for any help you can offer:)
EDIT:
After some tests I've found the following:
- The user service, WILL start clipse on boot/login. But clipse won't record system copy events like I mentioned above.
- Stopping and then starting the service again FROM the terminal AFTER login, starts clipse and clipse successfully records system copy events.
- Checking details about the two different processes, one started from systemd and the other from the terminal I get the following.
Clipse started from the terminal AFTER login
Clipse started from systemd service. (clipse is added to my path only when opening a terminal emulator.)
I don't know enough about this but the difference I see is in one having a tty listed but not the other.
Hey @BrayanLope5 thanks for raising this and for your kind words!
It looks like you've set this up correctly so I understand the confusion here. For some context, the clipse -listen
cmd spawns a new background listener prcocess using the following cmd: nohup clipse --listen-shell >/dev/null 2>&1 &
. I think something is interfering with systemd creating the new process during startup (maybe due to lack of an available shell env outside of TTY) so I would advise getting the service to call that command directy, cutting out the middle-man.
Something like:
[Unit]
Description=Clipse Clipboard Manager
[Service]
Type=simple
ExecStart=/usr/bin/nohup /home/brayan/Applications/bin/clipse/clipse_0.0.71_linux_amd64/clipse --listen-shell >/dev/null 2>&1 &
[Install]
WantedBy=default.target
Let me know if that fixes it. The only other thing I can think of rn is to use a startup script instead of systemd but best to avoid if possible I guess ๐
I couldn't make it work using a systemd service. I tried what you shared and that didn't work. I tried other variations and I just didn't make any headway. Instead I used a .desktop file that autostarts after login. I haven't tested it on KDE Plasma yet but I think it should work, I am on Gnome.
I save this to /home/brayan/.config/autostart/clipse-clipboard-manager.desktop
[Desktop Entry]
Name=clipse
Comment=Clipse event listener autostart.
Exec=/home/brayan/Applications/bin/clipse/clipse_0.0.71_linux_amd64/clipse --listen %f
Terminal=false
Type=Application
@BrayanLope5 I'm sorry I couldn't be of more help there but glad to hear you found a fix!
Also thank you for sharing a solution, I'll add that to the FAQs.
Not sure if this is the best way to do this, but it seems to be working for me:
[Unit]
Description=Clipse listener
Documentation=https://github.com/savedra1/clipse
PartOf=graphical-session.target
After=graphical-session.target
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=clipse -listen
[Install]
WantedBy=graphical-session.target
Not sure if this is the best way to do this, but it seems to be working for me:
[Unit] Description=Clipse listener Documentation=https://github.com/savedra1/clipse PartOf=graphical-session.target After=graphical-session.target [Service] Type=oneshot RemainAfterExit=true ExecStart=clipse -listen [Install] WantedBy=graphical-session.target
This helped me in hyprland, but in i3 and niri the problem remained. At this clipse left stacktrace:
clipse[7588]: goroutine 1 [running]:
clipse[7588]: runtime/debug.Stack()
clipse[7588]: runtime/debug/stack.go:24 +0x5e
clipse[7588]: runtime/debug.PrintStack()
clipse[7588]: runtime/debug/stack.go:16 +0x13
clipse[7588]: github.com/savedra1/clipse/utils.HandleError({0x721f08, 0xc000016940})
clipse[7588]: github.com/savedra1/clipse/utils/err.go:11 +0x2c
clipse[7588]: github.com/savedra1/clipse/shell.RunNohupListener({0x5f29a8?, 0xc00006a0c8?})
clipse[7588]: github.com/savedra1/clipse/shell/cmd.go:81 +0x17e
clipse[7588]: main.handleListen({0x5f29a8, 0x7})
clipse[7588]: github.com/savedra1/clipse/main.go:115 +0xe5
clipse[7588]: main.main()
clipse[7588]: github.com/savedra1/clipse/main.go:71 +0x3dc
systemd[1689]: clipse.service: Main process exited, code=exited, status=1/FAILURE
Not sure if this is the best way to do this, but it seems to be working for me:
[Unit] Description=Clipse listener Documentation=https://github.com/savedra1/clipse PartOf=graphical-session.target After=graphical-session.target [Service] Type=oneshot RemainAfterExit=true ExecStart=clipse -listen [Install] WantedBy=graphical-session.target
Tried this in Hyprland as well, but no success. Here's the output of the clipse service:
Sep 03 17:16:42 rafa-laptop systemd[622]: Starting Clipse listener...
Sep 03 17:16:42 rafa-laptop systemd[622]: Finished Clipse listener.
The TUI history seems to be working, but I can't copy from it to paste somewhere else. I also tried adding exec-once = clipse -listen
to my hyprland.conf
file, but it doesn't seem to work either.
Output of echo "hello world" | clipse -c
:
hello world
goroutine 1 [running]:
runtime/debug.Stack()
runtime/debug/stack.go:26 +0x5e
runtime/debug.PrintStack()
runtime/debug/stack.go:18 +0x13
github.com/savedra1/clipse/utils.HandleError({0x619dbaf10f98, 0x619dbb03c930})
github.com/savedra1/clipse/utils/err.go:11 +0x2c
main.handleCopy()
github.com/savedra1/clipse/main.go:157 +0x9d
main.main()
github.com/savedra1/clipse/main.go:68 +0x3d5
I'm an idiot... If anyone runs into this, my issue was that I didn't have the wl-clipboard
package installed. Installed it with my package manager and now everything works as intended ๐๐พ