diff --git a/helpers/icon_theme.lua b/helpers/icon_theme.lua index cdad7b9..0b1d35a 100644 --- a/helpers/icon_theme.lua +++ b/helpers/icon_theme.lua @@ -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