micheleg / dash-to-dock

A dock for the Gnome Shell. This extension moves the dash out of the overview transforming it in a dock for an easier launching of applications and a faster switching between windows and desktops.
https://micheleg.github.io/dash-to-dock/
GNU General Public License v2.0
3.9k stars 462 forks source link

Feature request: "Show Desktop" icon #163

Open chamfay opened 9 years ago

chamfay commented 9 years ago

Is there a plan to add "show desktop" icon in in dash?

micheleg commented 9 years ago

There's some work going on, not by me, to add additional widgets, included a show desktop one. Have a look at the video at the end of this post: http://micheleg.github.io/dash-to-dock/release/2015/03/08/new-release-v39.html. There's also an experimental branch with some preliminary code. I don't have a schedule of when such features will land in master. What would you think of an entry in the showapps button menu?

chamfay commented 9 years ago

Cool widgets, hope you add some of them as soon as possible! Sorry, I don't understand wht did you mean in the last question.

fusion809 commented 7 years ago

@micheleg Unless I am mistaken this still hasn't been done has it?

micheleg commented 7 years ago

I confirm, it hasn't been done yet.

koxu1996 commented 7 years ago

@micheleg Any updates on this?

micheleg commented 7 years ago

@koxu1996: not yet, and I don't have a plan for this feature for the moment.

btd1337 commented 7 years ago

Temporary Solution:

$ yaourt -S wmctrl

$ gedit ~/.local/bin/show-desktop.sh

Place this code in there:

#!/bin/bash
status="$(wmctrl -m | grep "showing the desktop" | sed -r 's/(.*)(ON|OFF)/\2/g')"

if [ $status == "ON" ]; then
    wmctrl -k off
else
    wmctrl -k on
fi

$ chmod +x ~/.local/bin/show-desktop.sh

[Desktop Entry]
Type=Application
Name=Show Desktop
Icon=show-desktop
Exec=/home/<your user>/.local/bin/show-desktop.sh
Nebrit commented 6 years ago

@micheleg this code writed for dash to panel I think that can you help to develop this feature.

`_displayShowDesktopButton: function (isVisible) {
        if(isVisible) {
            if(this._showDesktopButton)
                return;

            this._showDesktopButton = new St.Bin({ style_class: 'showdesktop-button',
                            reactive: true,
                            can_focus: true,
                            x_fill: true,
                            y_fill: true,
                            track_hover: true });

            this._showDesktopButton.connect('button-press-event', Lang.bind(this, this._onShowDesktopButtonPress));

            this._showDesktopButton.connect('enter-event', Lang.bind(this, function(){
                this._showDesktopButton.add_style_class_name('showdesktop-button-hovered');
            }));

            this._showDesktopButton.connect('leave-event', Lang.bind(this, function(){
                this._showDesktopButton.remove_style_class_name('showdesktop-button-hovered');
            }));

            this.panel._rightBox.insert_child_at_index(this._showDesktopButton, this.panel._rightBox.get_children().length);
        } else {
            if(!this._showDesktopButton)
                return;

            this.panel._rightBox.remove_child(this._showDesktopButton);
            this._showDesktopButton.destroy();
            this._showDesktopButton = null;
        }
    },

    _onShowDesktopButtonPress: function() {
        if(this._focusAppChangeId){
            tracker.disconnect(this._focusAppChangeId);
            this._focusAppChangeId = null;
        }

        if(this._restoreWindowList && this._restoreWindowList.length) {
            let current_workspace = global.screen.get_active_workspace();
            let windows = current_workspace.list_windows();
            this._restoreWindowList.forEach(function(w) {
                if(windows.indexOf(w) > -1)
                    Main.activateWindow(w);
            });
            this._restoreWindowList = null;

            Main.overview.hide();
        } else {
            let current_workspace = global.screen.get_active_workspace();
            let windows = current_workspace.list_windows().filter(function (w) {
                return w.showing_on_its_workspace() && !w.skip_taskbar;
            });
            windows = global.display.sort_windows_by_stacking(windows);

            windows.forEach(function(w) {
                w.minimize();
            });

            this._restoreWindowList = windows;

            Mainloop.timeout_add(0, Lang.bind(this, function () {
                this._focusAppChangeId = tracker.connect('notify::focus-app', Lang.bind(this, function () {
                    this._restoreWindowList = null;
                }));
            }));

            Main.overview.hide();
        }
    },

    _dtpUpdateSolidStyle: function() {
        if (this.actor.has_style_pseudo_class('overview') || !Main.sessionMode.hasWindows) {
            this._removeStyleClassName('solid');
            return false;`
micheleg commented 6 years ago

@Nebrit: thanks for pointing out at the code.

Nebrit commented 6 years ago

thanks for your time to develop @micheleg