I’d like to find out what the current keyboard layout (“input locale”) is, for the current user/Platform (in a cross-platform way, if possible). I’ve come up with this (awkward) way to do it via unixCmd
on Windows – maybe there is a nicer way to do it.
(
var inputLocale = Platform.case(
\windows, {
var lines = "systeminfo /fo csv".unixCmdGetStdOutLines[(0..1)];
var sysInfo = lines.collect(_.replace("\",\"", "|")).collect(_.split($|)).flop;
sysInfo.detect{|x| x.first.beginsWith("Input Locale") }.last
},
\linux, { /* TBD */ nil },
\osx, { /* TBD */ nil }
);
inputLocale
)
// -> "es;Spanish (Traditional Sort)"
Thanks,
Glen.
P.S. On macOS, it seems you’d have to do something like this. Here’s hoping there is a built-in way of doing it – perhaps some cross-platform Qt method?