Skip to content

How do I write a function to toggle between one and two masters? #3831

Answered by Aire-One
port19x asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @port19x

If you want to want a specific number of master clients for given tag, the easiest way to do it is to directly assign to the tag master_count https://awesomewm.org/apidoc/core_components/tag.html#master_count

function toggletwo()
    t = ascreen.focused().selected_tag
    t.master_count = t.master_count == 1 and 2 or 1
end

My goal is to bind this to a key so that I can effectively toggle between a "grid layout" and a regular master & stack

You probably should be looking for a grid layout instead 🤔 It shouldn't be that hard to write a custom layout.

https://github.com/xinhaoyuan/layout-machi can be used to generate on the fly layouts.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by port19x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants