1. Home
  2. Linux
  3. Fix a frozen xfce linux desktop

How to fix a frozen XFCE Linux desktop

The XFCE4 desktop environment is a lightweight powerhouse of a desktop environment. It’s rock-solid and rarely crashes, due to how reliable and stable its codebase is. That said, nothing is 100% perfect, and problems can happen on even the most sturdy of desktops. So, here’s how to fix a frozen XFCE Linux desktop.

Refresh the XFCE4 panel

Most of the time, the problems, issues, and crashes on XFCE4 involve the XFCE4 panel. It’s understandable, as the panel can sometimes have plugins added to it that cause it to fail.

Sadly, there’s no built-in way for XFCE users to click a button so that the panel will restart, and there’s no secret reset function built-in like there is in Gnome Shell. Instead, users looking to fix a non-responsive XFCE4 panel must force-quit it and re-launch it.

The best way to kill and re-run the XFCE4 panel is with the terminal. Mainly because the terminal emulator will give you program output details, and you’ll be able to troubleshoot the issues causing your panel to lock up and fail. So, press Ctrl + Alt + T or Ctrl + Shift + T on the keyboard and get a terminal window open. Once the terminal window is ready to use, run the pidof command to determine the process ID code for the panel.

pidof xfce4-panel

Read the output number and place it into the kill command below.

kill number-from-pidof

Alternatively, if the top command doesn’t kill the panel, try this command.

killall xfce4-panel

With the XFCE4 panel closed, you can re-launch it directly from the terminal with:

xfce4-panel &

Running this command from the terminal will add a new XFCE4 panel onto the screen. From there, you can execute disown to send it to run in the background as a process, outside of the terminal.

disown

Refresh the XFCE4 window manager

Though the XFCE4 panel is a major annoyance, it’s not the only thing with the potential to break your desktop session. The XFCE4 window manager can also run into some problems when it crashes and can make it so that you can’t minimize/maximize windows open on the desktop.

Much like the panel, the Window manager can be dealt with through the terminal. So, launch a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. From there, you’ll need to run the xfwm4 command with the “–replace” switch, so that it can replace itself with the current instance of the window manager that is broken.

xfwm4 --replace

Upon running the command above, you’ll see your desktop flicker for a second. Don’t panic! This flash is a good thing, and it means that the window manager and everything handling your desktop session is refreshing. From here, all window-switching issues should be gone!

Is the window manager not refreshing when you run the replace command? Try to re-run it a few times. Or, if all else fails, run a kill command and the XFCE4 desktop environment should automatically restart the window manager on its own.

killall xfwm4

or

pidof xfwm4
kill number-from-pidof

Make a reset script

Using a few commands in the Linux terminal to restart the XFCE4 panel or the XFCE4 window manager works in a pinch, but if you’d like to do it all in one go, the best way is to write a script.

The first step in creating a reset script for the XFCE4 desktop is to create the file where the code will be stored. To create a new file, use the touch command below.

touch xfce4-restart

After running the touch command above, a file with the name “xfce4-restart” will appear in your home directory (~). From here, open up the script file with the Nano text editor.

nano -w xfce4-restart

At the top of the restart file, write in the first line of code. This code is known as the “shebang,” and it will help your Linux operating system run the script properly.

#!/bin/bash

Following the shebang code, add in the command that will kill the XFCE4 panel.

killall xfce4-panel

Press Enter to make a new line underneath the panel command, then add in a command to re-run the panel.

xfce4-panel

Following the second panel command, you must add in the code to refresh the window manager. To refresh the window manager press Enter to make another new line. Then, write in the xfwm4 –replace command.

xfwm4 --replace &

Save your edits to the xfce4-restart file in the Nano text editor by pressing Ctrl + O on the keyboard. After that, exit Nano by pressing Ctrl + X. Once out of the Nano text editor, update the permissions of your restart file using the chmod command.

chmod +x xfce4-restart

With the file permissions up to date, move the file into “/usr/bin/” with the mv command.

sudo mv xfce4-restart /usr/bin/

You’ll now be able to restart both the panel and window manager on the XFCE4 desktop by merely bringing up the quick launcher with Alt + F2, entering the command below and pressing the Enter key!

 xfce4-restart

3 Comments

  1. These instructions aren’t useful when the desktop screen is frozen and you cannot create terminal windows or have it respond to keyboard or mouse.

    How do you do the restarts from a SSH when not connected via the display that is frozen?

  2. Modified script dor it to work in my system. Also put the executeable in ~/.local/bin/ instead.
    The modified version just launces without using stdout

    — start
    #!/bin/bash

    killall xfce4-panel
    (xfce4-panel &> /dev/null &)
    (xfwm4 –replace &> /dev/null &)
    — end