Skip to content

feat: add external control service for remote control #8043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

GoodbyeNJN
Copy link

What this PR does

When running in Wayland environment on Linux, the application's built-in global hotkey binding feature does not work. Adapting to each desktop environment's global hotkey solution is complex and hard to maintain. To address this, this PR introduces an external control service that can be invoked externally, enabling users to assign their own hotkeys to invoke the service, thereby achieving the original global hotkey features.

For consistency across platforms, both an HTTP server (cross-platform) and a UNIX domain socket (Unix-only) are provided.

Fixes #1736

Why we need it and why it was done in this way

Discussions #2379

Breaking changes

None. Just a new feature.

Special notes for your reviewer

My further idea is to allow passing parameters directly in the external invocation, so that specific features inside the application can be triggered directly.

For example, when the external control service is invoked with the following parameters, the application should open the miniwindow and directly navigate to the translation page to translate the given text.

{
  "cmd": "showQuickAssistant",
  "route": "translate",
  "clipboardText": "Hello, world!"
}

Checklist

Need to update documentation to explain how to use the external control service, but I don't know how to do it yet. I will update the documentation later.

Release note

Feature: Introduce external control service for invoking application features via external hotkeys.

@Copilot Copilot AI review requested due to automatic review settings July 10, 2025 16:41
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces an external control service to allow users to invoke application features via external hotkeys, providing both HTTP and UNIX domain socket servers.

  • Added ExternalControlServerType enum and Redux slice (externalControl) for storing server type and HTTP port.
  • Extended settings UI to let users choose server type and configure HTTP port.
  • Implemented ExternalControlService with HTTP and Unix socket listeners, wired up IPC handlers, config persistence, and app lifecycle integration.

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/renderer/src/types/index.ts Define ExternalControlServerType enum
src/renderer/src/store/externalControl.ts Create Redux slice for external control settings
src/renderer/src/pages/settings/ShortcutSettings.tsx Add UI controls for server type selector and HTTP port input
src/preload/index.ts Expose externalControl.setServerType and .setHttpPort APIs
src/main/services/ConfigManager.ts Persist and notify external control config keys
src/main/services/ExternalControlService.ts Implement HTTP and Unix socket servers and command handling
src/main/ipc.ts Register IPC channels for external control settings
src/main/index.ts Start/stop externalControlService on app lifecycle events
packages/shared/IpcChannel.ts Add new IPC channel constants for external control
src/renderer/src/i18n/locales/* Add translation keys for settings UI
Comments suppressed due to low confidence (2)

src/renderer/src/store/externalControl.ts:1

  • [nitpick] Consider adding unit tests for the externalControl slice reducers (setServerType and setHttpPort) to ensure configuration updates behave as expected.
import { createSlice, PayloadAction } from '@reduxjs/toolkit'

src/renderer/src/pages/settings/ShortcutSettings.tsx:408

  • [nitpick] Update the help/documentation link to point to the actual external control service documentation once it’s available, instead of the placeholder GitHub URL.
          <Link to="https://github.com/CherryHQ/cherry-studio" style={{ display: 'flex', marginLeft: 6 }}>

@0xfullex
Copy link
Collaborator

0xfullex commented Jul 10, 2025

how to solve the issue by seting up an http server?

@0xfullex 0xfullex added the Pending On hold due to priority/low, unresolved issues, suboptimal solution or needs more research label Jul 10, 2025
@0xfullex 0xfullex self-assigned this Jul 10, 2025
@0xfullex
Copy link
Collaborator

solutions about Linux wayland protocol, please refer to disscussion #2379

these pr will be pending due to the solutions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pending On hold due to priority/low, unresolved issues, suboptimal solution or needs more research
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Wayland 下快捷键/Keyboard Shortcut
2 participants