I do exactly the same sort of thing on Xubuntu Linux.
Now, in languages such as Lazarus there is a nifty command:
Code: Select all
GetKeyboardLayout
Code: Select all
GetKeyboardLayout
Code: Select all
on mouseUp
put the platform into tPlatform
if tplatform contains "mac" then
put "/usr/libexec/PlistBuddy -c 'print " & QUOTE & "AppleSelectedInputSources:0:KeyboardLayout Name" & QUOTE & "' /Library/Preferences/com.apple.HIToolbox.plist" into tCmd
put shell(tCmd) into tResult
answer "Current Keyboard Layout: " & tResult
else if tplatform contains "win" then
put "powershell -command Get-WinUserLanguageList" into tLayout
put shell(tLayout) into tResult
answer "Current Keyboard Layout: " & tResult
else if tplatform contains "lin" then
put "setxkbmap -query" into tCommand
put shell(tCommand) into tResult
filter lines of tResult with "layout:*"
answer "Current Keyboard Layout: " & tResult
end if
end mouseUp
Code: Select all
on mouseUp
put the platform into tPlatform
if tplatform contains "mac" then
put "/usr/libexec/PlistBuddy -c 'print " & QUOTE & "AppleSelectedInputSources:0:KeyboardLayout Name" & QUOTE & "' ~/Library/Preferences/com.apple.HIToolbox.plist" into tCmd
put shell(tCmd) into tResult
answer "Current Keyboard Layout: " & tResult
else if tplatform contains "win" then
put "powershell -command Get-WinUserLanguageList" into tLayout
put shell(tLayout) into tResult
answer "Current Keyboard Layout: " & tResult
else if tplatform contains "lin" then
put "setxkbmap -query" into tCommand
put shell(tCommand) into tResult
filter lines of tResult with "layout:*"
answer "Current Keyboard Layout: " & tResult
end if
end mouseUp
There's probably a few ways to do this on macOS.tperry2x wrote: ↑Fri Oct 25, 2024 7:29 pm on mouseUp
put the platform into tPlatform
if tplatform contains "mac" then
put "/usr/libexec/PlistBuddy -c 'print " & QUOTE & "AppleSelectedInputSources:0:KeyboardLayout Name" & QUOTE & "' ~/Library/Preferences/com.apple.HIToolbox.plist" into tCmd
put shell(tCmd) into tResult
answer "Current Keyboard Layout: " & tResult
else if tplatform contains "win" then
Code: Select all
defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleSelectedInputSources | egrep -w 'KeyboardLayout Name' |sed -E 's/^.+ = \"?([^\"]+)\"?;$/\1/'
Code: Select all
on rawKeyDown RD
switch RD
case "100"
put the glyph for my keyboard layout that overlays that rawKeyCode into field "K100"
break
--- and so it goes
end switch
end rawKeyDown
Code: Select all
set plistPath to "~/Library/Preferences/com.apple.HIToolbox.plist"
try
do shell script "defaults read " & plistPath & " dummy"
end try
tell application "System Events"
repeat with pli in property list items of ¬
property list item "AppleSelectedInputSources" of property list file plistPath
try
return value of property list item "KeyboardLayout Name" of pli
end try
end repeat
end tell
I was thinking I could make it so that you, me or anyone, could attach your own svg-path icons to the keys for that OnScreenKeyboard widget (it would just be replacing an array element in the array that stores the state of each key), but you would have to provide it glyphs sets as some sort of list. Perhaps it could be a simple tab-sep-values list, which is what the OXT SVG glyphs library uses. I wanted to enhance the thing in a similar way already so that the 'alt' and 'option' keys could be labeled with symbols appropriate for a specific OS (for example).richmond62 wrote: ↑Tue Oct 29, 2024 9:08 am It looks like I will have to have a MONSTER lookup table for each possible keyboard layout because what interests me is NOT whether an enduser's keyboard layout will deliver the charаcters relevant to that language (which I assume it will), but something like this:
Imagine, if you will, an overlay on an OXT card that looks a bit like this (these are screenshots of the MacOS15 keyboard thingy):
-
SShot 2024-10-29 at 11.05.50.png
-
US English layout MacOS 15 which changes automatically inwith an OXT stack to this:
-
SShot 2024-10-29 at 11.06.04.png
-
when the end-user changes to the SlavonicCY layout (or whatever).
Users browsing this forum: No registered users and 0 guests