metent / uair

An extensible pomodoro timer
MIT License
89 stars 6 forks source link

problems making uair persistent when killing/starting waybar #15

Open ehula opened 9 months ago

ehula commented 9 months ago

This is a great tool!

I am using it in my waybar, but I am having a problem. I would like to be able to kill waybar and still have uair running in the background, and when I start waybar, I would like to be able to connect to the running uair.

In waybar, if I use the following exec line: exec = "uair"; then when I kill waybar, uair also is killed. Makes sense.

However, I tried this: exec = "pgrep -x uair > /dev/null && uairctl listen || nohup uair &"; which I thought would do it, but not quite. When I kill waybar, uair is still running. That's great. I can see output from the terminal using uairctl listen. However, when I restart waybar, I see the output from uairctl listen for about a second, then it disappears from waybar.

metent commented 9 months ago

I would suggest you to use the line exec = "uairctl listen"; in your polybar config and then create a user service for the 'main' uair instance using your init system. If you're using systemd you may use this service file.

[Unit]
Description=Uair

[Service]
Type=simple
ExecStart=/usr/bin/uair -q

[Install]
WantedBy=default.target

Alternatively, you can start the main instance when your window manager starts, but then the process is unsupervised and you can't start or stop it using your init system.