Ariver
2026-07-03 5fbe9789faf05ce99bbff6ec4cd0b905519acbd0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package services
 
import (
    "voicesnap/internal/config"
    "voicesnap/internal/hotkey"
)
 
// HotkeyService provides hotkey configuration methods to the frontend.
type HotkeyService struct {
    cfg *config.Config
    app AppOrchestrator
}
 
func NewHotkeyService(cfg *config.Config) *HotkeyService {
    return &HotkeyService{cfg: cfg}
}
 
// SetApp sets the app orchestrator reference.
func (s *HotkeyService) SetApp(app AppOrchestrator) {
    s.app = app
}
 
// GetCurrentHotkey returns the current hotkey VK code.
func (s *HotkeyService) GetCurrentHotkey() int {
    return s.cfg.HotkeyVK
}
 
// GetHotkeyName returns the display name for the current hotkey.
func (s *HotkeyService) GetHotkeyName() string {
    return hotkey.GetKeyName(s.cfg.HotkeyVK)
}
 
// SetHotkey updates the hotkey VK code.
func (s *HotkeyService) SetHotkey(vk int) {
    s.cfg.HotkeyVK = vk
    config.Save(s.cfg)
    if s.app != nil {
        s.app.UpdateHotkeyVK(vk)
    }
}
 
// StartRecordingHotkey enters hotkey recording mode (pauses hotkey polling).
func (s *HotkeyService) StartRecordingHotkey() {
    if s.app != nil {
        s.app.SetRecordingHotkey(true)
    }
}
 
// StopRecordingHotkey exits hotkey recording mode.
func (s *HotkeyService) StopRecordingHotkey() {
    if s.app != nil {
        s.app.SetRecordingHotkey(false)
    }
}
 
// GetKeyName returns the display name for a given VK code.
func (s *HotkeyService) GetKeyName(vk int) string {
    return hotkey.GetKeyName(vk)
}