如何让桌面图标显示在屏幕一角?

Die*_*ego 5 unity shortcuts

我知道如何在启动器中放置一个“显示桌面”图标,但我想在角落里放一个图标。

这样做的原因是,在启动器中我必须“小心”点击它,而如果它在角落里,我可以更“激进”。

编辑:我已经测试了答案中的一些解决方案,但没有一个能够实现我的目标,也许是因为我没有准确地说出:我想要在角落里显示桌面图标(或不,我真的不在乎如果相反,我只需将指针移动到角落),这样当我选择它时,就会显示桌面,我可以在桌面中工作,例如在那里复制一些文件,打开终端等。然后,我可以返回到使用相同图标最小化的所有窗口。

@Serg 的解决方案有两个问题:1)图标是固定的,但它不在角落。2)它不允许我返回到最小化的窗口。

@Heynnema 的解决方案有一个主要问题,即图标只是“显示”桌面,但我实际上无法处理它:如果我右键单击某个空白区域来打开终端,该空间可能不是真正的“空”的意思是,如果我在那里有一个打开的窗口,则显示的右键单击选项是最小化之前的该窗口之一。

@GautamVashisht 的解决方案似乎与 Heynnema 相同,因为每当我在 CCSM 中激活 Hot Corners 时,它就会被激活。

Ser*_*nyy 4

免责声明:我是该指标的作者,它是针对这个特定问题而编写的

\n\n

介绍

\n\n

默认情况下,Ubuntu 没有移动“显示桌面”图标的选项 - 它必须位于启动器上。您还可以将其显示在 Alt+Tab 菜单中。但是,可以创建一个小的指示器小程序,它将位于您的顶部面板中,这非常接近您将图标放置在屏幕角落的要求。这个答案恰恰说明了这一点

\n\n

用法

\n\n

使用方法非常简单。将代码保存在您的~/bin文件夹中,例如对我来说它将是/home/serg/bin/show_desktop_indicator. 为了使其在每次登录 Ubuntu 时都打开,请在 Dash 中搜索“启动应用程序”,打开该应用程序,并将指标的完整路径添加为新命令。

\n\n

您还可以从项目的 Github 页面下载带有指标的 zip 文件夹

\n\n

本质上,它最小化了所有打开的窗口。有两种方法可以解决这个问题。一,您可以单击指示器图标,然后单击“显示桌面”菜单项,或使用鼠标中键单击图标本身。

\n\n

代码

\n\n

也可以在Github上找到

\n\n
#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n#\n# Author: Serg Kolo , contact: 1047481448@qq.com\n# Date: November 5th, 2016\n# Purpose: appindicator for minimizing all windows\n# Written for: http://askubuntu.com/q/846067/295286\n# Tested on: Ubuntu 16.04 LTS\n#\n#\n# Licensed under The MIT License (MIT).\n# See included LICENSE file or the notice below.\n#\n# Copyright \xc2\xa9 2016 Sergiy Kolodyazhnyy\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the "Software"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included\n# in all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n# SOFTWARE.\nimport gi\ngi.require_version(\'AppIndicator3\', \'0.1\')\ngi.require_version(\'Notify\', \'0.7\')\nfrom gi.repository import GLib as glib\nfrom gi.repository import AppIndicator3 as appindicator\nfrom gi.repository import Gtk as gtk\nfrom gi.repository import Gdk\n\nclass ShowDesktop(object):\n\n    def __init__(self):\n        self.app = appindicator.Indicator.new(\n            \'files-indicator\', "user-desktop",\n            appindicator.IndicatorCategory.OTHER\n        )\n        self.app.set_status(appindicator.IndicatorStatus.ACTIVE)\n        self.make_menu()\n\n    def add_menu_item(self, menu_obj, item_type, image, label, action, args):\n        """ dynamic function that can add menu items depending on\n            the item type and other arguments"""\n        menu_item, icon = None, None\n        if item_type is gtk.ImageMenuItem and label:\n            menu_item = gtk.ImageMenuItem.new_with_label(label)\n            menu_item.set_always_show_image(True)\n            if \'/\' in image:\n                icon = gtk.Image.new_from_file(image)\n            else:\n                icon = gtk.Image.new_from_icon_name(image, 48)\n            menu_item.set_image(icon)\n        elif item_type is gtk.ImageMenuItem and not label:\n            menu_item = gtk.ImageMenuItem()\n            menu_item.set_always_show_image(True)\n            if \'/\' in image:\n                icon = gtk.Image.new_from_file(image)\n            else:\n                icon = gtk.Image.new_from_icon_name(image, 16)\n            menu_item.set_image(icon)\n        elif item_type is gtk.MenuItem:\n            menu_item = gtk.MenuItem(label)\n        elif item_type is gtk.SeparatorMenuItem:\n            menu_item = gtk.SeparatorMenuItem()\n        if action:\n            menu_item.connect(\'activate\', action, *args)\n\n        menu_obj.append(menu_item)\n        menu_item.show()\n\n\n\n    def make_menu(self):\n        self.app_menu = gtk.Menu()\n        content = [self.app_menu,gtk.MenuItem,\n                   None,\'Show Desktop\',\n                   self.show_desktop,[None]\n        ]\n        self.add_menu_item(*content)\n        last = None\n        for i in self.app_menu.get_children():\n             last = i\n        self.app.set_secondary_activate_target(last)\n\n        content = [self.app_menu,gtk.ImageMenuItem,\n                   \'exit\',\'Quit\',\n                   self.quit,[None]\n        ]\n        self.add_menu_item(*content)\n        self.app.set_menu(self.app_menu)\n\n    def show_desktop(self,*args):\n        screen = Gdk.Screen.get_default()\n        for w in screen.get_window_stack():\n            w.iconify()\n            w.process_all_updates()\n\n    def run(self):\n        """ Launches the indicator """\n        try:\n            gtk.main()\n        except KeyboardInterrupt:\n            pass\n\n    def quit(self, *args):\n        """ closes indicator """\n        gtk.main_quit()\n\n\ndef main():\n    """ defines program entry point """\n    indicator = ShowDesktop()\n    indicator.run()\n\nif __name__ == \'__main__\':\n  try:\n    main()\n  except  KeyboardInterrupt:\n    gtk.main_quit()\n
Run Code Online (Sandbox Code Playgroud)\n\n

运行中的指标:

\n\n

Ubuntu 与 Kylin 图标主题:

\n\n

在此输入图像描述

\n


Gau*_*sht 0

到目前为止,Ubuntu 中还没有特定的方法可以将启动器中的“显示桌面”图标移动到角落。但是,您可以使用几种替代方法(解决方法)来访问桌面屏幕!下面列出了其中一些:-

1.) Alt + Tab 快捷键

使用Alt + Tab快捷键。它主要用于切换应用程序。当您按Alt + Tab键时,左侧出现的第一个图标是“显示桌面”图标。您可以按 Tab 键移动到此图标以访问桌面屏幕。

2.) Super + DCtrl + Alt + D快捷键

在 Unity Desktop 中,您可以使用默认的 Super + DCtrl + Alt + D快捷键来访问桌面屏幕。

3.) 使用Hotcorners访问桌面屏幕

为此,首先通过 Ubuntu 软件中心或sudo apt-get install unity-tweak-tool在终端中输入来安装 Unity Tweak Tool。然后打开/启动 Unity Tweak Tool 并单击Windows Manager下的Hotcorners。然后在“常规”部分下,打开“Hotcorners”,并在“行为”部分下,在您要使用的 Hotcorner 旁边的框中选择“切换桌面” 。然后,每当您将光标悬停在该角落时,您都会看到桌面屏幕。

参考资料:在 Ubuntu 中访问显示桌面图标