summarylogtreecommitdiffstats
path: root/imchooser-helper.sh
diff options
context:
space:
mode:
Diffstat (limited to 'imchooser-helper.sh')
-rw-r--r--imchooser-helper.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/imchooser-helper.sh b/imchooser-helper.sh
index 7abad7e21b66..748c9d724a81 100644
--- a/imchooser-helper.sh
+++ b/imchooser-helper.sh
@@ -1,10 +1,11 @@
#!/bin/sh
case $1 in
disable)
- sed -i 's:^Exec=fcitx-autostart$:Exec=/usr/share/imchooser/imchooser-helper fcitx:g' /etc/xdg/autostart/fcitx-autostart.desktop
+ match=$(cat /etc/xdg/autostart/fcitx-autostart.desktop | grep -o imchooser-helper)
+ [[ z$match == zimchooser-helper ]] || sed -i 's:^Exec=[^\n]*$:Exec=/usr/share/imchooser/imchooser-helper fcitx:g' /etc/xdg/autostart/fcitx-autostart.desktop
;;
enable)
- sed -i 's:^Exec=/usr/share/imchooser/imchooser-helper fcitx:Exec=fcitx-autostart:g' /etc/xdg/autostart/fcitx-autostart.desktop
+ sed -i 's:^Exec=[^\n]*$:Exec=fcitx-autostart:g' /etc/xdg/autostart/fcitx-autostart.desktop
;;
fcitx)
[[ "$XDG_SESSION_DESKTOP" == "KDE" ]] || /usr/bin/fcitx-autostart