All Projects → dagronf → AppKitFocusOverlay

dagronf / AppKitFocusOverlay

Licence: MIT license
Add hotkey(s) to display the key focus path for any window in your AppKit application.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to AppKitFocusOverlay

Poliopager
A flexible TabBarController with search tab like SNKRS.
Stars: ✭ 133 (+216.67%)
Mutual labels:  tab
react-native-macos
Fork of https://github.com/ptmt/react-native-macos with more features
Stars: ✭ 22 (-47.62%)
Mutual labels:  appkit
rainmood
一个简单项目,只有一个页面。循环播放十首电影原声精选,背景乐为下雨声。
Stars: ✭ 12 (-71.43%)
Mutual labels:  focus
Csvreader
csvreader library / gem - read tabular data in the comma-separated values (csv) format the right way (uses best practices out-of-the-box with zero-configuration)
Stars: ✭ 169 (+302.38%)
Mutual labels:  tab
vue-focus-loop
Vue component that helps you to to trap focus in an element.
Stars: ✭ 23 (-45.24%)
Mutual labels:  focus
react-tv-navigation
React Navigation for TVs
Stars: ✭ 64 (+52.38%)
Mutual labels:  focus
Nativescript App Templates
Monorepo for NativeScript app templates
Stars: ✭ 108 (+157.14%)
Mutual labels:  tab
react-sunbeam
Spatial navigation and focus management system for React apps
Stars: ✭ 50 (+19.05%)
Mutual labels:  focus-management
flutter sliding tutorial
User onboarding library with smooth animation of objects and background colors
Stars: ✭ 127 (+202.38%)
Mutual labels:  tab
ostrich
A Game Boy Sound System player for macOS, written in Swift
Stars: ✭ 37 (-11.9%)
Mutual labels:  appkit
Hyper Tabs Enhanced
Enhanced Tabs Plugin for Hyper
Stars: ✭ 173 (+311.9%)
Mutual labels:  tab
Unity-2017.2-and-Vuforia-6.5---Camera-Auto-Focus
Unity 2017.2 and Vuforia 6.5 Augmented Reality (AR) Camera Auto Focus
Stars: ✭ 17 (-59.52%)
Mutual labels:  focus
OutlineViewDiffableDataSource
Stop looking for NSOutlineViewDiffableDataSource, it’s here 👌
Stars: ✭ 96 (+128.57%)
Mutual labels:  appkit
Fliptabs
Android Flip Tabs Library
Stars: ✭ 135 (+221.43%)
Mutual labels:  tab
focus-options-polyfill
JavaScript polyfill for the WHATWG spec of focusOptions, that enables a set of options to be passed to the focus method
Stars: ✭ 46 (+9.52%)
Mutual labels:  focus
Visualforce Table Grid
Flexible and highly customizable Visualforce table grid component. Salesforce.com Classic Look and Feel.
Stars: ✭ 126 (+200%)
Mutual labels:  tab
Equinox
🌇 🌃 Create dynamic wallpapers for macOS.
Stars: ✭ 737 (+1654.76%)
Mutual labels:  appkit
tabulous
Vim plugin for setting the tabline including the tab page labels. It is lightweight and written in pure Vim script.
Stars: ✭ 21 (-50%)
Mutual labels:  tab
ngx-tabset
A very simple library to let you create some tabs
Stars: ✭ 19 (-54.76%)
Mutual labels:  tab
CompositionalLayoutDSL
CompositionalLayoutDSL, library to simplify the creation of UICollectionViewCompositionalLayout. It wraps the UIKit API and makes the code shorter and easier to read.
Stars: ✭ 47 (+11.9%)
Mutual labels:  appkit

AppKitFocusOverlay

A simple package for displaying the current focus (nextKeyView) target path for an AppKit window.

  • Press and hold option-[ key to display the focus key path for the currently focussed window
  • Press and hold option-] key to display the focus key path from the currently focussed UI element.

Supports both Swift and Objective-C projects.

Why?

It's important for your app to be keyboard navigable and that the tab path makes sense to a user. There's been a bit of discussion of recent regarding keyboard navigation on iOS, highlighting the -UIFocusLoopDebuggerEnabled YES launch argument option for iOS apps in Xcode.. The question was posed as to whether this also worked for AppKit, and the short answer was no.

I built the prototype for this a few years back for use in my own apps. It's not as frictionless as adding a launch argument but it's straight forward enough to add. Given how useful it's been for me I thought I'd package it up cleanly and make it public.

Demo

Click here to see a demo video of the focus overlay added to the wonderful 'ControlRoom' application.

There are also very basic AppKit example applications (using both Swift and Objective-C) in the Demo subfolder you can play with.

Simple setup

  • Add the https://github.com/dagronf/AppKitFocusOverlay package to your application.

  • Define a global instance of AppKitFocusOverlay in your app and access the instance within a method that gets called early in your app's lifecycle, such as applicationDidFinishLaunching.

import AppKitFocusOverlay
let _globalFocusOverlay = AppKitFocusOverlay()

func applicationDidFinishLaunching(_ aNotification: Notification) {
   // Force the focus overlay instance to init.
   _ = _globalFocusOverlay
   ...
}

Features

Custom hotkeys

You can define the hotkeys to use in the initializer of the instance. By default, these are option-[ and option-], but you can change them to f13 and f14 (for example) if you want.

import AppKitFocusOverlay
import HotKey               // Available due to AppKitFocusOverlay dependency 

let _globalFocusOverlay: AppKitFocusOverlay(
   windowHotKey: HotKey(key: .f13, modifiers: []),
   viewHotKey: HotKey(key: .f14, modifiers: [])
)

func applicationDidFinishLaunching(_ aNotification: Notification) {
   // Force the focus overlay instance to init.
   _ = _globalFocusOverlay
   ...
}

Objective-C support

You can add AppKitFocusOverlay to your Objective-C project easily.

@import AppKitFocusOverlay;

@interface AppDelegate ()
/// Define an instance of the focus overlay
@property (nonatomic, strong) AppKitFocusOverlay* focusOverlay;
@end

@implementation AppDelegate

- (void)applicationDidFinishLaunching:(NSNotification*)aNotification {
   /// Create the overlay and attach
   AppKitFocusOverlay* focus = [[AppKitFocusOverlay alloc] init];
   [self setFocusOverlay: focus];
}

@end

Notes

  • You may need to embed the swift libraries (Build settings) if your app doesn't already if you're planning to distribute an archive or release build to (eg.) your QA dept.
  • If you need to customize the hotkeys for objective-c you'll need to fork this library and change the code in AppKitFocusOverlay.swift, as the HotKey library is not exposed through Objective-C and as such the hotkey-setting initializers are not exposed to objc.

Screenshots

Thanks!

Uses HotKey to define and detect hot-key presses.

License

MIT. Use it for anything you want, just attribute my work if you do. Let me know if you do use it somewhere, I'd love to hear about it!

MIT License

Copyright (c) 2021 Darren Ford

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].