Skip to content

Commit

Permalink
Add reghotkey flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Simple-Tracker committed Jan 6, 2025
1 parent 48c9d49 commit 213ab19
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ Usually, occasional errors can be ignored. The reasons may be: 1. Network proble
| --debug | false | Debug mode. Effective before loading config file |
| --startdelay | 0 (Sec, Disable) | Start delay. Special uses for some user |
| --nochdir | false | Don't change working directory. Change to the program directory by default |
| --reghotkey | true | Register window hotkey. The window hotkey is fixed to CTRL+ALT+B |
| --hidewindow | false | Hide window by default. Only available on Windows |
| --hidesystray | false | Hide systray by default. Only available on Windows |
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
| --debug | false (禁用) | 调试模式. 加载配置文件前生效 |
| --startdelay | 0 (秒, 禁用) | 启动延迟. 部分用户的特殊用途 |
| --nochdir | false (禁用) | 不切换工作目录. 默认会切换至程序目录 |
| --reghotkey | true (启用) | 注册窗口热键. 窗口热键固定为 CTRL+ALT+B |
| --hidewindow | false (禁用) | 默认隐藏窗口. 仅 Windows 可用 |
| --hidesystray | false (禁用) | 默认隐藏托盘图标. 仅 Windows 可用 |
Expand Down
2 changes: 2 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ var shortFlag_ShowVersion bool
var longFlag_ShowVersion bool
var startDelay uint
var noChdir bool
var needRegHotKey bool
var needHideWindow bool
var needHideSystray bool

Expand Down Expand Up @@ -630,6 +631,7 @@ func RegFlag() {
flag.BoolVar(&config.Debug, "debug", false, GetLangText("DebugMode"))
flag.UintVar(&startDelay, "startdelay", 0, GetLangText("StartDelay"))
flag.BoolVar(&noChdir, "nochdir", false, GetLangText("NoChdir"))
flag.BoolVar(&needRegHotKey, "reghotkey", true, GetLangText("RegHotKey"))
flag.BoolVar(&needHideWindow, "hidewindow", false, GetLangText("HideWindow"))
flag.BoolVar(&needHideSystray, "hidesystray", false, GetLangText("HideSystray"))
flag.Parse()
Expand Down
1 change: 1 addition & 0 deletions i18n.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var defaultLangContent = map[string]string{
"DebugMode": "调试模式",
"StartDelay": "启动延迟",
"NoChdir": "不切换工作目录",
"RegHotkey": "注册窗口热键",
"HideWindow": "默认隐藏窗口 (仅 Windows)",
"HideSystray": "默认隐藏托盘图标 (仅 Windows)",
"RunConsole_StartDelay": "启动延迟: %d 秒",
Expand Down
1 change: 1 addition & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"DebugMode": "Debug mode",
"StartDelay": "Start delay",
"NoChdir": "Don't change working directory",
"RegHotkey": "Register window hotkey",
"HideWindow": "Hide window by default (Only Windows)",
"HideSystray": "Hide systray by default (Only Windows)",
"RunConsole_StartDelay": "Start delay: %d Sec",
Expand Down
4 changes: 4 additions & 0 deletions main_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ func Platform_Stop() {
systray.Quit()
}
func RegHotKey() {
if !needRegHotKey {
return
}

err := programHotkey.Register()
if err != nil {
Log("RegHotKey", GetLangText("Error-RegHotkey"), false, err.Error())
Expand Down

0 comments on commit 213ab19

Please sign in to comment.