最新消息:阿啰哈,本人90后,目前单身,欢迎妹子们来撩!.(。→‿←。)

Show / Hide Desktop Shortcuts in Ubuntu via Context Menu

Xubuntu 林志斌 1014浏览

Want an option in your desktop’s context menu (right-click menu) that hides or un-hides all your desktop shortcuts in Ubuntu Unity or Gnome?

Ramvignesh, the guy sent me two simple scripts with this great idea. If you are interested, below will show you how to do it step by step.

1. How to Create Desktop Shortcuts in Ubuntu 14.04

Due to bug, you can’t drag and drop an application shortcut icon from Unity Dash result to desktop in Ubuntu 14.04 LTS.

But it’s still easy to create a desktop shortcut, all you need to do is:

  1. Open your file browser, navigate to Computer (from left sidebar)-> user -> share -> applications.
  2. Right click on a shortcut icon and select ‘Copy’
  3. Right-click on blank area of your desktop and select ‘Paste’

Create Desktop Shortcuts Ubuntu

Finally you’re able to click the desktop shortcut to launch the application without worrying about user permission issue.

2. Create the scripts to show/hide desktop shortcuts

Thanks to Ramvignesh for the simple scripts.

  • Create a new folder called bin in user’s Home folder.
  • Go into bin folder and create 2 empty documents: show-desktop-shortcutshide-desktop-shortcuts
  • Edit 2 documents one by one and paste below contents into them. IMPORTANT: Replace handbook in red with your user name.
  • for show-desktop-shortcuts file:

    #!/bin/bash
    #
    cd /home/handbook/Desktop
    for f in .* ; do 
    new=`echo "$f" | cut -c 2-`
    mv "$f" "$new"
    done

    for hide-desktop-shortcuts file:

    #!/bin/bash
    #
    cd /home/handbook/Desktop
    for f in * ; do
    mv "$f" ".${f#.}"
    done

    show-hide-desktop-shortcuts2

    Finally make the 2 scripts executable by going to their context menu (right-click menu) -> Properties -> Permissions tab -> check the box where it says 'Allow executing file as program'.

    allow-execute

    3. Add The 2 Scripts As Options Into Desktop's Context Menu

    Click the button below to bring up Ubuntu Software Center and install nautilus-actions, a graphical tool for configuring Nautilus' context menu.

    Click install nautilus-actions

    Now open nautilus-actions from Launcher and do:

    1. Create 2 new actions in Items list, name them to Show Desktop Shortcuts & Hide Desktop Shortcuts
    2. Under Action tab of both items, check the box says "Display item in location context menu"
    3. Type a name in Context label

      create-context-menu-items

    4. Under Command tab of both items, type in (browser) path to the two scripts in Path box.
      create-context-menu-items2
    5. (Optional) Go the menu Edit -> Preferences, in first tab un-check the two boxes under Nautilus menu layout.

    Finally, your desktop's context menu will look like below after reboot.

    desktop-context-menu

    Enjoy!

    via: http://ubuntuhandbook.org/index.php/2014/08/show-hide-desktop-shortcuts-via-context-menu

    转载请注明:林志斌 » Show / Hide Desktop Shortcuts in Ubuntu via Context Menu

    发表评论
    取消评论
    表情

    Hi,您需要填写昵称和邮箱!

    • 昵称 (必填)
    • 邮箱 (必填)
    • 网址