mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
change kbd layout using setxkbmap
This commit is contained in:
@ -165,3 +165,10 @@ short XGetScreenRate() {
|
||||
XRRScreenConfiguration *conf = XRRGetScreenInfo(display, RootWindow(display, 0));
|
||||
return XRRConfigCurrentRate(conf);
|
||||
}
|
||||
|
||||
void SetKeyboard(char *layout) {
|
||||
// TOOD: refactor, use native API.
|
||||
char cmd[12] = "setxkbmap ";
|
||||
strcat(cmd, layout);
|
||||
system(cmd);
|
||||
}
|
||||
|
@ -210,6 +210,16 @@ func GetScreenSize() *types.ScreenSize {
|
||||
return nil
|
||||
}
|
||||
|
||||
func SetKeyboard(layout string) {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
|
||||
layoutUnsafe := C.CString(layout)
|
||||
defer C.free(unsafe.Pointer(layoutUnsafe))
|
||||
|
||||
C.SetKeyboard(layoutUnsafe)
|
||||
}
|
||||
|
||||
//export goCreateScreenSize
|
||||
func goCreateScreenSize(index C.int, width C.int, height C.int, mwidth C.int, mheight C.int) {
|
||||
ScreenConfigurations[int(index)] = types.ScreenConfiguration{
|
||||
|
@ -38,5 +38,7 @@
|
||||
|
||||
void XDisplayClose(void);
|
||||
void XDisplaySet(char *input);
|
||||
|
||||
void SetKeyboard(char *layout);
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user