Gnome
了解 .desktop 文件中的 AutostartCondition 鍵
帶有 GNOME 3 Shell 的 CentOS 7.x 預設在with鍵下提供以下
*.desktop
文件:/etc/xdg/autostart/``AutostartCondition
# gnome-welcome-tour.desktop [Desktop Entry] Type=Application Name=Welcome Exec=/usr/libexec/gnome-welcome-tour AutostartCondition=if-exists run-welcome-tour OnlyShowIn=GNOME; NoDisplay=true
和
# gnome-initial-setup-first-login.desktop [Desktop Entry] Name=Initial Setup #... Icon=preferences-system Exec=/usr/libexec/gnome-initial-setup --existing-user Terminal=false Type=Application StartupNotify=true Categories=GNOME;GTK;System; OnlyShowIn=GNOME; NoDisplay=true AutostartCondition=unless-exists gnome-initial-setup-done #...
我的問題:
- 我是否正確地認為key在啟動時讀取文件後
AutostartCondition
確定 key 的值是否Exec
由 GNOME 3(或其他 XDG 兼容桌面或會話管理器)執行?/etc/xdg/autostart/*.desktop
- 如何查詢目前值
AutostartCondition
?關於問題 #2:我嘗試了以下失敗(我已經完成了 gnome-welcome-tour 和 gnome-initial-setup 並且在登錄時沒有提示):
[user@user-centos-7 ~]$ gconftool-2 --recursive-list / | grep gnome-initial-setup-done [user@user-centos-7 ~]$ gsettings list-schemas | while read -r SCHEMA; do gsettings list-recursively $SCHEMA; done | grep gnome-initial-setup-done [user@user-centos-7 ~]$ [user@user-centos-7 ~]$ gconftool-2 --recursive-list / | grep run-welcome-tour [user@user-centos-7 ~]$ gsettings list-schemas | while read -r SCHEMA; do gsettings list-recursively $SCHEMA; done | grep run-welcome-tour [user@user-centos-7 ~]$
會話管理器讀取
.desktop
所有啟動應用程序的文件。如果AutostartCondition
在任何這些文件中找到一個鍵,它會檢查它的值:如果不滿足條件,則從啟動應用程序列表中刪除該特定應用程序。自動啟動條件在freedesktop郵件列表上的一篇非常古老的文章中進行了描述:The Autostart-Condition Key The Autostart-Condition key gives a condition which should be tested before autostarting the application; if the condition is not met, then the application MUST NOT be autostarted. The condition can be in one of the following forms: if-exists FILE The application should only be autostarted if FILE exists (relative to $XDG_CONFIG_HOME). unless-exists FILE The application should only be autostarted if FILE *doesn't* exist (relative to $XDG_CONFIG_HOME). DESKTOP-ENVIRONMENT-NAME [DESKTOP-SPECIFIC-TEST] The application should only be autostarted under the named desktop environment (as with OnlyShowIn). If DESKTOP-SPECIFIC-TEST is also given, the desktop environment will evaluate it in some manner specific to that desktop to determine whether or not the application should be autostarted. which would end up being used like: Name=kgpg # start only under KDE, and only if the given kconfig key is set Autostart-Condition=KDE kgpgrc:User Interface:AutoStart:false Name=vino # start only under GNOME, and only if the given gconf key is set Autostart-Condition=GNOME /desktop/gnome/remote_access/enabled Name=beagled # start under any desktop environment, unless # ~/.config/beagle/disable-autostart exists Autostart-Condition=unless-exists beagle/disable-autostart
因此,在您的特定情況下,自動啟動條件是
./config/run-welcome-tour
存在和./config/gnome-initial-setup-done
不存在。