owncloud / client

🖥️ Desktop Syncing Client for ownCloud
GNU General Public License v2.0
1.39k stars 667 forks source link

[KDE Plasma5] Don't start on session resume and auto start at same time #3273

Closed soee closed 5 years ago

soee commented 9 years ago

Few months ago first versions of Plasma 5 has been released and used by various Linux distributions (i'm using it on Kubuntu 15.04). After switch from KDE4 where Owncloud client worked fine, now with Plasma 5, settings window is always loaded maximized when starting system. This isn't serious bug but should be fixed somehow.

OS: Kubuntu 15.04 DE: Plasma 5.3.0 QT: 5.4.1 Client varsion: 1.8.1

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/17007542-kde-plasma5-don-t-start-on-session-resume-and-auto-start-at-same-time?utm_campaign=plugin&utm_content=tracker%2F216457&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F216457&utm_medium=issues&utm_source=github).
nixternal commented 9 years ago

This also happened with Plasma 4 on Kubuntu 14.10. It is annoying having to close it every boot up.

guruz commented 9 years ago

Can it actually be that two instances of oC are started? The first one launches fine into the background (with tray icon). The second one notices that one is already launched and tells the first one via IPC to show its settings icon

FYI @ogoffart @dragotin

nixternal commented 9 years ago

owncloud

BINGO! @guruz you nailed the issue right on the head. I disabled the startup script in System Settings & no more popup. OwnCloud Client is starting up silent once again. Thanks!

guruz commented 9 years ago

Great :-) I keep this open in case we have a good idea to automatically avoid this on startup.

I think @ogoffart mentioned something about checking Qt's isSessionRestored()

cruessler commented 8 years ago

I’d like to help in debugging this issue as I am experiencing it myself on one of my machines (owncloud 2.0.1, Kubuntu 15.04, Plasma 5.3.2). KDE is configured to “Start with an empty session”, owncloud is configured to “Launch on System Startup” and visible in the “Autostart” section of my system settings. Despite that, I can see owncloud’s configuration window after every login to KDE.

sudhirkhanger commented 8 years ago

@guruz @nixternal If I uncheck ownCloud autostart script from System Setting then it doesn't autostart at all on my system. If I leave it checked which starts ownCloud but starts it unminimized.

nixternal commented 8 years ago

Yeah, it worked for a few days then started acting weird again. I shut off remember session & it was still doing it. With remember session set & removing it from startup seemed to give me the best results as it wouldn't pop up as much when starting the system.

sudhirkhanger commented 8 years ago

One of the users on the mailing list mentioned adding a sleep timer of 5 second could help. There was at least once it didn't work. It does seem to work most of the time.

rperezb commented 8 years ago

@cruessler it'd be great if you may check whether the issue is fixed for you, thx

guruz commented 8 years ago

@cruessler Linux nightlies are here: https://build.opensuse.org/project/show/isv:ownCloud:community:nightly/

soee commented 8 years ago

@guruz this link is broken. Can you provide working one ?

danimo commented 8 years ago

@soee The link was wrong (nighly -> nightly). Fixed. Please try again.

cruessler commented 8 years ago

I just installed revision https://github.com/owncloud/client/commit/6b1bfb44740ceafc39a86b732304b41ce1131c15 (built today) and restarted my machine several times. I did not change anything besides that. Unfortunately, the issue persists. Is there any log output I could provide?

dragotin commented 8 years ago

I checked code a bit. According to http://code.woboq.org/qt5/qtbase/src/gui/kernel/qguiapplication.cpp.html#1289 the isSessionRestored() decides by the argv of the application if it was started from session. It checks for a argument -session. In my KDE4 based environment, the client is started on session start, but without the -session argument.

@cruessler can you check if the application that is started by your session management has an argument --session <something> or not?

dragotin commented 8 years ago

With @ogoffart s fix above, this should be solved.

cruessler commented 8 years ago

I just upgraded to the latest nightly (c3cf6aef7dbafb9133903b52c5919eccd4821a25, built October 30) and can still see the settings window after login. owncloud seems to be started without parameters.

~ $ ps aux | grep owncloud
christo+  1700  4.8  0.7 831024 59392 ?        Sl   11:18   0:00 /usr/bin/owncloud
cruessler commented 8 years ago

Replacing /usr/bin/owncloud by a script that logs each invocation to a file, reveals that on my machine owncloud is only called once at session start (by kdeinit5).

ogoffart commented 8 years ago

@cruessler could you also log a timestamp and see what's the time between the two invkation. We have a 10 seconds timer.

cruessler commented 8 years ago

I searched the codebase and I think I found the code that triggered the settings dialog in my case. It is https://github.com/owncloud/client/blob/419d18c1284fc2560ca781d9f42a8a9c2c32b7e4/src/gui/main.cpp#L110:

auto desktopSession = qgetenv("XDG_CURRENT_DESKTOP").toLower();
[several lines omitted]
if (!QSystemTrayIcon::isSystemTrayAvailable() && desktopSession != "ubuntu") {
  app.showSettingsDialog();
}

On my machine, $XDG_CURRENT_DESKTOP is KDE by default. Replacing /usr/bin/owncloud by the following shell script made the settings dialog not appear after login.

#!/bin/sh

export XDG_CURRENT_DESKTOP=ubuntu; /usr/bin/owncloud.orig

QSystemTrayIcon::isSystemTrayAvailable() seems to incorrectly return false in the version of Qt I’m using (5.3). On a second machine that is already at Qt 5.4, the issue is not present.