File tree 1 file changed +13
-4
lines changed
1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -276,13 +276,22 @@ std::vector<InputMethodEntry> KeymanEngine::listInputMethods() {
276
276
}
277
277
std::vector<InputMethodEntry> result;
278
278
for (auto &[id, keyboard] : keyboards) {
279
+ std::string icon = " km-config" ;
280
+ // Check if icon file exists, otherwise fallback to keyman's icon.
281
+ for (auto *suffix : {" .bmp.png" , " .icon.png" }) {
282
+ auto path = stringutils::joinPath (keyboard->baseDir ,
283
+ stringutils::concat (id, suffix));
284
+ if (fs::isreg (path)) {
285
+ icon = std::move (path);
286
+ break ;
287
+ }
288
+ }
289
+
279
290
result.emplace_back (stringutils::concat (" keyman:" , id),
280
291
stringutils::concat (keyboard->name , " (Keyman)" ),
281
292
keyboard->language , " keyman" );
282
- result.back ()
283
- .setIcon (" km-config" )
284
- .setConfigurable (true )
285
- .setUserData (std::move (keyboard));
293
+ result.back ().setIcon (icon).setConfigurable (true ).setUserData (
294
+ std::move (keyboard));
286
295
}
287
296
return result;
288
297
}
You can’t perform that action at this time.
0 commit comments