File size: 11,591 Bytes
76d666a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
'''Tables reused from laptop-agent (B) plus union extensions. Edit here to add apps / sites / folders / services.'''

WIN_AUDIO = r'''Add-Type -TypeDefinition @"
using System.Runtime.InteropServices;
[Guid("5CDF2C82-841E-4546-9722-0CF74078229A"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IAudioEndpointVolume { int f(); int g(); int h(); int i();
 int SetMasterVolumeLevelScalar(float fLevel, System.Guid pguidEventContext); int j();
 int GetMasterVolumeLevelScalar(out float pfLevel); int k(); int l(); int m(); int n();
 int SetMute([MarshalAs(UnmanagedType.Bool)] bool bMute, System.Guid pguidEventContext); int GetMute(out bool pbMute); }
[Guid("D666063F-1587-4E43-81F1-B948E807363F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IMMDevice { int Activate(ref System.Guid id, int clsCtx, int activationParams, out IAudioEndpointVolume aev); }
[Guid("A95664D2-9614-4F35-A746-DE8DB63617E6"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IMMDeviceEnumerator { int f(); int GetDefaultAudioEndpoint(int dataFlow, int role, out IMMDevice endpoint); }
[ComImport, Guid("BCDE0395-E52F-467C-8E3D-C4579291692E")] class MMDeviceEnumeratorComObject { }
public class Audio {
 static IAudioEndpointVolume Vol() { var enumerator = new MMDeviceEnumeratorComObject() as IMMDeviceEnumerator;
  IMMDevice dev = null; Marshal.ThrowExceptionForHR(enumerator.GetDefaultAudioEndpoint(0, 1, out dev));
  IAudioEndpointVolume epv = null; var epvid = typeof(IAudioEndpointVolume).GUID;
  Marshal.ThrowExceptionForHR(dev.Activate(ref epvid, 23, 0, out epv)); return epv; }
 public static float Volume { get { float v = -1; Marshal.ThrowExceptionForHR(Vol().GetMasterVolumeLevelScalar(out v)); return v; }
  set { Marshal.ThrowExceptionForHR(Vol().SetMasterVolumeLevelScalar(value, System.Guid.Empty)); } }
 public static bool Mute { get { bool m = false; Marshal.ThrowExceptionForHR(Vol().GetMute(out m)); return m; }
  set { Marshal.ThrowExceptionForHR(Vol().SetMute(value, System.Guid.Empty)); } }
}
"@; '''

WIN_KEYS = r'''Add-Type -TypeDefinition @"
using System; using System.Runtime.InteropServices;
public class K { [DllImport("user32.dll")] public static extern void keybd_event(byte vk, byte scan, int flags, int extra);
 public static void Press(byte[] vks){ foreach(var v in vks) keybd_event(v,0,0,0); Array.Reverse(vks); foreach(var v in vks) keybd_event(v,0,2,0);} }
"@; '''

WIN_BT = r'''Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTask = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
Function Await($t, $rt) { $n = $asTask.MakeGenericMethod($rt).Invoke($null, @($t)); $n.Wait(-1) | Out-Null; $n.Result }
[Windows.Devices.Radios.Radio,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
[Windows.Devices.Radios.RadioAccessStatus,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
Await ([Windows.Devices.Radios.Radio]::RequestAccessAsync()) ([Windows.Devices.Radios.RadioAccessStatus]) | Out-Null
$radios = Await ([Windows.Devices.Radios.Radio]::GetRadiosAsync()) ([System.Collections.Generic.IReadOnlyList[Windows.Devices.Radios.Radio]])
$bt = $radios | ? { $_.Kind -eq 'Bluetooth' }
[Windows.Devices.Radios.RadioState,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
Await ($bt.SetStateAsync('STATE')) ([Windows.Devices.Radios.RadioAccessStatus]) | Out-Null'''

WIN_SCREENSHOT = r'''Add-Type -AssemblyName System.Windows.Forms,System.Drawing;
$b=[System.Windows.Forms.SystemInformation]::VirtualScreen; $bmp=New-Object System.Drawing.Bitmap $b.Width,$b.Height;
$g=[System.Drawing.Graphics]::FromImage($bmp); $g.CopyFromScreen($b.Left,$b.Top,0,0,$bmp.Size);
$p="$env:USERPROFILE\Pictures\screenshot_$(Get-Date -f yyyyMMdd_HHmmss).png"; $bmp.Save($p); "saved $p"'''

VK = {"ctrl": 0x11, "alt": 0x12, "shift": 0x10, "win": 0x5B, "tab": 0x09, "f4": 0x73, "f5": 0x74, "up": 0x26, "down": 0x28,
      "left": 0x25, "right": 0x27, "plus": 0xBB, "minus": 0xBD, "0": 0x30, "a": 0x41, "c": 0x43, "d": 0x44, "s": 0x53,
      "t": 0x54, "v": 0x56, "w": 0x57, "x": 0x58, "y": 0x59, "z": 0x5A, "media_play_pause": 0xB3, "media_next": 0xB0,
      "media_prev": 0xB1, "vol_up": 0xAF, "vol_down": 0xAE, "vol_mute": 0xAD}

XDO = {"ctrl": "ctrl", "alt": "alt", "shift": "shift", "super": "super", "win": "super", "tab": "Tab", "f4": "F4", "f5": "F5",
       "up": "Up", "down": "Down", "left": "Left", "right": "Right", "plus": "plus", "minus": "minus", "h": "h", "d": "d"}

WIN_PROC = {"chrome": "chrome.exe", "firefox": "firefox.exe", "edge": "msedge.exe", "notepad": "notepad.exe",
            "calculator": "CalculatorApp.exe", "paint": "mspaint.exe", "word": "WINWORD.EXE", "excel": "EXCEL.EXE",
            "powerpoint": "POWERPNT.EXE", "outlook": "OUTLOOK.EXE", "teams": "ms-teams.exe", "vscode": "Code.exe",
            "terminal": "WindowsTerminal.exe", "cmd": "cmd.exe", "powershell": "powershell.exe", "file_explorer": None,
            "task_manager": "Taskmgr.exe", "control_panel": None, "spotify": "Spotify.exe", "vlc": "vlc.exe",
            "media_player": "wmplayer.exe", "whatsapp": "WhatsApp.exe", "telegram": "Telegram.exe", "zoom": "Zoom.exe",
            "discord": "Discord.exe", "slack": "slack.exe", "camera": "WindowsCamera.exe", "photos": "Photos.exe",
            "calendar": "HxOutlook.exe", "clock": "Time.exe", "snipping_tool": "SnippingTool.exe", "store": "WinStore.App.exe",
            "obs": "obs64.exe", "steam": "steam.exe", "onenote": "ONENOTE.EXE", "sticky_notes": "Microsoft.Notes.exe"}

PI_PROC = {"chrome": "chromium", "chromium": "chromium", "firefox": "firefox", "notepad": "mousepad", "calculator": "galculator",
           "word": "soffice", "excel": "soffice", "powerpoint": "soffice", "vscode": "code", "terminal": "lxterminal",
           "cmd": "lxterminal", "file_explorer": "pcmanfm", "task_manager": "lxtask", "vlc": "vlc", "media_player": "vlc",
           "telegram": "telegram-desktop", "camera": "rpicam-hello", "photos": "gpicview", "obs": "obs", "thonny": "thonny"}

APPS = {
"chrome": {
"win": "start chrome",
"pi": "chromium-browser &"
},
"firefox": {
"win": "start firefox",
"pi": "firefox &"
},
"edge": {
"win": "start msedge",
"pi": None
},
"chromium": {
"win": None,
"pi": "chromium-browser &"
},
"notepad": {
"win": "notepad",
"pi": "mousepad &"
},
"calculator": {
"win": "calc",
"pi": "galculator &"
},
"paint": {
"win": "start mspaint",
"pi": None
},
"word": {
"win": "start winword",
"pi": "libreoffice --writer &"
},
"excel": {
"win": "start excel",
"pi": "libreoffice --calc &"
},
"powerpoint": {
"win": "start powerpnt",
"pi": "libreoffice --impress &"
},
"outlook": {
"win": "start outlook",
"pi": None
},
"teams": {
"win": "start msteams:",
"pi": None
},
"vscode": {
"win": "code",
"pi": "code &"
},
"terminal": {
"win": "start wt || start cmd",
"pi": "x-terminal-emulator &"
},
"cmd": {
"win": "start cmd",
"pi": "lxterminal &"
},
"powershell": {
"win": "start powershell",
"pi": None
},
"file_explorer": {
"win": "explorer.exe",
"pi": "xdg-open ~ &"
},
"task_manager": {
"win": "taskmgr",
"pi": "x-terminal-emulator -e htop &"
},
"control_panel": {
"win": "start control",
"pi": None
},
"spotify": {
"win": "start spotify:",
"pi": None
},
"vlc": {
"win": "start vlc",
"pi": "vlc &"
},
"media_player": {
"win": "start wmplayer",
"pi": "vlc &"
},
"whatsapp": {
"win": "start whatsapp:",
"pi": None
},
"telegram": {
"win": "start tg:",
"pi": "telegram-desktop &"
},
"zoom": {
"win": "start zoommtg:",
"pi": None
},
"discord": {
"win": "start discord:",
"pi": None
},
"slack": {
"win": "start slack:",
"pi": None
},
"camera": {
"win": "start microsoft.windows.camera:",
"pi": "rpicam-hello -t 0 &"
},
"photos": {
"win": "start ms-photos:",
"pi": "gpicview &"
},
"calendar": {
"win": "start outlookcal:",
"pi": None
},
"clock": {
"win": "start ms-clock:",
"pi": None
},
"snipping_tool": {
"win": "start ms-screenclip:",
"pi": None
},
"store": {
"win": "start ms-windows-store:",
"pi": None
},
"obs": {
"win": "start obs64",
"pi": "obs &"
},
"steam": {
"win": "start steam:",
"pi": None
},
"onenote": {
"win": "start onenote:",
"pi": None
},
"thonny": {
"win": None,
"pi": "thonny &"
},
"sticky_notes": {
"win": "start ms-stickynotes:",
"pi": None
},
"browser": {
"win": "start msedge",
"pi": "chromium-browser &"
},
"disk_management": {
"win": "diskmgmt.msc",
"pi": "gparted &"
},
"signal": {
"win": "start signal://",
"pi": "signal-desktop &"
},
"sms": {
"win": None,
"pi": None
}
}

SITES = {
"youtube": "https://www.youtube.com",
"google": "https://www.google.com",
"gmail": "https://mail.google.com",
"facebook": "https://www.facebook.com",
"instagram": "https://www.instagram.com",
"twitter": "https://x.com",
"linkedin": "https://www.linkedin.com",
"github": "https://github.com",
"wikipedia": "https://www.wikipedia.org",
"amazon": "https://www.amazon.in",
"flipkart": "https://www.flipkart.com",
"netflix": "https://www.netflix.com",
"hotstar": "https://www.hotstar.com",
"chatgpt": "https://chatgpt.com",
"claude": "https://claude.ai",
"whatsapp_web": "https://web.whatsapp.com",
"stackoverflow": "https://stackoverflow.com",
"google_maps": "https://maps.google.com",
"google_drive": "https://drive.google.com",
"irctc": "https://www.irctc.co.in"
}

FOLDERS = {
"downloads": {
"win": "$env:USERPROFILE\\Downloads",
"pi": "~/Downloads"
},
"documents": {
"win": "$env:USERPROFILE\\Documents",
"pi": "~/Documents"
},
"desktop": {
"win": "$env:USERPROFILE\\Desktop",
"pi": "~/Desktop"
},
"pictures": {
"win": "$env:USERPROFILE\\Pictures",
"pi": "~/Pictures"
},
"music": {
"win": "$env:USERPROFILE\\Music",
"pi": "~/Music"
},
"videos": {
"win": "$env:USERPROFILE\\Videos",
"pi": "~/Videos"
},
"home": {
"win": "$env:USERPROFILE",
"pi": "~"
},
"c_drive": {
"win": "C:\\",
"pi": "/"
},
"d_drive": {
"win": "D:\\",
"pi": "/mnt"
}
}

SETTINGS_PAGES = {
"display": "ms-settings:display",
"sound": "ms-settings:sound",
"bluetooth": "ms-settings:bluetooth",
"wifi": "ms-settings:network-wifi",
"network": "ms-settings:network",
"battery": "ms-settings:batterysaver",
"power": "ms-settings:powersleep",
"update": "ms-settings:windowsupdate",
"apps": "ms-settings:appsfeatures",
"privacy": "ms-settings:privacy",
"notifications": "ms-settings:notifications",
"personalization": "ms-settings:personalization",
"date_time": "ms-settings:dateandtime",
"language": "ms-settings:regionlanguage",
"keyboard": "ms-settings:typing",
"mouse": "ms-settings:mousetouchpad",
"storage": "ms-settings:storagesense",
"accounts": "ms-settings:yourinfo",
"about": "ms-settings:about",
"default_apps": "ms-settings:defaultapps",
"printers": "ms-settings:printers"
}

SERVICE_UNITS = {"ssh": "ssh", "vnc": "vncserver-x11-serviced", "apache": "apache2", "nginx": "nginx", "docker": "docker", "bluetooth": "bluetooth", "cron": "cron", "mysql": "mariadb", "samba": "smbd", "mosquitto": "mosquitto", "nodered": "nodered", "pihole": "pihole-FTL", "spooler": "cups", "w32time": "systemd-timesyncd", "sshd": "ssh"}

WIN_SERVICES = {"spooler": "Spooler", "w32time": "W32Time", "ssh": "sshd", "docker": "com.docker.service", "mysql": "MySQL", "apache": "Apache2.4", "nginx": "nginx", "bluetooth": "bthserv", "cron": "Schedule", "vnc": "tvnserver", "samba": "LanmanServer", "mosquitto": "mosquitto", "nodered": "nodered", "pihole": "pihole"}

DISPLAY_MODES = {"pc_only": "DisplaySwitch.exe /internal", "duplicate": "DisplaySwitch.exe /clone", "extend": "DisplaySwitch.exe /extend", "second_only": "DisplaySwitch.exe /external"}