Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
;; provide emacs interface for zero-panel dbus service.
;;================
;; implementation
;;================
(require 'dbus)
(defun zero-panel-async-call (method handler &rest args)
"call Method on zero-panel service asynchronously. This is a wrapper around `dbus-call-method-asynchronously'"
(apply 'dbus-call-method-asynchronously
:session "com.emacsos.zero.Panel"
"/com/emacsos/zero/Panel"
"com.emacsos.zero.Panel"
method nil args))
;;============
;; public API
;;============
(defun zero-panel-move (x y)
"move panel to specific position
(x, y) are coordinates, (0, 0) is at screen top left corner"
(zero-panel-async-call "Move" nil :int32 x :int32 y))
(defun zero-panel-show-candidates (preedit_str candidate_length candidates)
"show candidates"
(zero-panel-async-call "ShowCandidates" nil
:string preedit_str
:int32 candidate_length
(or candidates '(:array))))
(defun zero-panel-show ()
"show panel"
(zero-panel-async-call "Show" nil))
(defun zero-panel-hide ()
"hide panel"
(zero-panel-async-call "Hide" nil))
(defun zero-panel-quit ()
"quit panel application"
(zero-panel-async-call "Quit" nil))
(provide 'zero-panel)