diff options
| author | kkard2 <[email protected]> | 2025-05-09 21:22:47 +0200 |
|---|---|---|
| committer | kkard2 <[email protected]> | 2025-05-09 21:22:47 +0200 |
| commit | bcf6736d46437a8f310fdb786e2ac632ec632dc6 (patch) | |
| tree | 0e870bbb05d667fd038fd7b3c8dd21d2d4baddd2 /_windows/VirtualDesktopSwitcher/Program.cs | |
| parent | a21dc107c9bcf20d18ab13c96df7f0f92e5f750f (diff) | |
i didn't finish
Diffstat (limited to '_windows/VirtualDesktopSwitcher/Program.cs')
| -rw-r--r-- | _windows/VirtualDesktopSwitcher/Program.cs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/_windows/VirtualDesktopSwitcher/Program.cs b/_windows/VirtualDesktopSwitcher/Program.cs new file mode 100644 index 0000000..eba2e44 --- /dev/null +++ b/_windows/VirtualDesktopSwitcher/Program.cs @@ -0,0 +1,43 @@ +using System.Runtime.InteropServices; +using WindowsDesktop; + + + +class Program +{ + [DllImport("user32.dll")] private static extern IntPtr GetForegroundWindow(); + + private static int RealIndex(int index) + { + if (index == 0) + return 9; + + return index - 1; + } + + [STAThread] + public static int Main(string[] args) + { + if (args[0] == "prepare") + { + while (VirtualDesktop.GetDesktops().Length < 10) + VirtualDesktop.Create(); + return 0; + } + if (args[0] == "switch") + { + var desktops = VirtualDesktop.GetDesktops(); + desktops[RealIndex(int.Parse(args[1]))].Switch(); + return 0; + } + if (args[0] == "move") + { + var desktops = VirtualDesktop.GetDesktops(); + var targetDesktop = desktops[RealIndex(int.Parse(args[1]))]; + VirtualDesktop.MoveToDesktop(GetForegroundWindow(), targetDesktop); + } + + return 1; + } +} + |
