Skip to content
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

[QuickAccent] Adding Enable/Disable Hotkey #31413

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Mahfoudh94
Copy link

Summary of the Pull Request

it adds the ability to enable/disable QuickAccent using a global hotkey without the need to enter the settings every time you don't need this utility (the clip is blocky because of the recorder + conversion to GIF)
quickaccent

PR Checklist

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

@Mahfoudh94
Copy link
Author

Mahfoudh94 commented Feb 14, 2024 via email

@Mahfoudh94
Copy link
Author

Help is welcome as I have a problem formatting src\settings-ui\Settings.UI\SettingsXAML\Views\PowerAccentPage.xaml

@Mahfoudh94 Mahfoudh94 marked this pull request as ready for review February 14, 2024 14:53
@Jay-o-Way
Copy link
Collaborator

Jay-o-Way commented Feb 14, 2024

Was it intentional to upgrade winrt? It causes a huge number of file changes. Ref #31396

@Mahfoudh94
Copy link
Author

Mahfoudh94 commented Feb 14, 2024

Was it intentional to upgrade winrt?

No, it wasn't, as of one time trying to get into the repositories management system, I pulled again from the main branch which was at the time updated with that winrt thing. As such I reverted the changes at the end, if you know how to remove them entirely from the fork, I'd be thankful for you to tell me how.

@Jay-o-Way
Copy link
Collaborator

Okay. The merge includes changes from the main branch.

@Mahfoudh94
Copy link
Author

It shouldn't have been implemented in my commit, however it got included as a merge, therefor I removed it

@Jay-o-Way
Copy link
Collaborator

If it were me, I think I would create a new, fresh branch. Then maybe cherry-pick the correct commits(s) to the new one. Or, sometimes when I think a branch/pr is getting too messy, I just start over.
@crutkas your tip?

@jaimecbernardo
Copy link
Collaborator

Yeah, this is weird. Why is there a revert?
Can you please update your branch to only have the commits that include your changes?

@jaimecbernardo
Copy link
Collaborator

Thanks for opening this PR, by the way.

Copy link
Collaborator

@jaimecbernardo jaimecbernardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Mahfoudh94 , I've tried reverting your changes to fix the PR. Can you please look at https://github.com/microsoft/PowerToys/pull/31413/files and make sure that's the changes you've intended for the PR?
I'm quite sure that PowerToys.sln and Resources file have unintended changes. Can you please fix those?

@Mahfoudh94
Copy link
Author

I would create a new, fresh branch. Then maybe cherry-pick the correct commits(s)

So here comes the cherry-pick handy..., okay I'll give it a try, thanks

Thanks for opening this PR

Don't mention it, it is thanks to you two for being here helping me

as for why the revert, when the new code where implemented from the pull, it raises problems from "Audit deps.json files for all applications" step, you can check it on azure pipelines

@jaimecbernardo
Copy link
Collaborator

Actually, that "Audit deps.json files for all applications" step was caused by the Visual Studio 17.9 update in the CI. A fix has been done in main already, so I've merged main in, which should fix that.

@Mahfoudh94
Copy link
Author

Mahfoudh94 commented Feb 15, 2024

understood, now I should go and cherry-pick only those code changes I've done, then what? open a new pull request or is there a way to update this PR and take it from another branch?
EDIT: I think the last question was a dumb question on my end, like I forgot I was a developer 😅

@Mahfoudh94 Mahfoudh94 force-pushed the quickaccent_toggle_hotkey branch from 0280686 to 16b7852 Compare February 15, 2024 21:50
@Mahfoudh94
Copy link
Author

There it is, cleaned and cherry-picked. Hoping it all goes well.

@Mahfoudh94
Copy link
Author

@jaimecbernardo, still waiting for your approval, and it happens there is a merge conflict because I added to the strings Resources.resw

Copy link
Collaborator

@Jay-o-Way Jay-o-Way left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First quick comments

@@ -9,6 +9,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library
{
public class PowerAccentProperties
{
public static readonly HotkeySettings DefaultHotkeyValue = new HotkeySettings(true, false, false, false, 0x2D);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this translate to keys?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think we're missing a comment here to understand the defaults.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is clear by the name of it, seeing it from my end ofc.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, what I meant was: which keys are this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes 😅, it is (Win + INS)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mahfoudh94 , can you please add some code comments to avoid having magic numbers like this that are not understood? Thank you!

<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard x:Uid="QuickAccent_Enable_Hotkey" HeaderIcon="{ui:FontIcon Glyph=&#xEDA7;}">
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.Hotkey, Mode=TwoWay}" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Path= is unneeded :⁠-⁠)

Copy link
Author

@Mahfoudh94 Mahfoudh94 Feb 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you say so, let's get rid of it, it doesn't violate the guidelines anyway XD

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mahfoudh94 , can you please address this feedback? Thank you!

Copy link
Collaborator

@jaimecbernardo jaimecbernardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening the PR and cleaning it up. 😄
I've done a code review now. Can you please address the issues?

@@ -47,4 +47,7 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Natvis Include="$(MSBuildThisFileDirectory)..\..\natvis\wil.natvis" />
</ItemGroup>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this file being added?

<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(CoreLibraryDependencies);%(AdditionalDependencies);winmm.lib</AdditionalDependencies>
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">winmm.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">winmm.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't all these lines be merged into one?

if (m_enabled)
{
disable();
PlaySound(TEXT("Media\\Windows Notify Messaging.wav"), NULL, SND_FILENAME | SND_ASYNC);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it doesn't make sense to have the runner process play a sound.
Although I see that it can't likely be the QuickAccent process because it would need to play while exiting...
Can we turn this into a setting that's turned off by default? Always on top also has this as a setting, for example.

m_hotkey.alt = false;
m_hotkey.shift = false;
m_hotkey.ctrl = false;
m_hotkey.key = 0x2D;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a comment here for what 0x2D means as well.

PowerToys.sln Outdated
@@ -577,7 +577,6 @@ Global
{9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Debug|ARM64.ActiveCfg = Debug|ARM64
{9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Debug|ARM64.Build.0 = Debug|ARM64
{9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Debug|x64.ActiveCfg = Debug|x64
{9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Debug|x64.Build.0 = Debug|x64
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PowerToys.sln has lots of lines removed. I don't see a reason for this. Can you please fix it?

@jaimecbernardo jaimecbernardo added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Mar 12, 2024
@htcfreek htcfreek added Needs-Team-Response An issue author responded so the team needs to follow up Needs-Review This Pull Request awaits the review of a maintainer. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Sep 23, 2024
@htcfreek
Copy link
Collaborator

@jaimecbernardo
Please check if all review comments are fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Review This Pull Request awaits the review of a maintainer. Needs-Team-Response An issue author responded so the team needs to follow up
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants