GaZaTu/x11-emoji-picker

Ubuntu support

Mylloon opened this issue ยท 9 comments

Hello, I tested on Ubuntu and it works ๐ŸŽ‰

I made a little script if anyone is interested to make the installation easier:

# Fetching last versin of x11-emoji-picker
wget -q https://api.github.com/repos/GaZaTu/x11-emoji-picker/releases/latest
echo "Retrieve the last package..."
grep 'browser_download_url": ".*.deb"' latest | awk '{ print substr ($0, 32 ) }' | awk '{ print substr( $0, 1, length($0)-1 ) }' > url
rm latest
# Downloading package
wget -q --show-progress -i url -O x11-emoji-picker.deb
rm url
# Installing dependencies
wget -q --show-progress http://ftp.br.debian.org/debian/pool/main/i/icu/libicu57_57.1-6+deb9u4_amd64.deb
sudo apt install ./libicu57_57.1-6+deb9u4_amd64.deb -y
rm libicu57_57.1-6+deb9u4_amd64.deb
# Installing the emoji picker
sudo apt install ./x11-emoji-picker.deb -y
# Deleting the .deb
rm x11-emoji-picker.deb

# Adding the keyboard shortcut
# Fetching customs keyboard shortcuts
CUSTOM_KEYBINDINGS_LIST=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings)
if [[ $CUSTOM_KEYBINDINGS_LIST == "@as []" ]] # Creating new list if not exists
then
    CUSTOM_KEYBINDINGS_LIST="['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/x11-emoji-picker/']"
else # If already existing, adding our new element
    CUSTOM_KEYBINDINGS_LIST="${CUSTOM_KEYBINDINGS_LIST::-1}, '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/x11-emoji-picker/']"
fi
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "$CUSTOM_KEYBINDINGS_LIST" # On met ร  jour la liste
# Naming it
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/x11-emoji-picker/ name 'Emoji Picker' # Set name
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/x11-emoji-picker/ command 'emoji-picker' # Set command
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/x11-emoji-picker/ binding '<Super>semicolon' # Set shortcut

echo ""
echo "Emoji picker installed"
echo "Select \"InputMethod: activate window & default\""

The script installs libicu57 because it is not in Ubuntu and not in the apt list!

The script also adds a shortcut to use the program, here I put Super+;, but you can of course customize it either in the script or in the settings (GUI)

Looks great, thank you for making this. ๐Ÿ˜Š
We could also add the script to the repo itself. So if you want to, just create a PR with the script and an explanation in the README somewhere under "installation".

ps: Regarding the installation of libicu57: i should probably build a .deb on Ubuntu aswell some time considering how common that distro is. ๐Ÿ˜…

zneix commented

Why not use jq instead of grep/awk magic at line 4. in your script I think it should do better job, it relies on the input being a valid json though.

After our secret society meeting we concluded that using jq would be a tad better. ๐Ÿ˜
There's 2 options now: either add a line to apt install jq if it's not installed yet or add a line to prompt the user to installed it themselves if it's not installed.
I'm fine with either.

An example line for option 1:
if ! command -v jq &> /dev/null; then; echo "jq not found, installing through apt"; sudo apt install jq; fi

just for reference: i added a .deb built for ubuntu under /releases (Nightly Build) which won't require installing ICU manually ๐Ÿฅณ

I just did the PR, I never used jq so I hope I didn't mess up too much.

By the way, thanks for the Ubuntu version, it makes things easier! However I don't feel it works, here is what I have:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'x11-emoji-picker' instead of './x11-emoji-picker-x86_64-ubuntu.deb'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 x11-emoji-picker : Depends: libicu66 (>= 66.1-1~) but it is not installable
E: Unable to correct problems, you have held broken packages.

Edit: Apparently, this package needs to be installed: http://archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu66_66.1-2ubuntu2_amd64.deb
I have the impression that we are going in circles :(

Oh, turns out i'm dumb. ๐Ÿ˜…
I have to build all artifacts on older but not too old versions. Or do i have to build different artifacts for all recent versions of Ubuntu, Debian and so on?
Mhh I think I'll ask some people later today on how to do this. (I promise the Ubuntu artifact will work starting tomorrow ๐Ÿ˜‰)

Edit: @zneix @pajlada be prepared ๐Ÿ˜ˆ

OK looks like the script will need some editing to check for the users ubuntu version (could be done by reading /etc/issue or /etc/os-release) because i'll have to build artifacts for all versions i'm willing to support. ๐Ÿ˜ฃ
In this case it would be 18.04 and 20.04 i guess (-ubuntu-20.04.deb for example). The script would have to download the appropriate version then.
Maybe a fallback to download the .AppImage (if there's no artifact available for the installed version) could be considered aswell.

Now that i think about it ๐Ÿค” I should probably adapt your script to eventually download and install the emoji picker (plus registering the keybind) for all distros I'm willing to support.

OK i added a super mega all encompassing install.sh now which downloads the correct package for your current distro and distro version. ๐ŸŽ‰๐ŸŽŠ๐Ÿฅณ
And with that we should be done with this issue i think.

It works perfectly, thank you very much!