Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for launching the application at OS startup #56

Closed
hluk opened this issue May 27, 2013 · 9 comments
Closed

Add option for launching the application at OS startup #56

hluk opened this issue May 27, 2013 · 9 comments
Labels
feature New feature request

Comments

@hluk
Copy link
Owner

hluk commented May 27, 2013

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

This should be also possible to set in Windows installer.

@scottkosty
Copy link
Collaborator

(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.

@Mic92
Copy link
Collaborator

Mic92 commented Jul 2, 2013

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"

@hluk
Copy link
Owner Author

hluk commented Jul 2, 2013

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".

@scottkosty
Copy link
Collaborator

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

@hluk
Copy link
Owner Author

hluk commented Jul 29, 2013

Implemented for Linux/X11: fdcc0c6

@hluk
Copy link
Owner Author

hluk commented Jul 29, 2013

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.

@sateshb
Copy link

sateshb commented Jun 24, 2019

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

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

Value data may vary depending on the specified installation location._

Here is a oneliner to run in CMD:

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" /v CopyQ /t REG_SZ /d "C:\Program Files (x86)\CopyQ\copyq.exe"

@Mintellect310
Copy link

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’t an option for Open file location, it means the app can’t 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.

@Adam1544
Copy link

Adam1544 commented Sep 21, 2020

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’t an option for Open file location, it means the app can’t 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
None yet
Development

No branches or pull requests

6 participants