diff --git a/frontend/device/sdl/device.lua b/frontend/device/sdl/device.lua index 28cb08b7d..c5f421cea 100644 --- a/frontend/device/sdl/device.lua +++ b/frontend/device/sdl/device.lua @@ -1,8 +1,16 @@ local Event = require("ui/event") local Generic = require("device/generic/device") local SDL = require("ffi/SDL2_0") +local ffi = require("ffi") local logger = require("logger") +-- SDL computes WM_CLASS on X11/Wayland based on process's binary name. +-- Some desktop environments rely on WM_CLASS to name the app and/or to assign the proper icon. +if jit.os == "Linux" or jit.os == "BSD" or jit.os == "POSIX" then + if not os.getenv("SDL_VIDEO_WAYLAND_WMCLASS") then ffi.C.setenv("SDL_VIDEO_WAYLAND_WMCLASS", "KOReader", 1) end + if not os.getenv("SDL_VIDEO_X11_WMCLASS") then ffi.C.setenv("SDL_VIDEO_X11_WMCLASS", "KOReader", 1) end +end + local function yes() return true end local function no() return false end local function notOSX() return jit.os ~= "OSX" end