Skip to content

Comments

Fix accessibility permission not updating in app#14

Merged
jsonify merged 4 commits intomainfrom
claude/fix-accessibility-permission-detection-011CUzZuPGo5BGLrh9giPpxM
Nov 10, 2025
Merged

Fix accessibility permission not updating in app#14
jsonify merged 4 commits intomainfrom
claude/fix-accessibility-permission-detection-011CUzZuPGo5BGLrh9giPpxM

Conversation

@jsonify
Copy link
Owner

@jsonify jsonify commented Nov 10, 2025

No description provided.

The app was not recognizing when accessibility permissions were granted
because it checked immediately after opening System Settings, before the
user had a chance to grant permission. Now the app automatically detects
when it becomes active (e.g., user returning from System Settings) and
re-checks permissions at that time, properly updating the UI.

Changes:
- Added NSApplication.didBecomeActiveNotification observer to monitor app activation
- Re-check permissions automatically when app becomes active
- Removed premature permission check in requestAccessibilityPermission()
- Added proper cleanup in deinit to remove observer

Fixes: Permission banner now disappears and clicking is enabled after granting permission
This commit addresses two major issues:

1. **Refactor build system to use separate SPM targets**
   - Created separate ClickIt and ClickItLite targets in Package.swift
   - Each target excludes the other's entry point file
   - Both ClickItApp.swift and ClickItLiteApp.swift now have @main permanently enabled
   - Updated build_app_unified.sh to build the correct SPM target
   - No more file modification during builds - git working directory stays clean
   - Updated BUILD_VERSIONS_GUIDE.md to reflect new approach

2. **Fix ESC emergency stop and add SPACEBAR support**
   - Added local event monitor in addition to global monitor
   - Global monitor catches events when app is inactive
   - Local monitor catches events when app is active
   - Added SPACEBAR as secondary emergency stop key
   - Updated UI to show "Press ESC or SPACEBAR to emergency stop"

Benefits:
- Source files no longer modified during builds (fixes git status issues)
- Emergency stop now works reliably in all scenarios
- Users have two keys for emergency stop (ESC and SPACEBAR)
- Cleaner separation between Pro and Lite versions

Files changed:
- Package.swift: Added ClickItLite target with proper exclusions
- build_app_unified.sh: Updated to build correct SPM target
- Sources/ClickIt/Lite/ClickItLiteApp.swift: Uncommented @main
- Sources/ClickIt/Lite/SimpleHotkeyManager.swift: Added local monitor and SPACEBAR support
- Sources/ClickIt/Lite/SimplifiedMainView.swift: Updated UI text
- BUILD_VERSIONS_GUIDE.md: Updated documentation
SPM expects targets to either be in Sources/TargetName/ or have an explicit
path specified. Since both ClickIt and ClickItLite share Sources/ClickIt/,
we need to specify path: "Sources/ClickIt" for both targets.

This fixes the build error:
'Source files for target ClickItLite should be located under Sources/ClickItLite'
The previous approach had both targets using the same path which caused
overlapping sources. Now:
- ClickIt target uses Sources/ClickIt and excludes the entire Lite directory
- ClickItLite target uses Sources/ClickIt/Lite exclusively

This eliminates the overlapping sources error while keeping files organized.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jsonify, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant refactoring of the application's build process by migrating to distinct Swift Package Manager targets for its Pro and Lite versions, thereby simplifying build configurations and maintaining a cleaner codebase. Concurrently, it addresses a critical bug preventing accessibility permissions from updating reliably after user interaction with system settings. Additionally, the user experience is enhanced with the introduction of the SPACEBAR as an alternative emergency stop hotkey.

Highlights

  • Build System Refactor: The build system for Pro and Lite versions has been refactored to use separate Swift Package Manager (SPM) executable targets. This eliminates the need for the toggle_version.sh script, which previously modified source files by commenting/uncommenting @main attributes. Now, @main is permanently enabled in both app entry points, and the build system handles target selection automatically.
  • Accessibility Permission Fix: An issue where accessibility permissions were not updating correctly within the app has been resolved. The application now automatically re-checks accessibility permissions when it becomes active (e.g., after a user returns from System Settings), ensuring the permission status is always up-to-date.
  • Enhanced Emergency Stop Hotkey: The emergency stop functionality has been improved by adding the SPACEBAR as an alternative hotkey, alongside the existing ESC key. This hotkey is now monitored both globally (when the app is inactive) and locally (when the app is active) for a more robust user experience.
  • Documentation and Script Updates: The BUILD_VERSIONS_GUIDE.md documentation and the build_app_unified.sh script have been updated to reflect the new SPM-based build system and the enhanced emergency stop hotkey functionality.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@jsonify jsonify merged commit 398935d into main Nov 10, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant improvement to the build system by using separate SPM targets for the Pro and Lite versions, which makes the build process cleaner and more reliable. The fix for the accessibility permission not updating is well-implemented by observing app activation. The addition of the spacebar as an emergency stop key is also a nice usability enhancement. The code quality is high, and the changes are well-structured. I have one suggestion regarding test coverage for the new ClickItLite target to ensure its long-term stability.

Comment on lines +31 to +37
// ClickIt Lite - Simplified version
.executableTarget(
name: "ClickItLite",
dependencies: [],
path: "Sources/ClickIt/Lite",
resources: []
),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

With the addition of the ClickItLite target, it's important to also add a corresponding test target to ensure its functionality is covered by tests. Currently, only the ClickIt (Pro) target has a test target.

To maintain code quality and prevent regressions in the Lite version, please consider adding a new test target for ClickItLite. For example:

.testTarget(
    name: "ClickItLiteTests",
    dependencies: ["ClickItLite"],
    path: "Tests/ClickItLiteTests" // You may need to create this directory
)

@jsonify jsonify deleted the claude/fix-accessibility-permission-detection-011CUzZuPGo5BGLrh9giPpxM branch November 10, 2025 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants