Score:0

How to run Midnight Commander as a separate app, not a terminal instance?

sy flag

Midnight Commander has a file which makes it available as a gnome app
/usr/share/applications/mc.desktop

[Desktop Entry]
Name=Midnight Commander
...
Exec=mc
Icon=MidnightCommander
Terminal=true
Type=Application
Categories=ConsoleOnly;Utility;FileManager;System;FileTools;
Keywords=file manager;console;

But when I run it, MC introduces itself as a Terminal app. How to run it as a separate app (with the MC icon in the dock, switching apps views)?

I tried to set Terminal=false but that changed nothing.

It bothers me, because when I have a running MC, and I want to open a terminal, I hit the super key, then type terminal, hit enter, and then I realize that nothing happened because MC already works as a terminal, so I need to open a terminal as a new window.

Ubuntu 22.04.1 LTS
GNOME 42.5
David avatar
cn flag
The version of Ubuntu is needed for this question. Different versions of Ubuntu use different versions of Gnome. Your app may not work on all of them.
Adrian Bienias avatar
sy flag
@David I've updated the question with Ubuntu & Gnome version
David avatar
cn flag
Have you verified the app works with Gnome 42?
Adrian Bienias avatar
sy flag
@David, I'm not sure you understand what's the problem. The app (Midnight Commander) works fine. I just don't want it to introduce itself as a terminal app.
Score:1
cn flag
  • Make a copy of your /usr/share/applications/mc.desktop in ~/.local/share/applications. You may need to create the folder applications if you do not already have it.

  • Edit the copy ~/.local/share/applications/mc.desktop`

    1. Change Terminal=true to Terminal=false
    2. Change Exec=mc to Exec=gnome-terminal --class=mccommander -- mc
    3. Add the line StartupWMClass=mccommander

This will now launch mc in a terminal that has a distinct window class, and will be treated as a separate application.

Adrian Bienias avatar
sy flag
Thanks, it works. I replaced `mccommander` with `mc` (don't know why I should name it somehow differently?), and added `mc` to `Keywords` so it's still searchable as `mc`.
vanadium avatar
cn flag
The choice of the classname is entirely yours, indeed.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.