7

I was wondering what commands/utilities can be used in terminal to know the types of windowing system (such as X window system), window manager (such as Metacity, KWin, Window Maker) and desktop environment (such as KDE, Gnome) of a Linux or other Unix-like operating systems?

Thanks!

Tim
  • 101,790
  • 2
    So you want to know what's installed, what's default or what's running? – bahamat Feb 14 '11 at 16:14
  • @bahamat: what is running. That is why I want to know if there are some system files or commands for me to check that. But if you also know how to check for what's installed, what's default, then I also would like to know. Thanks! – Tim Feb 14 '11 at 17:49
  • What do you want to do with this information? (Windowing system is at least almost always X windows) – pjc50 Feb 15 '11 at 15:38
  • @pjc50: different types come with different sets of applications. I need the info to decide whether an application is for mine. – Tim Feb 15 '11 at 15:41
  • 1
    For desktop environment, I came across env | grep XDG_CURRENT_DESKTOP. –  May 07 '13 at 17:41
  • I think the only way to know what's running is to see what processes are running in your current session. As for what's installed, just check what packages are installed (but still you can compile from source, then apt database is skipped). As for what's default, it really depends on how you start your DE and your configuration. In general, there's no 100% sure way to test this. – 炸鱼薯条德里克 Feb 19 '19 at 01:35

3 Answers3

9

From Ask Ubuntu.SE: If you have wmctrl installed, wmctrl -m will identify the window manager for you.

Thomas already mentioned the XDG_CURRENT_DESKTOP environment variable for identifying the desktop environment.

And from this thread here in Unix & Linux SE: the XDG_SESSION_TYPE environment variable can be used to identify whether the windowing system is X11 or Wayland.

Pandya
  • 24,618
telcoM
  • 96,466
6

With difficulty.

There is no centralized system for keeping track of these things.

  • On Debian-derived Linuxes you might try the alternatives system.
  • You could query the package manager, and if you find only one Foo installed, you can be pretty sure which Foo is in use.
  • You could try parsing the output of ps. Or equivalently of reading /proc on systems that have it.

Possibly the most reliable thing is to ask the user.

2

One of the answers in the comments works for me in Kali (probably in other Debian-based distros as well)

env | grep XDG_CURRENT_DESKTOP
Thomas
  • 123