Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

feat: started experimenting with moving windows through windows api

Lars Berger93ed09e941d4
diff --git a/LarsWM/Program.cs b/LarsWM/Program.cs
index 71d7a8ad..2c355723 100644
--- a/LarsWM/Program.cs
+++ b/LarsWM/Program.cs
@@ -1,12 +1,43 @@
using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
namespace LarsWM
{
class Program
{
+
+ static int SW_MAXIMIZE = 3;
+
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
+ var a = GetForegroundWindow();
+ Console.WriteLine("aaaaa" + a);
+ MoveWindow(a, 40, 0, 500, 600, true);
+
+ foreach (Process proc in Process.GetProcesses())
+ {
+
+ Console.WriteLine(proc);
+ if (proc.MainWindowTitle.Contains("Spotify"))
+ {
+ ShowWindow(proc.MainWindowHandle, SW_MAXIMIZE);
+ SetFocus(proc.MainWindowHandle);
+ }
+ }
}
+
+ [DllImport("user32.dll")]
+ public static extern IntPtr GetForegroundWindow();
+
+ [DllImport("user32.dll")]
+ public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
+
+ [DllImport("user32.dll")]
+ public static extern bool SetFocus(IntPtr hWnd);
+
+ [DllImport("user32.dll")]
+ public static extern bool ShowWindow(IntPtr hWnd, int X);
}
}