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
@ -8,7 +8,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type KeyboardLayoutData struct {
|
type KeyboardLayoutData struct {
|
||||||
Layout string `json:"layout"`
|
Layout string `json:"layout"`
|
||||||
|
Variant string `json:"variant"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type KeyboardModifiersData struct {
|
type KeyboardModifiersData struct {
|
||||||
@ -22,7 +23,7 @@ func (h *RoomHandler) keyboardLayoutSet(w http.ResponseWriter, r *http.Request)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err := h.desktop.SetKeyboardLayout(data.Layout)
|
err := h.desktop.SetKeyboardLayout(data.Layout, data.Variant)
|
||||||
if err != nil{
|
if err != nil{
|
||||||
utils.HttpInternalServerError(w, "Unable to change keyboard layout.")
|
utils.HttpInternalServerError(w, "Unable to change keyboard layout.")
|
||||||
return
|
return
|
||||||
|
@ -55,9 +55,9 @@ func (manager *DesktopManagerCtx) ChangeScreenSize(width int, height int, rate i
|
|||||||
return xorg.ChangeScreenSize(width, height, rate)
|
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.
|
// TOOD: Use native API.
|
||||||
cmd := exec.Command("setxkbmap", layout)
|
cmd := exec.Command("setxkbmap", "-layout", layout, "-variant", variant)
|
||||||
_, err := cmd.Output()
|
_, err := cmd.Output()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ type DesktopManager interface {
|
|||||||
ResetKeys()
|
ResetKeys()
|
||||||
ScreenConfigurations() map[int]ScreenConfiguration
|
ScreenConfigurations() map[int]ScreenConfiguration
|
||||||
GetScreenSize() *ScreenSize
|
GetScreenSize() *ScreenSize
|
||||||
SetKeyboardLayout(layout string) error
|
SetKeyboardLayout(layout string, variant string) error
|
||||||
SetKeyboardModifiers(mod KeyboardModifiers)
|
SetKeyboardModifiers(mod KeyboardModifiers)
|
||||||
GetKeyboardModifiers() KeyboardModifiers
|
GetKeyboardModifiers() KeyboardModifiers
|
||||||
GetCursorImage() *CursorImage
|
GetCursorImage() *CursorImage
|
||||||
|
@ -140,8 +140,9 @@ type KeyboardModifiers struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type KeyboardLayout struct {
|
type KeyboardLayout struct {
|
||||||
Event string `json:"event,omitempty"`
|
Event string `json:"event,omitempty"`
|
||||||
Layout string `json:"layout"`
|
Layout string `json:"layout"`
|
||||||
|
Variant string `json:"variant"`
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
|
@ -12,7 +12,7 @@ func (h *MessageHandlerCtx) keyboardLayout(session types.Session, payload *messa
|
|||||||
return nil
|
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 {
|
func (h *MessageHandlerCtx) keyboardModifiers(session types.Session, payload *message.KeyboardModifiers) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user