Add mozc to type in japanese

This commit is contained in:
2023-02-28 01:30:29 +09:00
parent c7386f662a
commit 89ddcc90c0
13 changed files with 140 additions and 17 deletions
+1
View File
@@ -117,6 +117,7 @@
git.enable = true;
nvim.enable = true;
direnv.enable = true;
fcitx5.enable = true;
};
};
};
+1
View File
@@ -8,6 +8,7 @@
./git
./nvim
./direnv
./fcitx5
];
home.stateVersion = "22.11";
+1 -1
View File
@@ -2,7 +2,7 @@
(defpoll percent :interval "1s" "./bar/battery/get-battery.sh percent")
(defwidget battery []
(box :class "battery module floating"
(box :class "battery module floating ${percent < 18 ? "red" : ""}"
:spacing 6
(label :valign "center" :class "icon" :text "${icon}")
(label :valign "center" :class "percent" :text "${percent}%"))
+2
View File
@@ -3,6 +3,7 @@
(include "./bar/window/eww.yuck")
(include "./bar/notification/eww.yuck")
(include "./bar/battery/eww.yuck")
(include "./bar/language/eww.yuck")
(include "./bar/clock.yuck")
(defwidget left []
@@ -19,6 +20,7 @@
:halign "end"
(notification)
(battery)
(language)
(date)
(clock)
))
+8
View File
@@ -0,0 +1,8 @@
(defpoll lang :interval "1s" "./bar/language/language.sh")
(defwidget language []
(box :class "module floating"
:spacing 6
(label :valign "center" :class "icon" :text "")
(label :valign "center" :class "percent" :text "${lang}")))
+59
View File
@@ -0,0 +1,59 @@
#!/usr/bin/env bash
IMLIST_FILE="/tmp/fcitx5-imlist"
# Print out identifier of current input method
current() {
dbus-send --session --print-reply \
--dest=org.fcitx.Fcitx5 \
/controller \
org.fcitx.Fcitx.Controller1.CurrentInputMethod \
| grep -Po '(?<=")[^"]+'
}
# List all input methods added to Fcitx
imlist() {
if [ ! -f "${IMLIST_FILE}" ]; then
dbus-send --session --print-reply --dest=org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.AvailableInputMethods \
| awk 'BEGIN{i=0}{
if($0~/struct {/) i=0;
else if(i<6){gsub(/"/,"",$2); printf("%s,",$2); i++}
else if(i==6){printf("%s\n",$2); i++}
}' > ${IMLIST_FILE}
# Output like this:
# pinyin, 拼音, 拼音, fcitx-pinyin, 拼, zh_CN, true
# rime, 中州韻, , fcitx-rime, ㄓ, zh, true
# ......
fi
cat ${IMLIST_FILE}
}
# This script wait for events from `watch` and
# update the text by printing a new line.
#
# Strip `Keyboard - ` part from IM name then print
print_pretty_name() {
name=$(imlist | grep "^$(current)," | cut -d',' -f5)
if [[ -z "$name" ]]; then
return
fi
echo "${name}"
}
react() {
print_pretty_name
# Track input method changes. Each new line read is an event fired from IM switch
while true; do
# When read someting from dbus-monitor
read -r unused
print_pretty_name
done
}
# Watch for events from Fcitx.
# Need --line-buffered to avoid messages being hold in buffer
# dbus-monitor --session destination=org.freedesktop.IBus | grep --line-buffered '65505\|65509' | react
# Dbus watching does not seems to work so /shrug
print_pretty_name
+4 -3
View File
@@ -1,4 +1,6 @@
@import 'colors';
@import "bar/eww";
@import "panel/scss/_init.scss";
* {
all: unset;
@@ -23,7 +25,8 @@
}
.red {
background-color: $base0E;
background-color: $base08;
color: $base02;
}
.red-txt {
color: $base0E;
@@ -44,5 +47,3 @@
}
@import "bar/eww";
@import "panel/scss/_init.scss";
+49
View File
@@ -0,0 +1,49 @@
{
lib,
config,
pkgs,
...
}:
with lib; let
cfg = config.modules.fcitx5;
in {
options.modules.fcitx5 = {enable = mkEnableOption "fcitx5";};
config = mkIf cfg.enable {
i18n = {
inputMethod = {
enabled = "fcitx5";
fcitx5.addons = with pkgs; [
fcitx5-mozc
];
};
};
xdg.configFile."fcitx5/config".text = ''
[Hotkey/TriggerKeys]
0=Super+N
[Behavior]
ShowInputMethodInformation=False
CompactInputMethodInformation=False
ShowFirstInputMethodInformation=False
'';
xdg.configFile."fcitx5/profile".text = ''
[Groups/0]
Name=Default
Default Layout=us
DefaultIM=mozc
[Groups/0/Items/0]
Name=keyboard-us
Layout=
[Groups/0/Items/1]
Name=mozc
Layout=
[GroupOrder]
0=Default
'';
};
}
+1 -1
View File
@@ -2,7 +2,7 @@ exec-once=xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL
exec-once=discord
exec-once=eww open bar
exec-once=fusuma -c /home/zoriya/.config/fusuma/config.yaml
exec-once=swayidle -w timeout 600 lock before-sleep lock
exec-once=swayidle -w timeout 1200 lock before-sleep lock
exec-once=/home/zoriya/.config/hypr/wallpaper.sh init
exec-once=kitty --class=scratchpad
+7 -4
View File
@@ -1,10 +1,13 @@
export GDK_SCALE=2
export XCURSOR_SIZE=24
export GTK_IM_MODULE=ibus
export QT_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export SDL_IM_MODULE=ibus
export INPUT_METHOD=fcitx
export QT_IM_MODULE=fcitx
export GTK_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
export XIM_SERVERS=fcitx
export GLFW_IM_MODULE=ibus
fcitx5 -d
exec Hyprland
+4
View File
@@ -16,3 +16,7 @@ nixify()
fi
direnv allow
}
(whence -w run-help | grep -q alias) && unalias run-help
autoload run-help
+2 -1
View File
@@ -56,8 +56,9 @@ in {
s = "git status";
op = "xdg-open";
wp = "~/.config/hypr/wallpaper.sh";
py = "nix-shell -p python3";
py = "nix-shell -p python3 --command python3";
jctl = "sudo journalctl -n 1000 -fu";
where = "where -s"; # Follow symlinks
};
plugins = [
+1 -7
View File
@@ -40,12 +40,6 @@ in {
};
};
};
i18n = {
defaultLocale = "en_US.UTF-8";
inputMethod = {
enabled = "ibus";
ibus.engines = with pkgs.ibus-engines; [ mozc ];
};
};
i18n.defaultLocale = "en_US.UTF-8";
};
}