end-4 / dots-hyprland

Modern, feature-rich and accessible desktop configuration.
https://end-4.github.io/dots-hyprland-wiki/en/
GNU General Public License v3.0
3.1k stars 201 forks source link

[Issue] Flatpack apps have no Icon #487

Closed myryk31415 closed 1 month ago

myryk31415 commented 1 month ago

Icons of flatpack apps dont show up, apps installed via the package manager work as expected. I copypasted some stuff from here into my dotfiles so I might just miss smth important, but if you have any immeadiate ideas what the issue could be any tips would be appreciated :)

end-4 commented 1 month ago

Flatpak apps have different window class names, something like org.kde.kolourpaint ...and this get really stupid with gnome apps because their class names have capitalization. My dotfiles actually makes one or two guesses by lowercasing and converting it to kebab case, but this method isn't perfect and might not successfully guess in all cases Maybe your icon pack doesn't support Flatpak apps well ¯\_(ツ)_/¯


Anyway, look at the topleft corner of the bar. the smaller text is the class name. Add icon substitutions to the userConfigOptions object in your ~/.config/ags/user_options.js like this:

    'icons': {
        substitutions: {
            'com.example.myappclass': "real-icon-name-in-your-pack",
        }
    },
myryk31415 commented 1 month ago

it was the icon theme, changed it from breeze to tokyo night now flatpak apps have icons as well :). Only thing still not working is steam apps but idk if steam provides icons that one could get?

Anyway thx a lot for ur help :)

end-4 commented 1 month ago

idk if steam provides icons that one could get?

pretty sure they get shown on gnome but idk how it's done but if you want those icons that much you can add a substitution for the game's window class (steamapp\) to the path of the icon, i think

myryk31415 commented 1 month ago

looking at the logs it tries to assign the icon "steam_app_964570" but it should be "steam_icon_964570". How can i check what i have to add in front? com.steam. ? then i could try to substitute it

end-4 commented 1 month ago

but it should be "steam_icon_964570"

you sure? i tried this and it doesn't work i can't find the icon for the game anywhere lol

end-4 commented 1 month ago

nvm, distrohopping moment yes it should work your user_options.js should look something like this

const userConfigOptions = {
    'icons': {
        substitutions: {
            'steam_app_964570': "steam_icon_964570",
        }
    },
}
export default userConfigOptions;
myryk31415 commented 1 month ago

nope Im not, I couldnt try it since Im not sure what im supposed the write instead of com.example.

I`m gonna check later wether I can find the exact place the icons are located

myryk31415 commented 1 month ago

ah just saw ur 2nd comment. Imma try later :)

myryk31415 commented 1 month ago

I added a check to the substitute function:

export function substitute(str) {
    if(userOptions.icons.substitutions[str]) return userOptions.icons.substitutions[str];
    if (str.search("steam_app") != -1) //checks for steam apps
    {
        let tmp = str.replace("app", "icon");
        if (iconExists(tmp)) return tmp;
                return "steam";
    }
    if (!iconExists(str)) str = str.toLowerCase().replace(/\s+/g, '-'); // Turn into kebab-case
    return str;
}

Alternatively you could probably check the .desktop file of the steam app which has the icon name in it so it might be more solid? on the other hand idk if the .desktop files are placed in different directories on other distros or if you use steam flatpak etc.

myryk31415 commented 1 month ago

Also it only works for the overview right now since neither the dock nor the volume center call the substitute function for the icon. Any reason for that?

myryk31415 commented 1 month ago

If u want I can try to include it there as well and then open a merge request

end-4 commented 1 month ago

even better, implemented regex replacements now if you update it should work out of the box

end-4 commented 1 month ago

also made sure dock uses those substitutions btw

myryk31415 commented 1 month ago

man ur awesome!!! Will update and test :) You mentioned the dock, what about the volume mixer? I`ll find out during testing ig.

end-4 commented 1 month ago

it isn't that simple for volume mixer ags gives the icon names for audio streams, and when it doesn't, we don't have the window class name on which we can base the icon guessing. i don't wanna implement a solution that checks the stream title since it's just stupid

myryk31415 commented 1 month ago

I played around with the mixer stream class and didn't find a way either :(

Did implement a fallback tho, so there is no missing icon symbol:

self.icon = stream.stream.name.toLowerCase();
    if (!iconExists(self.icon)) {
        self.icon = stream.stream.get_icon_name();
    }

In most cases it gives back somethink like generic_multimedia, getting the actual icon name would be too much to ask ig.

myryk31415 commented 1 month ago

thats in volumemixer.js:17

myryk31415 commented 1 month ago

while were at it, if there is no description of the stream it just says "audio stream #n". A check for that (at volumemixer.js:37):

self.label = `${stream.description}`;
if (self.label.search("audio stream #") != -1) {
    self.label = stream.name;
}
end-4 commented 1 month ago

while were at it, if there is no description of the stream it just says "audio stream #n". A check for that (at volumemixer.js:37):

self.label = `${stream.description}`;
if (self.label.search("audio stream #") != -1) {
    self.label = stream.name;
}

i don't get it. what are you trying to do? currently the text shows ${stream.stream.name} • ${stream.description}

myryk31415 commented 1 month ago

Ah my bad I was on an old version, upgrading is kinda annoying cause I modified some stuff to make it work on my distro

end-4 commented 1 month ago

Soooo you're happy? I'll close this