Ubuntu系统下如何隐藏已挂载驱动器(无需安装GNOME及外部库)
The gsettings command you tried is tied directly to GNOME's Nautilus file manager, so the error makes sense—your system doesn't have that GNOME-specific schema installed, which you're intentionally avoiding. Let's walk through solutions tailored to common non-GNOME desktop environments and setups:
1. Xfce Desktop (e.g., Xubuntu)
Xfce uses its native xfconf configuration tool, which comes pre-installed:
- Graphical approach:
- Open Settings > Desktop > Icons
- Uncheck the box labeled Mounted Volumes
- Command line approach:
Run this to disable mounted volume icons on the desktop immediately:xfconf-query --channel xfce4-desktop --property /desktop-icons/show-mounted --set false
2. KDE Plasma Desktop (e.g., Kubuntu)
KDE includes kwriteconfig5 for command-line tweaks, no extra libraries required:
- Graphical approach:
- Right-click the desktop and select Configure Desktop and Wallpaper
- Navigate to Desktop Icons > General
- Uncheck Show removable devices
- Command line approach:
# Disable the drive icon setting kwriteconfig5 --file plasmarc --section DesktopIcons --key ShowRemovableDevices false # Restart Plasma to apply changes kquitapp5 plasmashell && kstart5 plasmashell
3. MATE Desktop
MATE uses dconf (pre-installed by default) for settings management:
- Graphical approach:
- Open System Settings > Desktop > Desktop Icons
- Uncheck Show mounted volumes
- Command line approach:
dconf write /org/mate/desktop/desktop-icons/show-mounted-volumes false
4. Lightweight Window Managers (e.g., Openbox, i3wm)
If you're using a minimal window manager without a full desktop environment, drive icons usually come from your panel (like lxpanel or tint2):
- For lxpanel:
Right-click the panel, select Panel Settings > Plugins, find the Mount Devices plugin, and click Remove - For tint2:
Edit your tint2 config file (typically~/.config/tint2/tint2rc), locate lines related to drive monitoring (e.g.,execp = mount), and comment them out by adding a#at the start.
Quick check: What desktop environment am I using?
If you're unsure, run this terminal command to confirm:
echo $XDG_CURRENT_DESKTOP
内容的提问来源于stack exchange,提问作者Bugsfounder

