Fix issue for GIO - Fs widget not working (#564)

* Fix issue for GIO

* support both versions
This commit is contained in:
Madhur Ahuja 2026-07-13 22:50:49 +05:30 committed by GitHub
parent 88f5a8abd2
commit 9f350d95a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,6 +9,7 @@
local helpers = require("lain.helpers")
local Gio = require("lgi").Gio
local GioUnix = require("lgi").GioUnix
local focused = require("awful.screen").focused
local wibox = require("wibox")
local naughty = require("naughty")
@ -76,8 +77,19 @@ local function factory(args)
fs_now = {}
local notifypaths = {}
for _, mount in ipairs(Gio.unix_mounts_get()) do
local path = Gio.unix_mount_get_mount_path(mount)
local mounts_get
local mount_get_mount_path
pcall(function()
mounts_get = GioUnix.mounts_get
mount_get_mount_path = GioUnix.mount_get_mount_path
end)
if not mounts_get then
mounts_get = Gio.unix_mounts_get
mount_get_mount_path = Gio.unix_mount_get_mount_path
end
for _, mount in ipairs(mounts_get()) do
local path = mount_get_mount_path(mount)
local root = Gio.File.new_for_path(path)
local info = root:query_filesystem_info(query)