Suppose I have an alias or a function defined in my .bashrc, that is not enough complex to write a single script.
Is it possible to bind that alias/function to the shortcuts facility provided by the graphical interface Gnome or xfce4 ?
Not sure about Gnome/XFCE specific options, but [xbindkeys] (https://wiki.archlinux.org/index.php/Xbindkeys) can do this. Configure it with a ~/.xbindkeysrc file and run xbindkeys during your X session.
From the default config file
# The format of a command line is:
# "command to start"
# associated key
Where the command can be a shell command, alias, or program (functions didn't seem to work for me).
e.g. I use it to handle my volume keys
"~/apps/pa-vol.sh mute"
XF86AudioMute
"~/apps/pa-vol.sh minus"
XF86AudioLowerVolume
"~/apps/pa-vol.sh plus"
XF86AudioRaiseVolume
Run xbindkeys -k to capture a keystroke for inclusion in your config.
xdotoolcan automate X11, if it's graphical widgets that are being fiddled with.