swaymonad icon indicating copy to clipboard operation
swaymonad copied to clipboard

More layout options

Open johnr14 opened this issue 1 year ago • 1 comments

Hi, I really like swaynomad, thanks for your work. I am new to sway and just can't get why this is not a standard feature !

I was wondering if it would be possible to add more layout options. As there are currently 3 layouts, it could be increased for fancier use. It would be nice to use the current focused window to be the largest one when re-arranging (promote).

I wish you could implement it, but I can understand that you may not have the time or desire to do so. I am opening an issue so it could give ideas to others and maybe find a kind soul that can implement it and make a pull request. I am pondering if it can be all configured in the /sway/config file and tackle this myself...

I tried adding this in my config but it didn't work. Is it a question of non-zero exit code from python functions : "the keybind will terminate on the first command that returns a non-zero exit code" ?

bindsym $mod+Alt+r nop promote_window ; nop set_layout tall ; nop reflecty

If I could get the above command working, most of the following could easily be possible.

# mode "layout"
n = nop for normal sway
r = tall column on right side
l = tall column on left side
t = wide column on top
b = wide column on bottom
c = 3 column 
w = wide monitor with 3 column with central being larger
g = golden ratio

# set default % of column space for biggest_window in current workspace:workroom
1-5 = set primary vertical column a % of screen to 25%-35%-50%-60%-75%
6-0 = set primary horizontal column a % of screen to 25%-35%-50%-60%-75%

# extra 
s = spiral
r = reverse spiral

r & l : this is just a reflection of the other on Y t & b : same but on X Having them defined is just to prevent doing a reflection after changing layout because it didn't give the desired layout

wide monitor : 3_column like this 4k setup

Last 2 may not be useful, but just pretty ?

Also, how could the layout be re-arranged after a layout change so it takes effect immediately ?

johnr14 avatar Oct 30 '23 19:10 johnr14

The problem with the multiple nops is that sway's ipc protocol lets swaymonad listen to binding executions, not individual commands, so swaymonad sees that a binding was executed with "nop promote_window ; nop set_layout tall ; nop reflecty" and fails to parse that. bd9b94ae756a09c185a2b2b0323b7008c19c859b implements support for multiple commands like that.

I'm not sure what you mean by "Also, how could the layout be re-arranged after a layout change so it takes effect immediately ?".

nicolasavru avatar Feb 25 '24 21:02 nicolasavru