Comments (7)
@Rhys-T Thank you a lot already. I am pretty sure that I did not always use the same app when the issue occurred, but I will double check that and note which apps I used when the issue occurs again. 50% of me using that script is moving the terminal position, but I only use Alacritty. Input Monitoring
only shows two apps that I hardly ever use. I tried with both apps open and had no issue with my script. I added the isSecureInputEnabled
and report back if there is more information.
from hammerspoon.
Today Hammerspoon did not react again and I noticed something more:
-
Even if I completely quit the Hammerspoon process and start it again, the problem does not get resolved. I have to take the whole MacBook to sleep and wake it up again to resolve the problem.
-
Hammerspoon does not really hang when I start hyper mode. I can still use the arrow keys to move my windows around, but I cannot use any of the "letter"-keys to quick-launch applications. I can also not use option+W to exit hyper mode.
-
That might be important. When I am in hyper mode and press the arrow keys, they are captured by Hammerspoon and used to move windows, but the rest of the keys ("letter"-keys) are not captured and are entered in the currently active application as if they were not bound to Hammerspoon. Again, I use this extensively for days without an issue and suddenly this happens. I have not yet found any special behavior that I do different when this happens.
from hammerspoon.
Are there specific apps that you're usually in when you have this problem? I'm wondering if it could be an app enabling secure input mode (a.k.a. "secure keyboard input").
Basically, an app can put the system into a mode where no other apps (like, for instance, Hammerspoon) can watch what's being typed. This normally gets turned on when you're in a password field. Some terminal apps turn it on by default too (at least iTerm2 and Apple's Terminal, though possibly not Alacritty?). And sometimes certain apps can forget to turn it off again afterwards.
I think this originally just affected hs.eventtap
s, but at some point started blocking hs.hotkey
s as well - see #2880. Some people in that thread can still get hs.hotkey
s that involve modifier keys to work, but others can't. I wonder if it's something like "ignore any hotkeys that were created after secure input was turned on (e.g. by a modal being entered)".
Try changing your hyper.entered()
function to look like this:
function hyper:entered()
if hs.eventtap.isSecureInputEnabled() then
hs.alert("⚠️ Secure Input is on. Hyper Mode commands might not work.")
end
-- The rest of this is the code you already had here:
hyperAlerts = {}
for i, screen in pairs(hs.screen.allScreens()) do
alert = hs.alert("Hyper Mode ✈", hyperStyle, screen, "")
hyperAlerts[i] = alert
end
end
If the modal only gets stuck after showing that warning message, then it's definitely secure input mode that's causing the problem. You might also want to bind Escape in the modal to an exit command, so you can at least get out of hyper mode when this happens - it sounds like Escape hotkeys still work while SIM is on.1 (Or maybe just add hyper:exit(); return
after the warning message, to immediately kick you back out of hyper mode before it gets stuck.)
If the app that's responsible still turns SIM off when it's done, you might be able to work around it by creating and focusing an invisible hs.webview
2 in hyper:entered()
(thus taking you out of the password field or whatever), then restoring focus to the correct window in hyper:exited()
. (Of course, all the other commands that look at hs.window.focusedWindow()
would need to be changed to work on whatever window was saved by hyper:entered()
.)
Footnotes
-
I'm stuck on an older system at the moment, so I'm afraid I can't test this yet. ↩
-
Edit 11/17/2023: I originally said to use an empty
hs.canvas
, because it's probably more lightweight than a webview, but Hammerspoon doesn't seem to give you a way to focus anhs.canvas
.hs.webview
s don't directly have afocus
method either, but you can at least dosomeWebview:hswindow():focus()
. ↩
from hammerspoon.
Related Issues (20)
- ClipboardTool logs images despite description stating it only copies text HOT 1
- Modifiers not working on Remote desktop HOT 4
- How can I run shortcuts via the terminal instead of using keys? HOT 1
- Any way to swap caps to ctrl? HOT 7
- Test hs.ipc.cliInstall on macOS Sonoma HOT 3
- suspected memory leak HOT 8
- New revision of Stream Deck XL with a new PID not supported HOT 1
- Various small questions about the hs.wifi module HOT 5
- Subject: Difficulty Keeping Notifications Persistent and Moving Them to Notification Center
- hs.network.ping.ping blocks callback function of timer HOT 3
- hs.audiodevice state is particular to Hammerspoon object, not audio device (Documation clarification needed) HOT 1
- MacOS killing Hammerspoon due to high CPU usage? HOT 7
- Print statements hanging Hammerspoon and triggering memory leak HOT 7
- HIDAPI module wrapper / Surface Dial support
- No arrows in submenus HOT 2
- hs.grid alphanumeric keys ignored on Sonoma 14.1.2 HOT 2
- Feature request: allow multiple key bindings for a single function in `hs.spoons.bindHotkeysToSpec` HOT 3
- Tucking Apps HOT 1
- switcher.ui.highlight rounded corners? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hammerspoon.