mirror of
https://github.com/chylex/Query.git
synced 2025-04-28 00:15:42 +02:00
Remove Windows Control Panel launcher
This commit is contained in:
parent
54200a9304
commit
12c5418443
AppWindows
@ -6,8 +6,7 @@ namespace AppSys;
|
||||
|
||||
public sealed class App : IApp {
|
||||
private static readonly IHandler[] Handlers = [
|
||||
new HandlerProcesses(),
|
||||
new HandlerApps()
|
||||
new HandlerProcesses()
|
||||
];
|
||||
|
||||
public string[] RecognizedNames => [
|
||||
|
@ -1,59 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using Base;
|
||||
|
||||
namespace AppSys.Handlers;
|
||||
|
||||
sealed class HandlerApps : IHandler {
|
||||
private static readonly string PathSystem = Environment.GetFolderPath(Environment.SpecialFolder.System);
|
||||
|
||||
private static readonly Dictionary<string, ProcessStartInfo> Mappings = new () {
|
||||
{
|
||||
"audio", new ProcessStartInfo {
|
||||
FileName = Path.Combine(PathSystem, "control.exe"),
|
||||
Arguments = "mmsys.cpl"
|
||||
}
|
||||
}, {
|
||||
"programs", new ProcessStartInfo {
|
||||
FileName = Path.Combine(PathSystem, "control.exe"),
|
||||
Arguments = "appwiz.cpl"
|
||||
}
|
||||
}, {
|
||||
"system", new ProcessStartInfo {
|
||||
FileName = Path.Combine(PathSystem, "control.exe"),
|
||||
Arguments = "sysdm.cpl"
|
||||
}
|
||||
}, {
|
||||
"environment", new ProcessStartInfo {
|
||||
FileName = Path.Combine(PathSystem, "rundll32.exe"),
|
||||
Arguments = "sysdm.cpl,EditEnvironmentVariables"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private static readonly Dictionary<string, string> Substitutions = new () {
|
||||
{ "sounds", "audio" },
|
||||
{ "apps", "programs" },
|
||||
{ "appwiz", "programs" },
|
||||
{ "env", "environment" },
|
||||
{ "envvars", "environment" },
|
||||
{ "vars", "environment" },
|
||||
{ "variables", "environment" }
|
||||
};
|
||||
|
||||
public bool Matches(Command cmd) {
|
||||
return Mappings.ContainsKey(cmd.Text) || Substitutions.ContainsKey(cmd.Text);
|
||||
}
|
||||
|
||||
public string? Handle(Command cmd) {
|
||||
if (!Substitutions.TryGetValue(cmd.Text, out string? key)) {
|
||||
key = cmd.Text;
|
||||
}
|
||||
|
||||
using (Process.Start(Mappings[key])) {}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user