如何阻止Linux中xdg-open/gio open启动Atom而非默认文件管理器?
Hey, I’ve dealt with similar default app mix-ups on Debian-based distros like Parrot before—let’s walk through how to track down and fix this issue step by step.
Step 1: Confirm the Broken MIME Association
First, let’s verify that the system is indeed linking directory opening to Atom. Run this command in your terminal:
xdg-mime query default inode/directory
If the output is something like atom.desktop, that’s the root of the problem—your system thinks Atom should handle directory navigation instead of your file manager.
Step 2: Fix the Default Directory Handler
Parrot OS typically uses Nemo as its default file manager, but adjust this if you use Thunar, Nautilus, or another one. Run the following command to set the correct app:
# Replace nemo.desktop with your file manager's desktop file (e.g., thunar.desktop, nautilus.desktop) xdg-mime default nemo.desktop inode/directory
Step 3: Check & Fix Gio Associations
Since you mentioned gio open . also triggers Atom, let’s update Gio’s settings too:
- Check the current Gio association:
gio mime inode/directory - Set it to your file manager:
gio mime inode/directory nemo.desktop
Step 4: Verify Atom Isn’t Overstepping Its Bounds
Sometimes apps like Atom incorrectly register themselves to handle directories during installation. Let’s check its desktop file:
- Open Atom’s desktop file (it might be in either global or user-specific location):
# Global location sudo nano /usr/share/applications/atom.desktop # Or user-specific location nano ~/.local/share/applications/atom.desktop - Look for the
MimeTypeline. If it includesinode/directory, remove that entry. - Save the file and update the desktop database:
# For user-specific changes update-desktop-database ~/.local/share/applications/ # For global changes sudo update-desktop-database /usr/share/applications/
Step 5: Test the Fix
Now run these commands to confirm everything works:
xdg-open . gio open .
Also try opening a directory from Firefox’s downloads panel or your desktop GUI—they should launch your default file manager instead of Atom.
Possible Causes
This usually happens because:
- Atom was set as the default directory handler accidentally during installation
- A script or system update overwrote your MIME associations
- A misconfigured desktop file for Atom incorrectly claimed directory handling
内容的提问来源于stack exchange,提问作者will.mendil

