mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add layout variant.
This commit is contained in:
parent
7f18c5842d
commit
71dbdc06f5
@ -9,6 +9,7 @@ import (
|
||||
|
||||
type KeyboardLayoutData struct {
|
||||
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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -142,6 +142,7 @@ type KeyboardModifiers struct {
|
||||
type KeyboardLayout struct {
|
||||
Event string `json:"event,omitempty"`
|
||||
Layout string `json:"layout"`
|
||||
Variant string `json:"variant"`
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user