Copyq: Add option for launching the application at OS startup

Created on 27 May 2013  路  9Comments  路  Source: hluk/CopyQ

This is mainly for Windows but may apply on Ubuntu and others too.

This should be also possible to set in Windows installer.

feature

Most helpful comment

It looks like their is a race condition between the unity systray and copyq. As there aren't more sophisticated solutions to start programs a 3 seconds delay or so might help:

sh -c "sleep 3; copyq"

All 9 comments

(let me know if I should open a separate issue for this Ubuntu-specific problem)

On Ubuntu (13.04), I added CopyQ as a startup application by going to "Startup Applications" and adding "copyq" as the command to run. For the most part this works perfectly, but about 1 out of 5 times, CopyQ does not start. To investigate this, I moved /usr/local/bin/copyq to /usr/local/bin/copyq_ORIG and saved the following script as /usr/local/bin/copyq:

#!/bin/bash

exec > "/home/scott/copyq.log"
exec 2>> "/home/scott/copyq.log"

date
/usr/local/bin/copyq_ORIG "$@"

Here is the output when I start copyq from the command line after the computer is started. CopyQ starts and works fine.

CopyQ: Loading configuration
CopyQ: Loading plugin: /usr/local/lib/copyq/plugins/libitemdata.so
CopyQ: Loading plugin: /usr/local/lib/copyq/plugins/libitemimage.so
CopyQ: Loading plugin: /usr/local/lib/copyq/plugins/libitemtext.so
CopyQ: Loading plugin: /usr/local/lib/copyq/plugins/libitemweb.so
CopyQ: Configuration loaded
CopyQ: Clipboard Monitor: Starting
CopyQ: Clipboard Monitor: Started

Here is the output from my log after CopyQ a successful automatic start:

CopyQ: Loading configuration
CopyQ: Loading plugin: /usr/local/lib/copyq/plugins/libitemdata.so
CopyQ: Loading plugin: /usr/local/lib/copyq/plugins/libitemimage.so
CopyQ: Loading plugin: /usr/local/lib/copyq/plugins/libitemtext.so
CopyQ: Loading plugin: /usr/local/lib/copyq/plugins/libitemweb.so
CopyQ: Configuration loaded
"sni-qt/2129" WARN  21:50:31.826 void StatusNotifierItemFactory::connectToSnw() Invalid interface to SNW_SERVICE 
No systemtrayicon available
CopyQ: Clipboard Monitor: Starting
CopyQ: Clipboard Monitor: Started

Here is the output from my log after CopyQ an unsuccessful automatic start:

CopyQ: Loading configuration
CopyQ: Loading plugin: /usr/local/lib/copyq/plugins/libitemdata.so
CopyQ: Loading plugin: /usr/local/lib/copyq/plugins/libitemimage.so
CopyQ: Loading plugin: /usr/local/lib/copyq/plugins/libitemtext.so
CopyQ: Loading plugin: /usr/local/lib/copyq/plugins/libitemweb.so
CopyQ: Configuration loaded
"sni-qt/2128" WARN  21:59:39.663 void StatusNotifierItemFactory::connectToSnw() Invalid interface to SNW_SERVICE 
No systemtrayicon available
CopyQ: Clipboard Monitor: Starting
CopyQ: Clipboard Monitor: Started
CopyQ ERROR: Remote process: Failed to start new remote process!
CopyQ ERROR: Cannot start clipboard monitor!
CopyQ ERROR: Remote process: Close connection unsucessful!
CopyQ: Clipboard Monitor: 
CopyQ ERROR: Clipboard monitor crashed!
CopyQ: Clipboard Monitor: Terminating
CopyQ: Clipboard Monitor: Terminated
CopyQ: Clipboard Monitor: Starting
CopyQ: Clipboard Monitor: Started

Is the solution to have copyq check for the processes it depends on and if those aren't started sleep for a second or two and try again (and then give up after, say, 5 tries)?

Let me know if there's any other testing I can do to help.

It looks like their is a race condition between the unity systray and copyq. As there aren't more sophisticated solutions to start programs a 3 seconds delay or so might help:

sh -c "sleep 3; copyq"

The interval may help but I guess sni-qt should create indicator icon in panel as soon as it's available, otherwise it's a bug on their side.

I wonder what else is happening because the "CopyQ ERROR" messages must be unrelated to the previous. Is that v1.8.3 or version from git?

For more verbose output you can build CopyQ in debug version with cmake -DCMAKE_BUILD_TYPE=Debug ..

It'll be better to create other issue labeled as "bug".

It was a git checkout of b7d5f02. I will create another issue with output from the debug build and from current HEAD.

Implemented for Linux/X11: fdcc0c625cc207f8c58892fe96e416ee09912191

If anyone need this option on Windows and know how to implement it, there are *Autostart* methods in src/platform/winplatform.* that need implementing. Note that it's possible to put copyq link to Startup folder using the installer for Windows.

For windows, add a new string value in the following location and specify the path to copyq.exe

Path: HKEY_CURRENT_USER\Software\Microsoft\WindowsCurrentVersion\Run
Value name: CopyQ
Value data: "C:\Program Files (x86)\CopyQ\copyq.exe"

_Value data may vary depending on the specified installation location.__

Add apps to run automatically at startup in Windows 10

To add an app to Startup:

  1. Select the Start Windows logo Start button button and scroll to find the app you want to run at startup.
  2. Right-click the app, select More, and then select Open file location. This opens the location where the shortcut to the app is saved. If there isn鈥檛 an option for Open file location, it means the app can鈥檛 run at startup.
  3. With the file location open, press the Windows logo key Windows logo Start button + R, type shell:startup, then select OK. This opens the Startup folder.
  4. Copy and paste the shortcut to the app from the file location to the Startup folder.

Add apps to run automatically at startup in Windows 10

To add an app to Startup:

  1. Select the Start Windows logo Start button button and scroll to find the app you want to run at startup.
  2. Right-click the app, select More, and then select Open file location. This opens the location where the shortcut to the app is saved. If there isn鈥檛 an option for Open file location, it means the app can鈥檛 run at startup.
  3. With the file location open, press the Windows logo key Windows logo Start button + R, type shell:startup, then select OK. This opens the Startup folder.
  4. Copy and paste the shortcut to the app from the file location to the Startup folder.

Even if there's no "open file location" one can try to find it with: Win+R and then opening: Shell:AppsFolder and making a shortcut on desktop and copying it to shell:startup folder.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

happysurf picture happysurf  路  9Comments

m4r71n picture m4r71n  路  5Comments

sebflipper picture sebflipper  路  8Comments

eera5607 picture eera5607  路  7Comments

maricn picture maricn  路  3Comments