-
Notifications
You must be signed in to change notification settings - Fork 635
Open
Description
Hi,
I want to set the mouse tracking speed according to my location. I added this script to my init.lua file loaded at start by Hammerspoon:
home_wifi = "home_wifi_name"
work_wifi = "work_wifi_name"
function updateMouseSpeed()
local currentWiFi = hs.wifi.currentNetwork()
if hs.fnutils.contains(home_wifi, currentWiFi) then
hs.mouse.trackingSpeed(3.0) -- Maximum speed
hs.alert.show("Mouse tracking speed set for home location")
elseif currentWiFi == work_wifi then
hs.mouse.trackingSpeed(0.0) -- Minimum speed
hs.alert.show("Mouse tracking speed set for work location")
else
hs.mouse.trackingSpeed(1.5) -- Default speed
hs.alert.show("Default mouse speed")
end
end
-- Run the script at start
local tracking_speed = hs.mouse.trackingSpeed()
hs.alert.show(tracking_speed)
updateMouseSpeed()
local tracking_speed = hs.mouse.trackingSpeed()
hs.alert.show(tracking_speed)
The value shown of hs.mouse.trackingSpeed() is changed by the location, but it does not affect the real value set in the system preferences. Is there a way to apply the setting ?
Thank you for your support,
Guillaume
MacBook Pro, M1 Pro, 2021, macOS Sequoia 15.2
Metadata
Metadata
Assignees
Labels
No labels