This can error out

This commit is contained in:
Ksaper 2023-02-14 03:40:16 +02:00
parent 680fbb06ac
commit 4445f0b0fb
1 changed files with 10 additions and 11 deletions

View File

@ -1,7 +1,3 @@
-------------------------------------------
-- @author https://github.com/Kasper24
-- @copyright 2021-2022 Kasper24
-------------------------------------------
local lgi = require("lgi")
local Gio = lgi.Gio
local DesktopAppInfo = Gio.DesktopAppInfo
@ -77,13 +73,16 @@ function _icon_theme.get_icon_path(icon_name, icon_theme, icon_size)
end
function _icon_theme.get_client_icon_path(client, icon_theme, icon_size)
local desktop_app_info_filename = DesktopAppInfo.search(client.class)[1][1]
if desktop_app_info_filename then
local desktop_app_info = DesktopAppInfo.new(desktop_app_info_filename)
if desktop_app_info then
local icon_name = desktop_app_info:get_string("Icon")
if icon_name then
return _icon_theme.get_icon_path(icon_name, icon_theme, icon_size)
local desktop_app_info_filename_arr = DesktopAppInfo.search(client.class)[1]
if desktop_app_info_filename_arr then
local desktop_app_info_filename = desktop_app_info_filename_arr[1]
if desktop_app_info_filename then
local desktop_app_info = DesktopAppInfo.new(desktop_app_info_filename)
if desktop_app_info then
local icon_name = desktop_app_info:get_string("Icon")
if icon_name then
return _icon_theme.get_icon_path(icon_name, icon_theme, icon_size)
end
end
end
end