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

Document how to autostart for all platforms #116

Closed
2 of 4 tasks
ErikBjare opened this issue Oct 14, 2017 · 26 comments
Closed
2 of 4 tasks

Document how to autostart for all platforms #116

ErikBjare opened this issue Oct 14, 2017 · 26 comments

Comments

@ErikBjare
Copy link
Member

ErikBjare commented Oct 14, 2017

It's important that people don't forget to turn on ActivityWatch, autostart is therefore an important feature, but we have yet to implement it.

Later we will have this managed automatically but a good start is to figure out how to do it cross-platform and add the information to the docs.

  • Windows
    • Update: Autostart is now automatically configured by the installer.
    • Create a new shortcut that points to aw-qt and move it to the autostart folder
  • macOS
    • Done using the 'Login items' config in the user settings
    • One needs to use Automator in order to create a runnable when installing from source into a virtualenv. Unsure if needed with the zip. No longer needed with the .app bundle.
  • Linux
    • We should probably use the free desktop standard (/etc/xdg/autostart/ and/or ~/.config/autostart/)
    • Can be done manually by adding it in the "Startup Applications" menu in Ubuntu/Gnome.
@ErikBjare ErikBjare changed the title Figure out how to autostart on all platforms and add to docs Document how to autostart on all platforms Oct 31, 2017
@ErikBjare ErikBjare changed the title Document how to autostart on all platforms Document how to autostart for all platforms Oct 31, 2017
@zicameau
Copy link

Hey there, I'm interested in providing some help with this issue. How would you like me to add this documentation to the project? Implementing it into the readme? Providing a step-by-step tutorial for each platform? I look forward to your clarification!

@ErikBjare
Copy link
Member Author

ErikBjare commented Nov 22, 2017 via email

@dufferzafar
Copy link

For anyone wondering, you don't even have to write the .desktop file yourselves.

Steal stuff from: https://github.com/ActivityWatch/aw-qt/blob/8825db6d69f476d81a104e1e3197955f825323b2/resources/aw-qt.desktop and modify paths as you want.

@ErikBjare
Copy link
Member Author

Thanks for mentioning that @dufferzafar, your issue on the matter was also helpful: #176

@ErikBjare
Copy link
Member Author

Made some progress on adding a .desktop file to the AUR package by introducing it into the aw-qt PyInstaller bundle here: ActivityWatch/aw-qt@09c5736

Now we just need to actually make a new bin release and then update the AUR install scripts to put the file in the right place.

@Codeplaya
Copy link

For windows release, it really helps to have the shortcut in shell:startup set to run: minimized from properties - > shortcut. At least until the super-annoying console window is present.

@johan-bjareholt
Copy link
Member

@Codeplaya I'm so sorry for the console still being there, it's fixed now though so the next version of ActivityWatch will not have it.

@anoopd
Copy link

anoopd commented Sep 16, 2018

@zicameau I have installed activitywatch using virtualenv ( i have to do source ./venv/bin/activate before running aw-qt ) . Can you please help me to autostart on Ubuntu 16.04 ? After running the above command i did whereis aw-qt and got the result aw-qt: /home/anoopd/venv/bin/aw-qt . I created a file named activitywatch.service in /etc/systemd/system with contents

[Unit]
Description=Activitywatch
After=network.target

[Service]
Type=simple
User=%i
ExecStart=/home/anoopd/venv/bin/aw-qt

[Install]
WantedBy=multi-user.target

but it is not working . Right now i am using rescuetime and would like to switch . Totaly linux newbie . Please help.

@Otto-AA
Copy link

Otto-AA commented Sep 16, 2018

I've added it via the Startup Applications menu (preinstalled at least in Ubuntu). In my case I used the command aw-qt, in yours it would probably be source "$HOME/anoopdvenv/bin/activate" && "$HOME/anoopd/venv/bin/aw-qt". If this doesn't work, maybe take a look at this question on askubuntu.

@ErikBjare
Copy link
Member Author

ErikBjare commented Sep 16, 2018

@anoopd It's not a good idea to start aw-qt as a systemd service since it's a GUI application.

Use the "Startup Applications" menu offered by your desktop environment as @Otto-AA did. I'd recommend using the prebuild binaries over the virtualenv, if you do all you need is to unzip it and then point "Startup Applications"-entry to the aw-qt binary.

@anoopd
Copy link

anoopd commented Sep 16, 2018

@ErikBjare Thank you for your valid suggestion . So i am supposed to uninstall the venv version and use the prebuild binaries right ? ( just for clarification ........... )

@johan-bjareholt
Copy link
Member

@anoopd Well, both works of course but the pre-built binaries are easier to manage and update.
In other words, if you are unsure it's probably a better idea to use the pre-built binaries.

@TomNicholas
Copy link

TomNicholas commented Jan 2, 2019

+1 for this - I just spent quite a while trying to get activitywatch to automatically start up reliably on Ubuntu 16.04 until I found this thread. Startup-applications works nicely though.

Also it's pretty important - I was close to just giving up and forgetting about the application, because there's no way I would have remembered to manually start the program every time I turned on my machine!

@jonbesga
Copy link

jonbesga commented Feb 4, 2019

For anyone in Arch Linux: I was trying to get the autostart but for some reason it wasn't working. I got ActivityWatch from AUR and the .desktop file was in /etc/xdg/autostart but wasn't doing anything.

I have Gnome Tweaks but the desktop application wasn't appearing because the .desktop file should have been in /usr/share/applications. I copied it there and added the application to the autostart list using the Tweaks interface.

The file was automatically copied into ~/.config/autostart but still, wasn't working. The problem was that the property X-GNOME-Autostart-enabled=false should have been to true and my OS hadn't changed it

Once I changed that property manually to the file in ~/.config/autostart (which, strangely enough, is named aws-qt.desktop instead of aw-qt.desktop) the application started to run after login!

Hope this helps anyone coming after me.

@ErikBjare
Copy link
Member Author

@jonbesga Woah, didn't realize X-GNOME-Autostart-enabled was set to false! Fixed here, will be available in the next release: ActivityWatch/aw-qt@248a529

Should hopefully make the process a lot easier for those installing from the AUR, and in the future those installing from a .deb package (Ubuntu/Debian users).

@WorldMaker
Copy link

For Windows, it might be preferable to encourage people to use Task Scheduler instead of the autostart folder (or I suppose in addition to as an "advanced" option). It's more capable (allowing for things like finer control of a Delayed Start to avoid slowing overall boot/login processes), and since its introduction in Windows XP has been the preferred Windows tool for application startup over the autostart folder.

@masaeedu
Copy link

I've noticed that there seems to be an issue with how processes are parented in the Linux setup with the desktop file. If a user logs out and then tries to log back in, multiple errors occur where running instances of the subprocesses (window-watcher etc.) conflict with attempts to start new instances.

@BrunoVernay
Copy link

Is there any reason not to run ActivityWatch as a systemd unit on Linux?
An optional .desktop file could just control (start / stop) the service and even open the browser.

@johan-bjareholt
Copy link
Member

@BrunoVernay that was answered higher up in the thread. #116 (comment)

Personally though I do use a systemd user service for aw-server, but it's not easily doable to run the watchers and aw-qt with it so it wouldn't be as good of an experience as just auto-starting aw-qt for most people.

@BrunoVernay
Copy link

The point is not to start the GUI via systemd obviously, but to start the services aw-watcher-window,
aw-watcher-afk , aw-server .
These could be then managed with aw-qt, or any systemd utility GUI Cockpit or command line

I am not saying that the project should do that. It is just to know if I the architecture is aligned with this solution, Since it looks OK, I am going to do just that.

@ErikBjare
Copy link
Member Author

ErikBjare commented Mar 27, 2020 via email

@johan-bjareholt
Copy link
Member

@ErikBjare Exactly, systemd is aware of user sessions but not display sessions which aw-watcher-window and aw-watcher-afk depend on existing when they start. So while it's possible to script around the issue it's not a very nice looking solution, I did that before but found that just autostarting aw-watcher-window and aw-watcher-afk once my window manager has started is much more simple and works just as well.

@stale
Copy link

stale bot commented Oct 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale
Copy link

stale bot commented Jun 10, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 10, 2021
@stale stale bot closed this as completed Jun 24, 2021
@RokeJulianLockhart

This comment was marked as resolved.

@ErikBjare
Copy link
Member Author

@RokeJulianLockhart Please don't question how we work with issues. We have many good reasons, designed to prevent overload/burnout :)

It has been closed because no one is working on it anymore. If you think that should change, do some work!

We do not automatically register the AppImage in your autostart, that is correct.

It might not even be a good idea to do so due to the portable nature of the AppImage (such that the AppImage location cannot be assumed to be stable on first-run). Better you place it in it's final destination and add it manually to avoid bad paths.

That being said, if you know how that can be done, or how the documentation could be clearer on this, do feel free to make a PR!

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

No branches or pull requests