resize: restore the fleur cursor and add a beautiful option (#957)
Fixes #956
This commit is contained in:
parent
6f1df7a3ad
commit
d4dc579105
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
local aplace = require("awful.placement")
|
local aplace = require("awful.placement")
|
||||||
local capi = {mousegrabber = mousegrabber}
|
local capi = {mousegrabber = mousegrabber}
|
||||||
|
local beautiful = require("beautiful")
|
||||||
|
|
||||||
local module = {}
|
local module = {}
|
||||||
|
|
||||||
|
@ -19,6 +20,19 @@ local mode = "live"
|
||||||
local req = "request::geometry"
|
local req = "request::geometry"
|
||||||
local callbacks = {enter={}, move={}, leave={}}
|
local callbacks = {enter={}, move={}, leave={}}
|
||||||
|
|
||||||
|
local cursors = {
|
||||||
|
["mouse.resize"] = "fleur",
|
||||||
|
["mouse.move" ] = "cross"
|
||||||
|
}
|
||||||
|
|
||||||
|
--- The resize cursor name.
|
||||||
|
-- @beautiful beautiful.cursor_mouse_resize
|
||||||
|
-- @tparam[opt=fleur] string cursor
|
||||||
|
|
||||||
|
--- The move cursor name.
|
||||||
|
-- @beautiful beautiful.cursor_mouse_move
|
||||||
|
-- @tparam[opt=cross] string cursor
|
||||||
|
|
||||||
--- Set the resize mode.
|
--- Set the resize mode.
|
||||||
-- The available modes are:
|
-- The available modes are:
|
||||||
--
|
--
|
||||||
|
@ -122,6 +136,11 @@ local function handler(_, client, context, args) --luacheck: no unused_args
|
||||||
|
|
||||||
geo = nil
|
geo = nil
|
||||||
|
|
||||||
|
-- Select the cursor
|
||||||
|
local tcontext = context:gsub('[.]', '_')
|
||||||
|
|
||||||
|
local cursor = beautiful["cursor_"..tcontext] or cursors[context] or "cross"
|
||||||
|
|
||||||
-- Execute the placement function and use request::geometry
|
-- Execute the placement function and use request::geometry
|
||||||
capi.mousegrabber.run(function (_mouse)
|
capi.mousegrabber.run(function (_mouse)
|
||||||
if not client.valid then return end
|
if not client.valid then return end
|
||||||
|
@ -193,7 +212,7 @@ local function handler(_, client, context, args) --luacheck: no unused_args
|
||||||
client:emit_signal( req, context, geo)
|
client:emit_signal( req, context, geo)
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end, "cross")
|
end, cursor)
|
||||||
end
|
end
|
||||||
|
|
||||||
return setmetatable(module, {__call=handler})
|
return setmetatable(module, {__call=handler})
|
||||||
|
|
Loading…
Reference in New Issue