GithubHelp home page GithubHelp logo

Comments (2)

emanuele6 avatar emanuele6 commented on August 26, 2024

Node selectors do not behave differently.

.local.floating is not a valid node selector, as it is missing a node descriptor; it is just a list of node modifiers.

The -n/-d/-m options for the query -N/query -D/query -M commands will accept either a node/desktop/monitor selector, or a list of node/desktop/monitor modifiers. If you specify a selector, it will constrain result the only the node/desktop/monitor specified by that selector; if you just specify a modifier, it will constrain results to any node/desktop/monitor that matches those modifiers.

A node selector will only specify one node, with bspc query -N -n .local.floating, you are getting the IDs of all the nodes that match those modifiers.

In fact, your bspc node -f $(bspc query -N -n .local.floating) command will have a few problems if there are more than one match or no matches.

If you use an actual node selector, it will work with node too; for example, you can use the any node descriptor to get the "first" node that matches the given modifiers (the first node that would show up in the ouptut of bspc query -N):

bspc node any.floating.local -f
# or:  bspc node -f any.floating.local

Note that, when you use a selector for node -f, you almost always want to specify .!hidden otherwise, if there is a floating node in the focused desktop, that is hidden, and happens to be the "first" .local.floating node, your command will fail because hidden nodes are not focusable, even though there is another focusable node that matches those modifiers.

Also note, that if you are writing a hotkey to focus a floating window, it is better to use next or prev instead of any, so that if you press the binding multiple times, you will focus another floating window instead of the same one again. (next focuses the "first" node that matches the given modifiers, starting from after the focused node, unlike any that always starts from the root node of the first non-free desktop; prev is similar, but matches the first node looking going backwards starting from the focused node).

Example sxhkd hotkeys:

# focus or cycle floating windows
super + {_,shift + }g
	bspc node '{next,prev}.!hidden.local.floating' -f
# focus or cycle tiled (or pseudo_tiled) windows
super + {_,shift + }c
	bspc node '{next,prev}.!hidden.local.!floating.!fullscreen.window' -f

Perhaps you were thinking .local.floating was a node selector because the manual says that the -n option of the query commands accepts node selectors; that was a documentation bug that has since been fixed on the git repository, now the documentation says that -n accepts either a node selector (NODE_SEL) or a list of node modifiers (NODE_MODIFIERS).

from bspwm.

ShinyZero0 avatar ShinyZero0 commented on August 26, 2024

Oh now i get it, thank you for this explanation.

from bspwm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.