1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

日本語句読点「。と、」「.と,」の切り替え

1
Posted at

はじめに

日本語文書を作成を作成する際、目的に応じて「。と、」と「.と,」のどちらを使用するかを切り替えたい場面があります。

Raycastの Script Commands を利用すれば、1動作で日本語入力システム (IME) の設定を切り替えられます。

Code

RaycastのSettings (cmd + , ) → Extensions → Scripts で、Add Directories から Script Directories にRaycast用のScript Directoriesを追加します。

スクリーンショット 2026-01-04 19.35.49.jpg

以下のコードをScript Directoriesに保存します。

jp_comma_period.sh
#!/bin/bash

# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Toggle Japanese IME Punctuation
# @raycast.mode silent
# @raycast.packageName Input
#
# Optional parameters:
# @raycast.icon ⌨️
# @raycast.description Toggle Kotoeri punctuation between 「、。」 and 「, .」
#
# Documentation:
# @raycast.author zerollpaper

DOMAIN="com.apple.inputmethod.Kotoeri"
KEY="JIMPrefPunctuationTypeKey"

current=$(defaults read "$DOMAIN" "$KEY" 2>/dev/null)
[[ -z "$current" ]] && current=0

if [[ "$current" -eq 0 ]]; then
  next=3
  msg="日本語IMEの句読点 → , ."
else
  next=0
  msg="日本語IMEの句読点 → 、。"
fi

defaults write "$DOMAIN" "$KEY" -int "$next"

killall -HUP JapaneseIM-RomajiTyping 2>/dev/null || true
killall -HUP JapaneseIM 2>/dev/null || true

echo "$msg"

句読点切り替え用の Hotkey を登録します。

スクリーンショット 2026-01-04 19.43.35.jpg

おわりに

自分で登録した Hotkeyを使用して日本語句読点の出力を切り替えるスクリプトを紹介しました。
Mac標準搭載の日本語入力システムKotoeriを前提にしています。
ご自身の環境に応じて以下の内容を変更して使用してください。

DOMAIN="com.apple.inputmethod.Kotoeri"
KEY="JIMPrefPunctuationTypeKey"
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?