0bCdian / Waypaper-Engine

A wallpaper setter with playlist functionality!
GNU General Public License v3.0
165 stars 0 forks source link

daemon start issue #3

Closed TwelveNight closed 7 months ago

TwelveNight commented 7 months ago

image What this mean?What path should I add?

0bCdian commented 7 months ago

Can you run waypaper-engine on the terminal and verify it runs the gui? if not, then it probably didn't install correctly, that's why the cli cannot find the app in the path.

TwelveNight commented 7 months ago

Can you run waypaper-engine on the terminal(终端) and verify it runs the gui? if not, then it probably didn't install(安装) correctly(正确), that's why the cli cannot find(找到) the app in the path.

image I can run it in the terminal

0bCdian commented 7 months ago

Does the problem with the cli still persist? I tested on two machines and couldn't reproduce the cli not working, if you look in the cli source files youll see its just some bash scripts running commands to both the waypaper gui and the daemon, so if the app runs correctly, it should in theory run with the cli, since it's just a bash script calling the same waypaper-engine with the --daemon flag.

0bCdian commented 7 months ago

Btw the error in the cli can be improved, It actually refers to when I was manually moving the .AppImage compiled app in the path ($HOME/.local/bin for me, but it may change depending on your system and shell) and running it, but since the install script already does that and better (It still is a workaround until I publish this app in the aur tho), I should just output in the terminal the actual error instead!

TwelveNight commented 7 months ago

What deamon behavior do you expected? If I can see it at tray?

https://github.com/0bCdian/Waypaper-Engine/assets/113519679/76e1e89f-69ed-410b-96fb-b6402b1ef1dc

As you can see,the path problem recurrent when the app is run but when it is not run,the deamon won't last long

0bCdian commented 7 months ago

Oh no the daemon it's a server that runs in the background, that listens to commands through a unix socket, that server holds the logic of the playlists, so it must run separately from the gui, when you start only the daemon, you can queue commands like , set random image, or next image in playlist, previous image in playlist, stop playlist, etc (the cli has all of the commands available, but you can take a look a the structure in the cli files). The gui starts the server if you run it anyways, but I added the option to only start the daemon if you already have your playlist set, and only want to have the playlists controls without the gui, so it takes up less ram or if you prefer to use some scripts in widgets to control it that way. Something you can do on hyprland is something like this:

exec-once = waypaper-engine --daemon

or with the cli:

exec-once= wpe-cli daemon (this is just a wrapper of the waypaper-engine --daemon)

this starts just the daemon at login, and it will run swww if not running already, and if you had a playlist, it will keep running it, say a daily playlist, or whatever, and it should remember the last image set, and keep the order.

So in summary the expected behaviour of running the daemon option is just to spin up the server, you can check if its running by doing pidof wpe-daemon and if it returns the process id its running correctly.

0bCdian commented 7 months ago

What deamon behavior do you expected? If I can see it at tray? 2023-12-16_10-46-35.mp4

As you can see,the path problem recurrent when the app is run but when it is not run,the deamon won't last long

This is expected behavior, you can't have two instances of the same server running at the same time (because of collisions with the playlist logic), so there is logic to kill the process if it detects another process with the same nodejs process.title which is wpe-daemon. The waypaper engine spinning and killing itself its also designed that way, its the electron gui process starting up when you run waypaper-engine --daemon, then running the function to spin the server up, and exiting the gui process. It's all expected behavior so you don't end up with zombie processes or whatnot.