TransWikia.com

Restart desktop without losing programs?

Ask Ubuntu Asked by CatMan on December 23, 2021

I can restart my desktop from a console window (Ctrl+Alt+F1) with this command:

sudo service lightdm restart

This will present a fresh login screen and closes all programs running on the desktop. This it not what I want.

I want a command or a script that restarts the desktop from a console while keeping all applications running, so I can access their windows when I get back the desktop screen.

Background

I keep having problems with the desktop blacking out while the computer remains running fine. There are 9,286 posts with “black screen” with different causes. Some with solutions like this, some without. I am working with many Xubuntu computers and had it happen multiple times.

While causes differ, (in my cases) the symptom is often the same. It usually helped to restart lightdm, but I was losing my data and had to restart all applications. Now I had the problem when testing VGA matrix switches. Every time I reconnected my monitor, I had to reset lightdm. So I learned that what I need is a better workaround. Something analogous to restarting explorer.exe with the Windows Task Manager. This solves every hang up of the desktop but does not affect running programs (it basically restarts the desktop).

System: Xubuntu 16.04 64-bit, PC laptop

2 Answers

For Ubuntu 20.04 if you have ssh enabled on the computer.

  1. ssh into the affected computer from a remote computer
  2. execute killall -1 gnome-shell without sudo.

There's a bit of lag at the start when logging in as it is re-instantiating all gnome objects be patient; but most if not all running programs should continue working.

Answered by DanglingPointer on December 23, 2021

On Xubuntu 20.04 at least, the command

xfwm4 --replace &

did the trick for me.

Answered by FriendFX on December 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP