Add Linux desktop icons according to XDG spec
Change X11 Window WM_CLASS to 'dosbox-staging' to avoid conflicts with upstream DOSBox, which might be provided by package manager. Update .desktop file to specify WMClass to be correlated with dosbox-staging process (even if executable file conflicts with dosbox upstream). Update contrib/icons/Makefile to generate 'hicolor' directory structure.
This commit is contained in:
parent
e5486f67cc
commit
a6da84d23e
4 changed files with 39 additions and 0 deletions
1
contrib/icons/.gitignore
vendored
1
contrib/icons/.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
dosbox-staging.iconset
|
||||
icon_*.png
|
||||
hicolor/
|
||||
|
|
|
@ -4,6 +4,7 @@ help:
|
|||
@echo "Re-generate icons in platform specific formats."
|
||||
@echo
|
||||
@echo "Available targets:"
|
||||
@echo " hicolor - Freedesktop icon directory structure"
|
||||
@echo " dosbox-staging.ico - Windows format"
|
||||
@echo " dosbox-staging.icns - macOS format"
|
||||
@echo " icon_<size>.png - render icon in specific size, e.g. icon_24.png"
|
||||
|
@ -55,12 +56,38 @@ dosbox-staging.iconset: \
|
|||
cp icon_512.png $@/icon_512x512.png
|
||||
cp icon_1024.png $@/icon_512x512@2x.png
|
||||
|
||||
##
|
||||
# Freedesktop icons (for Linux or other OSes) often are placed in 'hicolor'
|
||||
# directory in /usr/share/icons/ or /usr/local/share/icons/.
|
||||
#
|
||||
# Users can override them by placing icons in ~/.local/share/icons/
|
||||
#
|
||||
# This is not strictly necessary (just placing scalable icon is enough,
|
||||
# but some there are some corner cases where small raster icon looks better).
|
||||
#
|
||||
hicolor: \
|
||||
dosbox-staging.svg \
|
||||
icon_32.png \
|
||||
icon_24.png \
|
||||
icon_22.png \
|
||||
icon_16.png
|
||||
install -DT -m 644 $< $@/scalable/apps/dosbox-staging.svg
|
||||
install -DT -m 644 icon_32.png $@/32x32/apps/dosbox-staging.png
|
||||
install -DT -m 644 icon_24.png $@/24x24/apps/dosbox-staging.png
|
||||
install -DT -m 644 icon_22.png $@/22x22/apps/dosbox-staging.png
|
||||
install -DT -m 644 icon_16.png $@/16x16/apps/dosbox-staging.png
|
||||
|
||||
icon_16.png: small-svg/dosbox-staging-16.svg
|
||||
rsvg-convert -h 16 $< > $@
|
||||
|
||||
icon_24.png: small-svg/dosbox-staging-24.svg
|
||||
rsvg-convert -h 24 $< > $@
|
||||
|
||||
# Some desktop environments expect 22x22 icon (e.g. KDE Plasma).
|
||||
# Rendering 24px source to 22px looks good enough.
|
||||
icon_22.png: small-svg/dosbox-staging-24.svg
|
||||
rsvg-convert -h 22 $< > $@
|
||||
|
||||
icon_32.png: small-svg/dosbox-staging-32.svg
|
||||
rsvg-convert -h 32 $< > $@
|
||||
|
||||
|
@ -84,4 +111,5 @@ icon_1024.png: dosbox-staging.svg
|
|||
|
||||
clean:
|
||||
rm -rf dosbox-staging.iconset
|
||||
rm -rf hicolor
|
||||
rm -f icon_*.png
|
||||
|
|
|
@ -8,3 +8,4 @@ Type=Application
|
|||
Terminal=false
|
||||
Keywords=dos;gaming;game;games;emulator;
|
||||
Categories=Game;Emulator;
|
||||
StartupWMClass=dosbox-staging
|
||||
|
|
|
@ -3072,11 +3072,20 @@ void Disable_OS_Scaling() {
|
|||
#endif
|
||||
}
|
||||
|
||||
void OverrideWMClass()
|
||||
{
|
||||
#if !defined(WIN32)
|
||||
constexpr int overwrite = 0; // don't overwrite
|
||||
setenv("SDL_VIDEO_X11_WMCLASS", "dosbox-staging", overwrite);
|
||||
#endif
|
||||
}
|
||||
|
||||
//extern void UI_Init(void);
|
||||
int main(int argc, char* argv[]) {
|
||||
int rcode = 0; // assume good until proven otherwise
|
||||
try {
|
||||
Disable_OS_Scaling(); //Do this early on, maybe override it through some parameter.
|
||||
OverrideWMClass(); // Before SDL2 video subsystem is initialized
|
||||
|
||||
CommandLine com_line(argc,argv);
|
||||
Config myconf(&com_line);
|
||||
|
|
Loading…
Add table
Reference in a new issue