Skip to content

fix: optimize shortcut launch performance by replacing subprocess spawning with in-process handlers#1118

Open
robertkill wants to merge 1 commit into
linuxdeepin:masterfrom
robertkill:fix-361803-optimize-shortcut-launch
Open

fix: optimize shortcut launch performance by replacing subprocess spawning with in-process handlers#1118
robertkill wants to merge 1 commit into
linuxdeepin:masterfrom
robertkill:fix-361803-optimize-shortcut-launch

Conversation

@robertkill
Copy link
Copy Markdown
Contributor

@robertkill robertkill commented May 22, 2026

Summary

Fix BUG-361803: shortcut-triggered app launches are significantly slower than clicking on the dock.

Root cause: The keybinding daemon spawned separate Go binaries (default-file-manager, default-terminal) and complex shell pipelines (lockScreen) as subprocesses for certain system shortcuts. Go binary startup (~200-300ms runtime init) and subprocess overhead caused 500-900ms extra delay compared to the click path.

Fix: Replace subprocess spawning with in-process handlers that use the daemon's existing session bus and GIO/GSettings APIs directly.

Changes

  1. ActionTypeLaunchMimeType — GIO AppInfoGetDefaultForTyperunDesktopFile() (AM Launch in-process). Removes default-file-manager Go binary subprocess.
  2. ActionTypeLaunchTerminal — GSettings com.deepin.desktop.default-applications.terminalrunDesktopFile() (AM Launch in-process). Removes default-terminal Go binary subprocess.
  3. ActionTypeLockScreen — X11 grab cleanup (setxkbmap + xdotool) + in-process DBus LockFront1.Show. Removes dbus-send subprocess from shell pipeline.
  4. SystemShortcut.customAction — New optional field allowing per-shortcut GetAction() override without changing storage or serialization.

Performance

Shortcut Before After Improvement
Win+E (fileManager) ~1,011ms ~176ms -83%
Ctrl+Alt+T (terminal) ~678ms ~608ms -10%
Win+L (lockScreen) shell pipeline (setxkbmap+xdotool+dbus-send) setxkbmap+xdotool + in-process DBus eliminated dbus-send subprocess

Modified Files

  • keybinding1/shortcuts/action.go — 3 new ActionType constants + factory functions
  • keybinding1/shortcuts/system_shortcut.gocustomAction field on SystemShortcut
  • keybinding1/shortcuts/shortcut_manager.go — Apply customAction for fileManager/terminal/lockScreen
  • keybinding1/manager_handlers.go — 3 new handlers for the new ActionTypes

PMS: BUG-361803

Summary by Sourcery

Optimize shortcut-triggered app launches by handling key system shortcuts in-process instead of spawning external subprocesses.

New Features:

  • Add new in-process action types for launching default applications by MIME type, launching the default terminal, and locking the screen via DBus.

Bug Fixes:

  • Resolve slow startup of file manager, terminal, and lock screen when triggered by shortcuts by eliminating heavyweight helper binaries and shell pipelines from the hot path.

Enhancements:

  • Allow system shortcuts to specify an optional custom action distinct from the stored exec command, enabling specialized handling without changing persistence format.

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: robertkill

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 22, 2026

Reviewer's Guide

Replaces slow, subprocess-based implementations of system shortcuts with in-process actions using GIO/GSettings and direct D-Bus calls, enabled via new action types and an optional customAction on SystemShortcut, to significantly improve shortcut launch performance.

Sequence diagram for in-process fileManager launch shortcut

sequenceDiagram
    actor User
    participant Manager
    participant SystemShortcut
    participant gio

    User->>Manager: KeyEvent (Win+E)
    Manager->>SystemShortcut: GetAction()
    SystemShortcut-->>Manager: Action{Type:ActionTypeLaunchMimeType, Arg:mimeType}
    Manager->>Manager: handlers[ActionTypeLaunchMimeType](ev)
    Manager->>gio: AppInfoGetDefaultForType(mimeType, false)
    gio-->>Manager: AppInfo
    Manager->>gio: ToDesktopAppInfo(AppInfo)
    gio-->>Manager: DesktopAppInfo
    Manager->>Manager: runDesktopFile(desktopFile)
    Manager-->>User: Default file manager window opened
Loading

File-Level Changes

Change Details Files
Add new in-process action types for launching default apps and locking the screen, with corresponding handlers in Manager.
  • Introduce ActionTypeLaunchMimeType, ActionTypeLaunchTerminal, and ActionTypeLockScreen in the ActionType enum and provide factory constructors for each.
  • Register new handlers in Manager.initHandlers for the new action types, using gio.AppInfoGetDefaultForType and runDesktopFile for mime-type launches, GSettings for terminal app lookup, and direct D-Bus calls for lock screen, including X11 grab cleanup and restoration.
  • Use the existing runDesktopFile helper to perform app launches instead of spawning external helper binaries.
keybinding1/shortcuts/action.go
keybinding1/manager_handlers.go
Extend SystemShortcut to support optional custom actions without affecting storage/serialization, enabling per-shortcut overrides.
  • Add a customAction field to SystemShortcut that can override the default exec-cmd-based action when present.
  • Modify GetAction to return customAction when set, falling back to constructing an ActionTypeExecCmd otherwise.
  • Relax SetAction to accept either exec-cmd actions (updating the stored arg) or non-exec custom actions (storing them in customAction).
keybinding1/shortcuts/system_shortcut.go
Wire system shortcut IDs for file manager, terminal, and lock screen to the new in-process actions instead of external commands.
  • In AddSystemById, assign NewLaunchMimeTypeAction("inode/directory") to the "fileManager" shortcut so it launches via the in-process app launcher.
  • In AddSystemById, assign NewLaunchTerminalAction() to the "terminal" shortcut to use the default terminal app from GSettings via in-process launch.
  • In AddSystemById, assign NewLockScreenAction() to "lockScreen" and "lockScreen-wayland" so they use in-process D-Bus lock with X11 grab cleanup rather than a dbus-send shell pipeline.
keybinding1/shortcuts/shortcut_manager.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • In the lock screen handler, consider replacing the exec.Command("sh", "-c", "setxkbmap -query | grep ...") shell pipeline with direct exec.Command("setxkbmap", "-query") plus Go-side parsing to avoid relying on the shell and external text utilities.
  • For the terminal launch handler, it may be worth explicitly handling the case where settings.GetString(gsKeyTerminalAppId) returns an empty string (e.g., log and return early) to avoid passing an invalid desktop file ID into runDesktopFile.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the lock screen handler, consider replacing the `exec.Command("sh", "-c", "setxkbmap -query | grep ...")` shell pipeline with direct `exec.Command("setxkbmap", "-query")` plus Go-side parsing to avoid relying on the shell and external text utilities.
- For the terminal launch handler, it may be worth explicitly handling the case where `settings.GetString(gsKeyTerminalAppId)` returns an empty string (e.g., log and return early) to avoid passing an invalid desktop file ID into `runDesktopFile`.

## Individual Comments

### Comment 1
<location path="keybinding1/manager_handlers.go" line_range="201" />
<code_context>
+		}()
+	}
+
+	m.handlers[ActionTypeLockScreen] = func(ev *KeyEvent) {
+		go func() {
+			// 1. 获取当前 keyboard option
</code_context>
<issue_to_address>
**issue (complexity):** Consider extracting the new lock-screen and app-launch logic from `initHandlers` into small helper methods and replacing the shell pipeline with Go parsing to keep the function focused on simple wiring.

You can keep all the new functionality while reducing complexity in `initHandlers` by:

### 1. Extracting the lock screen flow into helpers

Move the multi-step script from the inline goroutine into small helper methods on `Manager`. This makes `initHandlers` just wiring, and keeps responsibilities separated.

**Before (simplified):**

```go
m.handlers[ActionTypeLockScreen] = func(ev *KeyEvent) {
    go func() {
        out, err := exec.Command("sh", "-c",
            "setxkbmap -query | grep option | awk -F ' ' '{print $2}'").Output()
        origOption := strings.TrimSpace(string(out))
        logger.Debug("lockScreen: orig option:", origOption)

        exec.Command("setxkbmap", "-option", "grab:break_actions").Run()
        if !_useWayland {
            exec.Command("xdotool", "key", "XF86Ungrab").Run()
        }

        lockObj := m.sessionSigLoop.Conn().Object(
            "org.deepin.dde.LockFront1",
            "/org/deepin/dde/LockFront1")
        err = lockObj.Call("org.deepin.dde.LockFront1.Show", 0).Err
        if err != nil {
            logger.Warning("lockScreen: failed to show lock front:", err)
        }

        if origOption != "" {
            exec.Command("setxkbmap", "-option", origOption).Run()
        }
    }()
}
```

**After (example refactor):**

```go
m.handlers[ActionTypeLockScreen] = func(ev *KeyEvent) {
    go m.lockScreen()
}
```

With helpers like:

```go
func (m *Manager) lockScreen() {
    origOption := m.getCurrentXkbOption()
    logger.Debug("lockScreen: orig option:", origOption)

    m.breakXGrab()
    defer m.restoreXkbOption(origOption)

    m.showLockFront()
}

func (m *Manager) breakXGrab() {
    exec.Command("setxkbmap", "-option", "grab:break_actions").Run()
    if !_useWayland {
        exec.Command("xdotool", "key", "XF86Ungrab").Run()
    }
}

func (m *Manager) restoreXkbOption(orig string) {
    if orig != "" {
        exec.Command("setxkbmap", "-option", orig).Run()
    }
}

func (m *Manager) showLockFront() {
    lockObj := m.sessionSigLoop.Conn().Object(
        "org.deepin.dde.LockFront1",
        "/org/deepin/dde/LockFront1")
    if err := lockObj.Call("org.deepin.dde.LockFront1.Show", 0).Err; err != nil {
        logger.Warning("lockScreen: failed to show lock front:", err)
    }
}
```

### 2. Replace the shell pipeline with simple Go parsing

The `sh | grep | awk` pipeline is brittle and harder to read/test than a small parsing helper:

**Before:**

```go
out, err := exec.Command("sh", "-c",
    "setxkbmap -query | grep option | awk -F ' ' '{print $2}'").Output()
origOption := strings.TrimSpace(string(out))
```

**After:**

```go
func (m *Manager) getCurrentXkbOption() string {
    out, err := exec.Command("setxkbmap", "-query").Output()
    if err != nil {
        logger.Warning("lockScreen: setxkbmap -query failed:", err)
        return ""
    }

    for _, line := range strings.Split(string(out), "\n") {
        line = strings.TrimSpace(line)
        if strings.HasPrefix(line, "options:") {
            // "options:   grp:alt_shift_toggle"
            fields := strings.Fields(line)
            if len(fields) >= 2 {
                return fields[1]
            }
        }
    }
    return ""
}
```

This keeps the behavior (read current option, ignore errors by returning empty string) but makes it explicit and testable without invoking a shell.

### 3. Keep `initHandlers` focused on wiring for new actions

You can similarly extract the logic for launching default apps so `initHandlers` only wires actions:

**Before:**

```go
m.handlers[ActionTypeLaunchMimeType] = func(ev *KeyEvent) {
    action := ev.Shortcut.GetAction()
    mimeType, ok := action.Arg.(string)
    if !ok {
        logger.Warning(ErrTypeAssertionFail)
        return
    }

    go func() {
        appInfo := gio.AppInfoGetDefaultForType(mimeType, false)
        if appInfo == nil {
            logger.Warning("no default app for mime type:", mimeType)
            return
        }
        defer appInfo.Unref()

        dAppInfo := gio.ToDesktopAppInfo(appInfo)
        desktopFile := filepath.Base(dAppInfo.GetFilename())

        err := m.runDesktopFile(desktopFile)
        if err != nil {
            logger.Warning("launch mime type error:", err)
        }
    }()
}
```

**After:**

```go
m.handlers[ActionTypeLaunchMimeType] = func(ev *KeyEvent) {
    action := ev.Shortcut.GetAction()
    mimeType, ok := action.Arg.(string)
    if !ok {
        logger.Warning(ErrTypeAssertionFail)
        return
    }
    go m.launchDefaultForMimeType(mimeType)
}
```

```go
func (m *Manager) launchDefaultForMimeType(mimeType string) {
    appInfo := gio.AppInfoGetDefaultForType(mimeType, false)
    if appInfo == nil {
        logger.Warning("no default app for mime type:", mimeType)
        return
    }
    defer appInfo.Unref()

    dAppInfo := gio.ToDesktopAppInfo(appInfo)
    desktopFile := filepath.Base(dAppInfo.GetFilename())

    if err := m.runDesktopFile(desktopFile); err != nil {
        logger.Warning("launch mime type error:", err)
    }
}
```

And for the terminal:

```go
m.handlers[ActionTypeLaunchTerminal] = func(ev *KeyEvent) {
    go m.launchDefaultTerminal()
}

func (m *Manager) launchDefaultTerminal() {
    settings := gio.NewSettings(gsSchemaDefaultTerminal)
    if settings == nil {
        logger.Warning("failed to get terminal settings")
        return
    }
    defer settings.Unref()

    appId := settings.GetString(gsKeyTerminalAppId)
    if err := m.runDesktopFile(appId); err != nil {
        logger.Warning("launch terminal error:", err)
    }
}
```

These changes keep all behavior intact but reduce complexity in `initHandlers`, isolate concerns, and make the new logic easier to test and maintain.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread keybinding1/manager_handlers.go
@robertkill robertkill force-pushed the fix-361803-optimize-shortcut-launch branch from 327a517 to ca45cf0 Compare May 22, 2026 01:22
@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

这份代码的主要目标是将部分快捷键(文件管理器、终端、锁屏)的处理方式从“派生子进程”重构为“进程内调用(in-process)”,以提升性能和安全性。整体思路清晰,但在代码健壮性、安全性、错误处理和并发控制方面存在一些需要改进的地方。

以下是对该 Git Diff 的详细代码审查意见:

1. 代码安全

  • 命令注入风险(低):在 getCurrentXkbOptionrestoreXkbOption 中使用了 exec.Command。虽然当前传入的参数是硬编码的字符串(如 "setxkbmap", "-query" 和从输出解析的 orig),不存在直接的命令注入风险,但 orig 的内容来源于外部命令的输出。如果 setxkbmap -query 的输出被恶意篡改(虽然极难实现),可能会传入非法参数。建议对解析出的 orig 进行基本的字符校验。
  • GSettings Schema 依赖launchDefaultTerminal 中硬编码了 gsSchemaDefaultTerminal。如果系统中未安装该 Schema,gio.NewSettings 可能会返回 nil(代码中已做判断,这是好的),但在某些发行版或自定义环境中可能会因 Schema 缺失而静默失败。

2. 代码逻辑与健壮性

  • launchDefaultForMimeType 中的类型转换隐患
    dAppInfo := gio.ToDesktopAppInfo(appInfo)
    desktopFile := filepath.Base(dAppInfo.GetFilename())
    gio.AppInfoGetDefaultForType 返回的是 *AppInfo,而 ToDesktopAppInfo 可能会进行类型断言。如果默认应用不是一个 DesktopAppInfo(例如它是自定义脚本或某些特殊的 GIO 扩展),ToDesktopAppInfo 可能会返回 nil,从而导致后续 dAppInfo.GetFilename() 发生 Nil Pointer Dereference (空指针解引用) 导致程序崩溃
    改进意见:必须检查 dAppInfo 是否为 nil
  • breakXGrab 忽略错误
    exec.Command("setxkbmap", "-option", "grab:break_actions").Run()
    这里完全忽略了 Run() 的错误返回值。如果 setxkbmap 执行失败,后续的锁屏逻辑可能会在键盘 Grab 未释放的情况下执行,导致锁屏无法正常响应键盘。
    改进意见:至少应记录错误日志 logger.Warning(err)
  • restoreXkbOptiondefer 时序问题
    lockScreen() 中:
    m.breakXGrab()
    defer m.restoreXkbOption(origOption)
    m.showLockFront()
    如果 showLockFront() 是一个阻塞调用或者耗时调用,defer 会等到 lockScreen() 函数返回时才执行。这意味着 XkbOption 可能会过晚才被恢复。需确认 showLockFront() 是否为异步/非阻塞。如果是阻塞等待锁屏结束,那么在锁屏期间 Xkb 配置一直是被修改的状态,这可能不符合预期。
  • SetAction 的逻辑漏洞
    system_shortcut.go 中:
    if newAction.Type == ActionTypeExecCmd {
        // ...
        ss.customAction = nil
    } else {
        ss.customAction = newAction
    }
    如果用户尝试设置一个非 ActionTypeExecCmd 且非预期的新类型,这里会直接将其赋给 customAction。虽然目前调用方受控,但作为公共方法,建议增加对 newAction.Type 的白名单校验,防止传入非法类型。

3. 代码性能

  • 频繁创建 GSettings 对象
    每次按下终端快捷键都会调用 launchDefaultTerminal(),并执行 gio.NewSettings(gsSchemaDefaultTerminal)。GSettings 对象的创建和销毁虽然开销不大,但在高频按键场景下(如长按快捷键触发重复按键),会产生不必要的内存分配和 D-Bus 通信。
    改进意见:考虑在 Manager 初始化时创建一次 gio.Settings 并作为成员变量复用,或者使用缓存机制(如 sync.Pool 或懒加载单例)。
  • 频繁执行外部命令
    getCurrentXkbOption 每次锁屏都会执行 setxkbmap -query 并解析输出。这涉及进程创建和管道通信。
    改进意见:如果 Xkb 选项不经常变动,可以考虑在 Manager 级别缓存该值,仅在配置变更时更新,而不是每次锁屏都去查询。

4. 代码规范与风格

  • 注释规范:Go 语言推荐使用 // 加空格的开头注释,且首字母大写。新增的 Action 构造函数注释未大写首字母:
    // launch the default application for the given mime type via AM (in-process)
    func NewLaunchMimeTypeAction(mimeType string) *Action {
    改进意见:改为 // LaunchMimeTypeAction creates an action to launch the default application...
  • shortcut_manager.go 中的硬编码 if 判断
    if id == "fileManager" { ... }
    if id == "terminal" { ... }
    if id == "lockScreen" || id == "lockScreen-wayland" { ... }
    这三个 if 语句是互斥的,但使用了三个独立的 if,增加了不必要的条件判断次数。
    改进意见:改为 if - else if 结构,或者使用 switch 语句,逻辑更清晰且效率略高。

改进后的代码建议

针对上述主要问题,以下是修改后的关键代码片段:

manager_handlers.go 修复空指针和错误处理:

func (m *Manager) launchDefaultForMimeType(mimeType string) {
	appInfo := gio.AppInfoGetDefaultForType(mimeType, false)
	if appInfo == nil {
		logger.Warning("no default app for mime type:", mimeType)
		return
	}
	defer appInfo.Unref()

	dAppInfo := gio.ToDesktopAppInfo(appInfo)
	if dAppInfo == nil {
		logger.Warning("failed to cast AppInfo to DesktopAppInfo for mime type:", mimeType)
		return
	}
	
	desktopFile := filepath.Base(dAppInfo.GetFilename())

	err := m.runDesktopFile(desktopFile)
	if err != nil {
		logger.Warning("launch mime type error:", err)
	}
}

func (m *Manager) breakXGrab() {
	err := exec.Command("setxkbmap", "-option", "grab:break_actions").Run()
	if err != nil {
		logger.Warning("breakXGrab: setxkbmap failed:", err)
	}
	if !_useWayland {
		err = exec.Command("xdotool", "key", "XF86Ungrab").Run()
		if err != nil {
			logger.Warning("breakXGrab: xdotool failed:", err)
		}
	}
}

func (m *Manager) restoreXkbOption(orig string) {
	if orig != "" {
		err := exec.Command("setxkbmap", "-option", orig).Run()
		if err != nil {
			logger.Warning("restoreXkbOption: setxkbmap failed:", err)
		}
	}
}

shortcut_manager.go 优化条件判断:

func (sm *ShortcutManager) AddSystemById(wmObj wm.Wm, id string) {
	// ... 前置代码 ...
	
	// 使用 switch 优化逻辑
	switch id {
	case "fileManager":
		// fileManager 走 in-process AM Launch,不 spawn 子进程
		sysShortcut.customAction = NewLaunchMimeTypeAction("inode/directory")
	case "terminal":
		// terminal 走 in-process AM Launch,不 spawn 子进程
		sysShortcut.customAction = NewLaunchTerminalAction()
	case "lockScreen", "lockScreen-wayland":
		// lockScreen 走 in-process DBus,不 spawn dbus-send
		sysShortcut.customAction = NewLockScreenAction()
	}

	sm.addWithoutLock(sysShortcut)
}

system_shortcut.go 增强 SetAction 校验:

func (ss *SystemShortcut) SetAction(newAction *Action) error {
	if newAction == nil {
		return ErrNilAction
	}
	
	// 建议增加对允许的 Action 类型的白名单校验
	allowedTypes := map[ActionType]bool{
		ActionTypeExecCmd: true,
		ActionTypeLaunchMimeType: true,
		ActionTypeLaunchTerminal: true,
		ActionTypeLockScreen: true,
		// 其他允许的类型...
	}
	if !allowedTypes[newAction.Type] {
		return ErrInvalidActionType
	}

	if newAction.Type == ActionTypeExecCmd {
		arg, ok := newAction.Arg.(*ActionExecCmdArg)
		if !ok {
			return ErrTypeAssertionFail
		}
		ss.arg = arg
		ss.customAction = nil
	} else {
		ss.customAction = newAction
		// 清理旧的 arg,避免内存泄漏或状态不一致
		ss.arg = nil 
	}
	return nil
}

@robertkill robertkill force-pushed the fix-361803-optimize-shortcut-launch branch from ca45cf0 to 16c10f7 Compare May 22, 2026 01:59
…wning with in-process handlers

1. Add ActionTypeLaunchMimeType handler: use GIO AppInfoGetDefaultForType + AM Launch in-process, removes default-file-manager Go binary subprocess
2. Add ActionTypeLaunchTerminal handler: use GSettings to read terminal app-id + AM Launch in-process, removes default-terminal Go binary subprocess
3. Add ActionTypeLockScreen handler: in-process DBus LockFront1.Show + X11 grab cleanup, removes dbus-send subprocess from shell pipeline
4. Add customAction field to SystemShortcut: allows per-shortcut override of GetAction() return value without changing storage/serialization

Influence:
1. fileManager shortcut (Win+E): ~1,011ms -> ~176ms
2. terminal shortcut (Ctrl+Alt+T): ~678ms -> ~608ms
3. lockScreen shortcut (Win+L): shell pipeline eliminated, DBus call now in-process
fix: 优化快捷键启动性能,用 in-process handler 替换子进程

1. 新增 ActionTypeLaunchMimeType handler:GIO 查 mime + AM Launch 进程内完成,消除 default-file-manager Go 子进程
2. 新增 ActionTypeLaunchTerminal handler:GSettings 读终端配置 + AM Launch 进程内完成,消除 default-terminal Go 子进程
3. 新增 ActionTypeLockScreen handler:in-process DBus LockFront1.Show + X11 抓取清理,消除 shell 链中的 dbus-send 子进程
4. SystemShortcut 新增 customAction 字段:允许按快捷键覆写 GetAction() 返回值,不改存储/序列化

Influence:
1. fileManager 快捷键 (Win+E):~1,011ms -> ~176ms
2. terminal 快捷键 (Ctrl+Alt+T):~678ms -> ~608ms
3. lockScreen 快捷键 (Win+L):消除 shell 链,DBus 调用改为进程内直连
PMS: BUG-361803
@robertkill robertkill force-pushed the fix-361803-optimize-shortcut-launch branch from 16c10f7 to 4e187eb Compare May 22, 2026 02:00
@deepin-bot
Copy link
Copy Markdown
Contributor

deepin-bot Bot commented May 22, 2026

TAG Bot

New tag: 6.1.91
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1121

@deepin-bot
Copy link
Copy Markdown
Contributor

deepin-bot Bot commented May 25, 2026

TAG Bot

New tag: 6.1.92
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1127

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