shifty: don't spawn anything when moving window around

If a tag does not exist yet and we send a window it, it will be
created. However, we don't want to spawn anything at this point. Add an
argument to `getpos()` for that.
This commit is contained in:
Vincent Bernat 2014-01-01 09:05:25 +01:00
parent eb309fd35b
commit a47babf57e
2 changed files with 14 additions and 10 deletions

View file

@ -377,12 +377,14 @@ function set(t, args)
-- execute run/spawn -- execute run/spawn
if awful.tag.getproperty(t, "initial") then if awful.tag.getproperty(t, "initial") then
local spawn = args.spawn or preset.spawn or config.defaults.spawn if not args.nospawn then
local run = args.run or preset.run or config.defaults.run local spawn = args.spawn or preset.spawn or config.defaults.spawn
if spawn and args.matched ~= true then local run = args.run or preset.run or config.defaults.run
awful.util.spawn_with_shell(spawn, scr) if spawn and args.matched ~= true then
awful.util.spawn_with_shell(spawn, scr)
end
if run then run(t) end
end end
if run then run(t) end
awful.tag.setproperty(t, "initial", nil) awful.tag.setproperty(t, "initial", nil)
end end
@ -752,7 +754,7 @@ end
--getpos : returns a tag to match position --getpos : returns a tag to match position
-- @param pos : the index to find -- @param pos : the index to find
-- @return v : the tag (found or created) at position == 'pos' -- @return v : the tag (found or created) at position == 'pos'
function getpos(pos, scr_arg) function getpos(pos, scr_arg, nospawn)
local v = nil local v = nil
local existing = {} local existing = {}
local selected = nil local selected = nil
@ -794,7 +796,8 @@ function getpos(pos, scr_arg)
if j.position == pos then if j.position == pos then
v = add({name = i, v = add({name = i,
position = pos, position = pos,
noswitch = not switch}) noswitch = true,
nospawn = nospawn})
end end
end end
end end
@ -802,7 +805,8 @@ function getpos(pos, scr_arg)
-- not existing, not preconfigured -- not existing, not preconfigured
v = add({position = pos, v = add({position = pos,
name = pos, name = pos,
noswitch = not switch}) noswitch = true,
nospawn = nospawn})
end end
return v return v
end end

View file

@ -158,7 +158,7 @@ for i = 1, (shifty.config.maxtags or 9) do
function () function ()
local c = client.focus local c = client.focus
if c then if c then
local t = shifty.getpos(i) local t = shifty.getpos(i, nil, true)
awful.client.movetotag(t, c) awful.client.movetotag(t, c)
end end
end, end,
@ -166,7 +166,7 @@ for i = 1, (shifty.config.maxtags or 9) do
awful.key({ modkey, "Control", "Shift" }, i, awful.key({ modkey, "Control", "Shift" }, i,
function () function ()
if client.focus then if client.focus then
awful.client.toggletag(shifty.getpos(i)) awful.client.toggletag(shifty.getpos(i, nil, true))
end end
end, end,
i == 5 and "Toggle this tag on this window" or nil), i == 5 and "Toggle this tag on this window" or nil),