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 | | `Mod4` | `Mod1 (Alt)` | `Shift` | Resize a client relative to the top left corner |
| `Control` | `Mod1 (Alt)` | | Move to the next/previous tag | | `Control` | `Mod1 (Alt)` | | Move to the next/previous tag |
| `Control` | `Mod4` | `Mod1 (Alt)` | Move to the next/previous screen | | `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 # Using different keys

View File

@ -119,9 +119,9 @@ function module.tag(direction,swap,max)
start_loop(swap,max) start_loop(swap,max)
end end
function module.screen(direction) function module.screen(direction, move)
current_mode = "screen" current_mode = "screen"
module._screen.display(nil,direction) module._screen.display(nil,direction,move)
start_loop(false,max) start_loop(false,max)
end end
@ -134,15 +134,16 @@ local function new(k)
glib.idle_add(glib.PRIORITY_DEFAULT_IDLE, function() glib.idle_add(glib.PRIORITY_DEFAULT_IDLE, function()
for k,v in pairs(keys) do for k,v in pairs(keys) do
for _,key_nane in ipairs(v) do for _,key_nane in ipairs(v) do
aw[#aw+1] = awful.key({ "Mod4", }, key_nane, function () module.focus (k ) end) aw[#aw+1] = awful.key({ "Mod4", }, key_nane, function () module.focus (k ) end)
aw[#aw+1] = awful.key({ "Mod4", "Mod1" }, key_nane, function () module.resize(k ) end) aw[#aw+1] = awful.key({ "Mod4", "Mod1" }, key_nane, function () module.resize(k ) end)
aw[#aw+1] = awful.key({ "Mod4", "Shift" }, key_nane, function () module.move (k ) end) aw[#aw+1] = awful.key({ "Mod4", "Shift" }, key_nane, function () module.move (k ) end)
aw[#aw+1] = awful.key({ "Mod4", "Shift", "Control" }, key_nane, function () module.move (k,nil ,true) end) 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", "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({ "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 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", "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) aw[#aw+1] = awful.key({ "Mod1", "Shift", "Control" }, key_nane, function () module.tag (k,true,true) end)
end end
end end
end end

View File

@ -95,7 +95,7 @@ local function draw_shape(s,collection,current_idx,icon_f,y,text_height)
-- Borders and background -- Borders and background
cr3:set_source(k==current_idx and focus or nornal) 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) 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:stroke_preserve()
cr3:set_source(bg) cr3:set_source(bg)
cr3:fill() cr3:fill()

View File

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