This commit is contained in:
Xinhao Yuan 2019-08-05 22:29:03 -04:00
parent d0e84ca334
commit 9376a4397f
2 changed files with 39 additions and 20 deletions

View File

@ -145,7 +145,7 @@ Calling `machi.switcher.start()` will create a switcher supporting the following
- Arrow keys: move focus into other regions by the direction.
- `Shift` + arrow keys: move the focused window to other regions by the direction. In draft mode, move the window while preserving its size.
- `Control` + arrow keys: move the bottom-right region of the focused window by direction. Only work in draft mode.
- `Control`[ + `Shift`] + arrow keys: move the bottom-right (or top-left window if `Shift` is pressed) region of the focused window by direction. Only works in draft mode.
- `Tab`: switch beteen windows covering the current regions.
So far, the key binding is not configurable. One has to modify the source code to change it.
@ -165,8 +165,6 @@ To differentiate tags with the same name, you may need a more advanced naming fu
2. True transparency is required. Otherwise switcher and editor will block the clients.
3. The resize handler of machi does not behave well in the default `awful.mouse.client.resize(c)` -- it is recommended to use `awful.mouse.client.resize(c, "bottom_right")`.
## License
Apache 2.0 --- See LICENSE

View File

@ -172,10 +172,20 @@ local function start(c)
infobox.bgimage = draw_info
local key_translate_tab = {
["w"] = "Up",
["a"] = "Left",
["s"] = "Down",
["d"] = "Right",
}
local kg
kg = api.awful.keygrabber.run(
function (mod, key, event)
if event == "release" then return end
if key_translate_tab[key] ~= nil then
key = key_translate_tab[key]
end
if key == "Tab" then
ensure_tablist()
@ -270,7 +280,34 @@ local function start(c)
traverse_y = max(regions[choice].y + traverse_radius, min(regions[choice].y + regions[choice].height - traverse_radius, traverse_y))
tablist = nil
if shift then
if ctrl and draft_mode then
local lu = c.machi_lu
local rd = c.machi_rd
if shift then
lu = choice
if regions[rd].x + regions[rd].width <= regions[lu].x or
regions[rd].y + regions[rd].height <= regions[lu].y
then
rd = lu
end
else
rd = choice
if regions[rd].x + regions[rd].width <= regions[lu].x or
regions[rd].y + regions[rd].height <= regions[lu].y
then
lu = rd
end
end
machi.layout.set_geometry(c, regions[lu], regions[rd], 0, c.border_width)
c.machi_lu = lu
c.machi_rd = rd
c:emit_signal("request::activate", "mouse.move", {raise=false})
c:raise()
api.layout.arrange(screen)
elseif shift then
-- move the window
if draft_mode then
c.x = regions[choice].x
@ -284,22 +321,6 @@ local function start(c)
api.layout.arrange(screen)
tablist = nil
elseif ctrl and draft_mode then
-- move the right-down region
local lu = c.machi_lu
local rd = choice
if regions[rd].x + regions[rd].width <= regions[lu].x or
regions[rd].y + regions[rd].height <= regions[lu].y
then
lu = rd
end
machi.layout.set_geometry(c, regions[lu], regions[rd], 0, c.border_width)
c.machi_lu = lu
c.machi_rd = rd
c:emit_signal("request::activate", "mouse.move", {raise=false})
c:raise()
api.layout.arrange(screen)
else
-- move the focus
ensure_tablist()