KZDKM / Hyprspace

Workspace overview plugin for Hyprland
GNU General Public License v2.0
373 stars 15 forks source link

Navigate workspaces with keybinds? #46

Open cenunix opened 2 months ago

cenunix commented 2 months ago

Is there any way to navigate through workspaces in the overview with keybinds instead of using the mouse? the mouse controls are nice when my hand is already there, without it already there though I find myself wishing I could scroll back and forth through the previews with a simple keybind.

kooskaspers commented 2 months ago

@cenunix, yes, you can do this with the default bindings of Hyprland:

bind=modifierkey,whateverkey,workspace,m-1
bind=modifierkey,whateverkey,workspace,r+1

In my case I have mapped the bracket keys to switch workspaces:

bind=,bracketleft,workspace,m-1
bind=,bracketright,workspace,r+1

These will work within the overview plugin as well.

kiecla commented 2 months ago

It might be nice if a single hotkey comination could respond to the overview visibility state For example, one press of Super-TAB brings up the overview on the current workspace, the next cycles to the next workspace I think hycov has something like that, with the hotkey that responds to plugin state

KZDKM commented 2 months ago

Is there any way to navigate through workspaces in the overview with keybinds instead of using the mouse?

Opening overview does not disable any keybinds in your config, just configure hyprland keybinds to switch workspace.

It might be nice if a single hotkey comination could respond to the overview visibility state

Yeah that is possible but I could not think of a non-janky way of implementing it atm.

kiecla commented 1 month ago

Yeah that is possible but I could not think of a non-janky way of implementing it atm.

I was thinking of a separate dispatcher (perhaps overview:openOrNext) that does something like this pseudo-code

openOrNext() {
    if (isOverviewOpenOn(activeMonitor)) {
        goToNextWorkspaceOn(activeMonitor);
    } else {
        openOverviewOn(activeMonitor);
    }
}

No idea if that's how a plugin function is structured but you get the idea, doesn't seem too janky Are any of those three functions used there needing to be created or would it be possible to patch this together from stuff you've already written for the plugin or that exists in Hyprland? The only one that seems it might not already be here is isOverviewOpenOn

KZDKM commented 1 month ago

The proper way to implement this would be to create a keybind that executes a script that executes different dispatchers based on the overview state. Currently hyprland does not implement any API that allows plugin to interact with external scripts/programs. I might be able to create a socket so that scripts could implement an isOverviewOpen function.

kiecla commented 1 month ago

You're right, that would be the more modular solution to this