diff --git a/README.md b/README.md index 63fa1c1..2fa6515 100644 --- a/README.md +++ b/README.md @@ -10,18 +10,23 @@ Thanks to [sarim](https://github.com/sarim/goibus) and [haunt98](https://github. * Install and setup [IBus](https://wiki.archlinux.org/title/IBus) * Install [GoVarnam](https://github.com/varnamproject/govarnam) -* Download a release from Releases +* Download the [latest release](https://github.com/varnamproject/govarnam-ibus/releases) * Extract the zip file -* Run the install script in the extracted folder (need sudo): -``` -sudo ./install.sh install -``` +* Open the extracted folder +* Now we need to run the install script + * Double click `install.sh`, and choose "Run In Terminal" + * Or for KDE, Right click, choose "Run In Konsole" + * Or right click on folder, choose "Open In Terminal", type this and press enter: + ```bash + ./install.sh + ``` +* Type your password and press enter * Restart ibus (no sudo) ```bash ibus restart ``` * Go to IBus settings, add Varnam input method. -* Maybe set an easy to use switch key to switch between languages +* Maybe set an easy to use switch key to switch between languages (Default is `Meta Key (Windows Key) + Space`) To uninstall: ``` diff --git a/install.sh.in b/install.sh.in index f6b620d..4637d65 100755 --- a/install.sh.in +++ b/install.sh.in @@ -4,35 +4,29 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -if [[ "$EUID" != 0 ]]; then - echo "Run this script as root or with sudo" - exit -fi - -if [ -z "$1" ]; then - echo "Specify install or uninstall" -else - if [ "$1" = "install" ]; then - sudo cp "$SCRIPT_DIR/varnam-ibus-engine" "@INSTALL_PREFIX@/bin/varnam-ibus-engine" - - sudo mkdir -p "@INSTALL_PREFIX@/share/varnam/ibus/icons" - sudo cp "$SCRIPT_DIR/icons/"*.png "@INSTALL_PREFIX@/share/varnam/ibus/icons/" - sudo cp "$SCRIPT_DIR/component/"*.xml "@IBUS_COMPONENT_INSTALL_LOC@" - - echo "Installation finished. Restart ibus to add new input method." - - elif [ "$1" = "uninstall" ]; then - sudo rm "@INSTALL_PREFIX@/bin/varnam-ibus-engine" - for XML in $(find "$SCRIPT_DIR/component/"*.xml -printf "%f\n"); do - sudo rm "@IBUS_COMPONENT_INSTALL_LOC@/$XML" - done - for ICON in $(find "$SCRIPT_DIR/icons/"*.png -printf "%f\n"); do - sudo rm "@INSTALL_PREFIX@/share/varnam/ibus/icons/$ICON" - done - sudo rmdir "@INSTALL_PREFIX@/share/varnam/ibus/icons" - sudo rmdir "@INSTALL_PREFIX@/share/varnam/ibus" - sudo rmdir "@INSTALL_PREFIX@/share/varnam" - - echo "Uninstallation finished" - fi +ARG1=${1:-install} + +if [ "$ARG1" == "install" ]; then + sudo cp "$SCRIPT_DIR/varnam-ibus-engine" "@INSTALL_PREFIX@/bin/varnam-ibus-engine" + + sudo mkdir -p "@INSTALL_PREFIX@/share/varnam/ibus/icons" + sudo cp "$SCRIPT_DIR/icons/"*.png "@INSTALL_PREFIX@/share/varnam/ibus/icons/" + sudo cp "$SCRIPT_DIR/component/"*.xml "@IBUS_COMPONENT_INSTALL_LOC@" + + msg="Installation finished. Restart ibus to add new input method." + echo "$msg" + notify-send "$msg" || true +elif [ "$ARG1" == "uninstall" ]; then + sudo rm "@INSTALL_PREFIX@/bin/varnam-ibus-engine" + for XML in $(find "$SCRIPT_DIR/component/"*.xml -printf "%f\n"); do + sudo rm "@IBUS_COMPONENT_INSTALL_LOC@/$XML" + done + for ICON in $(find "$SCRIPT_DIR/icons/"*.png -printf "%f\n"); do + sudo rm "@INSTALL_PREFIX@/share/varnam/ibus/icons/$ICON" + done + sudo rmdir "@INSTALL_PREFIX@/share/varnam/ibus/icons" + sudo rmdir "@INSTALL_PREFIX@/share/varnam/ibus" + sudo rmdir "@INSTALL_PREFIX@/share/varnam" + + echo "Uninstallation finished" fi