tyrannical
tyrannical copied to clipboard
Restrict layouts available for a tag
Is it possible to specify a list of layouts that are allowed for a specific tag.
For preventing mod4+space
to select them? No, there is no way to do that, rc.lua control that list and that keybinding, tyrannical
cannot really access them that easily. I am sorry
I did it this way if it will be useful to anyone (or to absorb into tyrannical)
-- Add parameter to tyrannical table
{
name = "5:IDE",
position = 5,
exclusive = true,
init = false,
floating = false,
layout = awful.layout.suit.max,
layouts = {awful.layout.suit.max, awful.layout.suit.fair},
class = { "Eclipse"}
},
-- Add keys
awful.key({ modkey, }, "space", function() switchLayout(1) end, "Next layout"),
awful.key({ modkey, "Shift" }, "space", function() switchLayout(-1) end, "Prev layout"),
-- method to restrict layouts on tags
function switchLayout(direction)
t=awful.tag.selected(mouse.screen)
allowedLayoutsTable = (awful.tag.getdata(t)))
if allowedLayoutsTable == nil or allowedLayoutsTable['layouts'] == nil then
awful.layout.inc(layouts, direction)
else
awful.layout.inc(allowedLayoutsTable['layouts'], direction)
end
end
I just made a totally untested commit here: https://github.com/Elv13/awesome-1/commits/tag_layouts
This basically (maybe) implement what you want. This could be merged into Awesome and it would then work in Tyrannical. Again, I just coded that from a train without testing at all. So, please test, see if it works for you (and maybe fix it if it doesn't), then I will submit that to be merged for 3.6.
The problem with your approach is that it cannot really be integrated in Tyrannical without badly monkeypatching awful.layout. Remember, Tyrannical is only a wrapper on top of awful, it doesn't "implement" anything beside a few dynamic tagging related properties. I did some ugly monkeypatching in early Awesome 3.5 versions, but I really don't want to go back into doing that, it cause more bugs than it fix.