tyrannical icon indicating copy to clipboard operation
tyrannical copied to clipboard

Restrict layouts available for a tag

Open hari-rangarajan opened this issue 9 years ago • 3 comments

Is it possible to specify a list of layouts that are allowed for a specific tag.

hari-rangarajan avatar Sep 08 '15 22:09 hari-rangarajan

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

Elv13 avatar Sep 08 '15 22:09 Elv13

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

hari-rangarajan avatar Oct 30 '15 15:10 hari-rangarajan

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.

Elv13 avatar Oct 31 '15 23:10 Elv13