G-dH / vertical-workspaces

V-Shell is a GNOME Shell extension that allows you to customize the layout and behavior of the Shell UI.
GNU General Public License v3.0
215 stars 19 forks source link

[FEATURE] Add function to close the overview / app grid by clicking empty space #149

Open meybonomme opened 2 months ago

meybonomme commented 2 months ago

Currently I'm using "Click To Close Overview" extension: https://extensions.gnome.org/extension/3826/click-to-close-overview/

This small and simple extension adds the possibility to close overview / app grid by clicking empty space. I think this is something that could be integrated into V-Shell. It only contains a few dozen lines of code:

import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import Clutter from 'gi://Clutter';

export default class ClickToCloseOverview {
    enable() {
        /* create new click action */
        this._clickAction = new Clutter.ClickAction();
        this._clickAction.connect('clicked', action => {
            /* ignore non-primary clicks */
            if (action.get_button() !== 1 && action.get_button() !== 0)
                return;

            /* clicked actor */
            const [x, y] = global.get_pointer();
            const actor = global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y);

            /* ignore clicks inside search box */
            const searchBox = Main.overview._overview._controls._searchEntry;
            if (actor === searchBox || actor.get_parent() === searchBox
                    || actor.get_parent().get_parent() === searchBox)
                return;

            Main.overview.toggle();
        });
        /* connect click action to the overview */
        Main.layoutManager.overviewGroup.add_action(this._clickAction);
    }

    disable() {
        /* disconnect click action from the overview */
        Main.layoutManager.overviewGroup.remove_action(this._clickAction);
        delete this._clickAction;
    }
}
meybonomme commented 2 months ago

Installed your update, but it only works in overview, but not in app grid.

G-dH commented 2 months ago

It works outside the app grid, preventing closing the overview when interacting with it.

meybonomme commented 2 months ago

Please make it work with app grid too, at least optionally. This is the main feature of the "Click To Close Overview" extension I use, but unfortunately it doesn't work with V-Shell now either.

G-dH commented 1 month ago

It works in the app grid view, but you need to click an empty space, not the app grid background to prevent unintentional closing while interacting with the app grid. I added this feature only because it's more consistent behavior if you disable workspace preview background. But honestly, I don't understand why anyone would open the app grid just to close it. How often do you actually use the app grid, and how often do you need to close it without launching an application?

G-dH commented 1 month ago

OK, I've removed the app grid blocker and added the option to disable it.

meybonomme commented 1 month ago

Thank you for taking the feedback into account and for developing V-Shell with great dedication!

I keep my V-Shell updated via the Github repository and test changes. I will provide more detailed feedback when I find more time.

G-dH commented 1 month ago

Can we close this issue?

meybonomme commented 1 month ago

I'm sorry I haven't found time to answer more thoroughly.

But honestly, I don't understand why anyone would open the app grid just to close it. How often do you actually use the app grid, and how often do you need to close it without launching an application?

For example, to use the search and if you don't find what you want, to leave the App Grid. I use it very often for various reasons. Yes, I can also use the Super key or the Esc key, but the mouse click is much more intuitive.

However, I have found time to test and think about the concept of navigating with mouse buttons:

...preventing closing the overview when interacting with it.

If you accidentally click past the icon area, the Application Grid will close immediately, which is really not good. The primary mouse click outside of the App Grid also doesn't feel good as there are no clear lines where App Grid starts or ends.

G-dH commented 1 month ago

Thanks.

meybonomme commented 5 days ago

Would you consider removing the primary click to exit the app grid and leaving only the secondary click option? I'm getting more and more aware that your original concept was better, and it's starting to bother me that accidentally clicking past the icon closes the app grid.

G-dH commented 5 days ago

Sure :)