是否可以将自定义项添加到“系统设置”窗口?
例如,如何在此窗口中添加“启动应用程序首选项”启动程序?
添加自定义应用程序条目到系统设置
要将自定义应用程序添加到系统设置 ( Gnome控制中心 ),请找到其桌面条目文件 – /usr/share/applications/{appname}.desktop
并对其进行编辑以确保存在以下条目:
Categories=Settings;X-GNOME-Settings-Panel;xxxxx; X-GNOME-Settings-Panel={appname}
将{appname}
替换为您要添加到“系统设置”的应用程序的名称。 xxxxx
决定显示应用程序的部分 。 将xxxxx
替换为以下可能选项之一:
X-GNOME-PersonalSettings – 个人部分
HardwareSettings – 硬件部分(注意不使用前缀X-GNOME)
X-GNOME-SystemSettings – 系统部分
修改后运行此命令:
sudo update-desktop-database
这是在Ubuntu 12.04 LTS 12.04上试用和测试的,带有gnome-control-center版本3.4.2-0ubuntu0.12
注意事项 :
- 系统设置无法识别
~/.local/share/applications
桌面文件,因此,无法仅为一个用户向系统设置添加应用程序。 - 正如本回答中 Manish Sinha所述 ,Ubuntu使用带有Ubuntu特定补丁的
gnome-control-center
,可以添加自定义条目。 因此,此方法是特定于Ubuntu的,并且不适用于其他发行版使用的vanillagnome-control-center
。
11.10
现在,在GNOME上游不支持向系统设置添加自定义项目
Ubuntu补丁系统设置gnome-control-center
以便它可以包含它自己的ubuntu特定条目。
简而言之,你需要安装libgnome-control-center-dev
并在应用程序周围创建一个包装器,它是使用libgnome-control-center-dev
为pkg-config
针对gnome-control-center软件包构建的
现在没有GUI方法来添加它。 您需要使用C以编程方式执行此操作,它仅适用于Ubuntu。
David Zeuthen详细介绍了不允许第三方条目(称为小组)的原因
> Thu, May 12, 2011 at 4:39 PM, Sergey Udaltsov wrote: > My whole point was that in the ideal world GNOME could be extensible > enough so that no _forking_ would be necessary. Extension modules, not > patches. That would be not a side effect of the license but the > fundamental feature of the architecture. Do you see the difference? Yes. I also think we tried that with GNOME 2 and failed. I mean, look at GNOME 2's control center - on all distros, it's a royal mess of random crap from either GNOME, the distro or 3rd party app written by a kid in a basement. With GNOME 3.2, we will have a simpler control center (since the extension mechanism is going away) but it will be _awesome_.
@lancer为Ubuntu 14.04更新答案:
它可能来自ubuntu团队的gnome-system-settings的分支,因为我可以在某处找到一些博客文章(不记得在哪里..:/)
无论如何,以下两行显示了差异,下面是一个更全面的例子
X-Unity-Settings-Panel={appname} Categories=GNOME;GTK;Settings;X-Unity-Settings-Panel;xxxx;
例如:
[Desktop Entry] Encoding=UTF-8 Type=Application Name=TefApp Name[C]=TefApp Exec=/home/stephaneag/Documents/ubuntu_CustomSystemSettingsEntryApp/dummyScript.sh Comment[C]=dumb dummy app StartupNotify=true Icon=utilities-terminal Terminal=false NoDisplay=false # the following is necessary for the .desktop to be accepted in System Settings # for our stuff to appear in "System" section: #Categories=GNOME;GTK;Settings;X-Unity-Settings-Panel;X-GNOME-SystemSettings; # for our stuff to appear in "Hardware" section: #Categories=GNOME;GTK;Settings;X-Unity-Settings-Panel;HardwareSettings; # for our stuff to appear in the "Personal" section: Categories=GNOME;GTK;Settings;X-Unity-Settings-Panel;X-GNOME-PersonalSettings; OnlyShowIn=Unity;
有关使用users-admin替换默认用户程序的具体详细信息,请参阅14.04更新,以便更改组。
-
使用users-admin安装gnome系统工具
sudo apt-get install gnome-system-tools
- 编辑用户管理桌面,使其显示在Unity Control Center中 – 请参阅下面的条目
-
移动旧用户桌面,使其不显示在Unity Control Center中
cd /usr/share/applications/ mv unity-user-accounts-panel.desktop unity-user-accounts-panel.desktop.ORIG
-
更新数据库
sudo update-desktop-database
这是在Ubuntu 14.04 LTS上测试的。 不知道系统更新将如何影响更新的文件。 将不得不检查下一次升级。
/usr/share/applications/users.desktop:
[Desktop Entry] Version=1.0 Name=Users and Groups Comment=Add or remove users and groups Exec=users-admin Icon=config-users Terminal=false Type=Application StartupNotify=true Categories=GNOME;GTK;Settings;X-Unity-Settings-Panel;X-GNOME-SystemSettings; OnlyShowIn=Unity; X-Unity-Settings-Panel=users