在 Launcher(啟動器) 內加入指令
這個例子(如上圖),是在 Launcher 裡加一個 lock screen 的程式。簡單的說就是寫一個 .desktop,把指令寫在 exec 那行,再把它放在家目錄的 ~/.local/share/applications/ 即可。
$ cat .local/share/applications/lock.desktop [Desktop Entry] Name=lock screen Icon=/usr/share/icons/oxygen/128x128/actions/system-lock-screen.png Exec=gnome-screensaver-command --lock Terminal=true Type=Application Categories=Settings;DesktopSettings; StartupNotify=true
加入捷徑並增加右鍵選單
在 Unity 的左邊有一排捷徑,可以用 gsettings get 取得列表,如下:
$ gsettings get com.canonical.Unity.Launcher favorites ['application:///home/dorowu/bin/custom-config.desktop', 'application://firefox.desktop', 'application://terminator.desktop', 'application://gvim.desktop', 'application://nautilus.desktop', 'application://zim.desktop', 'application://gemanx.desktop', 'application://virtualbox.desktop', 'application://shutter.desktop', 'application://google-chrome.desktop', 'application://gnome-control-center.desktop', 'unity://expo-icon', 'unity://devices', 'unity://running-apps']
捷徑可以放在任意位置,我是放在家目錄的 bin,接著再開 nautilus 拖進去就行。如上圖。
$ cat bin/custom-config.desktop [Desktop Entry] Encoding=UTF-8 Name=SwitchSetting Exec=/home/dorowu/bin/config.sh Icon=/usr/share/icons/Humanity/apps/48/redhat-tools.svg Terminal=true Type=Application StartupNotify=false X-Ayatana-Desktop-Shortcuts=Test1;Test2;Test3 [Test1 Shortcut Group] Name=General Exec=/home/dorowu/bin/config.sh TargetEnvironment=Unity [Test2 Shortcut Group] Name=General_Unity Exec=/home/dorowu/bin/config.sh 1 TargetEnvironment=Unity [Test3 Shortcut Group] Name=Asustor Exec=/home/dorowu/bin/config.sh 1 asustor TargetEnvironment=Unity
Reference
- UnityLaunchersAndDesktopFiles, https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles
- Desktop Entry Specification, http://standards.freedesktop.org/desktop-entry-spec/latest/
No comments:
Post a Comment