diff --git a/Makefile b/Makefile
index f89646fd..97a8a445 100755
--- a/Makefile
+++ b/Makefile
@@ -18,6 +18,7 @@
PREFIX=/usr
engine_name=bamboo
+engine_gui_name=ibus-setup-Bamboo.desktop
ibus_e_name=ibus-engine-$(engine_name)
keyboard_shortcut_editor=keyboard-shortcut-editor
macro_editor=macro-editor
@@ -60,6 +61,7 @@ install: build
mkdir -p $(DESTDIR)$(ibus_dir)/component/
cp -R -f icons data $(DESTDIR)$(engine_dir)
+ cp -f $(engine_gui_name) $(DESTDIR)$(PREFIX)/share/applications/
cp -f $(ibus_e_name) $(DESTDIR)$(PREFIX)/lib/ibus-${engine_name}/
cp -f $(keyboard_shortcut_editor) $(DESTDIR)$(PREFIX)/lib/ibus-$(engine_name)/
cp -f $(macro_editor) $(DESTDIR)$(PREFIX)/lib/ibus-$(engine_name)/
@@ -70,7 +72,7 @@ uninstall:
sudo rm -rf $(DESTDIR)$(engine_dir)
sudo rm -rf $(DESTDIR)$(PREFIX)/lib/ibus-$(engine_name)/
sudo rm -f $(DESTDIR)$(ibus_dir)/component/$(engine_name).xml
- sudo rm -f $(DESTDIR)$(ibus_dir)/component/$(engine_name)-simple.xml
+ sudo rm -rf $(DESTDIR)$(PREFIX)/share/applications/$(engine_gui_name)
src: clean
diff --git a/bamboo.xml b/bamboo.xml
index 0f589093..06fdc35f 100644
--- a/bamboo.xml
+++ b/bamboo.xml
@@ -38,6 +38,7 @@
default
Bamboo
Vietnamese input method editor
+ /usr/lib/ibus-bamboo/ibus-engine-bamboo -gui
1
@@ -51,6 +52,7 @@
Bamboo (US layout)
Vietnamese input method editor with US keyboard layout
1
+ /usr/lib/ibus-bamboo/ibus-engine-bamboo -gui
@@ -59,11 +61,12 @@
vi
GPLv3
Tran Duc Binh <binhtran432k@gmail.com>
- /usr/share/ibus-bamboo/icons/vi-candy.svg
+ /usr/share/ibus-bamboo/icons/vi-candy.svg
default
Bamboo Candy
Vietnamese input method editor with US keyboard layout with Candy Icon
1
+ /usr/lib/ibus-bamboo/ibus-engine-bamboo -gui
vi
@@ -71,11 +74,12 @@
vi
GPLv3
Tran Duc Binh <binhtran432k@gmail.com>
- /usr/share/ibus-bamboo/icons/vi-flag.svg
+ /usr/share/ibus-bamboo/icons/vi-flag.svg
default
Bamboo Flag
Vietnamese input method editor with US keyboard layout with Flag Icon
1
+ /usr/lib/ibus-bamboo/ibus-engine-bamboo -gui
@@ -84,11 +88,12 @@
en
GPLv3
Tran Duc Binh <binhtran432k@gmail.com>
- /usr/share/ibus-bamboo/icons/us.svg
+ /usr/share/ibus-bamboo/icons/us.svg
us
Bamboo English (US)
Vietnamese input method editor with US keyboard layout with US Normal Icon
2
+ /usr/lib/ibus-bamboo/ibus-engine-bamboo -gui
en
@@ -96,11 +101,12 @@
en
GPLv3
Tran Duc Binh <binhtran432k@gmail.com>
- /usr/share/ibus-bamboo/icons/us-candy.svg
+ /usr/share/ibus-bamboo/icons/us-candy.svg
us
Bamboo English (US) Candy
Vietnamese input method editor with US keyboard layout with US Candy Icon
2
+ /usr/lib/ibus-bamboo/ibus-engine-bamboo -gui
en
@@ -108,11 +114,12 @@
en
GPLv3
Tran Duc Binh <binhtran432k@gmail.com>
- /usr/share/ibus-bamboo/icons/us-flag.svg
+ /usr/share/ibus-bamboo/icons/us-flag.svg
us
Bamboo English (US) Flag
Vietnamese input method editor with US keyboard layout with US Flag Icon
2
+ /usr/lib/ibus-bamboo/ibus-engine-bamboo -gui
diff --git a/ibus-setup-Bamboo.desktop b/ibus-setup-Bamboo.desktop
new file mode 100644
index 00000000..46dd4c93
--- /dev/null
+++ b/ibus-setup-Bamboo.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Name=IBus-Bamboo Setup
+Type=Application
+Exec=/usr/lib/ibus-bamboo/ibus-engine-bamboo -gui
+Icon=/usr/share/ibus-bamboo/icons/vi.svg
+NoDisplay=true
+StartupNotify=true
diff --git a/src/ibus-bamboo/engine.go b/src/ibus-bamboo/engine.go
index 885f2faf..aa8693db 100644
--- a/src/ibus-bamboo/engine.go
+++ b/src/ibus-bamboo/engine.go
@@ -22,7 +22,6 @@ package main
import (
"fmt"
"log"
- "os"
"os/exec"
"reflect"
"strconv"
@@ -244,21 +243,7 @@ func (e *IBusBambooEngine) PropertyActivate(propName string, propState uint32) *
return nil
}
if propName == PropKeyInputModeLookupTableShortcut {
- cmd := exec.Command("/usr/lib/ibus-bamboo/keyboard-shortcut-editor", e.getShortcutString(), strconv.Itoa(e.config.DefaultInputMode))
- cmd.Env = os.Environ()
- cmd.Env = append(cmd.Env, "GTK_IM_MODULE=gtk-im-context-simple")
- out, err := cmd.Output()
- if err != nil {
- out, err = exec.Command("./keyboard-shortcut-editor", e.getShortcutString(), strconv.Itoa(e.config.DefaultInputMode)).Output()
- if err != nil {
- return nil
- }
- }
- if len(out) > 0 {
- e.parseShortcuts(string(out))
- } else if err != nil {
- fmt.Println("execute keyboard-shortcut-editor: ", err)
- }
+ e.openShortcutsGUI()
}
if propName == PropKeyMacroTable {
OpenMactabFile(e.engineName)
diff --git a/src/ibus-bamboo/engine_utils.go b/src/ibus-bamboo/engine_utils.go
index a3c43b2b..9278f074 100644
--- a/src/ibus-bamboo/engine_utils.go
+++ b/src/ibus-bamboo/engine_utils.go
@@ -21,6 +21,8 @@ package main
import (
"fmt"
+ "os"
+ "os/exec"
"strconv"
"strings"
"sync"
@@ -52,6 +54,11 @@ func GetIBusEngineCreator() func(*dbus.Conn, string) dbus.ObjectPath {
engine.config = loadConfig(engineName)
engine.propList = GetPropListByConfig(config)
ibus.PublishEngine(conn, objectPath, engine)
+ if *gui {
+ engine.openShortcutsGUI()
+ saveConfig(engine.config, engine.engineName)
+ os.Exit(0)
+ }
go engine.init()
return objectPath
@@ -572,6 +579,24 @@ func notify(enMode bool) {
}
}
+func (e *IBusBambooEngine) openShortcutsGUI() {
+ cmd := exec.Command("/usr/lib/ibus-bamboo/keyboard-shortcut-editor", e.getShortcutString(), strconv.Itoa(e.config.DefaultInputMode))
+ cmd.Env = os.Environ()
+ cmd.Env = append(cmd.Env, "GTK_IM_MODULE=gtk-im-context-simple")
+ out, err := cmd.Output()
+ if err != nil {
+ out, err = exec.Command("./keyboard-shortcut-editor", e.getShortcutString(), strconv.Itoa(e.config.DefaultInputMode)).Output()
+ if err != nil {
+ return
+ }
+ }
+ if len(out) > 0 {
+ e.parseShortcuts(string(out))
+ } else if err != nil {
+ fmt.Println("execute keyboard-shortcut-editor: ", err)
+ }
+}
+
func (e *IBusBambooEngine) parseShortcuts(s string) {
fmt.Printf("output=(%s)\n", s)
list := strings.Split(s, ",")
diff --git a/src/ibus-bamboo/main.go b/src/ibus-bamboo/main.go
index ca0870c3..7d07fff8 100644
--- a/src/ibus-bamboo/main.go
+++ b/src/ibus-bamboo/main.go
@@ -36,6 +36,7 @@ const (
var embedded = flag.Bool("ibus", false, "Run the embedded ibus component")
var version = flag.Bool("version", false, "Show version")
+var gui = flag.Bool("gui", false, "Show GUI")
var isWayland = false
var isGnome = false