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
49 changes: 49 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: 🐛 创建错误报告
description: 此处只受理 Bug 报告
title: "[Bug] 描述问题的标题"
labels: bug
body:
- type: markdown
attributes:
value: |
> 💡 请务必遵循标题格式。例如:[Bug] 窗口无法隐藏
- type: checkboxes
attributes:
label: 议题条件
description: 在你开始之前,请花几分钟时间确保你已如实完成以下工作,以便让我们更高效地沟通。
options:
- label: 我确认即使在最新正式版中存在该问题。
required: true
- label: 我确认已在 [Issues](/IvanHanloth/Boss-Key/issues) 进行搜索并确认没有人反馈过相同的Bug。
required: true
- label: 我确认已经总结议题内容并按规范设置此Issue的标题
required: true
- type: input
attributes:
label: 系统环境
description: 在哪个平台(Windows/Linux/MacOS)上运行?如果是直接使用Python运行,则尽量同时提供Python版本
placeholder: 如:Windows 11 Python 3.11.9
validations:
required: true
- type: input
attributes:
label: 使用版本
description: 请提供您当前使用的 Boss Key 版本号。
placeholder: 如:v2.0.3
validations:
required: true
- type: textarea
attributes:
label: 问题描述
description: 请提供详细的问题描述和操作步骤等信息,以便我们也能够更轻松地将问题复现。
validations:
required: true
- type: textarea
attributes:
label: 错误日志
description: 如果有错误日志,请提供以便更好地定位问题。
render: auto
- type: textarea
attributes:
label: 截图补充
description: 如上述仍然无法准确地表述问题,可提供必要的截图(可直接粘贴上传)
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: ❓提出问题
url: https://github.com/IvanHanloth/BossKey/discussions
about: 提问项目相关的其他问题
- name: 📄官方文档
url: https://ivanhanloth.github.io/Boss-Key/
about: 在创建 Issue 之前,请仔细查阅 Bili23 Downloader 使用手册以确保正确使用。
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: ✨ 提出建议
description: 此处支持提出建议、请求新功能
title: "[Feature] 简要描述你的建议或请求"
labels: enhancement
body:
- type: markdown
attributes:
value: |
> 💡 请务必遵循标题格式。例如:[Feature] 希望支持鼠标隐藏
- type: checkboxes
attributes:
label: 议题条件
description: 在你开始之前,请花几分钟时间确保你已如实完成以下工作,以便让我们更高效地沟通。
options:
- label: 我确认即使在最新正式版中存在该问题。
required: true
- label: 我确认已在 [Issues](/IvanHanloth/Boss-Key/issues) 进行搜索并确认没有人反馈过相同的Bug。
required: true
- label: 我确认已经总结议题内容并按规范设置此Issue的标题
required: true
- type: textarea
attributes:
label: 详细描述
description: 请详细描述你的建议或需求。
validations:
required: true
- type: textarea
attributes:
label: 其他
description: 如上述仍然无法准确地表述问题,可提供必要的截图(可直接粘贴上传)
1 change: 1 addition & 0 deletions .github/workflows/tag-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
draft: false
prerelease: false
generate_release_notes: true
discussion_category_name: announcements

compile-to-installer:
runs-on: windows-latest
Expand Down
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- multifile - 多文件版,标准的程序版本,所有依赖文件被压缩到一个压缩包里,解压后可用
- installer - 安装程序(推荐),完整封装的Boss-Key程序安装程序,提供一键安装、更新、卸载,可以更高效的管理Boss-Key程序

部分版本会提供win7系统的软件包,带有win7标识的可以在Windows 7系统上运行

### 基础使用

Expand Down Expand Up @@ -75,6 +76,10 @@

注意!此功能仍在测试,启用后会导致窗口隐藏出现延时

#### 文件路径匹配功能
Boss Key默认使用窗口标题等多因素进行窗口匹配以确保精确隐藏窗口,但是有时可能出现希望根据可执行文件路径来进行匹配:
即只要是由同一个程序启动的窗口都隐藏,此时就可以启用“文件路径匹配”选项进行模糊匹配

#### 同时隐藏当前活动窗口
启用该功能后,按下隐藏窗口热键时,除了会隐藏绑定的窗口,还会隐藏当前被激活的窗口。

Expand All @@ -91,6 +96,8 @@

如果你安装了python环境,也可以尝试克隆仓库后,运行Boss-Key.py文件来启动窗口

如果你是windows7系统,部分版本会提供win7系统的软件包,可以下载带有win7标识的软件使用

**为什么我一直没办法检查更新**
检查更新的服务依赖Github提供的Github Page,如果你的电脑无法访问[https://ivanhanloth.github.io/Boss-Key](https://ivanhanloth.github.io/Boss-Key),则无法检查更新

Expand Down Expand Up @@ -118,7 +125,8 @@ Boss-Key
│   │   ├── about.py 关于页面
│   │   ├── record.py 录制热键页面
│   │   ├── setting.py 设置页面
│   │   └── taskbar.py 托盘图标
│   │   ├── taskbar.py 托盘图标
│   │   └── window_restore.py 窗口恢复工具页面
│   └── Boss-Key.py 项目入口文件
├── src 网站相关目录
│   └── static 静态文件目录
Expand All @@ -129,18 +137,41 @@ Boss-Key
└── requirements.txt 项目依赖文件

```
## 分支说明及规范
为了高效、安全的完成开发,我们对分支、合并等有一定限制。

仓库有两个主要分支`main`和`dev`分支:
- `main`包含正式发布版本的源代码,此分支不能直接提交,原则上只能已完成版本功能开发且决定发布新版本并通过测试后,从`dev`分支合并
- `dev`用于存储所有正在开发的功能的源代码,此分支不能直接提交,原则上只能包含已经完成开发并通过测试的功能

其他分支则用于正常功能开发、提交等。

新功能、Bug修复等操作应该通过PR提交至`dev`分支,经过代码审查后合并。最后经过测试后,统一通过PR合并至`main`分支。

分支命名没有强制规范,但是为了方便维护,我们推荐使用类似`类型/功能`的命名方式,例如`feat/checkUpdate`、`fix/hideWindow`等。

## Project规范
我们通常使用github提供的Project功能进行统一项目规划管理。

应该尽量将Issue-PullRequest-Project三者相互关联,以便实现统一管理。

## 已知问题
- 无法隐藏部分游戏窗口,可能由于游戏窗口加密导致

## 更新日志
**V2.0.3 (更新于2025/4/5)**
- 新增文件路径匹配选项
- 新增窗口恢复工具
- 修复状态列表问题
- 优化运行速度和占用

**V2.0.2 (更新于2025/2/2)**
- 新增全选窗口选项
- 新增隐藏窗口后同时隐藏程序托盘图标选项
- 修复无法使用热键关闭程序的问题
- 优化界面UI设计
- 优化配置文件读取

**V2.0.1 (更新于2025/1/17)**
- 修改已在运行时的提醒
- 修复窗口销毁后再打开隐藏失败的问题
Expand Down
84 changes: 51 additions & 33 deletions main/Boss-Key.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# nuitka-project: --onefile
# nuitka-project: --windows-console-mode=disable
# nuitka-project: --standalone
# nuitka-project: --assume-yes-for-downloads
# nuitka-project: --follow-import-to=core
# nuitka-project: --windows-icon-from-ico=icon.ico
# nuitka-project: --windows-product-name="Boss Key"
# nuitka-project: --windows-file-description="Boss Key Application"
# nuitka-project: --follow-import-to=GUI
# nuitka-project: --copyright="Copyright (C) 2025 Ivan Hanloth All Rights Reserved. "
# nuitka-project: --windows-company-name="Ivan Hanloth"
# nuitka-project: --product-name="Boss Key"
# nuitka-project: --file-description="Boss Key Application"
# nuitka-project: --windows-icon-from-ico=icon.ico
# nuitka-project: --windows-console-mode=disable

from GUI import setting, taskbar
from core import listener
Expand All @@ -16,19 +17,32 @@
import psutil
import wx
from core.config import Config
import platform
import atexit

ctypes.windll.shcore.SetProcessDpiAwareness(2) # Win10 and Win8
ctypes.windll.user32.SetProcessDPIAware() #Win7 and below
if platform.system() == "Windows":
if platform.release() == "7":
ctypes.windll.user32.SetProcessDPIAware()
else:
ctypes.windll.shcore.SetProcessDpiAwareness(2)

class APP(wx.App):
def __init__(self):
wx.App.__init__(self)

def clean():
try:
Config.HotkeyListener.Close()
except:
pass
atexit.register(clean)

# 设置语言环境为中文
self.locale = wx.Locale(wx.LANGUAGE_CHINESE_SIMPLIFIED)

self.SetAppName(Config.AppName)
self.SetAppDisplayName(Config.AppName)
self.SetVendorName(Config.AppAuthor)

lock=os.path.join(os.path.dirname(sys.argv[0]),"Boss-Key.lock")
if self.is_already_running(lock):
ask=wx.MessageBox("Boss Key 可能已在运行\n点击“确定”继续运行新的Boss-Key程序\n点击“取消”直接关闭此窗口","Boss Key", wx.OK | wx.ICON_INFORMATION | wx.CANCEL | wx.CANCEL_DEFAULT)
Expand All @@ -42,37 +56,41 @@ def write_pid(self,name):
with open(name, "w") as f:
f.write(str(psutil.Process().pid))

def is_already_running(self,name):
if os.path.exists(name):
with open(name, "r") as f:
pid=f.read()
if pid == "":
def is_already_running(self, name):
if not os.path.exists(name):
self.write_pid(name)
return False

with open(name, "r") as f:
pid = f.read()

if pid == "":
self.write_pid(name)
return False

try:
process = psutil.Process(int(pid))
if not process.is_running():
self.write_pid(name)
else:
try:
process=psutil.Process(int(pid))
if process.is_running():
this_name=psutil.Process(psutil.Process().pid).name() #获取当前进程名
if this_name==process.name():
return True
else:
self.write_pid(name)
return False
else:
self.write_pid(name)
return False
except:
self.write_pid(name)
return False
else:
return False

this_name = psutil.Process(psutil.Process().pid).name() # 获取当前进程名
if this_name == process.name():
return True

self.write_pid(name)
return False
except:
self.write_pid(name)
return False


if __name__ == '__main__':
app = APP()
Config.SettingWindowId = wx.NewIdRef()
Config.TaskBarIcon=taskbar.TaskBarIcon()
Config.HotkeyListener=listener.HotkeyListener()
Config.SettingWindow=setting.SettingWindow()
setting.SettingWindow(Config.SettingWindowId)
if Config.first_start:
Config.SettingWindow.Show()
wx.FindWindowById(Config.SettingWindowId).Show()
app.MainLoop()

12 changes: 6 additions & 6 deletions main/GUI/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def Show(self):
wx.adv.AboutBox(self.info)

class UpdateWindow(wx.Dialog):
def __init__(self):
super().__init__(None, title="检查更新 - Boss Key", style=wx.DEFAULT_DIALOG_STYLE | wx.STAY_ON_TOP | wx.RESIZE_BORDER)
def __init__(self,id=None):
super().__init__(None,id=id, title="检查更新 - Boss Key", style=wx.DEFAULT_DIALOG_STYLE | wx.STAY_ON_TOP | wx.RESIZE_BORDER)
self.SetIcon(wx.Icon(wx.Image(Config.icon).ConvertToBitmap()))

self.init_Load_UI()
Expand Down Expand Up @@ -52,15 +52,15 @@ def init_Load_UI(self):
self.panel.SetSizer(self.sizer)

def onCheckUpdate(self):
def checkUpdate():
def check():
try:
info = check_update()
info = checkUpdate()
except:
wx.CallAfter(self.init_error_UI)
return

wx.CallAfter(self.init_real_UI,info)
threading.Thread(target=checkUpdate).start()
threading.Thread(target=check).start()

def init_real_UI(self,info):
## 清空原有元素
Expand Down Expand Up @@ -114,4 +114,4 @@ def Btn_click(self,url,is_latest):
if ask == wx.CANCEL:
return
webbrowser.open(url)
self.Hide()
self.Hide()
Loading