Documentation ¶
Index ¶
- Constants
- Variables
- func GetKeyFirstCode(keySymbols *keysyms.KeySymbols, str string) (x.Keycode, error)
- func GetQtKeycodeMap() map[string]string
- func GetSystemActionCmd(id string) string
- func SetLogger(l *log.Logger)
- type Action
- func GetAction(id string) *Action
- func NewAudioCtrlAction(cmd ActionCmd) *Action
- func NewCallbackAction(fn func(ev *KeyEvent)) *Action
- func NewDisplayCtrlAction(cmd ActionCmd) *Action
- func NewExecCmdAction(cmd string, execOnRelease bool) *Action
- func NewKbdBrightnessCtrlAction(cmd ActionCmd) *Action
- func NewMediaPlayerCtrlAction(cmd ActionCmd) *Action
- func NewOpenMimeTypeAction(mimeType string) *Action
- func NewTouchpadCtrlAction(cmd ActionCmd) *Action
- type ActionCmd
- type ActionExecCmdArg
- type ActionType
- type BaseShortcut
- func (sb *BaseShortcut) GetAction() *Action
- func (sb *BaseShortcut) GetId() string
- func (sb *BaseShortcut) GetKeystrokes() []*Keystroke
- func (sb *BaseShortcut) GetKeystrokesModifiable() bool
- func (sb *BaseShortcut) GetName() string
- func (sb *BaseShortcut) GetNameBlocks() pinyin_search.Blocks
- func (sb *BaseShortcut) GetType() int32
- func (sb *BaseShortcut) GetUid() string
- func (sb *BaseShortcut) Marshal() (string, error)
- func (sb *BaseShortcut) ShouldEmitSignalChanged() bool
- func (sb *BaseShortcut) String() string
- type CustomShortcut
- func (cs *CustomShortcut) GetAction() *Action
- func (cs *CustomShortcut) Marshal() (string, error)
- func (cs *CustomShortcut) ReloadKeystrokes() bool
- func (cs *CustomShortcut) Save() error
- func (cs *CustomShortcut) SaveKeystrokes() error
- func (cs *CustomShortcut) SetName(name string)
- func (cs *CustomShortcut) ShouldEmitSignalChanged() bool
- type CustomShortcutManager
- type FakeShortcut
- type GSettingsShortcut
- type Key
- type KeyEvent
- type KeyEventFunc
- type Keycode
- type Keystroke
- func (ks *Keystroke) DebugString() string
- func (a *Keystroke) Equal(keySymbols *keysyms.KeySymbols, b *Keystroke) bool
- func (ks *Keystroke) IsGood() bool
- func (ks *Keystroke) MarshalJSON() ([]byte, error)
- func (ks *Keystroke) String() string
- func (ks *Keystroke) ToKey(keySymbols *keysyms.KeySymbols) (Key, error)
- func (ks *Keystroke) ToKeyList(keySymbols *keysyms.KeySymbols) ([]Key, error)
- type MediaShortcut
- type Modifiers
- type Shortcut
- type ShortcutManager
- func (sm *ShortcutManager) Add(shortcut Shortcut)
- func (sm *ShortcutManager) AddCustom(csm *CustomShortcutManager)
- func (sm *ShortcutManager) AddKWin(wmObj wm.Wm)
- func (sm *ShortcutManager) AddKWinForWayland(wmObj wm.Wm)
- func (sm *ShortcutManager) AddMedia(gsettings *gio.Settings)
- func (sm *ShortcutManager) AddMediaToKwin(gsettings *gio.Settings, wmObj wm.Wm)
- func (sm *ShortcutManager) AddShortcutKeystroke(shortcut Shortcut, ks *Keystroke)
- func (sm *ShortcutManager) AddSpecial()
- func (sm *ShortcutManager) AddSpecialToKwin(wmObj wm.Wm)
- func (sm *ShortcutManager) AddSystem(gsettings, gsPlatform, gsEnable *gio.Settings, wmObj wm.Wm)
- func (sm *ShortcutManager) AddSystemById(gsettings *gio.Settings, id string)
- func (sm *ShortcutManager) AddSystemToKwin(gsettings *gio.Settings, wmObj wm.Wm)
- func (sm *ShortcutManager) AddWM(gsettings *gio.Settings)
- func (sm *ShortcutManager) CheckSystem(gsPlatform, gsEnable *gio.Settings, id string) bool
- func (sm *ShortcutManager) DelSystemById(id string)
- func (sm *ShortcutManager) Delete(shortcut Shortcut)
- func (sm *ShortcutManager) DeleteShortcutKeystroke(shortcut Shortcut, ks *Keystroke)
- func (sm *ShortcutManager) Destroy()
- func (sm *ShortcutManager) EnableRecord(val bool)
- func (sm *ShortcutManager) EventLoop()
- func (sm *ShortcutManager) FindConflictingKeystroke(ks *Keystroke) (*Keystroke, error)
- func (sm *ShortcutManager) GetByIdType(id string, type0 int32) Shortcut
- func (sm *ShortcutManager) GetByUid(uid string) Shortcut
- func (sm *ShortcutManager) GrabAll()
- func (sm *ShortcutManager) List() (list []Shortcut)
- func (sm *ShortcutManager) ListByType(type0 int32) (list []Shortcut)
- func (sm *ShortcutManager) ModifyShortcutKeystrokes(shortcut Shortcut, newVal []*Keystroke)
- func (sm *ShortcutManager) NotifyLayoutChanged()
- func (sm *ShortcutManager) ReloadAllShortcutsKeystrokes() []Shortcut
- func (sm *ShortcutManager) Search(query string) (list []Shortcut)
- func (sm *ShortcutManager) SetAllModKeysReleasedCallback(cb func())
- func (sm *ShortcutManager) UngrabAll()
- type SystemShortcut
- type XRecordEventHandler
Constants ¶
View Source
const ( ShortcutTypeSystem int32 = iota ShortcutTypeCustom ShortcutTypeMedia ShortcutTypeWM ShortcutTypeFake )
View Source
const ( SKLCtrlShift uint32 = 1 << iota SKLAltShift SKLSuperSpace )
View Source
const ActionTypeCount = int(actionTypeMax)
Variables ¶
View Source
var ActionNoOp = &Action{Type: ActionTypeNonOp}
View Source
var ErrInvalidActionType = errors.New("invalid action type")
View Source
var ErrNilAction = errors.New("action is nil")
View Source
var ErrOpNotSupported = errors.New("operation is not supported")
errors:
View Source
var ErrTypeAssertionFail = errors.New("type assertion failed")
Functions ¶
func GetKeyFirstCode ¶
func GetQtKeycodeMap ¶
func GetSystemActionCmd ¶
Types ¶
type Action ¶
type Action struct { Type ActionType Arg interface{} }
func NewAudioCtrlAction ¶
func NewCallbackAction ¶
func NewDisplayCtrlAction ¶
func NewExecCmdAction ¶
func NewOpenMimeTypeAction ¶
run the program which default handle mimeType
func NewTouchpadCtrlAction ¶
type ActionCmd ¶
type ActionCmd uint
const ( // audio ctrl AudioSinkMuteToggle ActionCmd = iota + 1 AudioSinkVolumeUp AudioSinkVolumeDown AudioSourceMuteToggle // media play ctrl MediaPlayerPlay MediaPlayerPause MediaPlayerStop MediaPlayerPrevious MediaPlayerNext MediaPlayerRewind MediaPlayerForword MediaPlayerRepeat // display ctrl MonitorBrightnessUp MonitorBrightnessDown DisplayModeSwitch AdjustBrightnessSwitch // keyboard backlight ctrl KbdLightToggle KbdLightBrightnessUp KbdLightBrightnessDown // touchpad ctrl TouchpadToggle TouchpadOn TouchpadOff )
type ActionExecCmdArg ¶
exec commandline
type ActionType ¶
type ActionType uint
const ( ActionTypeNonOp ActionType = iota ActionTypeExecCmd ActionTypeOpenMimeType ActionTypeDesktopFile ActionTypeShowNumLockOSD ActionTypeShowCapsLockOSD ActionTypeSystemShutdown ActionTypeSystemSuspend ActionTypeSystemLogOff ActionTypeSystemAway // controllers ActionTypeAudioCtrl ActionTypeMediaPlayerCtrl // MPRIS ActionTypeDisplayCtrl ActionTypeKbdLightCtrl ActionTypeTouchpadCtrl ActionTypeSwitchKbdLayout ActionTypeToggleWireless ActionTypeShowControlCenter ActionTypeCallback // 触发回调函数点Action )
type BaseShortcut ¶
type BaseShortcut struct { Id string Type int32 Keystrokes []*Keystroke `json:"Accels"` Name string // contains filtered or unexported fields }
func (*BaseShortcut) GetAction ¶
func (sb *BaseShortcut) GetAction() *Action
func (*BaseShortcut) GetId ¶
func (sb *BaseShortcut) GetId() string
func (*BaseShortcut) GetKeystrokes ¶
func (sb *BaseShortcut) GetKeystrokes() []*Keystroke
func (*BaseShortcut) GetKeystrokesModifiable ¶
func (sb *BaseShortcut) GetKeystrokesModifiable() bool
func (*BaseShortcut) GetName ¶
func (sb *BaseShortcut) GetName() string
func (*BaseShortcut) GetNameBlocks ¶
func (sb *BaseShortcut) GetNameBlocks() pinyin_search.Blocks
func (*BaseShortcut) GetType ¶
func (sb *BaseShortcut) GetType() int32
func (*BaseShortcut) GetUid ¶
func (sb *BaseShortcut) GetUid() string
func (*BaseShortcut) Marshal ¶
func (sb *BaseShortcut) Marshal() (string, error)
func (*BaseShortcut) ShouldEmitSignalChanged ¶
func (sb *BaseShortcut) ShouldEmitSignalChanged() bool
func (*BaseShortcut) String ¶
func (sb *BaseShortcut) String() string
type CustomShortcut ¶
type CustomShortcut struct { BaseShortcut Cmd string `json:"Exec"` // contains filtered or unexported fields }
func (*CustomShortcut) GetAction ¶
func (cs *CustomShortcut) GetAction() *Action
func (*CustomShortcut) Marshal ¶
func (cs *CustomShortcut) Marshal() (string, error)
func (*CustomShortcut) ReloadKeystrokes ¶
func (cs *CustomShortcut) ReloadKeystrokes() bool
经过 Reset 重置后, 自定义快捷键的 keystrokes 被设置为空,始终返回 false 是为了另外计算改变的自定义快捷键项目。
func (*CustomShortcut) Save ¶
func (cs *CustomShortcut) Save() error
func (*CustomShortcut) SaveKeystrokes ¶
func (cs *CustomShortcut) SaveKeystrokes() error
func (*CustomShortcut) SetName ¶
func (cs *CustomShortcut) SetName(name string)
func (*CustomShortcut) ShouldEmitSignalChanged ¶
func (cs *CustomShortcut) ShouldEmitSignalChanged() bool
type CustomShortcutManager ¶
type CustomShortcutManager struct {
// contains filtered or unexported fields
}
func NewCustomShortcutManager ¶
func NewCustomShortcutManager(file string) *CustomShortcutManager
func (*CustomShortcutManager) Add ¶
func (csm *CustomShortcutManager) Add(name, action string, keystrokes []*Keystroke) (Shortcut, error)
func (*CustomShortcutManager) Delete ¶
func (csm *CustomShortcutManager) Delete(id string) error
func (*CustomShortcutManager) List ¶
func (csm *CustomShortcutManager) List() []Shortcut
func (*CustomShortcutManager) Save ¶
func (csm *CustomShortcutManager) Save() error
type FakeShortcut ¶
type FakeShortcut struct { BaseShortcut // contains filtered or unexported fields }
func NewFakeShortcut ¶
func NewFakeShortcut(action *Action) *FakeShortcut
func (*FakeShortcut) GetAction ¶
func (s *FakeShortcut) GetAction() *Action
func (*FakeShortcut) ReloadKeystrokes ¶
func (s *FakeShortcut) ReloadKeystrokes() bool
func (*FakeShortcut) SaveKeystrokes ¶
func (s *FakeShortcut) SaveKeystrokes() error
type GSettingsShortcut ¶
type GSettingsShortcut struct { BaseShortcut // contains filtered or unexported fields }
func NewGSettingsShortcut ¶
func NewGSettingsShortcut(gsettings *gio.Settings, id string, type0 int32, keystrokes []string, name string) *GSettingsShortcut
func (*GSettingsShortcut) ReloadKeystrokes ¶
func (gs *GSettingsShortcut) ReloadKeystrokes() bool
func (*GSettingsShortcut) SaveKeystrokes ¶
func (gs *GSettingsShortcut) SaveKeystrokes() error
type Key ¶
func (Key) ToKeystroke ¶
func (k Key) ToKeystroke(keySymbols *keysyms.KeySymbols) *Keystroke
type KeyEventFunc ¶
type KeyEventFunc func(ev *KeyEvent)
type Keystroke ¶
type Keystroke struct { Mods Modifiers Keystr string Keysym x.Keysym Shortcut Shortcut // contains filtered or unexported fields }
Keystroke field Mods ignore mod2(Num_Lock) and lock(Caps_Lock)
func ParseKeystroke ¶
<Super>L mods (mod4) key L <Super>% mods (mod4, shift) key % <Control><Alt>T mods (control,mod1) key T <Control><shift>T mods(control,shift) key T <Control>> mods(control) key > <Control>< invalid Super< invalid <Super> mods() key Super Print mods() key Print <Control>Print mods(Control) key Print check Keystroke.Keystr valid later
func ParseKeystrokes ¶
func (*Keystroke) DebugString ¶
func (*Keystroke) Equal ¶
func (a *Keystroke) Equal(keySymbols *keysyms.KeySymbols, b *Keystroke) bool
func (*Keystroke) MarshalJSON ¶
type MediaShortcut ¶
type MediaShortcut struct {
*GSettingsShortcut
}
func (*MediaShortcut) GetAction ¶
func (ms *MediaShortcut) GetAction() *Action
type Shortcut ¶
type Shortcut interface { GetId() string GetUid() string GetType() int32 GetName() string GetNameBlocks() pinyin_search.Blocks GetKeystrokesModifiable() bool GetKeystrokes() []*Keystroke SaveKeystrokes() error ReloadKeystrokes() bool GetAction() *Action Marshal() (string, error) ShouldEmitSignalChanged() bool // contains filtered or unexported methods }
type ShortcutManager ¶
type ShortcutManager struct { ConflictingKeystrokes []*Keystroke EliminateConflictDone bool // contains filtered or unexported fields }
func NewShortcutManager ¶
func NewShortcutManager(conn *x.Conn, keySymbols *keysyms.KeySymbols, eventCb KeyEventFunc) *ShortcutManager
func (*ShortcutManager) Add ¶
func (sm *ShortcutManager) Add(shortcut Shortcut)
func (*ShortcutManager) AddCustom ¶
func (sm *ShortcutManager) AddCustom(csm *CustomShortcutManager)
func (*ShortcutManager) AddKWin ¶
func (sm *ShortcutManager) AddKWin(wmObj wm.Wm)
func (*ShortcutManager) AddKWinForWayland ¶
func (sm *ShortcutManager) AddKWinForWayland(wmObj wm.Wm)
func (*ShortcutManager) AddMedia ¶
func (sm *ShortcutManager) AddMedia(gsettings *gio.Settings)
func (*ShortcutManager) AddMediaToKwin ¶
func (sm *ShortcutManager) AddMediaToKwin(gsettings *gio.Settings, wmObj wm.Wm)
func (*ShortcutManager) AddShortcutKeystroke ¶
func (sm *ShortcutManager) AddShortcutKeystroke(shortcut Shortcut, ks *Keystroke)
func (*ShortcutManager) AddSpecial ¶
func (sm *ShortcutManager) AddSpecial()
func (*ShortcutManager) AddSpecialToKwin ¶
func (sm *ShortcutManager) AddSpecialToKwin(wmObj wm.Wm)
func (*ShortcutManager) AddSystem ¶
func (sm *ShortcutManager) AddSystem(gsettings, gsPlatform, gsEnable *gio.Settings, wmObj wm.Wm)
func (*ShortcutManager) AddSystemById ¶
func (sm *ShortcutManager) AddSystemById(gsettings *gio.Settings, id string)
func (*ShortcutManager) AddSystemToKwin ¶
func (sm *ShortcutManager) AddSystemToKwin(gsettings *gio.Settings, wmObj wm.Wm)
func (*ShortcutManager) AddWM ¶
func (sm *ShortcutManager) AddWM(gsettings *gio.Settings)
func (*ShortcutManager) CheckSystem ¶
func (sm *ShortcutManager) CheckSystem(gsPlatform, gsEnable *gio.Settings, id string) bool
检测一个系统快捷键是否配置为可用,true可用,false不可用
func (*ShortcutManager) DelSystemById ¶
func (sm *ShortcutManager) DelSystemById(id string)
func (*ShortcutManager) Delete ¶
func (sm *ShortcutManager) Delete(shortcut Shortcut)
func (*ShortcutManager) DeleteShortcutKeystroke ¶
func (sm *ShortcutManager) DeleteShortcutKeystroke(shortcut Shortcut, ks *Keystroke)
func (*ShortcutManager) Destroy ¶
func (sm *ShortcutManager) Destroy()
func (*ShortcutManager) EnableRecord ¶
func (sm *ShortcutManager) EnableRecord(val bool)
func (*ShortcutManager) EventLoop ¶
func (sm *ShortcutManager) EventLoop()
func (*ShortcutManager) FindConflictingKeystroke ¶
func (sm *ShortcutManager) FindConflictingKeystroke(ks *Keystroke) (*Keystroke, error)
ret0: Conflicting keystroke ret1: error
func (*ShortcutManager) GetByIdType ¶
func (sm *ShortcutManager) GetByIdType(id string, type0 int32) Shortcut
func (*ShortcutManager) GetByUid ¶
func (sm *ShortcutManager) GetByUid(uid string) Shortcut
func (*ShortcutManager) GrabAll ¶
func (sm *ShortcutManager) GrabAll()
func (*ShortcutManager) List ¶
func (sm *ShortcutManager) List() (list []Shortcut)
func (*ShortcutManager) ListByType ¶
func (sm *ShortcutManager) ListByType(type0 int32) (list []Shortcut)
func (*ShortcutManager) ModifyShortcutKeystrokes ¶
func (sm *ShortcutManager) ModifyShortcutKeystrokes(shortcut Shortcut, newVal []*Keystroke)
func (*ShortcutManager) NotifyLayoutChanged ¶
func (sm *ShortcutManager) NotifyLayoutChanged()
func (*ShortcutManager) ReloadAllShortcutsKeystrokes ¶
func (sm *ShortcutManager) ReloadAllShortcutsKeystrokes() []Shortcut
func (*ShortcutManager) Search ¶
func (sm *ShortcutManager) Search(query string) (list []Shortcut)
func (*ShortcutManager) SetAllModKeysReleasedCallback ¶
func (sm *ShortcutManager) SetAllModKeysReleasedCallback(cb func())
func (*ShortcutManager) UngrabAll ¶
func (sm *ShortcutManager) UngrabAll()
type SystemShortcut ¶
type SystemShortcut struct { *GSettingsShortcut // contains filtered or unexported fields }
func (*SystemShortcut) GetAction ¶
func (ss *SystemShortcut) GetAction() *Action
func (*SystemShortcut) SetAction ¶
func (ss *SystemShortcut) SetAction(newAction *Action) error
func (*SystemShortcut) SetName ¶
func (ss *SystemShortcut) SetName(name string) error
type XRecordEventHandler ¶
type XRecordEventHandler struct {
// contains filtered or unexported fields
}
func NewXRecordEventHandler ¶
func NewXRecordEventHandler(keySymbols *keysyms.KeySymbols) *XRecordEventHandler
Click to show internal directories.
Click to hide internal directories.