r-thomson / Nightfall

A macOS menu bar utility for quickly toggling dark mode, written in Swift.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keyboard shortcut unreliable

kawtharmonki opened this issue · comments

Awesome work with getting it to transition gracefully to dark/light mode! I currently use a global hotkey to transition, which does so suddenly but works every time.

Nightfall seems to often ignore the hotkey unless the 'correct' application is in focus. e.g.������������ with Home.app in focus it will never capture the hotkey and transition, but with the Shortcuts pref in focus it works everytime.

Since it's using macOS' built-in API to capture the shortcut not sure how much control you have over this - perhaps adding a CLI flag to toggle (and then being able to call that through Alfred or SKHD) could offer another way to tackle this?

Catalina 10.15.4

I'm currently implementing the shortcut as a service (Application Menu > Services > Toggle Dark Mode). I know of two situations where the shortcut won't work right now. The first is if the current application has its own shortcut on the same key combo. Second, for some applications (e.g. Discord) the services menu is always empty, for reasons I'm not sure of.

This is something I will look at addressing in the future.

I installed the latest nightfall from GitHub releases on MacOS 10.15.4
I added all needed permissions, but the default keyboard shortcut ⌃⌥⌘T does not work in every app.

E.g. it works well in Finder but it does not work in Chrome.

Still great extension! Thanks!

Screenshot 2020-04-20 at 20 28 23

At this point, the biggest blocker for improving keyboard shortcuts is building a custom UI for setting the shortcut. SwiftUI, as it exists currently, doesn’t really give the type of keyboard event access that I need.

I’ll probably have to learn how to make custom NSViews for this.

Just giving a small update on this issue.

I was looking into integrating sindresorhus/KeyboardShortcuts into this project since it has a nice built-in control, but it was causing layout/positioning issues that seem to be caused by any NSSearchField with translatesAutoresizingMaskIntoConstraints = true. Finding a workaround is unfortunately beyond my Auto Layout debugging skills at the moment.

Fixed in next release