Skip to content

Commit

Permalink
always center the mouse on the primary screen at startup
Browse files Browse the repository at this point in the history
This ensures the user knows where the mouse is
  • Loading branch information
aarondill committed Dec 26, 2023
1 parent fde1549 commit 676b757
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions capi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ local boolean = false ---@type boolean
local string = "" ---@type string
---@alias screen AwesomeScreenInstance|integer
---@alias AwesomeGeometry { height: number, width: number, x: number, y: number }
---@alias AwesomePosition { x: number, y: number }
---@alias AwesomeLayout { arrange: function, name: string, skip_gap: function, arrange: function?}
---@alias CairoPattern userdata
---@alias exit_callback fun(type: "signal"|"exit", code: integer)
Expand Down Expand Up @@ -244,8 +245,10 @@ function types.AwesomeRoot:__newindex(k, v) end
---@class AwesomeKeygrabber
---@class AwesomeMousegrabber
---@class AwesomeMouse
---@field coords fun(coords_table?: AwesomePosition, silent?: boolean): {[integer]: boolean, x: number, y: number}
---@field screen AwesomeScreenInstance
---@field current_wibox table? wibox

---@class AwesomeScreen :AwesomeSignalClass
---@field primary AwesomeScreenInstance?
---@field [integer] AwesomeScreenInstance?
Expand Down
9 changes: 9 additions & 0 deletions rc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,12 @@ _G.collectgarbagetimer = require("gears.timer").new({
autostart = true,
callback = require("util.bind").with_args(collectgarbage, "collect"),
})

local primary = capi.screen.primary
if primary then
require("awful.screen").focus(primary)
capi.mouse.coords({
x = primary.geometry.width / 2,
y = primary.geometry.height / 2,
}, true)
end

0 comments on commit 676b757

Please sign in to comment.