diff --git a/internal/api/room/keyboard.go b/internal/api/room/keyboard.go index 73d0a696..f2f89e2f 100644 --- a/internal/api/room/keyboard.go +++ b/internal/api/room/keyboard.go @@ -8,7 +8,8 @@ import ( ) type KeyboardLayoutData struct { - Layout string `json:"layout"` + Layout string `json:"layout"` + Variant string `json:"variant"` } type KeyboardModifiersData struct { @@ -22,7 +23,7 @@ func (h *RoomHandler) keyboardLayoutSet(w http.ResponseWriter, r *http.Request) return } - err := h.desktop.SetKeyboardLayout(data.Layout) + err := h.desktop.SetKeyboardLayout(data.Layout, data.Variant) if err != nil{ utils.HttpInternalServerError(w, "Unable to change keyboard layout.") return diff --git a/internal/desktop/xorg.go b/internal/desktop/xorg.go index fed7cee8..3ab84b40 100644 --- a/internal/desktop/xorg.go +++ b/internal/desktop/xorg.go @@ -55,9 +55,9 @@ func (manager *DesktopManagerCtx) ChangeScreenSize(width int, height int, rate i return xorg.ChangeScreenSize(width, height, rate) } -func (manager *DesktopManagerCtx) SetKeyboardLayout(layout string) error { +func (manager *DesktopManagerCtx) SetKeyboardLayout(layout string, variant string) error { // TOOD: Use native API. - cmd := exec.Command("setxkbmap", layout) + cmd := exec.Command("setxkbmap", "-layout", layout, "-variant", variant) _, err := cmd.Output() return err } diff --git a/internal/types/desktop.go b/internal/types/desktop.go index 20e76271..afecec53 100644 --- a/internal/types/desktop.go +++ b/internal/types/desktop.go @@ -43,7 +43,7 @@ type DesktopManager interface { ResetKeys() ScreenConfigurations() map[int]ScreenConfiguration GetScreenSize() *ScreenSize - SetKeyboardLayout(layout string) error + SetKeyboardLayout(layout string, variant string) error SetKeyboardModifiers(mod KeyboardModifiers) GetKeyboardModifiers() KeyboardModifiers GetCursorImage() *CursorImage diff --git a/internal/types/message/messages.go b/internal/types/message/messages.go index a3b9ba4b..9102dd91 100644 --- a/internal/types/message/messages.go +++ b/internal/types/message/messages.go @@ -140,8 +140,9 @@ type KeyboardModifiers struct { } type KeyboardLayout struct { - Event string `json:"event,omitempty"` - Layout string `json:"layout"` + Event string `json:"event,omitempty"` + Layout string `json:"layout"` + Variant string `json:"variant"` } ///////////////////////////// diff --git a/internal/websocket/handler/keyboard.go b/internal/websocket/handler/keyboard.go index 1314cdf7..563feb6d 100644 --- a/internal/websocket/handler/keyboard.go +++ b/internal/websocket/handler/keyboard.go @@ -12,7 +12,7 @@ func (h *MessageHandlerCtx) keyboardLayout(session types.Session, payload *messa return nil } - return h.desktop.SetKeyboardLayout(payload.Layout) + return h.desktop.SetKeyboardLayout(payload.Layout, payload.Variant) } func (h *MessageHandlerCtx) keyboardModifiers(session types.Session, payload *message.KeyboardModifiers) error {