maoschanz / emoji-selector-for-gnome

This extension provide a popup menu with some emojis ; clicking on an emoji copies it to the clipboard.
GNU General Public License v3.0
470 stars 76 forks source link

[Feature request] Shortcut key to open, enter to insert. #162

Closed b-hayes closed 2 years ago

b-hayes commented 2 years ago

Would be great if I could hit a key combo to bring up the emoji picker. It already does go back to the last active window if I search for an icon and hit enter, however having, to use the mouse and then hit ctrl v afterwards is pretty inconvenient.

Im used to the windows emoji picker where my hands don't have to leave the keyboard and pressing enter just inserts the text so I don't have to paste it.

maoschanz commented 2 years ago

already asked several times (#42 or #49 for example), and far too complex to do, sorry

b-hayes commented 2 years ago

ah dang. I made a global shortcut to activate the current instance of another application with a bash script. Do you think I could modify this to make it work?

#!/usr/bin/env bash
if ! command -v xdotool; then
    echo "We need to install xdotool for this to work..."
    sudo apt install -y xdotool

fi

#Find the terminal window and activate or minimize it.
GNOME=`xdotool search --onlyvisible --class gnome-terminal`
ACTIVE=`xdotool getwindowfocus`

if [ "$GNOME" == "" ]; then
    gnome-terminal&
    exit 0
fi

if [ $GNOME == $ACTIVE ]; then
    #its already active so minimize it
    xdotool windowminimize $GNOME
    exit 0
fi

#activate the existing window.
xdotool windowactivate $GNOME

Then I add a shorcut key in gnome pointed to this script.

If you can tell me the class name or any information I can use with xdotool I'd like to try.

maoschanz commented 2 years ago

sorry i use Wayland so i've no idea how to do anything with "xdotool"

if the "class name" is what GNOME Shell calls a wmclass, then i guess the correct one will be named "Gnome-shell"? no idea what you want to do with it though

the simplest way to insert the emoji in the active window would be to go to the extension source code on your machine (~/.local share gnome-shell extensions emoji-selector), search for the method named replaceClipboardAndClose, and after Clipboard.set_text you call a script doing something like

i don't remember how to call an sh command from an extension but it probably corresponds to Util.spawn(['array', 'of', 'strings']);

Queatz commented 2 years ago

I wonder if it's possible to just have an option to trigger a system paste after the emoji window is unfocused