Merge pull request #1099 from Elv13/fix_1091

Closes https://github.com/awesomeWM/awesome/pull/1099.
Fixes https://github.com/awesomeWM/awesome/issues/1091.
This commit is contained in:
Daniel Hahler 2016-09-21 22:16:12 +02:00
commit 204e2ffada
2 changed files with 14 additions and 1 deletions

View File

@ -428,6 +428,7 @@ awful.rules.rules = {
raise = true, raise = true,
keys = clientkeys, keys = clientkeys,
buttons = clientbuttons, buttons = clientbuttons,
screen = awful.screen.preferred,
placement = awful.placement.no_overlap+awful.placement.no_offscreen placement = awful.placement.no_overlap+awful.placement.no_offscreen
} }
}, },

View File

@ -12,7 +12,8 @@ local capi =
{ {
mouse = mouse, mouse = mouse,
screen = screen, screen = screen,
client = client client = client,
awesome = awesome,
} }
local util = require("awful.util") local util = require("awful.util")
local object = require("gears.object") local object = require("gears.object")
@ -213,6 +214,17 @@ function screen.object.set_padding(self, padding)
end end
end end
--- Get the preferred screen in the context of a client.
-- This is exactly the same as `awful.screen.focused` except that it avoids
-- clients being moved when Awesome is restarted.
-- This is used in the default `rc.lua` to ensure clients get assigned to the
-- focused screen by default.
-- @tparam client c A client.
-- @treturn screen The preferred screen.
function screen.preferred(c)
return capi.awesome.startup and c.screen or screen.focused()
end
--- The defaults arguments for `awful.screen.focused` --- The defaults arguments for `awful.screen.focused`
-- @tfield[opt=nil] table awful.screen.default_focused_args -- @tfield[opt=nil] table awful.screen.default_focused_args