Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to GeulGuard are documented in this file.

## [0.6.0] - Unreleased

- 앱 시작 시 업데이트를 한 번 확인하며, 설정에서 시작 시 확인을 끌 수 있습니다.
- 메뉴의 ‘업데이트 확인…’으로 새 버전을 확인하고 서명된 PKG 업데이트를 설치할 수 있습니다.
- 업데이트 설치를 위해 앱을 종료하기 전에 ABC 입력 소스와 한글 조합 종료를 확인합니다.

## [0.5.0] - 2026-09-13

- 연속 자음의 쌍자음 조합을 설정에서 켜거나 끌 수 있습니다. 끄면 `ㄱㄱ`을 `ㄲ`으로 합치지 않고 각각 입력합니다.
Expand Down
15 changes: 15 additions & 0 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 14 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,29 @@ let package = Package(
.library(name: "HangulCore", targets: ["HangulCore"]),
.executable(name: "GeulGuardInput", targets: ["GeulGuardInput"])
],
dependencies: [
.package(url: "https://github.com/sparkle-project/Sparkle", exact: "2.10.0")
],
targets: [
.target(name: "HangulCore"),
.executableTarget(
name: "GeulGuardInput",
dependencies: ["HangulCore"],
dependencies: ["HangulCore", .product(name: "Sparkle", package: "Sparkle")],
linkerSettings: [
.linkedFramework("AppKit"),
.linkedFramework("InputMethodKit"),
.linkedFramework("SwiftUI")
.linkedFramework("SwiftUI"),
.linkedFramework("Carbon"),
.unsafeFlags(["-Xlinker", "-rpath", "-Xlinker", "@executable_path/../Frameworks"])
]
),
.testTarget(
name: "GeulGuardInputTests",
dependencies: ["GeulGuardInput"],
linkerSettings: [
.unsafeFlags(["-Xlinker", "-rpath", "-Xlinker", "@loader_path/../../.."])
]
),
.testTarget(name: "GeulGuardInputTests", dependencies: ["GeulGuardInput"]),
.testTarget(
name: "HangulCoreTests",
dependencies: ["HangulCore"]
Expand Down
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ Binary를 `/Library/Input Methods`에 설치하므로 관리자 암호가 필요
확인·변경할 수 있습니다. 글가드는 `Shift+Space`를 한/영 전환으로 가로채지 않습니다.
ESC는 조합 중인 한글만 확정하며 입력 소스를 바꾸지 않습니다.

## 업데이트

업데이트가 설정된 배포본에서는 메뉴 막대의 글가드 아이콘 → `업데이트 확인…`으로
새 버전을 확인합니다. 앱이 시작될 때 백그라운드에서 한 번 자동 확인하며 새 버전이
있을 때만 안내합니다. 설정의 `앱 시작 시 업데이트 확인`에서 끌 수 있습니다.
설치는 사용자 확인과 관리자 인증을 거칩니다.

설치 전에 입력 중인 글자를 확정하고 ABC로 전환하세요. 조합 중인 글자가 남거나
현재 소스가 ABC가 아니면 업데이트를 위한 종료를 막습니다. 설치 후 글가드를 다시
선택하고, 새 버전이 반영되지 않으면 작업 저장 후 로그아웃·로그인하세요.
업데이터가 없는 기존 버전은 업데이트 기능을 포함한 PKG를 한 번 수동 설치해야 합니다.
피드·공개키를 지정하지 않은 개발 빌드에서는 업데이트 메뉴와 설정이 비활성화됩니다.
배포 준비와 검증 절차는 [업데이트 배포 문서](docs/updates.md)를 참고하세요.

## 권장 사용법: ABC + 글가드 두벌식 + Karabiner

영어는 **ABC**, 한글은 **글가드 두벌식**, Caps Lock 전환은 **Karabiner-Elements**가
Expand Down Expand Up @@ -106,7 +120,8 @@ Shift로 직접 입력하는 쌍자음과 겹받침 조합에는 영향을 주
## 개인정보

키 입력은 현재 포커스된 앱으로 전달하기 위해 메모리에서만 처리합니다. 네트워크
연결, 입력 기록, 접근성 권한을 사용하지 않습니다.
연결은 업데이트 확인·다운로드에만 사용하며, 키 입력을 기록하거나 전송하지 않습니다.
접근성 권한을 사용하지 않습니다.
선택 구성인 Karabiner-Elements는 키를 재매핑하기 위한 별도의 macOS 권한과
드라이버를 사용합니다. 글가드 자체의 권한과 구분하세요.

Expand Down
12 changes: 10 additions & 2 deletions Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.5.0</string>
<string>0.6.0</string>
<key>CFBundleVersion</key>
<string>6</string>
<string>7</string>
<key>ComponentInputModeDict</key>
<dict>
<key>tsInputModeListKey</key>
Expand Down Expand Up @@ -64,6 +64,14 @@
<true/>
<key>LSMinimumSystemVersion</key>
<string>14.0</string>
<key>SUEnableAutomaticChecks</key>
<false/>
<key>SUAllowsAutomaticUpdates</key>
<false/>
<key>SUAutomaticallyUpdate</key>
<false/>
<key>SUSendProfileInfo</key>
<false/>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>TISInputSourceID</key>
Expand Down
5 changes: 3 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ Issue에 재현 정보를 올리지 마세요. GitHub의 **Report a vulnerabilit

## Privacy boundary

GeulGuard는 네트워크 연결, 키 입력 저장, 접근성 권한을 사용하지 않는 것을 보안
불변식으로 유지합니다.
GeulGuard는 업데이트 확인·다운로드에만 네트워크를 사용합니다. 키 입력을 저장하거나
전송하지 않으며, 접근성 권한을 사용하지 않는 것을 보안 불변식으로 유지합니다.
업데이트 확인 설정과 배포 검증 절차는 [업데이트 문서](docs/updates.md)를 참고하세요.
46 changes: 41 additions & 5 deletions Sources/GeulGuardInput/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@ import AppKit
import SwiftUI

@MainActor
final class AppDelegate: NSObject, NSApplicationDelegate {
final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
private lazy var updates = UpdateController()
private var statusItem: NSStatusItem?
private var settingsWindow: NSWindow?

func applicationDidFinishLaunching(_ notification: Notification) {
_ = updates
configureStatusItem()
Task { @MainActor in
updates.presentPostUpdateLogoutIfNeeded()
}
if ProcessInfo.processInfo.arguments.contains("--settings") {
showSettings()
}
}

@objc private func showSettings() {
if settingsWindow == nil {
let rootView = SettingsView()
let rootView = SettingsView(updates: updates)
let window = NSWindow(contentViewController: NSHostingController(rootView: rootView))
window.title = "글가드 설정"
window.setContentSize(NSSize(width: 520, height: 540))
window.setContentSize(NSSize(width: 520, height: 680))
window.styleMask = [.titled, .closable, .miniaturizable]
window.isReleasedWhenClosed = false
settingsWindow = window
Expand All @@ -29,10 +34,22 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
settingsWindow?.makeKeyAndOrderFront(nil)
}

func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
updates.confirmTermination()
}

@objc private func checkForUpdates() {
updates.checkForUpdates()
}

@objc private func quit() {
NSApp.terminate(nil)
}

func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
menuItem.action != #selector(checkForUpdates) || updates.canCheckForUpdates
}

private func configureStatusItem() {
let item = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
item.button?.toolTip = "글가드 · 한글 입력기"
Expand All @@ -47,6 +64,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate {

let menu = NSMenu()
menu.addItem(withTitle: "설정…", action: #selector(showSettings), keyEquivalent: ",")
let updateItem = menu.addItem(withTitle: "업데이트 확인…", action: #selector(checkForUpdates), keyEquivalent: "")
updateItem.target = self
menu.addItem(.separator())
menu.addItem(withTitle: "글가드 종료", action: #selector(quit), keyEquivalent: "q")
item.menu = menu
Expand All @@ -55,6 +74,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
}

private struct SettingsView: View {
@ObservedObject var updates: UpdateController
@AppStorage(GeulGuardPreferences.combineRepeatedInitialsKey)
private var combineRepeatedInitials = true

Expand All @@ -77,7 +97,7 @@ private struct SettingsView: View {
feature("한/영 전환", "macOS 입력 메뉴나 시스템 단축키로 ABC ↔ 글가드를 전환합니다.")
feature("커서 이동 안전", "방향키·Tab·Return·단축키 전에 조합 문자를 먼저 확정합니다.")
feature("ESC 확정", "조합 중인 한글만 확정합니다. 영어는 ABC 입력 소스를 사용하세요.")
feature("개인정보 보호", "네트워크 연결, 키 입력 저장, 접근성 권한이 없습니다.")
feature("개인정보 보호", "업데이트 확인·다운로드에만 네트워크를 사용하며 키 입력을 저장하거나 전송하지 않습니다.")

Divider()

Expand All @@ -89,15 +109,31 @@ private struct SettingsView: View {
.foregroundStyle(.secondary)
}

Divider()

VStack(alignment: .leading, spacing: 8) {
Text("업데이트").font(.headline)
Toggle("앱 시작 시 업데이트 확인", isOn: Binding(
get: { updates.checksOnLaunch },
set: { updates.setChecksOnLaunch($0) }
))
.disabled(!updates.isAvailable)
Text(updates.status)
.font(.callout)
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true)
}

Spacer()


Text("시스템 설정 → 키보드 → 텍스트 입력 → 편집에서 ‘ABC’와 ‘글가드 두벌식’을 추가하세요.")
.font(.callout)
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true)
}
.padding(28)
.frame(minWidth: 520, minHeight: 540)
.frame(minWidth: 520, minHeight: 680)
}

private func feature(_ title: String, _ description: String) -> some View {
Expand Down
27 changes: 27 additions & 0 deletions Sources/GeulGuardInput/GeulGuardInputController.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import AppKit
import HangulCore
import InputMethodKit
import os

@objc(GeulGuardInputController)
final class GeulGuardInputController: IMKInputController {
private static let composingSessions = OSAllocatedUnfairLock(initialState: Set<ObjectIdentifier>())

static var hasPendingComposition: Bool {
composingSessions.withLock { !$0.isEmpty }
}

private var composer = HangulComposer()
private let noReplacement = NSRange(location: NSNotFound, length: NSNotFound)

override func handle(_ event: NSEvent!, client sender: Any!) -> Bool {
guard let event, let client = sender as? IMKTextInput else { return false }
defer { recordCompositionState() }

guard event.modifierFlags.intersection([.command, .control, .option]).isEmpty else {
commitComposition(to: client)
Expand Down Expand Up @@ -44,6 +52,7 @@ final class GeulGuardInputController: IMKInputController {
}

override func commitComposition(_ sender: Any!) {
defer { recordCompositionState() }
guard let client = sender as? IMKTextInput else {
composer.cancel()
return
Expand All @@ -52,6 +61,7 @@ final class GeulGuardInputController: IMKInputController {
}

override func deactivateServer(_ sender: Any!) {
defer { recordCompositionState() }
if let client = sender as? IMKTextInput {
commitComposition(to: client)
} else {
Expand All @@ -60,6 +70,23 @@ final class GeulGuardInputController: IMKInputController {
super.deactivateServer(sender)
}

deinit {
let identifier = ObjectIdentifier(self)
_ = Self.composingSessions.withLock { $0.remove(identifier) }
}

private func recordCompositionState() {
let identifier = ObjectIdentifier(self)
let hasComposition = composer.hasComposition
Self.composingSessions.withLock { sessions in
if hasComposition {
sessions.insert(identifier)
} else {
sessions.remove(identifier)
}
}
}

private func apply(_ update: CompositionUpdate, to client: IMKTextInput) {
if !update.committed.isEmpty {
client.insertText(update.committed, replacementRange: noReplacement)
Expand Down
6 changes: 6 additions & 0 deletions Sources/GeulGuardInput/GeulGuardPreferences.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import Foundation

enum GeulGuardPreferences {
static let checkForUpdatesOnLaunchKey = "checkForUpdatesOnLaunch"

static var checksForUpdatesOnLaunch: Bool {
UserDefaults.standard.object(forKey: checkForUpdatesOnLaunchKey) as? Bool ?? true
}

static let combineRepeatedInitialsKey = "combineRepeatedInitials"

static var combinesRepeatedInitials: Bool {
Expand Down
Loading
Loading