-
Notifications
You must be signed in to change notification settings - Fork 7
Add Show Desktop action, SMTC-based 'Media Playing' rule, and move SetVolume to Media Tools #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Programmer-MrWang
merged 6 commits into
main
from
codex/move-system-volume-action-to-media-tools
May 8, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
01b1062
新增媒体播放规则与显示桌面行动并调整音量分组
Programmer-MrWang 3cc2474
新增ClassIsland窗口快捷行动与托盘悬浮窗切换并同步50ms进度刷新
Programmer-MrWang bf3b248
style: 整理代码
Programmer-MrWang 7e87aab
feat: 添加“Ctrl+Z”
Programmer-MrWang dd22183
fix: 添加using
Programmer-MrWang e8c027c
自动构建提交 - 2.5.0.105
Programmer-MrWang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| using System; | ||
| using System.Runtime.InteropServices; | ||
| using System.Threading.Tasks; | ||
| using ClassIsland.Core.Abstractions.Automation; | ||
| using ClassIsland.Core.Attributes; | ||
| using Microsoft.Extensions.Logging; | ||
| using Windows.Win32; | ||
|
|
||
| namespace SystemTools.Actions; | ||
|
|
||
| [ActionInfo("SystemTools.CtrlZ", "按下 Ctrl+Z", "\uEA0B", false)] | ||
| public class CtrlZAction(ILogger<CtrlZAction> logger) : ActionBase | ||
| { | ||
| private readonly ILogger<CtrlZAction> _logger = logger; | ||
|
|
||
| private const byte VK_CONTROL = 0x11; // Ctrl 键 | ||
| private const byte VK_Z = 0x5A; // Z 键 | ||
|
|
||
| protected override async Task OnInvoke() | ||
| { | ||
| try | ||
| { | ||
| _logger.LogInformation("正在模拟按下 Ctrl+Z"); | ||
|
|
||
| // 按下 Ctrl | ||
| PInvoke.keybd_event(VK_CONTROL, 0, 0, UIntPtr.Zero); | ||
| await Task.Delay(20); | ||
|
|
||
| // 按下 Z | ||
| PInvoke.keybd_event(VK_Z, 0, 0, UIntPtr.Zero); | ||
| await Task.Delay(20); | ||
|
|
||
| // 释放 Z | ||
| PInvoke.keybd_event(VK_Z, 0, Windows.Win32.UI.Input.KeyboardAndMouse.KEYBD_EVENT_FLAGS.KEYEVENTF_KEYUP, | ||
| UIntPtr.Zero); | ||
| await Task.Delay(20); | ||
|
|
||
| // 释放 Ctrl | ||
| PInvoke.keybd_event(VK_CONTROL, 0, Windows.Win32.UI.Input.KeyboardAndMouse.KEYBD_EVENT_FLAGS.KEYEVENTF_KEYUP, | ||
| UIntPtr.Zero); | ||
|
|
||
| _logger.LogInformation("Ctrl+Z 已成功发送"); | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| _logger.LogError(ex, "发送 Ctrl+Z 失败"); | ||
| throw; | ||
| } | ||
|
|
||
| await base.OnInvoke(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| using ClassIsland.Core.Abstractions.Automation; | ||
| using ClassIsland.Core.Abstractions.Services; | ||
| using ClassIsland.Core.Attributes; | ||
| using Microsoft.Extensions.Logging; | ||
| using System; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace SystemTools.Actions; | ||
|
|
||
| [ActionInfo("SystemTools.OpenAppSettings", "打开应用设置", "\uEF27", false)] | ||
| public class OpenAppSettingsAction( | ||
| ILogger<OpenAppSettingsAction> logger, | ||
| IUriNavigationService uriNavigationService) : ActionBase | ||
| { | ||
| private readonly ILogger<OpenAppSettingsAction> _logger = logger; | ||
| private readonly IUriNavigationService _uriNavigationService = uriNavigationService; | ||
|
|
||
| protected override Task OnInvoke() | ||
| { | ||
| _logger.LogInformation("正在打开 ClassIsland 应用设置窗口"); | ||
| _uriNavigationService.NavigateWrapped(new Uri("classisland://app/settings")); | ||
| return base.OnInvoke(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| using ClassIsland.Core.Abstractions.Automation; | ||
| using ClassIsland.Core.Abstractions.Services; | ||
| using ClassIsland.Core.Attributes; | ||
| using Microsoft.Extensions.Logging; | ||
| using System; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace SystemTools.Actions; | ||
|
|
||
| [ActionInfo("SystemTools.OpenClassSwapWindow", "打开换课窗口", "\uE13B", false)] | ||
| public class OpenClassSwapWindowAction( | ||
| ILogger<OpenClassSwapWindowAction> logger, | ||
| IUriNavigationService uriNavigationService) : ActionBase | ||
| { | ||
| private readonly ILogger<OpenClassSwapWindowAction> _logger = logger; | ||
| private readonly IUriNavigationService _uriNavigationService = uriNavigationService; | ||
|
|
||
| protected override Task OnInvoke() | ||
| { | ||
| _logger.LogInformation("正在打开 ClassIsland 换课窗口"); | ||
| _uriNavigationService.NavigateWrapped(new Uri("classisland://app/class-swap")); | ||
| return base.OnInvoke(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| using ClassIsland.Core.Abstractions.Automation; | ||
| using ClassIsland.Core.Abstractions.Services; | ||
| using ClassIsland.Core.Attributes; | ||
| using Microsoft.Extensions.Logging; | ||
| using System; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace SystemTools.Actions; | ||
|
|
||
| [ActionInfo("SystemTools.OpenProfileEditor", "打开档案编辑", "\uE699", false)] | ||
| public class OpenProfileEditorAction( | ||
| ILogger<OpenProfileEditorAction> logger, | ||
| IUriNavigationService uriNavigationService) : ActionBase | ||
| { | ||
| private readonly ILogger<OpenProfileEditorAction> _logger = logger; | ||
| private readonly IUriNavigationService _uriNavigationService = uriNavigationService; | ||
|
|
||
| protected override Task OnInvoke() | ||
| { | ||
| _logger.LogInformation("正在打开 ClassIsland 档案编辑窗口"); | ||
| _uriNavigationService.NavigateWrapped(new Uri("classisland://app/profile")); | ||
| return base.OnInvoke(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| using ClassIsland.Core.Abstractions.Automation; | ||
| using ClassIsland.Core.Attributes; | ||
| using Microsoft.Extensions.Logging; | ||
| using System; | ||
| using System.Threading.Tasks; | ||
| using Windows.Win32; | ||
| using Windows.Win32.UI.Input.KeyboardAndMouse; | ||
|
|
||
| namespace SystemTools.Actions; | ||
|
|
||
| [ActionInfo("SystemTools.ShowDesktop", "显示桌面", "\uE62F", false)] | ||
| public class ShowDesktopAction(ILogger<ShowDesktopAction> logger) : ActionBase | ||
| { | ||
| private readonly ILogger<ShowDesktopAction> _logger = logger; | ||
|
|
||
| private const byte VK_LWIN = 0x5B; | ||
| private const byte VK_D = 0x44; | ||
|
|
||
| protected override async Task OnInvoke() | ||
| { | ||
| try | ||
| { | ||
| _logger.LogInformation("正在模拟按下 Win+D 显示桌面"); | ||
|
|
||
| PInvoke.keybd_event(VK_LWIN, 0, 0, UIntPtr.Zero); | ||
| await Task.Delay(20); | ||
|
|
||
| PInvoke.keybd_event(VK_D, 0, 0, UIntPtr.Zero); | ||
| await Task.Delay(20); | ||
|
|
||
| PInvoke.keybd_event(VK_D, 0, KEYBD_EVENT_FLAGS.KEYEVENTF_KEYUP, UIntPtr.Zero); | ||
| await Task.Delay(20); | ||
|
|
||
| PInvoke.keybd_event(VK_LWIN, 0, KEYBD_EVENT_FLAGS.KEYEVENTF_KEYUP, UIntPtr.Zero); | ||
| _logger.LogInformation("Win+D 已成功发送"); | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| _logger.LogError(ex, "发送 Win+D 失败"); | ||
| throw; | ||
| } | ||
|
|
||
| await base.OnInvoke(); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sends
Win+D, which toggles the desktop state rather than always revealing it, so if the action runs while the desktop is already shown (for example via repeated automation) it will restore all previously open windows and undo the intended outcome. For an action namedShowDesktop, this non-idempotent behavior is surprising and can break automations; use a one-way minimize-all approach instead.Useful? React with 👍 / 👎.