변경 목적: Agent Compare 아래 비교본의 개발 문서와 런처 소스를 기준으로 현재 AX Commander에 빠져 있던 신규 런처 기능을 동일한 흐름으로 옮겨, 비교본 수준의 기능 폭을 현재 제품에 반영했습니다. 핵심 수정사항: 비교본의 신규 런처 핸들러 다수를 src/AxCopilot/Handlers로 이식하고 App.xaml.cs 등록 흐름에 연결했습니다. 빠른 링크, 파일 태그, 알림 센터, 포모도로, 파일 브라우저, 핫키 관리, OCR, 세션/스케줄/매크로, Git/정규식/네트워크/압축/해시/UUID/JWT/QR 등 AX Commander 기능을 추가했습니다. 핵심 수정사항: 신규 기능이 실제 동작하도록 AppSettings 확장, SchedulerService/FileTagService/NotificationCenterService/IconCacheService/UrlTemplateEngine/PomodoroService 추가, 배치 이름변경/세션/스케줄/매크로 편집 창 추가, NotificationService와 Symbols 보강, QR/OCR용 csproj 의존성과 Windows 타겟 프레임워크를 반영했습니다. 문서 반영: README.md와 docs/DEVELOPMENT.md에 비교본 기반 런처 기능 이식 이력과 검증 결과를 업데이트했습니다. 검증 결과: dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\\verify\\ -p:IntermediateOutputPath=obj\\verify\\ 실행 기준 경고 0개, 오류 0개를 확인했습니다.
156 lines
5.1 KiB
C#
156 lines
5.1 KiB
C#
using AxCopilot.Core;
|
|
using AxCopilot.SDK;
|
|
using AxCopilot.Services;
|
|
using AxCopilot.Themes;
|
|
|
|
namespace AxCopilot.Handlers;
|
|
|
|
/// <summary>
|
|
/// L5-1: 전용 핫키 관리 핸들러.
|
|
/// 예: hotkey → 등록된 전용 핫키 목록 표시
|
|
/// hotkey 1doc → 라벨 또는 대상에 "1doc" 포함 항목 필터
|
|
/// Enter 시 해당 핫키 항목의 대상을 실행합니다.
|
|
/// </summary>
|
|
public class HotkeyHandler : IActionHandler
|
|
{
|
|
private readonly SettingsService? _settings;
|
|
|
|
public HotkeyHandler(SettingsService? settings = null)
|
|
{
|
|
_settings = settings;
|
|
}
|
|
|
|
public string? Prefix => "hotkey";
|
|
|
|
public PluginMetadata Metadata => new(
|
|
"HotkeyManager",
|
|
"전용 핫키 목록 관리",
|
|
"1.0",
|
|
"AX");
|
|
|
|
public Task<IEnumerable<LauncherItem>> GetItemsAsync(string query, CancellationToken ct)
|
|
{
|
|
var items = new List<LauncherItem>();
|
|
var hotkeys = _settings?.Settings.CustomHotkeys ?? new List<Models.HotkeyAssignment>();
|
|
|
|
if (hotkeys.Count == 0)
|
|
{
|
|
items.Add(new LauncherItem(
|
|
"등록된 전용 핫키 없음",
|
|
"설정 → 전용 핫키 탭에서 항목별 글로벌 단축키를 등록하세요",
|
|
null,
|
|
"__open_settings__",
|
|
Symbol: "\uE713"));
|
|
return Task.FromResult<IEnumerable<LauncherItem>>(items);
|
|
}
|
|
|
|
var filter = query.Trim().ToLowerInvariant();
|
|
|
|
foreach (var h in hotkeys)
|
|
{
|
|
if (!string.IsNullOrEmpty(filter) &&
|
|
!h.Label.Contains(filter, StringComparison.OrdinalIgnoreCase) &&
|
|
!h.Hotkey.Contains(filter, StringComparison.OrdinalIgnoreCase) &&
|
|
!h.Target.Contains(filter, StringComparison.OrdinalIgnoreCase))
|
|
continue;
|
|
|
|
var typeSymbol = h.Type switch
|
|
{
|
|
"url" => Symbols.Globe,
|
|
"folder" => Symbols.Folder,
|
|
"command" => "\uE756",
|
|
_ => Symbols.App
|
|
};
|
|
|
|
var label = string.IsNullOrWhiteSpace(h.Label)
|
|
? System.IO.Path.GetFileNameWithoutExtension(h.Target)
|
|
: h.Label;
|
|
|
|
items.Add(new LauncherItem(
|
|
$"[{h.Hotkey}] {label}",
|
|
h.Target,
|
|
null,
|
|
h,
|
|
Symbol: typeSymbol));
|
|
}
|
|
|
|
// 설정 단축키 안내 항목
|
|
items.Add(new LauncherItem(
|
|
"전용 핫키 설정 열기",
|
|
"설정 → 전용 핫키 탭에서 핫키를 추가하거나 제거합니다",
|
|
null,
|
|
"__open_settings__",
|
|
Symbol: "\uE713"));
|
|
|
|
return Task.FromResult<IEnumerable<LauncherItem>>(items);
|
|
}
|
|
|
|
public Task ExecuteAsync(LauncherItem item, CancellationToken ct)
|
|
{
|
|
if (item.Data is string s && s == "__open_settings__")
|
|
{
|
|
System.Windows.Application.Current.Dispatcher.Invoke(() =>
|
|
{
|
|
var app = System.Windows.Application.Current as AxCopilot.App;
|
|
app?.OpenSettingsFromChat();
|
|
});
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
if (item.Data is Models.HotkeyAssignment ha)
|
|
{
|
|
ExecuteHotkeyTarget(ha.Target, ha.Type);
|
|
}
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
/// <summary>전용 핫키 대상을 타입에 따라 실행합니다.</summary>
|
|
internal static void ExecuteHotkeyTarget(string target, string type)
|
|
{
|
|
try
|
|
{
|
|
switch (type)
|
|
{
|
|
case "url":
|
|
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
|
{
|
|
FileName = target,
|
|
UseShellExecute = true
|
|
});
|
|
break;
|
|
|
|
case "folder":
|
|
System.Diagnostics.Process.Start("explorer.exe", target);
|
|
break;
|
|
|
|
case "command":
|
|
var parts = target.Split(' ', 2, StringSplitOptions.RemoveEmptyEntries);
|
|
var cmdFile = parts[0];
|
|
var cmdArgs = parts.Length > 1 ? parts[1] : "";
|
|
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
|
{
|
|
FileName = cmdFile,
|
|
Arguments = cmdArgs,
|
|
UseShellExecute = true
|
|
});
|
|
break;
|
|
|
|
default: // app
|
|
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
|
{
|
|
FileName = target,
|
|
UseShellExecute = true
|
|
});
|
|
break;
|
|
}
|
|
|
|
Services.LogService.Info($"전용 핫키 실행: {target} ({type})");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Services.LogService.Error($"전용 핫키 실행 오류: {target} — {ex.Message}");
|
|
}
|
|
}
|
|
}
|