PaperWM icon indicating copy to clipboard operation
PaperWM copied to clipboard

Mass window closing, like on browsers.

Open ripefig opened this issue 5 years ago • 7 comments

Again apologies if out of scope, but I think there is a use case for closing windows in workspace en-masse, the same way you can do on browsers.

Examples:

  1. Close all windows [or all windows of a class] to the left/right of current window. Useful for tabless browsing - given that PaperWM doesn't leave much room for tabs inside windows.
  2. Close all windows in workspace (destroy workspace).

ripefig avatar Jun 16 '19 11:06 ripefig

I think #53 would solve this nicely. Ie. select all to the left/right could be done quickly by pressing and holding </>. Issuing a close on a selection would close all windows in the selection.

I'm not sure what you mean by "doesn't leave much room for tabs"? That's up to the applications.

Closing all windows in a workspace works by pressing and holding <Super>Backspace. Ie. the action triggers again on key-repeat. (though we miiight change that (if technically possible) since it's source for mistakenly closed windows)

olejorgenb avatar Jun 16 '19 13:06 olejorgenb

edit.

You mean it can accidentally close multiple workspaces on key repeat?

This addresses the issue, I agree. Maybe some gui helper would be beneficial.

ripefig avatar Jun 16 '19 14:06 ripefig

You mean it can accidentally close multiple workspaces on key repeat?

No just multiple windows. The close action doesn't continue to the next workspace.

I haven't really considered the repeat behavior before - mutter (the gnome-shell "backend") triggers actions on key-repeat and I'm not even sure if that's controllable (without a hack).

I've used the extension for well over a year now and can't remember mistakenly closing a window due to the repeat though. But I know some WM's special cases repeat behavior of the close action (eg. notion/ion3).

olejorgenb avatar Jun 16 '19 14:06 olejorgenb

Oh in that case I would consider implementing a single action to close an entire set of windows (e.g destroy workspace). This could make tabless browsing possible on paper WM, for example. The current functionality more or less does the job, but it's a little less convenient.

ripefig avatar Jun 16 '19 14:06 ripefig

I agree that such action is useful for certain workflows, but we try to keep a slim core feature set atm.

Implementing a crude version of the action is simple (though no future API guarantees are given):

    var Keybindings = Extension.imports.keybindings;

    Keybindings.bindkey("<Super>d", "close-workspace", (mw) => {
        if (!mw) {
            return;
        }
        let space = Tiling.spaces.spaceOfWindow(mw);
        for (let col of space) {
            for (let metaWindow of col) {
                metaWindow.delete(global.get_current_time());
            }
        }

        // Uncoment to also remove the workspace
        // global.workspace_manager.remove_workspace(space.workspace, global.get_current_time());

    }, {activeInNavigator: true})

Put the above in ~/.config/paperwm/user.js inside the init function (after the existing code)

Note you might not want to remove the workspace since we don't have a convenient way to quickly create new workspaces. That is on the plan though.

olejorgenb avatar Jun 16 '19 14:06 olejorgenb

You could just manage workspace with Gnome overview though, correct?

ripefig avatar Jun 16 '19 16:06 ripefig

Sure :) (We listen to the workspace related signals so most existing workspace related actions should work out of the box)

But don't think you can create new workspaces from the overview if you use the static workspace settings?

olejorgenb avatar Jun 16 '19 16:06 olejorgenb

New features that allow managing multiple windows at once (including closing them all): #808.

jtaala avatar Mar 29 '24 11:03 jtaala

Closing as #808 adds the ability to mass close selected windows.

jtaala avatar Mar 29 '24 12:03 jtaala