maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   [Support thread] Battery Overlay (https://talk.maemo.org/showthread.php?t=94717)

hlev80 2015-04-03 10:18

Re: [Support thread] Battery Overlay
 
Does no more, no less, than what it should, great app.

I understand harbour apps cannot autostart, but I was thinking maybe it would be possible to be done manually with systemd. No success so far.

I created a .service file

/etc/systemd/system/batteryoverlay.service
Code:

[Unit]
Description=Start Battery Overlay

[Service]
ExecStart=/usr/bin/harbour-batteryoverlay

[Install]
WantedBy=multi-user.target

Tried enabling it, then reboot, but it fails.
As a second attempt I created a .timer for it.

/etc/systemd/system/batteryoverlay.timer
Code:

[Unit]
Description=Start Battery Overlay

[Timer]
OnStartupSec=45

[Install]
WantedBy=multi-user.target

After disabling the service, enabling the timer + reboot, it still fails.
Being new to systemd I'm probably missing something, but maybe someone can improve this approach.

juiceme 2015-04-03 17:23

Re: [Support thread] Battery Overlay
 
Without trying it myself, I'd rather guess you want to invoke it as user service rather than system service.
Also, make sure it starts after UI session, either it probably fails.

Schturman 2015-04-03 19:39

Re: [Support thread] Battery Overlay
 
hlev80, try this:
Code:

[Unit]
Description=Start Battery Overlay
After=ofono.service

[Service]
Type=simple
Environment="DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/100000/dbus/user_bus_socket"
ExecStart=/usr/bin/harbour-batteryoverlay

[Install]
WantedBy=multi-user.target

Give to this name like: overlayautostrat.service
and put it to: /lib/systemd/system
run as ROOT:
Code:

systemctl enable overlayautostrat.service

UPDATE:
Just now tested and it also not work :D

coderus 2015-04-03 21:04

Re: [Support thread] Battery Overlay
 
will try to add some hidden hack for enabling autostart. fooling harbour QA should be easy :)

hlev80 2015-04-04 11:23

Re: [Support thread] Battery Overlay
 
Thank you all!

As said, I haven't been too familiar with systemd. I looked up how to deploy a user service and it works that way. :)

/etc/systemd/user/batteryoverlay.service
Code:

[Unit]
Description=Start Battery Overlay

[Service]
ExecStart=/usr/bin/harbour-batteryoverlay

[Install]
WantedBy=default.target

I used a .timer as well to be safe and assumed everything it needs is started by then. (45sec is a bit long though, UI was ready in ~30)

/etc/systemd/user/batteryoverlay.timer
Code:

[Unit]
Description=Start Battery Overlay

[Timer]
OnStartupSec=45

[Install]
WantedBy=default.target

As root:
systemctl --user enable batteryoverlay.timer

Schturman 2015-04-05 06:23

Re: [Support thread] Battery Overlay
 
hlev80, thanks it work after reboot, but it not work after homescreen refresh (lipstick) :(
I tried to add "After=lipstick.service" under Unit in both files, but still not work..

nieldk 2015-04-05 07:27

Re: [Support thread] Battery Overlay
 
Try to add
Restart =always

Schturman 2015-04-05 07:39

Re: [Support thread] Battery Overlay
 
Yes, already fixed :)
service:
Code:

[Unit]
Description=Start Battery Overlay
After=lipstick.service

[Service]
ExecStart=/usr/bin/harbour-batteryoverlay
Restart=always

[Install]
WantedBy=default.target


Schturman 2015-04-05 10:25

Re: [Support thread] Battery Overlay
 
if someone want here is a small package for this. It will auto enable after installation, and just reboot your phone once after installstion.
Icon for easy remove.. ;)
https://db.tt/lWbVl5pO

hlev80 2015-04-06 07:18

Re: [Support thread] Battery Overlay
 
Quote:

Originally Posted by Schturman (Post 1465792)
Yes, already fixed :)
service:
Code:

[Unit]
Description=Start Battery Overlay
After=lipstick.service

[Service]
ExecStart=/usr/bin/harbour-batteryoverlay
Restart=always

[Install]
WantedBy=default.target


I guess this works without the timer already.


All times are GMT. The time now is 04:27.

vBulletin® Version 3.8.8