You are not logged in.

#1 2013-05-23 17:18:29

Registered: 2012-09-11
Posts: 86

Awesome WM, reassign window rules at whim

hey, everyone!

i've been trying to run awesome on top of MATE DE. thus far, it's mostly going well, but i've run into one particular issue with awesome itself.

it's very annoying that the window rules in awful.rules.rules are only applied on startup and when a new window is spawned. at present, my rules section looks like this:

awful.rules.rules = {
    -- All clients will match this rule.
    { rule = { },
      properties = { border_width = beautiful.border_width,
                     border_color = beautiful.border_normal,
                     focus = awful.client.focus.filter,
                     keys = clientkeys,
                     buttons = clientbuttons } },
    { rule = { maximized_horizontal = true }, -- these two should remove window borders from maximized windows because they get in the way
	  properties = { border_width = 0 } },
    { rule = { maximized_vertical = true },
	  properties = { border_width = 0 } },
    { rule = { type = "dock" }, -- set Mate-Panel to be always ontop
      properties = { border_width = 0,
                     ontop = true,
                     focus = false } },
    { rule = { fullscreen = true }, -- the idea here was that any fullscreen windows would be put ontop of the panel itself
      properties = { border_width = 0,
                     ontop = true } },
    { rule = { type = "desktop" }, -- removes the border from my caja desktop window and sets it on all tags
      properties = { border_width = 0,
                     sticky = true } },
    { rule_any = { class = { "MPlayer", "pinentry", "Gimp" } },
      properties = { floating = true } },
    -- Set Firefox to always map on tags number 2 of screen 1.
    -- { rule = { class = "Firefox" },
    --   properties = { tag = tags[1][2] } },

The problem with the rule set above is that awesome only sets window properties when it first starts and when a new process is spawned. this means that any window which starts in a maximised state won't have window borders, but any window that starts normally and then is maximised will. it also means that any window which is not initially spawned fullscreen will not be put ontop. the rules not being reset upon switching tags also means that i have to move the mouse or hit <Mod4>(j|k) to focus a window on the new tab, which interrupts workflow considerably. what i'd want to do is call whatever function reassigns window properties every time i hit the maximise/minimise keybinding or a switch tag keybinding, but i have no idea how to go about doing that.

oh, and speaking of moving the mouse to focus, is there a way to disable that?


Last edited by shmibs (2013-05-23 17:21:14)

[site] | [dotfiles] | "We're not human, are we?"


#2 2013-05-23 19:05:31

Registered: 2012-05-04
Posts: 40

Re: Awesome WM, reassign window rules at whim

Sounds like you want something along the lines of (untested, off the top of my head)

function () for c in awful.client.iterate() do awful.rules.apply(c) end end

called by your maximize/minimize/tagswitch keybinds and/or the relevant signals.  For turning of focus-follows-mouse, look for the section immediately following the comment "-- Enable sloppy focus" and remove that.


#3 2013-05-28 20:08:37

Registered: 2012-09-11
Posts: 86

Re: Awesome WM, reassign window rules at whim

hey, thanks smile
i've been able to figure out most of this after a bit of just messing around on my own:

switching the panel from ontop to above made it behave as expected, beneath fullscreen windows and above everything else.


function (c)
	        if c.maximized_horizontal or c.maximized_vertical then
				c.border_width = beautiful.border_width
				c.border_color = beautiful.border_focus
				c.maximized_horizontal = false
				c.maximized_vertical = false
				c.border_width = 0
				c.maximized_horizontal = true
				c.maximized_vertical = true

to the maximise keybinding fixed the window borders issue.

and i figured out that the focussing issue was that my panel and desktop were stealing focus when clicked on, so added a check to the "mouse button 1 sets focus" bit

Last edited by shmibs (2013-05-29 05:09:59)

[site] | [dotfiles] | "We're not human, are we?"


Board footer

Powered by FluxBB