当前位置:网站首页>Development and application of fcitx functional plug-ins
Development and application of fcitx functional plug-ins
2022-07-03 23:50:00 【Manon Feifei】
Fcitx Add plug-ins to the framework
Fcitx Plug ins can be divided into four categories :
1.Frontend
2.Input Method
3.Module
4.User Interface
Frontend The plug-in is responsible for the interface key message and passing the message to Fcitx frame ,
InputMethod Plug ins are responsible for converting keyboard input into their language information , That is, the core module of input method
Module It is a general module , Various functions can be realized by registering hooks
User interface The module is responsible for displaying various UI Elements
If the plug-in needs a configuration file , The plug-in should first provide a configuration description file , The name of the file should be the same as that of the plug-in . If the plug-in needs a series of sub configuration files , Or text files , The description file of the plug-in should contain SubConfig Field is used to match various file names .
The format of the plug-in description file is as follows :
[Addon]
Name=fcitx-table
_GeneralName=Table
_Comment=Table Input Method for Fcitx
Category=InputMethod
Enabled=True
Library=fcitx-table.so
Type=SharedLibrary
Dependency=fcitx-pinyin,fcitx-punc
SubConfig=Table:configfile:table/*.conf:table.desc,fcitx:domain
fcitx-table The plug-in has multiple configuration files , The format of the sub configuration is as follows :
SuConfig=SubConfig1,SubConfig2,...
The definition format of each sub configuration is as follows :
Name:type:description
The current configuration type can be :configfile, native,domain
native Format configuration file defines a simple text file name in the description , File names do not support fuzzy matching characters .
configfile The profile name described in the profile description of format supports fuzzy matching symbols
domian The format configuration file defines the text translation of the module .
configfile and natvie The names of are translatable , The corresponding translation content should be configured in domain In the sub configuration of .
How to achieve fcitx Of user interface modular
If there is no special need , Actually fcitx It is not recommended to realize a brand new user interface Modular , Because of the existing fcitx There are already three in the framework User Interface Module . Namely :
1.fcitx-classic-ui
2. be based on DBus Of fcitx-kimpanel-ui
3.fcitx-light-ui
To implement the new user interface module , It is best to use with kimpanel Compatible protocols , Do not modify fcitx Agreement of .
In the custom User Interface In the plug-in, we first need to define the interfaces of the plug-in :
// Define the name of the plug-in , Field , And type
// The name is feifei_ui, The field is ui field , The type is FcitxUI
FCITX_DEFINE_PLUGIN(feifei_ui, ui, FcitxUI) = {
FeifeiUICreate, //UI Built callback function
FeifeiUICloseInputWindow, // Close the callback of the input window
FeifeiUIShowInputWindow, // Display the callback of the input window
FeifeiUIMoveInputWindow, // Move the callback of the input window
FeifeiUIUpdateStatus, // to update UI Status callback
FeifeiUIRegisterStatus, // register UI Status callback
FeifeiUIRegisterMenu, // register UI Menu callback
FeifeiUIOnInputFocus, // Callback to get focus
FeifeiUIOnInputUnFocus, // A callback that loses focus
FeifeiUIOnTriggerOn, // Activated callback
FeifeiUIOnTriggerOff, // Closed callback
NULL, // Show message callback ( Ban )
FeifeiUIMainWindowSizeHint, // Get the callback of the main window size
ReloadConfigFeifeiUI, // Reload the configured callback
FeifeiUISuspend, // Pause the callback of switching
FeifeiUIResume, // Callback to resume from pause
NULL, // The destruction user interface The callback
FeifeiUIRegisterComplexStatus, // Register complex status
FeifeiUIUpdateComplexStatus, // Update complex status
FeifeiUIUnRegisterMenu, // Registration menu
};
stay CMakeLists.txt Through the file fcitx_addon_full Interface to declare the information of the plug-in
fcitx_add_addon_full(feifei-ui DESC SCAN SCAN_PRIV ${kimpanel_noinstall}
HEADER_DIR feifeiui
FXADDON_SRC fcitx-feifeiui.fxaddon
FXADDON_GEN fcitx-feifeiui.h
SOURCES ${FEIFEI_KIMPANEL_UI_SOURCES}
HEADERS feifeiinterface.h
LINK_LIBS ${FEIFEI_KIMPANEL_LINK_LIBS}
EXTRA_DESC skin.desc
EXTRA_PO fcitx-skin-installer.desktop.in fcitx-skin-installer.sh)
//DESC Parameter determines the of installing the plug-in desc file , With desc The path of the configuration file with suffix ,
// adopt DESC_SRC To make sure
//SCAN Parameter generation API The header file , The name of the generated header file is passed FXADDON_GEN Parameters to determine
// The path of the input file passes FXADDON_SRC Parameters to determine ,
//SCAN_PRIV Generate the added function header file , The path of the input file passes FXADDON_SRC Parameters to determine ,
// The generated header file passes ADDFUNCTIONS_GEN Parameter determination
//NO_INSTALL Do not install any files when the module is disabled , Nor compile any resources , But what needs to be produced
// The header file
//SCAN_IN adopt .in File generation api The header file ,fxaddon.in The path of the file passes FXADDON_SRC Parameters
// To make sure . The name of the generated header file passes through the parameter FXADDON_GEN To make sure
//HEADR_DIR fcitx/module A subdirectory under a directory , The header file of the plug-in will be installed in this directory
//LIB_NAME: The binary name of the plug-in defaults to (fcitx_${short_name})
//CONF_SRC: plug-in unit conf Path to file ( No, .in suffix ), The default is fxitx-${short_name}.desc
//DESC_SRC: plug-in unit desc The path to the configuration file
//UNIQUE_NAME: Unique name of the plug-in , The default is fcitx-${short_name}
/******** The following are multivalued parameters ******/
//SOURCES: The plug-in needs to compile the source file
//HEADER: The plug-in needs to install the header file ( The generated parameters are not included )
//EXTRA_DESC: Additional DESC Parameters
//EXTRA_PO: Additional files for browsing string translations
//EXTRA_LIBS Additional library files you need to rely on
//DEPENDS: Some other files that the plug-in needs to rely on
//IM_CONFIG: IME profile
边栏推荐
- Iclr2022: how does AI recognize "things I haven't seen"?
- Pytorch learning notes 5: model creation
- Enter MySQL in docker container by command under Linux
- Zipper table in data warehouse (compressed storage)
- Alibaba cloud container service differentiation SLO hybrid technology practice
- Interesting 10 CMD commands
- Common mode interference of EMC
- Selenium library 4.5.0 keyword explanation (4)
- D24:divisor and multiple (divisor and multiple, translation + solution)
- [note] glide process and source code analysis
猜你喜欢
Amway by head has this project management tool to improve productivity in a straight line
2022 chemical automation control instrument examination content and chemical automation control instrument simulation examination
Briefly understand the operation mode of developing NFT platform
How to write a good title of 10w+?
[note] IPC traditional interprocess communication and binder interprocess communication principle
[Happy Valentine's day] "I still like you very much, like sin ² a+cos ² A consistent "(white code in the attached table)
Kubedl hostnetwork: accelerating the efficiency of distributed training communication
It is the most difficult to teach AI to play iron fist frame by frame. Now arcade game lovers have something
Fluent learning (4) listview
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
随机推荐
股票开户最低佣金炒股开户免费,网上开户安全吗
NPM script
Iclr2022: how does AI recognize "things I haven't seen"?
[source code] VB6 chat robot
P1629 postman delivering letter
C # basic knowledge (3)
[note] IPC traditional interprocess communication and binder interprocess communication principle
Yyds dry goods inventory three JS source code interpretation - getobjectbyproperty method
Kubedl hostnetwork: accelerating the efficiency of distributed training communication
P3371 [template] single source shortest path (weakened version)
Introducing Software Testing
Les sociétés de valeurs mobilières dont la Commission d'ouverture d'un compte d'actions est la plus faible ont ce que tout le monde recommande.
The first game of the new year, many bug awards submitted
It is the most difficult to teach AI to play iron fist frame by frame. Now arcade game lovers have something
[MySQL] sql99 syntax to realize multi table query
Gossip about redis source code 74
Pytorch learning notes 5: model creation
Gossip about redis source code 83
EPF: a fuzzy testing framework for network protocols based on evolution, protocol awareness and coverage guidance
Fudan 961 review