「Fcitx」- 皮肤制作

  CREATED BY JENKINSBOT

​皮肤的安装路径

Fcitx自带的皮肤位于/usr/share/fcitx/skin中,每个皮肤都在独自的文件夹中,其中文件夹名为皮肤名。通过观察文件夹的内容得知自定义皮肤并不复杂。用户自定义的皮肤放在$HOME/.config/fcitx/skin目录中

如何自定义一个皮肤?

自定义皮肤并不复杂。皮肤由三部分组成:

  • 在皮肤的安装路径中,创建一个目录,目录名为皮肤名;
  • 文件夹中放入若干张图片,图片会在配置文件中使用,用于界面使用;
  • 再在文件夹中创建一个fcitx_skin.conf文件,用于配制输入法的各个部分(悬浮窗、输入栏、状态栏等)的样式;

所以,自定义皮肤的关键在于如何配置fcitx_skin.conf文件,然而并没有找到什么相关的官方手册对皮肤的自定义进行说明,本文大多数内容都是网上收集整理的。

如何配置fcitx_skin.conf文件?

该文件的格式是典型的INI风格的配置文件。

配置该文件有两种方式:

  • 手动修改fcitx_skin.conf配置文件;
  • 使用fcitx-config-gtk工具;

手动配置不再介绍,有关配置文件中的选项及含义参考本文的「配置文件选项」部分。本文主要介绍使用 fcitx-config-gtk 工具,配置文件的选项在该工具中都是可以进行直接配置的(我只是这么猜,并没有一个一个的比对)。

使用fcitx-config-gtk配置皮肤

运行fcitx-config-gtk,启动配置工具,在「Appearance」 > 「Other」 > 「选中某个皮肤」 > 「点击配置(齿轮+扳手那个按钮)」,如图:

配置可分为以下七个部分:

信息([SkinInfo])

配置皮肤的版本及作者信息;

字体([SkinFont])

对各个部分的「字体」进行配置;

主菜单栏([SkinMainBar])

对输入法的「悬浮窗」进行配置;

输入栏([SkinInputBar])

「候选词窗口」的样式;

托盘图标([SkinTrayIcon])

对「系统托盘图标」进行配置;

菜单([SkinMenu])

输入法「右键菜单」的样式设置;

屏幕键盘([SkinKeyboard])

对「屏幕键盘」进行配置;

配置文件选项

配置文件中的选项(我并没有找到相关的官方文档对皮肤自定义进行说明)

[SkinInfo]
# Skin Name
Name=mDark
# Skin Version
Version=0.8
# Skin Author
Author=M-Mark
# Description of Skin
Desc=Dark

[SkinFont]
# Input Font Size
FontSize=13
# Menu Font Size
MenuFontSize=13
# Font sizes respect dpi setting
# Available Value:
# True False
RespectDPI=True
# Tip Message Color
TipColor=162 181 255
# Input Message Color
InputColor=220 220 220
# Candidate Index Color
IndexColor=180 180 180
# First Candidate Color
FirstCandColor=118 147 255
# User Phrase Color
UserPhraseColor=255 255 143
# Table Code Color
CodeColor=255 255 255
# Other Color
OtherColor=220 220 220
# Active Menu Item Character Color
ActiveMenuColor=255 255 255
# Inactive Menu Item Character Color
InactiveMenuColor=255 255 255

[SkinMainBar]
# Background Image
BackImg=bar.png
# Logo Icon
Logo=logo.png
# English Mode Icon
Eng=en.png
# Active Mode Icon
Active=cn.png
# Resize Margin Left
MarginLeft=8
# Resize Margin Right
MarginRight=8
# Resize Margin Top
MarginTop=8
# Resize Margin Bottom
MarginBottom=8
# Margin Left for clickable region
#ClickMarginLeft=0
# Margin Right for clickable region
#ClickMarginRight=0
# Margin Top for clickable region
#ClickMarginTop=0
# Margin Bottom for clickable region
#ClickMarginBottom=0
# Overlay image
#Overlay=
# Overlay dock position
# Available Value:
# TopLeft
# TopCenter
# TopRight
# CenterLeft
# Center
# CenterRight
# BottomLeft
# BottomCenter
# BottomRight
#OverlayDock=TopLeft
# Overlay X offset
#OverlayOffsetX=0
# Overlay Y offset
#OverlayOffsetY=0
# Fill Background Vertical rule
# Available Value:
# Copy
# Resize
#FillVertical=Resize
# Fill Background Horizontal rule
# Available Value:
# Copy
# Resize
#FillHorizontal=Resize
# Use Custom text icon color
# Available Value:
# True False
#UseCustomTextIconColor=False
# Active Text Icon Color
#ActiveTextIconColor=0 0 0
# Inactive Text Icon Color
#InactiveTextIconColor=0 0 0
# Special Icon position
#Placement=

[SkinInputBar]
# Background Image
BackImg=input.png
# Resize Margin Left
MarginLeft=10
# Resize Margin Right
MarginRight=10
# Resize Margin Top
MarginTop=10
# Resize Margin Bottom
MarginBottom=10
# Margin Left for clickable region
#ClickMarginLeft=0
# Margin Right for clickable region
#ClickMarginRight=0
# Margin Top for clickable region
#ClickMarginTop=0
# Margin Bottom for clickable region
#ClickMarginBottom=0
# Overlay image
#Overlay=
# Overlay dock position
# Available Value:
# TopLeft
# TopCenter
# TopRight
# CenterLeft
# Center
# CenterRight
# BottomLeft
# BottomCenter
# BottomRight
#OverlayDock=TopLeft
# Overlay X offset
#OverlayOffsetX=0
# Overlay Y offset
#OverlayOffsetY=0
# Color of Cursor
CursorColor=255 255 255
# Position or offset of Preedit
InputPos=0
# Position or offset of LookupTable
OutputPos=0
# Prev Page Icon
BackArrow=prev.png
# Next Page Icon
ForwardArrow=next.png
# Prev Page Icon
BackArrowX=25
# Next Page Icon
BackArrowY=10
# Prev Page Icon
ForwardArrowX=15
# Next Page Icon
ForwardArrowY=10
# Fill Background Vertical rule
# Available Value:
# Copy
# Resize
#FillVertical=Resize
# Fill Background Horizontal rule
# Available Value:
# Copy
# Resize
#FillHorizontal=Resize

[SkinTrayIcon]
# Active Tray Icon
Active=active.png
# Inctive Tray Icon
Inactive=inactive.png

[SkinMenu]
# Background Image
BackImg=menu.png
# Resize Margin Top
MarginTop=8
# Resize Margin Bottom
MarginBottom=8
# Resize Margin Left
MarginLeft=8
# Resize Margin Right
MarginRight=8
# Margin Left for clickable region
#ClickMarginLeft=0
# Margin Right for clickable region
#ClickMarginRight=0
# Margin Top for clickable region
#ClickMarginTop=0
# Margin Bottom for clickable region
#ClickMarginBottom=0
# Overlay image
#Overlay=
# Overlay dock position
# Available Value:
# TopLeft
# TopCenter
# TopRight
# CenterLeft
# Center
# CenterRight
# BottomLeft
# BottomCenter
# BottomRight
#OverlayDock=TopLeft
# Overlay X offset
#OverlayOffsetX=0
# Overlay Y offset
#OverlayOffsetY=0
# Active Menu Color
ActiveColor=50 87 244
# Space Line Color
LineColor=204 204 204
# Fill Background Vertical rule
# Available Value:
# Copy
# Resize
#FillVertical=Resize
# Fill Background Horizontal rule
# Available Value:
# Copy
# Resize
#FillHorizontal=Resize

[SkinKeyboard]
# Virtual Keyboard Image
#BackImg=keyboard.png
# Key Color On Virutal Keyboard
KeyColor=255 255 255

其他内容

拼音输入法图标位置:/usr/share/fcitx/imicon/
可以创建$HOME/.config/fcitx/imicon目录,修改图标,对原有的图标进行覆盖;

参考文献

fcitx皮肤制作教程写完了,有兴趣的来看看吧!:http://tieba.baidu.com/p/2995553638