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

[PT Run] Sys Plugin Port from Wox.Plugins.Sys #8062

Conversation

benjamhooper
Copy link

@benjamhooper benjamhooper commented Nov 16, 2020

Summary of the Pull Request

Ability to Execute System/OS Commands

PR Checklist

Info on Pull Request

Direct Port from Wox.Plugins.Sys

Ability to use OS Commands:

  • Shutdown
  • Sleep
  • Lock
  • Sign out
  • Restart
  • Hibernate
  • Empty Recycle Bin

2020-11-16_00-03-05

Validation Steps Performed

  • Created Unit Tests and they are provided under Microsoft.Plugin.Sys.UnitTests
  • Manually Performed in Debug and Release

@github-actions
Copy link

New misspellings found, please review:

  • emptyrecyclebin
  • EWX
  • FORCEIFHUNG
  • hiberate
  • POWEROFF
  • Powrprof
To accept these changes, run the following commands
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"aae abkseg actionkeyword aeroglass alfredtheme APPDATA APPID appxpackage AProduct baf bakudies basedir bfa bretan BYCOMMAND calculatorpinyindb cbegin cend cheatsheet Combobox COUNTSLABELFMT ctx deletefilefolder Deserialized desktoppreviewhandler desktopshortcutinstalled dicts dirn dropdownstypekey dropdowntypekey DString Dvs EBF Ecma ecmascript ei eig eigval eigvec ENTIREITEMNAME evt excmd executionengine EXPLR ftp Fx fxml GETDESKWALLPAPER GWL gwoyeu hanyu hglobal hicon Highcontrast hmon hyjiacan IAlphabet IExclusive iexplore IInstant IME IMonitor IMulti Indexerpinyindb Inlining isborderless Italiano jsonrpc KBHOOK KBM KListener KSeparator lastpos launcherpinyin Launcherpinyindb lbl lbx Linux listbox LSHIFT MENUSTART nc NHotkey numberbox orphanedkey osdetection Pampalona pdk PERSISTEDDATA pimpl pinyindb Pipename Plist plistlib pls Pluginpinyindb Polski Portugu POWERTOYNAME Prepends PREVPANE progman Programpinyindb Progressbar reggedit remapkey remapkeyboard remapper remapshort Remoting reulst rgba rgn rk RPressed RStroked Rtc RWIN Scrollable scrollbar scrollviewer sessionending setings setwineventhook Shellpinyindb shortcutguide SHOWNA SHOWWINDOW Slovensk sni Srpski stefan strem stringstream subdir Subheader superfancyzones SYSKEYDOWN systemcolors Tcp temppath thr Tls tmpnam tohex transaprency TRANSPARENTGRADIENT TResult TZone uac uapmanifestschema uk Unsubscribe USERPROFILE VDId VGr VIRTUALDESKTOPCHANGE virtualized Virtualizing vkcode vstest Walkerpinyindb wangyiyun wca wcschr wcsrchr Webcam websearch wexfs winapi winlogo winr WINTAB WORKERW wsmatch wtmpnam Xecutor xyzpreviewhandler yinle yinyue yyy ZConfig "');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
  if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
  next if /^($re)(?:$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"Actionkeyword appdata appid combobox Ctx deserialized ebf emptyrecyclebin Entireitemname EWX explr FORCEIFHUNG fx gwl HGLOBAL hiberate HICON IEXPLORE ime kbm lshift pipename POWEROFF Powrprof prevpane Progman Remapper Rgn rwin scrollable showwindow Subdir syskeydown UAC unsubscribe userprofile Wca webcam WINAPI "');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a) cmp lc($b)} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;'
git add .github/actions/spell-check || echo '... you want to ensure .github/actions/spell-check/expect.txt is added to your repository...'

@enricogior
Copy link
Contributor

@benjamhooper
thank you for the PR!

PowerToys.sln Outdated Show resolved Hide resolved
@enricogior
Copy link
Contributor

@enricogior enricogior added the Run-Plugin Things that relate with PowerToys Run's plugin interface label Nov 16, 2020
@niels9001
Copy link
Contributor

@enricogior @BenjaminHooper - Yeah, let's stick to Segoe MDL2 Assets icons so we are consistent across all plug-ins and have a more native look and feel.

I'll create them and upload them here, so @BenjaminHooper can take those in.

@niels9001
Copy link
Contributor

@benjamhooper Here's a .zip with all the MDL2 icons, for both the dark and light theme:

Sys plugin icons.zip

Overview of the new icons:

sleep light
lock light
logoff light
recyclebin light
restart light
shutdown light

@htcfreek
Copy link
Collaborator

Idea for an enhancement
Allow timers in the commands to define a Shutdown in x seconds for example.

@benjamhooper
Copy link
Author

benjamhooper commented Nov 17, 2020

I've pushed the changes requested. Thanks for all the great feedback!

darktheme

lighttheme

@benjamhooper
Copy link
Author

Idea for an enhancement
Allow timers in the commands to define a Shutdown in x seconds for example.

@htcfreek I'll look into this more. Is there a feature already implemented in PT Run to allow you to confirm text? Example: I type shutdown (or any other command), hit enter. It Clears search and says, "Enter Time (Seconds) before Shutdown or press enter to immediately shutdown."

A second approach I was thinking of was adding ContextMenuResult(s) to commands(Shutdown and Sleep). With static time(s) 15s, 30s, 60s, etc..

@htcfreek
Copy link
Collaborator

htcfreek commented Nov 17, 2020

Idea for an enhancement
Allow timers in the commands to define a Shutdown in x seconds for example.

@htcfreek I'll look into this more. Is there a feature already implemented in PT Run to allow you to confirm text? Example: I type shutdown (or any other command), hit enter. It Clears search and says, "Enter Time (Seconds) before Shutdown or press enter to immediately shutdown."

A second approach I was thinking of was adding ContextMenuResult(s) to commands(Shutdown and Sleep). With static time(s) 15s, 30s, 60s, etc..

I would not use two steps method. I would use the parameter way like Shutdown -timer 30.

Context menu is only available with the buttons. It's by design/concept.

@github-actions
Copy link

New misspellings found, please review:

  • emptyrecyclebin
  • EWX
  • FORCEIFHUNG
  • POWEROFF
  • Powrprof
To accept these changes, run the following commands
perl -e '
my @expect_files=qw('".github/actions/spell-check/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"aae abkseg actionkeyword aeroglass alfredtheme APPDATA APPID appxpackage AProduct baf bakudies basedir bfa bretan BYCOMMAND calculatorpinyindb cbegin cend cheatsheet Combobox COUNTSLABELFMT ctx deletefilefolder Deserialized desktoppreviewhandler desktopshortcutinstalled dicts dirn dropdownstypekey dropdowntypekey DString Dvs EBF Ecma ecmascript ei eig eigval eigvec ENTIREITEMNAME evt excmd executionengine EXPLR ftp Fx fxml GETDESKWALLPAPER GWL gwoyeu hanyu hglobal hicon Highcontrast hmon hyjiacan IAlphabet IExclusive iexplore IInstant IME IMonitor IMulti Indexerpinyindb Inlining isborderless Italiano jsonrpc KBHOOK KBM KListener KSeparator lastpos launcherpinyin Launcherpinyindb lbl lbx Linux listbox LSHIFT MENUSTART nc NHotkey numberbox orphanedkey osdetection Pampalona pdk PERSISTEDDATA pimpl pinyindb Pipename Plist plistlib pls Pluginpinyindb Polski Portugu POWERTOYNAME Prepends PREVPANE progman Programpinyindb Progressbar reggedit remapkey remapkeyboard remapper remapshort Remoting reulst rgba rgn rk RPressed RStroked Rtc RWIN Scrollable scrollbar scrollviewer sessionending setings setwineventhook Shellpinyindb shortcutguide SHOWNA SHOWWINDOW Slovensk sni Srpski stefan strem stringstream subdir Subheader superfancyzones SYSKEYDOWN systemcolors Tcp temppath thr Tls tmpnam tohex transaprency TRANSPARENTGRADIENT TResult TZone uac uapmanifestschema uk Unsubscribe USERPROFILE VDId VGr VIRTUALDESKTOPCHANGE virtualized Virtualizing vkcode vstest Walkerpinyindb wangyiyun wca wcschr wcsrchr Webcam websearch wexfs winapi winlogo winr WINTAB WORKERW wsmatch wtmpnam Xecutor xyzpreviewhandler yinle yinyue yyy ZConfig "');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
  if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
  next if /^($re)(?:$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spell-check/expect.txt";
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"Actionkeyword appdata appid combobox Ctx deserialized ebf emptyrecyclebin Entireitemname EWX explr FORCEIFHUNG fx gwl HGLOBAL HICON IEXPLORE ime kbm lshift pipename POWEROFF Powrprof prevpane Progman Remapper Rgn rwin scrollable showwindow Subdir syskeydown UAC unsubscribe userprofile Wca webcam WINAPI "');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a) cmp lc($b)} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;'
git add .github/actions/spell-check || echo '... you want to ensure .github/actions/spell-check/expect.txt is added to your repository...'

@htcfreek
Copy link
Collaborator

Idea for an enhancement
Allow timers in the commands to define a Shutdown in x seconds for example.

@htcfreek I'll look into this more. Is there a feature already implemented in PT Run to allow you to confirm text? Example: I type shutdown (or any other command), hit enter. It Clears search and says, "Enter Time (Seconds) before Shutdown or press enter to immediately shutdown."

A second approach I was thinking of was adding ContextMenuResult(s) to commands(Shutdown and Sleep). With static time(s) 15s, 30s, 60s, etc..

I would not use two steps method. I would use the parameter way like Shutdown -timer 30.

Should be short and simple: -t 30.

Context menu is only available with the buttons. It's by design/concept.

Maybe we can add 4 buttons:

  • 15 sec : Initiates command director with 15 sec timer.
  • 30 sec : Initiates command director with 30 sec timer.
  • 60 sec : initiates command director with 60 sec timer.
  • custom : Changes input command text from Shutdown to Shutdown -t .

@enricogior
Copy link
Contributor

@benjamhooper
can you add the following terms to github\actions\spell-check\expect.txt? Thanks.

emptyrecyclebin
EWX
FORCEIFHUNG
POWEROFF
Powrprof

@benjamhooper
Copy link
Author

@enricogior Added 👍

Copy link
Contributor

@niels9001 niels9001 left a comment

Choose a reason for hiding this comment

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

Lgtm!

@benjamhooper
Copy link
Author

Did I do something wrong for the build to fail?

@enricogior
Copy link
Contributor

@benjamhooper
is a problem with our CI system, I restarted the build.

@crutkas
Copy link
Member

crutkas commented Nov 18, 2020

fixed the merge conflict, reviewing code now and will test locally

@@ -0,0 +1,12 @@
{
"ID":"CEA08895D2544B019B2E9C5009600DF4",
"ActionKeyword":"*",
Copy link
Member

Choose a reason for hiding this comment

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

would we want a direct action key for this? Example =2+2 is for calculator.

Copy link
Author

Choose a reason for hiding this comment

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

I could understand using \ ie. \shutdown, \restart, \hibernate. This could be utilized to expand this plugin.

src/modules/launcher/Plugins/Microsoft.Plugin.Sys/Main.cs Outdated Show resolved Hide resolved
@crutkas
Copy link
Member

crutkas commented Nov 18, 2020

looks like i oop'ed the sln. pushed a fix. once this works it is good to go.

@niels9001
Copy link
Contributor

@benjamhooper do you still need a plugin icon? Like the other plugins have as well?

If so, I'd go for the power button icon to represent the plugin itself and the actual action.

@crutkas
Copy link
Member

crutkas commented Nov 19, 2020

@niels9001, lets tweak the icons in diff PR.
@enricogior you good with merging this in?

@crutkas
Copy link
Member

crutkas commented Nov 19, 2020

@benjamhooper you good with where it is getting merged in?

@benjamhooper
Copy link
Author

I don't mean to review my own PR, but LGTM based on the reviews and fixes. I started a new issue for the UpdateIconPath as well.

@crutkas
Copy link
Member

crutkas commented Nov 20, 2020

@benjamhooper wanted to be sure you didn't have a "just one more thing" before we merged it in.

@enricogior
Copy link
Contributor

@crutkas @benjamhooper
has this been tested with the installer?
I don't see any file added to installer\PowerToysSetup\Product.wxs and .pipelines\pipeline.user.windows.yml

@crutkas
Copy link
Member

crutkas commented Nov 20, 2020

My thought was to do that outside this PR since that is much more something only our team can own.

i can check that in in a different PR

@crutkas
Copy link
Member

crutkas commented Nov 20, 2020

kind of want to get #8145 in first as well.

@htcfreek
Copy link
Collaborator

htcfreek commented Nov 23, 2020

Idea for an enhancement
Allow timers in the commands to define a Shutdown in x seconds for example.

@htcfreek I'll look into this more. Is there a feature already implemented in PT Run to allow you to confirm text? Example: I type shutdown (or any other command), hit enter. It Clears search and says, "Enter Time (Seconds) before Shutdown or press enter to immediately shutdown."

A second approach I was thinking of was adding ContextMenuResult(s) to commands(Shutdown and Sleep). With static time(s) 15s, 30s, 60s, etc..

I would not use two steps method. I would use the parameter way like Shutdown -timer 30.

Context menu is only available with the buttons. It's by design/concept.

@benjamhooper
Will you implement this or is this feature cancelled?
If you need an example how to implement this, you can look at the program plugin (@royvou implemented the parameter feature there.).

@benjamhooper
Copy link
Author

@htcfreek I can implement this feature, would you like me to open another PR/Issue?

@htcfreek
Copy link
Collaborator

htcfreek commented Nov 23, 2020

@htcfreek I can implement this feature, would you like me to open another PR/Issue?

Not sure if this is needed. I think no.
@crutkas, thoughts?

@crutkas
Copy link
Member

crutkas commented Nov 24, 2020

@enricogior, your call to have this in for .27

@enricogior
Copy link
Contributor

@crutkas
we locked stable yesterday. Only priority-0 will be merged, also this hasn't been tested enough.

@enricogior enricogior merged commit 9757a45 into microsoft:master Nov 26, 2020
@enricogior
Copy link
Contributor

@benjamhooper
thanks!

@benjamhooper benjamhooper deleted the user/benjamhooper/launcher-sys-plugin-port branch November 26, 2020 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Idea-Enhancement New feature or request on an existing product Product-PowerToys Run Improved app launch PT Run (Win+R) Window Run-Plugin Things that relate with PowerToys Run's plugin interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants