leap-16.0: Fix boo#1084804, boo#1246423, and boo#1246418 #1

Manually merged
anag_factory merged 4 commits from ftake/fcitx5:leap-16.0 into leap-16.0 2025-09-23 16:59:02 +02:00
4 changed files with 84 additions and 16 deletions

60
20-fcitx5-plasma-setup.sh Normal file
View File

@@ -0,0 +1,60 @@
#!/bin/sh
#
# If the virtual keyboard of Plasma Wayland has not been configured,
# configure it for this IM.
#
im_name="fcitx"
desktop_file="/usr/share/applications/org.fcitx.Fcitx5.desktop"
# Do nothing for X11 session
if [ "$XDG_SESSION_TYPE" != "wayland" ]; then
exit 0
fi
# Do nothing if kreadconfig6 is not available
if ! command -v kreadconfig6 >/dev/null 2>&1; then
exit 0
fi
# check current virtual keyboard
current_im=$(kreadconfig6 --file kwinrc --group Wayland --key InputMethod)
#
# initialize virtual keyboard if not configured yet
#
# check if $XDG_CONFIG_HOME/plasma_wayland_input_method_configured does not exist
config_dir="${XDG_CONFIG_HOME:-$HOME/.config}"
stamp_file="$config_dir/plasma_wayland_input_method_configured"
if [ ! -e "$stamp_file" ]; then
mkdir -p "$config_dir"
echo "$im_name" > "$stamp_file"
# check current virtual keyboard is None
if [ -z "$current_im" ]; then
# The virtual keyboard is not configured
echo "$0 is configuring the virtual keyboard for IBus."
current_im=$desktop_file
kwriteconfig6 --file kwinrc --group Wayland --key InputMethod $current_im
else
echo "$0 detected a virtual keyboard configured."
fi
fi
#
# export environment variables for applications running on Xwayland
#
if [ "$current_im" = "$desktop_file" ]; then
# do not override Qt IM module settings
if [ -z "$QT_IM_MODULE" ] && [ -z "$QT_IM_MODULES" ]; then
echo "$0 is setting QT_IM_MODULES for $im_name."
export QT_IM_MODULES="wayland;$im_name"
fi
# do not override xim settings
if [ -z "$XMODIFIERS" ]; then
echo "$0 is setting XMODIFIERS for $im_name."
export XMODIFIERS="@im=$im_name"
fi
fi

View File

@@ -1,11 +0,0 @@
--- fcitx5-5.1.7/data/org.fcitx.Fcitx5.desktop.in.in.org 2023-07-20 03:30:17.000000000 +0900
+++ fcitx5-5.1.7/data/org.fcitx.Fcitx5.desktop.in.in 2024-02-17 17:20:37.345816452 +0900
@@ -2,7 +2,7 @@
Name=Fcitx 5
GenericName=Input Method
Comment=Start Input Method
-Exec=@FCITX_INSTALL_BINDIR@/fcitx5
+Exec=@FCITX_INSTALL_BINDIR@/fcitx5-autostart
Icon=@FCITX_ICON_NAME@
Terminal=false
Type=Application

View File

@@ -1,3 +1,19 @@
-------------------------------------------------------------------
Mon Sep 15 13:40:18 UTC 2025 - Fuminobu Takeyama <ftake@geeko.jp>
- Add an initial setup feature for Plasma Wayland
* enables Fcitx5 as the active virtual keyboard on the first login,
allowing users to input text using Fcitx5 without manual configuration
* Fix boo#1084804, boo#1246423
-------------------------------------------------------------------
Fri Aug 15 14:15:41 UTC 2025 - Fuminobu Takeyama <ftake@geeko.jp>
- Fix Fcitx 5 not starting on Plasma Wayland
* A regression of the previous fix for boo#1246418
* Run ibus-autostart only from the desktop file for XDG autostart
* Drop fcitx5-autostart.patch
-------------------------------------------------------------------
Sun Jul 13 06:01:14 UTC 2025 - Fuminobu Takeyama <ftake@geeko.jp>

View File

@@ -34,12 +34,11 @@ Source2: https://raw.githubusercontent.com/fcitx/fcitx-artwork/master/log
Source3: xim.d-fcitx5
Source4: macros.fcitx5
Source5: fcitx5-autostart
Source6: 20-fcitx5-plasma-setup.sh
Source102: fcitx5.service
Patch1: fcitx5-gcc7.patch
Patch2: fcitx5-5.0.13-memfd.patch
Patch3: fcitx5-5.1.13-xcb.patch
# PATCH-FIX-OPENSUSE fcitx5-autostart.patch ftake@geeko.jp -- check INPUT_METHOD before launch
Patch4: fcitx5-autostart.patch
BuildRequires: cmake
BuildRequires: dbus-1-devel
BuildRequires: extra-cmake-modules
@@ -153,9 +152,9 @@ export CXX=%{_bindir}/g++-13
%install
%cmake_install
# recreate soft link
rm -rf %{buildroot}%{_sysconfdir}/xdg/autostart/org.fcitx.Fcitx5.desktop
ln -sf %{_datadir}/applications/org.fcitx.Fcitx5.desktop %{buildroot}%{_sysconfdir}/xdg/autostart/
# Run fcitx5-autostart instead of fcitx5 for /etc/xdg/autostart/org.fcitx.Fcitx5.desktop
# Note that /usr/share/applications/org.fcitx.Fcitx5.desktop executes fcitx5 directly.
sed -i 's|Exec=%{_bindir}/fcitx5|Exec=%{_bindir}/fcitx5-autostart|' %{buildroot}%{_sysconfdir}/xdg/autostart/org.fcitx.Fcitx5.desktop
# create autostart
mkdir -p %{buildroot}%{_distconfdir}/X11/xim.d/
@@ -174,6 +173,7 @@ pushd %{buildroot}%{_distconfdir}/X11/xim.d/
popd
install -m 755 %{SOURCE5} %{buildroot}%{_bindir}/fcitx5-autostart
install -D -m 0755 %{SOURCE6} %{buildroot}%{_distconfdir}/xdg/plasma-workspace/env/20-fcitx5-plasma-setup.sh
install -D -m 0644 %{SOURCE102} %{buildroot}%{_userunitdir}/fcitx5.service
# install icons
@@ -240,6 +240,9 @@ fi
%dir %{_sysconfdir}/xdg/Xwayland-session.d
%{_sysconfdir}/xdg/Xwayland-session.d/20-fcitx-x11
%{_sysconfdir}/xdg/autostart/org.fcitx.Fcitx5.desktop
%dir %{_distconfdir}/xdg/plasma-workspace
%dir %{_distconfdir}/xdg/plasma-workspace/env
%{_distconfdir}/xdg/plasma-workspace/env/20-fcitx5-plasma-setup.sh
%{_bindir}/fcitx5
%{_bindir}/fcitx5-configtool
%{_bindir}/fcitx5-remote