Skip to content

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

feat: instantiate a Monitor instance for each of user's screens

Larsbee242e01685
diff --git a/LarsWM/LarsWM.csproj b/LarsWM/LarsWM.csproj
index 7d6c6af6..78747b2f 100644
--- a/LarsWM/LarsWM.csproj
+++ b/LarsWM/LarsWM.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
- <OutputType>Exe</OutputType>
+ <OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon />
diff --git a/LarsWM/Program.cs b/LarsWM/Program.cs
index 97a35dc0..d57ebfec 100644
--- a/LarsWM/Program.cs
+++ b/LarsWM/Program.cs
@@ -13,7 +13,11 @@ namespace LarsWM
[STAThread]
static void Main()
{
- Application.Run();
+ Debug.WriteLine("Application started");
+
+ //Application.Run();
+
+ new WindowManager();
// TODO: Create a workspace and assign a workspace to each connected display
}
}
diff --git a/LarsWM/WindowManager.cs b/LarsWM/WindowManager.cs
index 998d88c2..43f777f9 100644
--- a/LarsWM/WindowManager.cs
+++ b/LarsWM/WindowManager.cs
@@ -1,32 +1,60 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace LarsWM
-{
- enum FocusDirection
- {
- Up,
- Down,
- Left,
- Right,
- }
-
- class WindowManager
- {
-
- public void ShiftFocusInDirection(FocusDirection direction)
- { }
-
- public void ShiftFocusToWorkspace(Workspace workspace)
- { }
-
- public void MoveFocusedWindowToWorkspace(Window window, Workspace workspace)
- { }
-
- public void MoveFocusedWindowInDirection(Window window, FocusDirection direction)
- { }
-
- }
-}
-
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Text;
+using System.Windows.Forms;
+
+namespace LarsWM
+{
+ enum FocusDirection
+ {
+ Up,
+ Down,
+ Left,
+ Right,
+ }
+
+ class Window { }
+ class Workspace { }
+
+ class WindowManager
+ {
+ private Monitor[] _monitors;
+
+ public WindowManager()
+ {
+ var screens = Screen.AllScreens;
+ _monitors = new Monitor[screens.Length];
+
+ _monitors[0] = new Monitor(0, Screen.PrimaryScreen);
+
+ var index = 1;
+ foreach (var screen in screens)
+ {
+ if (!screen.Primary)
+ {
+ _monitors[index] = new Monitor(index, screen);
+ index++;
+ }
+ }
+
+ var focusedMonitor = _monitors[0];
+ }
+
+ public int NumMonitors => _monitors.Length;
+
+ public void ShiftFocusInDirection(FocusDirection direction)
+ { }
+
+ public void ShiftFocusToWorkspace(Workspace workspace)
+ { }
+
+ public void MoveFocusedWindowToWorkspace(Window window, Workspace workspace)
+ { }
+
+ public void MoveFocusedWindowInDirection(Window window, FocusDirection direction)
+ { }
+
+ }
+}
+