Skip to content

Commit

Permalink
Implement version 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hankei6km committed Feb 19, 2018
1 parent 1fa760f commit 8348d36
Show file tree
Hide file tree
Showing 11 changed files with 544 additions and 0 deletions.
18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
project(fcitx-at-esc)
cmake_minimum_required(VERSION 2.6)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
find_package(Fcitx 4.2.7 REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(Gettext REQUIRED)
# pkg_check_modules(LIBSKK "libskk" REQUIRED)

_fcitx_add_uninstall_target()

set(CMAKE_C_FLAGS "-Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -fvisibility=hidden ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -fvisibility=hidden ${CMAKE_CXX_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--as-needed ${CMAKE_MODULE_LINKER_FLAGS}")

add_subdirectory(src)
add_subdirectory(po)
32 changes: 32 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
MIT License

Copyright (c) 2018 hankei6km

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


This repository based from Fcitx Tsundere Addon (https://github.com/felixonmars/fcitx-tsundere)
/***************************************************************************
* Copyright (C) 2010~2010 by Felix Yan *
* [email protected] *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/

69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# @esc addon for Fcitx

@esc は、
Vim ライクなキーバインド用に、esc キー押下で IME をオフにさせるための
Fcitx 用 addon です.


## Installation

cmake で C言語用のビルドができる環境であれば、以下の手順でインストールできると思います(Arch Linux で確認しています).

```
$ git clone https://github.com/hankei6km/fcitx-at-esc.git
$ cd fcitx-at-esc
$ cmake -DCMAKE_INSTALL_PREFIX=/usr .
$ sudo make install
```

## Usage

@esc が有効な状態で日本語入力を行っているとき、`esc` を押下することで IME がオフ(disabel) になります.
なお、変換途中の文字ある場合の `esc` の押下については、
後述の設定によって変化します
(デフォルトでは、`esc` の押下は IME 側で処理されます).

## Configuration

Fcitx の設定パネルから「アドオン」タブを開き「@esc」項目を選択すると、以下の項目を設定できます.

### 有効化(デフォルト値はオン)

@esc の機能の有効化/無効化を切り替えます.
なお、この項目は挙動を変更するだけで、addon 自体の有効化/無効化には反映されません.

### 強制的にIMEをオフ(デフォルト値はオフ)

この項目をオンにしていると、「変換入力中か?」といった状態に関係なく IME をオフにします.
変換途中の未確定文字の扱いについては、後述の「未確定文字をコミットする」項目の設定に依存します.

なお、この項目をオンにしていると
IME に対しての `esc` 押下による操作が行えなくなります.
これについては、IME の設定等で他のキーに `esc` 相当の機能を割り当てる、
といった回避方法が考えられます.

### 未確定文字をコミットする(デフォルト値はオフ)

上記の「強制的にIMEをオフ」と、この項目をオンにしていると、
`esc` 押下時に未確定の文字があればコミット(確定)します.
なお、チェックを外しても IME や Fcitx の設定によってはコミットされるかもしれません.

この項目がオンの時の挙動が少しわかりにくいのですが、
例えば Vim 上で変換入力している場合に `esc` を押下すると「未確定文字がコミット(確定)され IME はオフになり、Vim はNORMAL モードに切り替わる」といった動作となります.

### 有効化/無効化の切り替え(デフォルト値は空)

@esc の機能の有効化と無効化を切り替えるホットキーを指定できます.

## Known Issues

現状では mozc との組み合わせのみで利用しているので、他の IME との組み合わせについては殆ど動作確認していません.
skk との組み合わせでは以下のような不具合がわかっています.

* @esc から未確定文字をコミット(確定)すると、`` 等もコミットされてしまう.

## License

Copyright (c) 2018 hankei6km

Licensed under the MIT License. See LICENSE.txt in the project root.
5 changes: 5 additions & 0 deletions po/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set(PO_LANGS ja)
foreach(lang ${PO_LANGS})
fcitx_translate_add_po_file("${lang}" "${lang}.po")
endforeach()
fcitx_translate_set_pot_target(pot fcitx-at-esc fcitx-at-esc.pot)
47 changes: 47 additions & 0 deletions po/fcitx-at-esc.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2018-02-19 23:33+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: LANG\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: src/fcitx-at-esc.conf.in:3
msgid "@esc"
msgstr ""

#: src/fcitx-at-esc.conf.in:4
msgid "Hook esc key to disable IME for Vim like key bind."
msgstr ""

#: src/fcitx-at-esc.desc:1 src/fcitx-at-esc.desc:6 src/fcitx-at-esc.desc:11
#: src/fcitx-at-esc.desc:16
msgid "Basic"
msgstr ""

#: src/fcitx-at-esc.desc:4
msgid "Enabled"
msgstr ""

#: src/fcitx-at-esc.desc:9
msgid "Force disable IME"
msgstr ""

#: src/fcitx-at-esc.desc:14
msgid "Commit preedit text"
msgstr ""

#: src/fcitx-at-esc.desc:19
msgid "Toggle for enable or disable"
msgstr ""
47 changes: 47 additions & 0 deletions po/ja.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Japanese translations for PACKAGE package.
# Copyright (C) 2018 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# Automatically generated, 2018.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2018-02-19 23:33+0900\n"
"PO-Revision-Date: 2018-02-18 18:41+0900\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: ja\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"

#: src/fcitx-at-esc.conf.in:3
msgid "@esc"
msgstr ""

#: src/fcitx-at-esc.desc:1 src/fcitx-at-esc.desc:6 src/fcitx-at-esc.desc:11
#: src/fcitx-at-esc.desc:16
msgid "Basic"
msgstr "基本"

#: src/fcitx-at-esc.desc:14
msgid "Commit preedit text"
msgstr "未確定文字をコミットする"

#: src/fcitx-at-esc.desc:4
msgid "Enabled"
msgstr "有効化"

#: src/fcitx-at-esc.desc:9
msgid "Force disable IME"
msgstr "強制的にIMEをオフ"

#: src/fcitx-at-esc.conf.in:4
msgid "Hook esc key to disable IME for Vim like key bind."
msgstr "Vim ライクなキーバインド用に、esc キーをフックし IME を disable させる"

#: src/fcitx-at-esc.desc:19
msgid "Toggle for enable or disable"
msgstr "有効化/無効化の切り替え"
10 changes: 10 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
include_directories(${PROJECT_SOURCE_DIR}/src)
# include_directories(${LIBSKK_INCLUDE_DIRS})
# link_directories(${LIBSKK_LIBRARY_DIRS})

set(FCITX_AT_ESC_SOURCES
at-esc.c
)
fcitx_add_addon_full(at-esc DESC
HEADERS at-esc.h
SOURCES ${FCITX_AT_ESC_SOURCES})
Loading

0 comments on commit 8348d36

Please sign in to comment.