Skip to content

Commit d19a2a2

Browse files
committed
sdl_glimp: set PRODUCT_APPID as WMCLASS on Linux
1 parent 796e130 commit d19a2a2

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/common/Defs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3737
/** No case, No spaces */
3838
#define PRODUCT_NAME_LOWER "unvanquished"
3939

40+
#define PRODUCT_APPID "net.unvanquished.Unvanquished"
41+
4042
#define PRODUCT_VERSION "0.55.4"
4143

4244
/** Default base package */

src/engine/sys/sdl_glimp.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,6 +1703,20 @@ static rserr_t GLimp_StartDriverAndSetMode( int mode, bool fullscreen, bool bord
17031703
{
17041704
int numDisplays;
17051705

1706+
#if !defined(_WIN32) && !defined(__APPLE__)
1707+
/* Let X11 and Wayland desktops (Linux, FreeBSD…) associate the game
1708+
window with the XDG .desktop file, with the proper name and icon.
1709+
The .desktop file should have PRODUCT_APPID as base name or set the
1710+
StartupWMClass variable to PRODUCT_APPID. */
1711+
1712+
// SDL2.
1713+
Sys::SetEnv( "SDL_VIDEO_X11_WMCLASS", PRODUCT_APPID );
1714+
Sys::SetEnv( "SDL_VIDEO_WAYLAND_WMCLASS", PRODUCT_APPID );
1715+
1716+
// SDL3.
1717+
Sys::SetEnv( "SDL_HINT_APP_ID", PRODUCT_APPID );
1718+
#endif
1719+
17061720
if ( !SDL_WasInit( SDL_INIT_VIDEO ) )
17071721
{
17081722
const char *driverName;

0 commit comments

Comments
 (0)