migration
This commit is contained in:
27
hyprland/waybar/scripts/fcitx5-monitor.sh
Executable file
27
hyprland/waybar/scripts/fcitx5-monitor.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
current_im=$(fcitx5-remote -n 2>/dev/null)
|
||||
if [[ "$current_im" == "anthy" ]]; then
|
||||
CURRENT_STATUS="JP"
|
||||
else
|
||||
CURRENT_STATUS="EN"
|
||||
fi
|
||||
|
||||
dbus-monitor --session "type='signal',interface='org.fcitx.Fcitx.InputContext1',member='CurrentIM'" 2>/dev/null | \
|
||||
while IFS= read -r line; do
|
||||
if [[ "$line" == *"member=CurrentIM"* ]]; then
|
||||
# Read the next line which contains the input method string
|
||||
read -r im_line
|
||||
if [[ "$im_line" == *"Anthy"* ]]; then
|
||||
NEW_STATUS="JP"
|
||||
else
|
||||
NEW_STATUS="EN"
|
||||
fi
|
||||
|
||||
# Only refresh if status actually changed
|
||||
if [[ "$NEW_STATUS" != "$CURRENT_STATUS" ]]; then
|
||||
sleep 0.1
|
||||
pkill -RTMIN+8 waybar
|
||||
CURRENT_STATUS="$NEW_STATUS"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
25
hyprland/waybar/scripts/fcitx5-status.sh
Executable file
25
hyprland/waybar/scripts/fcitx5-status.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
# Get current fcitx5 input method
|
||||
IM=$(fcitx5-remote -n 2>/dev/null)
|
||||
|
||||
# Check if fcitx5 is running
|
||||
if [ -z "$IM" ]; then
|
||||
echo "EN"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$IM" in
|
||||
"keyboard-us")
|
||||
echo "EN"
|
||||
;;
|
||||
"anthy")
|
||||
echo "JP"
|
||||
;;
|
||||
"mozc-jp")
|
||||
echo "JP"
|
||||
;;
|
||||
*)
|
||||
# Fallback - show first 2 characters of input method name
|
||||
echo "${IM:0:2}" | tr '[:lower:]' '[:upper:]'
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user