SafeEyes icon indicating copy to clipboard operation
SafeEyes copied to clipboard

[Bug] Doesn't want to run on startup (Ubuntu 20.04 LTS - Wayland)

Open smith558 opened this issue 5 years ago • 18 comments

OS - Ubuntu 20.04 LTS display server - Wayland app version - 2.0.9-1 source - lp_ppa_slgobinath_safeeyes-focal-main also tried source - ppa:slgobinath/safeeyes

Safe Eyes does not run on startup with default startup script settings. Also tried custom settings for usr/bin/safeeyes usr/bin/x11/safeeyes and bin/safeeyes & bin/x11/safeyes

App runs just fine when launched manually.

smith558 avatar Jul 06 '20 14:07 smith558

Does it mean that it doesnt run at startup but works if you start from the terminal? If so, could you pls try this solution: https://github.com/slgobinath/SafeEyes/issues/361#issuecomment-609265191

If doesn't run at all (even from the terminal), can you try safeeyes --debug from the terminal and share the output?

slgobinath avatar Jul 09 '20 10:07 slgobinath

Does it mean that it doesnt run at startup but works if you start from the terminal? If so, could you pls try this solution: #361 (comment)

If doesn't run at all (even from the terminal), can you try safeeyes --debug from the terminal and share the output?

Precisely, doesn't run on startup only, otherwise works fine when launched via the icon in 'all apps' or via the terminal. safeeyes --debug doesn't show any exceptions

smith558 avatar Jul 09 '20 10:07 smith558

@slgobinath if i understood it correctly, https://github.com/slgobinath/SafeEyes/issues/361#issuecomment-609265191 states I should just remove ~/.config/autostart/safeeyes.desktop and it will work on startup? thx

if so, https://github.com/slgobinath/SafeEyes/issues/361#issuecomment-609265191 failed

smith558 avatar Jul 09 '20 10:07 smith558

I saw similar problem commented on https://aur.archlinux.org/packages/safeeyes-git

Can you check if there is a valid entry in /usr/share/applications/safeeyes.desktop? If it is not there, the ~/.config/autostart/safeeyes.desktop is not gonna work. I think deleting ~/.config/autostart/safeeyes.desktop and manually adding safe eyes to start up should fix this but I will check on my side why this happens.

slgobinath avatar Jul 09 '20 10:07 slgobinath

safeeyes.desktop in /usr/share/applications

[Desktop Entry]
Name=Safe Eyes
Comment=Protect your eyes from eye strain
Comment[ca]=Protegiu-vos els ulls de la fatiga visual
Comment[cs]=Chraňte své oči před únavou
Comment[de]=Schützt die Augen vor Überanstrengung
Comment[es]=Protege tus ojos de la fatiga ocular
Comment[et]=Kaitse oma silmi väsimuse eest
Comment[fa]=محافظت چشم هااز ضعیف شدن
Comment[fr]=Protégez vos yeux de la fatigue
Comment[ge]=დაიცავით თქვენი თვალები დაღლილობისაგან
Comment[hi]=तनाव से आंखों की रक्षा
Comment[hu]=Protect your eyes from eye strain
Comment[id]=Melindungi mata Anda dari kelelahan
Comment[lt]=Apsaugokite savo akis nuo įtampos
Comment[lv]=Aizsargājiet savas acis no pārslodzes
Comment[mk]=Заштитете се од замор на очите
Comment[pl]=Chroń oczy przed zmęczeniem
Comment[pt]=Proteja seus olhos da tensão ocular
Comment[ru]=Защитите свои глаза от зрительного перенапряжения
Comment[sk]=Chráňte svoje oči pred únavou
Comment[ta]=உங்கள் கண்களை சோர்வடையாது பாதுகாத்திடுங்கள்
Comment[tr]=Gözünüzü yorgunluğa karşı koruyun
Comment[uk]=Захистіть свої очі від втоми
Comment[vi]=Bảo vệ đôi mắt của bạn khỏi sự mệt mỏi
Exec=env GDK_BACKEND=x11 safeeyes
Icon=safeeyes
Terminal=false
Type=Application
Categories=Utility;

smith558 avatar Jul 09 '20 10:07 smith558

How exactly should I manually add safe eyes to startup? I tried multiple ways but none turned out to work.

Commands I tried: safeeyes usr/bin/safeeyes usr/bin/x11/safeeyes and bin/safeeyes & bin/x11/safeyes

smith558 avatar Jul 09 '20 10:07 smith558

Its strange. I will try Ubuntu 20.04 on VM and let you know.

slgobinath avatar Jul 09 '20 10:07 slgobinath

I've narrowed down the issue. The startup works fine when running Ubuntu with Xorg (default display server), I am running Ubuntu with Wayland 90% of the time.

The issue basically boils down to https://unix.stackexchange.com/questions/433188/how-do-i-auto-start-x-application-in-wayland

smith558 avatar Jul 09 '20 11:07 smith558

@slgobinath any progress on this by any chance?

smith558 avatar Jul 30 '20 11:07 smith558

Sorry I forgot to reply here. I wasn't able to get Ubuntu 20.04 installed on Virtual Box. At the end of installation, it freezes forever (tried several times). I am trying to get this resolved to reproduce the problem. I am little busy for a week. I will get back to you hopefully by August 8/9.

Maybe I should try Fedora.

slgobinath avatar Jul 30 '20 12:07 slgobinath

Hi, I was able to reproduce the problem. When I logged in with Wayland, I got the error Cannot connect to display server.

I was able to fix it by creating ~/.Xauthority file.

Please execute this command from the terminal, logout and login

touch ~/.Xauthority

Relevant issue: https://github.com/slgobinath/SafeEyes/issues/206

Please let me know if this helps. Thanks

slgobinath avatar Aug 09 '20 14:08 slgobinath

Hi, I was able to reproduce the problem. When I logged in with Wayland, I got the error Cannot connect to display server.

I was able to fix it by creating ~/.Xauthority file.

Please execute this command from the terminal, logout and login

touch ~/.Xauthority

Relevant issue: #206

Please let me know if this helps. Thanks

@slgobinath had no effect

smith558 avatar Aug 27 '20 14:08 smith558

I'm not sure if it helps, but this error is logged in my case:

cze 14 13:42:16 robert-laptop safeeyes.desktop[1459792]: Traceback (most recent call last):
cze 14 13:42:16 robert-laptop safeeyes.desktop[1459792]:   File "/usr/bin/safeeyes", line 9, in <module>
cze 14 13:42:16 robert-laptop safeeyes.desktop[1459792]:     load_entry_point('safeeyes==2.1.3', 'console_scripts', 'safeeyes')()
cze 14 13:42:16 robert-laptop safeeyes.desktop[1459792]:   File "/usr/lib/python3/dist-packages/safeeyes/__main__.py", line 147, in main
cze 14 13:42:16 robert-laptop safeeyes.desktop[1459792]:     safe_eyes = SafeEyes(system_locale, config)
cze 14 13:42:16 robert-laptop safeeyes.desktop[1459792]:   File "/usr/lib/python3/dist-packages/safeeyes/safeeyes.py", line 84, in __init__
cze 14 13:42:16 robert-laptop safeeyes.desktop[1459792]:     self.break_screen = BreakScreen(
cze 14 13:42:16 robert-laptop safeeyes.desktop[1459792]:   File "/usr/lib/python3/dist-packages/safeeyes/ui/break_screen.py", line 47, in __init__
cze 14 13:42:16 robert-laptop safeeyes.desktop[1459792]:     self.display = Display()
cze 14 13:42:16 robert-laptop safeeyes.desktop[1459792]:   File "/usr/lib/python3/dist-packages/Xlib/display.py", line 89, in __init__
cze 14 13:42:16 robert-laptop safeeyes.desktop[1459792]:     self.display = _BaseDisplay(display)
cze 14 13:42:16 robert-laptop safeeyes.desktop[1459792]:   File "/usr/lib/python3/dist-packages/Xlib/display.py", line 71, in __init__
cze 14 13:42:16 robert-laptop safeeyes.desktop[1459792]:     protocol_display.Display.__init__(self, *args, **keys)
cze 14 13:42:16 robert-laptop safeeyes.desktop[1459792]:   File "/usr/lib/python3/dist-packages/Xlib/protocol/display.py", line 167, in __init__
cze 14 13:42:16 robert-laptop safeeyes.desktop[1459792]:     raise error.DisplayConnectionError(self.display_name, r.reason)
cze 14 13:42:16 robert-laptop safeeyes.desktop[1459792]: Xlib.error.DisplayConnectionError: Can't connect to display ":0": b'No protocol specified\n'

rob006 avatar Jun 14 '21 12:06 rob006

I also encounter the same issue when booting with Wayland on Ubuntu 20.04. Adding ~/.Xauthority doesn't fix it for me, either. The error message I found in the log is the same as the one @rob006 provided.

Also, it seems that at the time of the crash, the $XAUTHORITY environment variable points to /run/user/$UID/.mutter-Xwaylandauth.XXXX, so I guess ~/.Xauthority wouldn't be used.

shaform avatar Aug 07 '21 20:08 shaform

I found a simple workaround to prevent the crash. If we add a time.sleep(...) before the following line, it no longer crashes. https://github.com/slgobinath/SafeEyes/blob/541f39fdc0d4e290d897da0c6498e355b444d0e2/safeeyes/ui/break_screen.py#L47

shaform avatar Aug 07 '21 20:08 shaform