From 5ae48086fbc87cc7086e9da43bfc1e3407214e5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Sat, 17 May 2025 20:32:58 +0200
Subject: [PATCH 1/2] lib, tests: use GioUnix to use platform-specific Gio
 classes

In newest glib GioUnix symbols are not anymore exposed in GioUnix,
while lua-lgi should handle the change transparently, it's better to
adapt awesome to just use the right namespace.
---
 lib/awful/spawn.lua  |  5 +++--
 tests/_client.lua    | 11 ++++++-----
 tests/test-spawn.lua |  8 ++++----
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/lib/awful/spawn.lua b/lib/awful/spawn.lua
index 7d3e945087..8eb7847627 100644
--- a/lib/awful/spawn.lua
+++ b/lib/awful/spawn.lua
@@ -225,6 +225,7 @@ local capi =
 }
 local lgi = require("lgi")
 local Gio = lgi.Gio
+local GioUnix = lgi.GioUnix
 local GLib = lgi.GLib
 local util   = require("awful.util")
 local gtable = require("gears.table")
@@ -418,11 +419,11 @@ function spawn.with_line_callback(cmd, callbacks)
         end
     end
     if have_stdout then
-        spawn.read_lines(Gio.UnixInputStream.new(stdout, true),
+        spawn.read_lines(GioUnix.InputStream.new(stdout, true),
                 stdout_callback, step_done, true)
     end
     if have_stderr then
-        spawn.read_lines(Gio.UnixInputStream.new(stderr, true),
+        spawn.read_lines(GioUnix.InputStream.new(stderr, true),
                 stderr_callback, step_done, true)
     end
     assert(stdin == nil)
diff --git a/tests/_client.lua b/tests/_client.lua
index 3eb015f312..d45786bb28 100644
--- a/tests/_client.lua
+++ b/tests/_client.lua
@@ -6,8 +6,9 @@ local spawn = require("awful.spawn")
 local test_client_source = [[
 local lgi = require 'lgi'
 local Gdk = lgi.require('Gdk')
-local Gtk = lgi.require('Gtk')
+local Gtk = lgi.require('Gtk', '3.0')
 local Gio = lgi.require('Gio')
+local GioUnix  = lgi.require('GioUnix')
 Gtk.init()
 
 local function open_window(class, title, options)
@@ -68,7 +69,7 @@ end)
 coro()
 
 -- Read lines from stdin and feed them to the coroutine
-local stdin = Gio.UnixInputStream.new(0, false)
+local stdin = GioUnix.InputStream.new(0, false)
 stdin = Gio.DataInputStream.new(stdin)
 
 local read_start, read_finish
@@ -96,7 +97,7 @@ Gtk:main{...}
 ]]
 
 local lgi = require("lgi")
-local Gio = lgi.require("Gio")
+local GioUnix = lgi.require("GioUnix")
 
 local initialized = false
 local pipe
@@ -105,9 +106,9 @@ local function init()
     initialized = true
     local cmd = { "lua", "-e", test_client_source }
     local _, _, stdin, stdout, stderr = awesome.spawn(cmd, false, true, true, true)
-    pipe = Gio.UnixOutputStream.new(stdin, true)
-    stdout = Gio.UnixInputStream.new(stdout, true)
-    stderr = Gio.UnixInputStream.new(stderr, true)
+    pipe = GioUnix.OutputStream.new(stdin, true)
+    stdout = GioUnix.InputStream.new(stdout, true)
+    stderr = GioUnix.InputStream.new(stderr, true)
     spawn.read_lines(stdout, function(...) print("_client", ...) end)
     spawn.read_lines(stderr, function(...) print("_client", ...) end)
 end
diff --git a/tests/test-spawn.lua b/tests/test-spawn.lua
index dfc3cc5f8d..a24a94238a 100644
--- a/tests/test-spawn.lua
+++ b/tests/test-spawn.lua
@@ -105,7 +105,7 @@ local steps = {
             local pid, _, _, stdout = awesome.spawn({ "sh", "-c", "echo $AWESOME_SPAWN_TEST_VAR $HOME $USER" },
                     false, false, true, false, nil, { "AWESOME_SPAWN_TEST_VAR=42" })
             assert(type(pid) ~= "string", pid)
-            spawn.read_lines(require("lgi").Gio.UnixInputStream.new(stdout, true),
+            spawn.read_lines(require("lgi").GioUnix.InputStream.new(stdout, true),
                     function(line)
                         assert(not read_line)
                         read_line = true

From 80b7fa8262495e331da3c98a48adf94a5a806fef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Sat, 13 Sep 2025 02:13:01 +0200
Subject: [PATCH 2/2] awesomeConfig: Bump dependency on GLib 2.79.2

This is the version that provided GioUnix symbols, so we need to depend
on that
---
 awesomeConfig.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake
index 592c2b2526..b27baa456c 100644
--- a/awesomeConfig.cmake
+++ b/awesomeConfig.cmake
@@ -132,7 +132,7 @@ pkg_check_modules(AWESOME_COMMON_REQUIRED REQUIRED
 
 set(AWESOME_DEPENDENCIES
     glib-2.0
-    glib-2.0>=2.40
+    glib-2.0>=2.79.2
     gdk-pixbuf-2.0
     cairo
     x11
