3

I know how to put a Show Desktop icon in the launcher, but I'd like to have one in a corner.

The reason for this is that in the Launcher I have to "carefully" click on it, while if it's on the corner, I can be more "aggressive".

EDIT: I've tested some of the solutions in the answers but none accomplishes my objective, maybe because I didn't say it accurately: I want, in a corner,a show desktop icon(or not, I really don't care if instead I just have to move the pointer to the corner ) such that when I select it, the Desktop is shown and I can work in the Desktop, for example copy some file there, open a terminal,etc. and then, I can go back to all the windows minimized with the same icon.

@Serg 's solution has two issues: 1) The icon is fixed, but it's not in a corner. 2) It doesn't let me go back to the windows i minimized.

@Heynnema 's solution has the major issue that the icon just "shows" the Desktop, but I can't actually work on it: if I right-click on some empty space to open a terminal, that space might not be really "empty" in the sense that if I had an open window there, the right click options displayed are the one of that window before being minimize.

@GautamVashisht 's solution seems to be the same than Heynnema, cause Hot Corners is activated whenever I activate it in the CCSM.

  • I don't understand what you mean... could you provide more information ? – Liso Nov 6 '16 at 3:18
  • 2
    Close voters , the question asks for something that's not related to Ubuntu version. The question is still perfectly on topic on the site – Sergiy Kolodyazhnyy Nov 6 '16 at 4:23
  • @Serg Then edit it removing the superfluous info, you nitwit! **:D ;-) ** Done already for your convenience and upvoted A. – Fabby Nov 6 '16 at 9:27
  • 1
    Is non-icon based solution an option? You can configure hotcorner to show desktop without icon – Anwar Nov 6 '16 at 10:29
4

disclaimer: I am author of this indicator and it is written for this specific question

Introduction

Ubuntu by default doesn't have option to move "Show Desktop" icon - it has to live on the launcher. You can also have it show up in the Alt+Tab menu. However, it is possible to create a small indicator applet, that will live in your top panel, which comes pretty close to your requirement of placing the icon into the corner of the screen. This answer provides exactly that

Usage

Usage is very simple. Save the code in your ~/bin folder, for example for me it would be /home/serg/bin/show_desktop_indicator. In order to make it open every time you log into your Ubuntu, search in Dash for "Startup Applications", open that app, and add the full path to the indicator as new command.

You can also download the zip folder with the indicator from the project's Github page

Essentially, it minimizes all the open windows. There's two ways to go about it. One, you can click on indicator icon, and click the "Show desktop" menu entry, or use middle-mouse click on the icon itself.

Code

Also available on Github

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

#
# Author: Serg Kolo , contact: 1047481448@qq.com
# Date: November 5th, 2016
# Purpose: appindicator for minimizing all windows
# Written for: http://askubuntu.com/q/846067/295286
# Tested on: Ubuntu 16.04 LTS
#
#
# Licensed under The MIT License (MIT).
# See included LICENSE file or the notice below.
#
# Copyright © 2016 Sergiy Kolodyazhnyy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import gi
gi.require_version('AppIndicator3', '0.1')
gi.require_version('Notify', '0.7')
from gi.repository import GLib as glib
from gi.repository import AppIndicator3 as appindicator
from gi.repository import Gtk as gtk
from gi.repository import Gdk

class ShowDesktop(object):

    def __init__(self):
        self.app = appindicator.Indicator.new(
            'files-indicator', "user-desktop",
            appindicator.IndicatorCategory.OTHER
        )
        self.app.set_status(appindicator.IndicatorStatus.ACTIVE)
        self.make_menu()

    def add_menu_item(self, menu_obj, item_type, image, label, action, args):
        """ dynamic function that can add menu items depending on
            the item type and other arguments"""
        menu_item, icon = None, None
        if item_type is gtk.ImageMenuItem and label:
            menu_item = gtk.ImageMenuItem.new_with_label(label)
            menu_item.set_always_show_image(True)
            if '/' in image:
                icon = gtk.Image.new_from_file(image)
            else:
                icon = gtk.Image.new_from_icon_name(image, 48)
            menu_item.set_image(icon)
        elif item_type is gtk.ImageMenuItem and not label:
            menu_item = gtk.ImageMenuItem()
            menu_item.set_always_show_image(True)
            if '/' in image:
                icon = gtk.Image.new_from_file(image)
            else:
                icon = gtk.Image.new_from_icon_name(image, 16)
            menu_item.set_image(icon)
        elif item_type is gtk.MenuItem:
            menu_item = gtk.MenuItem(label)
        elif item_type is gtk.SeparatorMenuItem:
            menu_item = gtk.SeparatorMenuItem()
        if action:
            menu_item.connect('activate', action, *args)

        menu_obj.append(menu_item)
        menu_item.show()



    def make_menu(self):
        self.app_menu = gtk.Menu()
        content = [self.app_menu,gtk.MenuItem,
                   None,'Show Desktop',
                   self.show_desktop,[None]
        ]
        self.add_menu_item(*content)
        last = None
        for i in self.app_menu.get_children():
             last = i
        self.app.set_secondary_activate_target(last)

        content = [self.app_menu,gtk.ImageMenuItem,
                   'exit','Quit',
                   self.quit,[None]
        ]
        self.add_menu_item(*content)
        self.app.set_menu(self.app_menu)

    def show_desktop(self,*args):
        screen = Gdk.Screen.get_default()
        for w in screen.get_window_stack():
            w.iconify()
            w.process_all_updates()

    def run(self):
        """ Launches the indicator """
        try:
            gtk.main()
        except KeyboardInterrupt:
            pass

    def quit(self, *args):
        """ closes indicator """
        gtk.main_quit()


def main():
    """ defines program entry point """
    indicator = ShowDesktop()
    indicator.run()

if __name__ == '__main__':
  try:
    main()
  except  KeyboardInterrupt:
    gtk.main_quit()

Indicator in action:

Ubuntu with Kylin icon theme:

enter image description here

| improve this answer | |
  • Hi, did you meant the bin folder in / ? Because there isn't any bin folder in home/$user , should I create it? – Diego Nov 6 '16 at 7:05
  • 1
    @Diego yes, create it. Don't put it into /bin, that one is reserved. ~/bin is for your personal scripts and other software – Sergiy Kolodyazhnyy Nov 6 '16 at 7:15
  • @Diego or in /usr/local/bin: that one is available to all users. And as you've never accepted an answer on this site before: If one of the answers solved your problem, don't forget to click the grey at the left of its text, which means Yes, this answer is the most useful of all! ;-) – Fabby Nov 6 '16 at 9:29
1

Even better...

Install Compiz configuration settings manager (compizconfig-settings-manager in Synaptic or terminal).

Start CompizConfig Settings Manager from the Unity Dash and choose the Expo plugin.

enter image description here

Then change the Expo Corner/Edge from None to whichever corner or side that you'd like to activate it. I've chosen the TopRight corner. Then quit CCSM.

enter image description here

Now you can just mouse up to the TopRight corner, click once in the desired desktop/viewport, and voila, no desktop icon even required!

| improve this answer | |
0

There is no specific way in Ubuntu till now to move Show Desktop icon in the launcher to a corner. But there are few alternative ways(workarounds) which you can use for accessing Desktop screen! Some of them are listed below :-

1.) Alt + Tab Shortcut Key

Use the Alt + Tab shortcut key. It is used mainly for switching applications. When you press Alt + Tab key, the first icon that appears on the left is the Show Desktop icon. You can Tab your way to this icon to access your Desktop screen.

2.) Super + D or Ctrl + Alt + D Shortcut Key

In Unity Desktop, you can use the default Super + D or Ctrl + Alt + D shortcut key to access your Desktop screen.

3.) Accessing the Desktop screen using Hotcorners

To do this, first install Unity Tweak Tool either by Ubuntu Software Centre or by typing sudo apt-get install unity-tweak-tool in the terminal. Then open/launch Unity Tweak Tool and click on Hotcorners under Windows Manager. Then under General section, turn on Hotcorners and under Behaviour section, select Toggle Desktop in the box adjacent to the hotcorner you wish to use. Then whenever you will hover your cursor in that corner, you will see your Desktop screen.

References : Accessing the Show Desktop icon in Ubuntu

| improve this answer | |
  • I have edited the answer now and have added a helpful link ! – Gautam Vashisht Nov 6 '16 at 5:07
  • Now I have edited my answer and have added the contents in that link in my answer. Is it OK now? – Gautam Vashisht Nov 6 '16 at 14:24
  • unity-tweak-tool hot corners for showing desktop does not work. After reading, it has a bug, it only works for the first time after login then stops. – Mohammed Joraid Jul 17 '17 at 0:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.