DRM/KMS + libinput backend and a Moon Plasma login session
compositor/kms: libseat (device access, VT switching), DRM dumb buffers with page flips and a hardware cursor, libinput keyboard/pointer, xkbcommon keymap and modifiers. --drm runs the compositor on the real display at the monitor's native mode. session/ holds the display-manager entry, launcher script and installer (just install-session). Untested on hardware: refuses to start inside another session. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7a37039673
commit
b2557aca52
9 files changed
+829
-2
No files matched your search
+55
-2
@@ -7,8 +7,9 @@ fn main {
|
||||
let mut theme_path = "config/themes/moon-night.json"
|
||||
let mut gfx_out = ""
|
||||
let mut windowed = false
|
||||
let width = 1280
|
||||
let height = 720
|
||||
let mut drm = false
|
||||
let mut width = 1280
|
||||
let mut height = 720
|
||||
|
||||
let mut i = 1
|
||||
while i < args.length() {
|
||||
@@ -22,6 +23,9 @@ fn main {
|
||||
} else if a == "--window" {
|
||||
windowed = true
|
||||
i = i + 1
|
||||
} else if a == "--drm" {
|
||||
drm = true
|
||||
i = i + 1
|
||||
} else if a == "--gfx-out" && i + 1 < args.length() {
|
||||
gfx_out = args[i + 1]
|
||||
i = i + 2
|
||||
@@ -41,6 +45,24 @@ fn main {
|
||||
@scene.ThemeTokens::moon_night()
|
||||
}
|
||||
|
||||
// Login-session mode: take over the display via DRM/KMS + libinput, and size
|
||||
// the desktop to the monitor's native mode.
|
||||
let kms = if drm {
|
||||
match @kms.Kms::open() {
|
||||
Some(k) => {
|
||||
width = k.width
|
||||
height = k.height
|
||||
Some(k)
|
||||
}
|
||||
None => {
|
||||
println("failed to start the DRM backend (run from a login VT, not inside another session)")
|
||||
return
|
||||
}
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
let gfx_surface = @gfx.Surface::new({
|
||||
width: Some(width),
|
||||
height: Some(height),
|
||||
@@ -77,9 +99,31 @@ fn main {
|
||||
} else {
|
||||
None
|
||||
}
|
||||
match kms {
|
||||
Some(k) => comp.server.set_keymap(k.keymap)
|
||||
None => ()
|
||||
}
|
||||
println("moon-plasma compositor listening on " + socket_path + " (wasi-gfx surface active)")
|
||||
while true {
|
||||
comp.step()
|
||||
match kms {
|
||||
Some(k) => {
|
||||
if !k.poll() {
|
||||
break
|
||||
}
|
||||
let now_ms = @env.now().to_uint()
|
||||
for ev in k.take_input() {
|
||||
comp.handle_input(ev, now_ms)
|
||||
}
|
||||
k.set_cursor_shape(comp.desired_cursor())
|
||||
if k.frame_ready() {
|
||||
k.present(comp.present_to_gfx(gfx_ctx))
|
||||
}
|
||||
@sys.sleep_ms(8)
|
||||
continue
|
||||
}
|
||||
None => ()
|
||||
}
|
||||
match nested {
|
||||
Some(n) => {
|
||||
if !n.poll() {
|
||||
@@ -104,8 +148,17 @@ fn main {
|
||||
}
|
||||
@sys.sleep_ms(16)
|
||||
}
|
||||
match kms {
|
||||
Some(k) => k.close()
|
||||
None => ()
|
||||
}
|
||||
comp.close()
|
||||
}
|
||||
None => {
|
||||
match kms {
|
||||
Some(k) => k.close()
|
||||
None => ()
|
||||
}
|
||||
println("failed to bind Wayland socket at " + socket_path)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user