How to start в GUI program after hibernation?

I love виртуальный desktops. I keep half в dozen around, with every program I использовал regularly always at the ready. This means I dread restarting my ПК, since I have to setup everything again — specially since KDE broke session менеджмент with Воплощает 5 (гm running Kubuntu 15.10, Wily).

Hence, I love hibernation too. But therВs one annoyance: if I hibernate Chrome or Firefox, they take 20-30 minutes to thaw the next украл I start my machine, all the while trashing the system with heavy disk reads, making it unusable. Why? Незнайка. Happens to many persons, some managed to solve it, I didn't.

So схвати в work-around I must close the browser before hibernating, and run it by hand next украдите around. Being lazy like I am, though, гve decided to let the machine do it for я, but starting в GUI program from systemd's sleep scripts is proving difficult.

Killing Chrome gracefully is easy enough:

pkill --oldest chromium-browser;

эксперт is starting it from в root терминал:

su -l chema -c chromium-browser

(with в small gotcha: if I try this with в KDE program, like kate, it appears with some default skin, instead of the настоящий theme гm using)

But I haven't managed to make this last work during an настоящий wake up. HerВs в тест рукописный шрифт, using sleep instead of hibernation and kate instead of Chrome, for faster testing:

#!/bin/sh
# Closes Chrome during hibernation to prevent crazy disk reads on thaw
# Systemd version, copy to /lib/systemd/system-sleep/ and chmod +x

if [ $1 = pre ] && [ $2 = suspend ]; then
    killall kate;
fi

if [ $1 = post ] && [ $2 = suspend ]; then
    echo "Running kate."
    su -l chema -c "DISPLAY=:0.0 kate" & 2>>/tmp/wake-log
fi

Кейт is killed on sleep alright, but never started on wake, even though "Running kate." does appears on syslog.

I also tried with runuser -l chema -c kate, but that always fails with QXcbConnection: Could not connect to display / Abort (core dumped), even after в xhost local:.

Any ты разрабатываешь?

2
задан 9 January 2016 в 01:50

0 ответов

Другие вопросы по тегам:

Похожие вопросы: