### size.width.percentage examples Source: https://ihsiao.com/apps/hamster/docs/guides/keyboard_skins/ Two examples showing how to set width as a percentage using the 'percentage' property. Example 1 uses a decimal (0.1) and Example 2 uses a fraction (85/375). Both represent a fraction of the total width. ```yaml ## 示例1 size: width: percentage: 0.1 ## 示例2 size: width: percentage: 85/375 ``` -------------------------------- ### keySounds full configuration examples Source: https://ihsiao.com/apps/hamster/docs/guides/keyboard_skins/ Complete keySounds configuration for two file locations: light/resources and dark/resources directories, and the sounds directory. ```yaml # 按键音设置,文件位置在 light/resources 与 dark/resources 目录下 keySounds: - inputKeySound: "input.aiff" - deleteKeySound: "delete.aiff" - systemKeySound: "system.aiff" - { action: space, url: "beezlefm.wav" } # 按键音设置,文件位置在 sounds 目录下 keySounds: - inputKeySound: "sounds/input.aiff" - deleteKeySound: "sounds/delete.aiff" - systemKeySound: "sounds/system.aiff" - { action: space, url: "sounds/beezlefm.wav" } ``` -------------------------------- ### center x and y adjustment example Source: https://ihsiao.com/apps/hamster/docs/guides/keyboard_skins/ Example of adjusting both x and y ratios to move a view right and down. ```yaml center: x: 0.75 y: 0.6 ``` -------------------------------- ### candidateContextMenu example Source: https://ihsiao.com/apps/hamster/docs/guides/keyboard_skins/ Example configuration for candidateContextMenu, defining a custom menu item named '测试删除' that sends the 'Shift+Delete' key combination. ```yaml toolbar: ... candidateContextMenu: candidateContextMenu candidateContextMenu: - name: "测试删除" action: { sendKeys: "Shift+Delete" } ``` -------------------------------- ### keySounds inputKeySound example Source: https://ihsiao.com/apps/hamster/docs/guides/keyboard_skins/ Sets a sound for input keys using the inputKeySound key. ```yaml inputKeySound: "input.aiff" ``` -------------------------------- ### keySounds action example Source: https://ihsiao.com/apps/hamster/docs/guides/keyboard_skins/ Sets a sound for a specific action using the action and url keys. ```yaml { action: space, url: "beezlefm.wav" } ``` -------------------------------- ### Image-based background style example Source: https://ihsiao.com/apps/hamster/docs/guides/keyboard_skins/ Example of a background style using images, with normalImage, highlightImage, and an optional animation reference. ```yaml # 字母按键背景样式 alphabeticBackgroundStyle: normalImage: file: anjian image: image1 highlightImage: file: anjian image: image2 animation: alphabeticBackgroundAnimation ``` -------------------------------- ### center y adjustment example Source: https://ihsiao.com/apps/hamster/docs/guides/keyboard_skins/ Example of adjusting the center y ratio to 0.6 to move a view downward. ```yaml center: y: 0.6 ``` -------------------------------- ### Native property-based background style example Source: https://ihsiao.com/apps/hamster/docs/guides/keyboard_skins/ Example of a background style using native properties (type: original) with insets, colors, corner radius, lower edge colors, and an animation reference. ```yaml alphabeticBackgroundStyle: type: original insets: { top: 6, left: 3, bottom: 6, right: 3 } normalColor: FFFFFF highlightColor: ABB0BA cornerRadius: 5 normalLowerEdgeColor: 88898D highlightLowerEdgeColor: 89898B animation: alphabeticBackgroundAnimation ``` -------------------------------- ### targetScale object example Source: https://ihsiao.com/apps/hamster/docs/guides/keyboard_skins/ Shows how to set targetScale as an object to scale width and height independently. Here, width is scaled to 0.8 and height to 0.75. ```yaml targetScale: x: 0.8 y: 0.75 ``` -------------------------------- ### RIME 同步配置 installation.yaml 示例 Source: https://ihsiao.com/apps/hamster/docs/guides/sync/ 在 Rime 目录下的 installation.yaml 文件中增加此配置,用于设置设备标识和 iCloud 同步路径。installation_id 用于区分设备,sync_dir 必须使用仓在 iCloud 上的固定路径前缀。 ```yaml installation_id: "hamster_6s" sync_dir: "/private/var/mobile/Library/Mobile Documents/iCloud~dev~fuxiao~app~hamsterapp/Documents/sync" ``` -------------------------------- ### 屏蔽中文九宫格按键划动:hamster.custom.yaml 配置 Source: https://ihsiao.com/apps/hamster/docs/guides/questions/ 通过新增 hamster.custom.yaml 文件并配置 patch 下的 swipe/keyboardSwipe/+ 来屏蔽中文九宫格按键的划动。若已有该文件,可将 patch 以下内容(不含 patch,注意缩进)添加到现有配置中。配置后需上传至 Rime 目录并运行「重新部署」。 ```yaml patch: swipe/keyboardSwipe/+: chineseNineGrid: keys: [] ``` -------------------------------- ### rimeSchema example Source: https://ihsiao.com/apps/hamster/docs/guides/keyboard_skins/ Binds a RIME input schema to the current layout using its ID. ```yaml rimeSchema: "double_pinyin_flypy" ``` -------------------------------- ### 自定义键盘配置文件示例 Source: https://ihsiao.com/apps/hamster/docs/guides/custom_keyboard/ 在 SharedSupport/hamster.yaml 文件中,通过 __include 指令导入 hamster_keyboards.yaml 文件中的 keyboards 节点。 ```yaml keyboards: __include: hamster_keyboards:/keyboards ``` -------------------------------- ### Example 1: backgroundStyle using JavaScript Source: https://ihsiao.com/apps/hamster/docs/guides/keyboard_skins/ Shows how to set backgroundStyle with a JavaScript function that returns a style name based on the return key type. The function getText uses $getReturnKeyType() and returns either 'blueSystemButtonBackgroundStyle' or 'systemButtonBackgroundStyle'. The snippet also includes the definitions of these two background styles. ```yaml backgroundStyle: |- // JavaScript function getText() { let type = $getReturnKeyType(); if (type === 1 || type === 4) { return "blueSystemButtonBackgroundStyle"; } return "systemButtonBackgroundStyle"; } ## 系统按键背景样式 systemButtonBackgroundStyle: normalImage: file: anjian image: image2 highlightImage: file: anjian image: image1 ## 系统按键背景样式 blueSystemButtonBackgroundStyle: normalImage: file: anjian image: image3 highlightImage: file: anjian image: image1 ``` -------------------------------- ### 自定义中文九宫格按键划动与长按:hamster.custom.yaml 配置 Source: https://ihsiao.com/apps/hamster/docs/guides/questions/ 通过 hamster.custom.yaml 配置 chineseNineGrid 下各按键的 swipe 和 callout 动作,实现自定义划动与长按。若已有该文件,可将 patch 以下内容(不含 patch,注意缩进)添加到现有配置中。配置后需上传至 Rime 目录并运行「重新部署」。 ```yaml patch: swipe/keyboardSwipe/+: chineseNineGrid: keys: - action: { chineseNineGrid: { symbol: { char: "@/." } } } # 自定义滑动设置 swipe: - direction: up action: { symbol: { char: "1" } } # 自定义长按设置 callout: - action: { symbol: { char: ".com" } } label: "com" - action: { chineseNineGrid: { symbol: { char: "ABC" } } } swipe: - direction: up action: { symbol: { char: "2" } } - action: { chineseNineGrid: { symbol: { char: "DEF" } } } swipe: - direction: up action: { symbol: { char: "3" } } - action: { chineseNineGrid: { symbol: { char: "GHI" } } } swipe: - direction: up action: { symbol: { char: "4" } } - action: { chineseNineGrid: { symbol: { char: "JKL" } } } swipe: - direction: up action: { symbol: { char: "5" } } - action: { chineseNineGrid: { symbol: { char: "MNO" } } } swipe: - direction: up action: { symbol: { char: "6" } } - action: { chineseNineGrid: { symbol: { char: "PQRS" } } } swipe: - direction: up action: { symbol: { char: "7" } } - action: { chineseNineGrid: { symbol: { char: "TUV" } } } swipe: - direction: up action: { symbol: { char: "8" } } - action: { chineseNineGrid: { symbol: { char: "WXYZ" } } } swipe: - direction: up action: { symbol: { char: "9" } } - action: space swipe: - direction: up action: { symbol: { char: "0" } } ``` -------------------------------- ### keyboardStyle: backgroundStyle configuration Source: https://ihsiao.com/apps/hamster/docs/guides/keyboard_skins/ Sets the keyboard area background style using the `keyboardStyle` parameter. The example references a background style named `keyboardBackgroundStyle`. ```yaml keyboardStyle: backgroundStyle: keyboardBackgroundStyle ```