ActivityWatch / activitywatch

The best free and open-source automated time tracker. Cross-platform, extensible, privacy-focused.
https://activitywatch.net/
Mozilla Public License 2.0
12.37k stars 557 forks source link

Document how to autostart for all platforms #116

Closed ErikBjare closed 3 years ago

ErikBjare commented 7 years ago

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.

zicameau commented 6 years ago

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 commented 6 years ago

The instructions might do best in the getting started guide in the docs: https://github.com/ActivityWatch/docs/blob/master/getting-started.rst

Let me know if you have any questions, otherwise, just throw us a pull request when you're done :)

On Nov 22, 2017 02:36, "Trevor" notifications@github.com wrote:

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!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ActivityWatch/activitywatch/issues/116#issuecomment-346216230, or mute the thread https://github.com/notifications/unsubscribe-auth/ABVxungd7aTJ2YYB5v-c9oJ2PcvO-f9oks5s43qKgaJpZM4P5iJP .

dufferzafar commented 6 years ago

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 commented 6 years ago

Thanks for mentioning that @dufferzafar, your issue on the matter was also helpful: https://github.com/ActivityWatch/activitywatch/issues/176

ErikBjare commented 6 years ago

Made some progress on adding a .desktop file to the AUR package by introducing it into the aw-qt PyInstaller bundle here: https://github.com/ActivityWatch/aw-qt/commit/09c57363b1f87df1454a550d6b7a2a564e343126

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 commented 6 years ago

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 commented 6 years ago

@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 commented 6 years ago

@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 commented 6 years ago

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 commented 6 years ago

@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 commented 6 years ago

@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 commented 6 years ago

@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 commented 5 years ago

+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 commented 5 years ago

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 commented 5 years ago

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

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 commented 5 years ago

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 commented 5 years ago

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 commented 4 years ago

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 commented 4 years ago

@BrunoVernay that was answered higher up in the thread. https://github.com/ActivityWatch/activitywatch/issues/116#issuecomment-421735620

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 commented 4 years ago

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 commented 4 years ago

You seem to have missed @johan-bjareholt's point that you will have trouble starting both aw-watcher-window and aw-watcher-afk through systemd since they too depend on an X session.

On Thu, 26 Mar 2020, 20:48 Bruno Vernay, notifications@github.com wrote:

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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ActivityWatch/activitywatch/issues/116#issuecomment-604647806, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKXDOWDY565E5GG7I5JBP3RJOWP3ANCNFSM4D7GEJHQ .

johan-bjareholt commented 4 years ago

@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[bot] commented 4 years ago

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[bot] commented 3 years ago

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.

RokeJulianLockhart commented 1 year ago

Why was this allowed to be closed merely because of lack of action? This feature still doesn't work for me using https://github.com/ActivityWatch/activitywatch/releases/download/v0.12.3b10/activitywatch-linux-x86_64.AppImage, as https://forum.activitywatch.net/t/auto-start-aw-server-at-boot/575/3#:~:text=https%3A%2F%2Fgithub.com%2Factivitywatch%2Factivitywatch%2Freleases%2Fdownload%2Fv0.12.3b10%2Factivitywatch-linux-x86_64.appimage%202%20doesn%E2%80%99t%20register%20itself explains.

ErikBjare commented 1 year ago

@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!