summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkkard2 <[email protected]>2025-05-09 21:22:47 +0200
committerkkard2 <[email protected]>2025-05-09 21:22:47 +0200
commitbcf6736d46437a8f310fdb786e2ac632ec632dc6 (patch)
tree0e870bbb05d667fd038fd7b3c8dd21d2d4baddd2
parenta21dc107c9bcf20d18ab13c96df7f0f92e5f750f (diff)
i didn't finish
-rw-r--r--_windows/README.md3
-rw-r--r--_windows/VirtualDesktopSwitcher/.gitignore2
-rw-r--r--_windows/VirtualDesktopSwitcher/Program.cs43
-rw-r--r--_windows/VirtualDesktopSwitcher/VirtualDesktopSwitcher.csproj16
-rw-r--r--_windows/startup.ps13
5 files changed, 66 insertions, 1 deletions
diff --git a/_windows/README.md b/_windows/README.md
index 391b886..db0c130 100644
--- a/_windows/README.md
+++ b/_windows/README.md
@@ -1,2 +1,5 @@
+# prepare
+* build VirtualDesktopSwitcher and move to path or sth
+
# running
* `./startup.ps1` on startup (via task scheduler is optimal)
diff --git a/_windows/VirtualDesktopSwitcher/.gitignore b/_windows/VirtualDesktopSwitcher/.gitignore
new file mode 100644
index 0000000..cd42ee3
--- /dev/null
+++ b/_windows/VirtualDesktopSwitcher/.gitignore
@@ -0,0 +1,2 @@
+bin/
+obj/
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;
+ }
+}
+
diff --git a/_windows/VirtualDesktopSwitcher/VirtualDesktopSwitcher.csproj b/_windows/VirtualDesktopSwitcher/VirtualDesktopSwitcher.csproj
new file mode 100644
index 0000000..b9d3539
--- /dev/null
+++ b/_windows/VirtualDesktopSwitcher/VirtualDesktopSwitcher.csproj
@@ -0,0 +1,16 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>net9.0-windows10.0.19041.0</TargetFramework>
+ <PublishSingleFile>true</PublishSingleFile>
+ <SelfContained>true</SelfContained>
+ <ImplicitUsings>enable</ImplicitUsings>
+ <Nullable>enable</Nullable>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="VirtualDesktop" Version="5.0.5" />
+ </ItemGroup>
+
+</Project>
diff --git a/_windows/startup.ps1 b/_windows/startup.ps1
index 7c8d4f4..a561fa9 100644
--- a/_windows/startup.ps1
+++ b/_windows/startup.ps1
@@ -1,3 +1,4 @@
Push-Location $PSScriptRoot
-.\ahk\run.ps1
+#.\ahk\run.ps1
+kanata --cfg ../kanata/kanata.kbd
Pop-Location