Add option to move tags across screens

This commit is contained in:
Emmanuel Lepage Vallee 2014-11-06 23:46:40 -05:00
parent fa3c18b4b2
commit 22e56ea43d
4 changed files with 29 additions and 19 deletions

View File

@ -59,6 +59,7 @@ while the `Control` key is used to max out the effect.
| `Mod4` | `Mod1 (Alt)` | `Shift` | Resize a client relative to the top left corner |
| `Control` | `Mod1 (Alt)` | | Move to the next/previous tag |
| `Control` | `Mod4` | `Mod1 (Alt)` | Move to the next/previous screen |
| `Control` | `Mod4` | `Mod1 (Alt)` | + `Shift` Move tag to the next/previous screen |
# Using different keys

View File

@ -119,9 +119,9 @@ function module.tag(direction,swap,max)
start_loop(swap,max)
end
function module.screen(direction)
function module.screen(direction, move)
current_mode = "screen"
module._screen.display(nil,direction)
module._screen.display(nil,direction,move)
start_loop(false,max)
end
@ -140,6 +140,7 @@ local function new(k)
aw[#aw+1] = awful.key({ "Mod4", "Shift", "Control" }, key_nane, function () module.move (k,nil ,true) end)
aw[#aw+1] = awful.key({ "Mod4", "Control" }, key_nane, function () module.focus (k,nil ,true) end)
aw[#aw+1] = awful.key({ "Mod4", "Mod1" , "Control" }, key_nane, function () module.screen(k ) end)
aw[#aw+1] = awful.key({ "Mod1", "Shift", "Control", "Mod4" }, key_nane, function () module.screen(k,true ) end)
if k == "left" or k =="right" then -- Conflict with my text editor, so I say no
aw[#aw+1] = awful.key({ "Mod1", "Control" }, key_nane, function () module.tag (k,nil ,true) end)
aw[#aw+1] = awful.key({ "Mod1", "Shift", "Control" }, key_nane, function () module.tag (k,true,true) end)

View File

@ -95,7 +95,7 @@ local function draw_shape(s,collection,current_idx,icon_f,y,text_height)
-- Borders and background
cr3:set_source(k==current_idx and focus or nornal)
util.draw_round_rect(cr3,dx+border,0+border,width-2*border,height-2*border,rad)
cr3:set_line_width(2*border)
cr3:set_line_width(2*border + 4) -- The 4 is required to cover the non-antialiased region
cr3:stroke_preserve()
cr3:set_source(bg)
cr3:fill()

View File

@ -98,7 +98,7 @@ local function init_wiboxes(direction)
return true
end
local function next_screen(ss,dir)
local function next_screen(ss,dir,move)
local scr_index = ss
for k,s in ipairs(screens) do
if ss == s then
@ -115,21 +115,28 @@ local function next_screen(ss,dir)
local geom = capi.screen[scr_index].geometry
capi.mouse.coords({x=geom.x+geom.width/2,y=geom.y+geom.height/2+55})
if move then
local t = awful.tag.selected(ss)
awful.tag.setscreen(t,scr_index)
awful.tag.viewonly(t)
else
local c = awful.mouse.client_under_pointer()
if c then
capi.client.focus = c
end
end
return scr_index
end
function module.display(_,dir)
function module.display(_,dir,move)
if #wiboxes == 0 then
init_wiboxes(dir)
end
module.reload(nil,direction)
local ss,opss = capi.client.focus and capi.client.focus.screen or capi.mouse.screen,pss
next_screen(ss,dir)
next_screen(ss,dir,move)
module.reload(nil,direction)
end
@ -141,10 +148,11 @@ function module.hide()
end
end
function module.reload(_,dir)
function module.reload(mod,dir,__,___,move)
print("LA",mod and #mod)
local ss,opss = capi.client.focus and capi.client.focus.screen or capi.mouse.screen,pss
if dir then
ss = next_screen(ss,dir:lower())
ss = next_screen(ss,dir:lower(),move or (mod and #mod == 4))
end
if pss ~= ss then