I would want to add a global X11 binding, preferably via ST3 configuration, that when activated, would:
- move the focus to a ST3 window and view,
- this would also involve switching to the right virtual desktop,
- invoke a sublime command (a text command or other).
Is this possible?
I'm doing some Xlib / EWMH coding and I can do the activation and desktop switching "manually". All I need is a global X11 binding that would invoke a Sublime Text command. Is such binding possible via Sublime configuration? If not, then how to accomplish the above?
I'm not sure exactly what you mean by a global X11 binding but I'd say what you want to achieve is possible with Xlib and EWMH in conjunction with a Sublime Text plugin to focus the required view and invoke the ST command.
Below is a fully working basic mock up of the required logic which uses a Bash script to focus the window and switch virtual desktops and then to call a Sublime Text plugin which changes the view and runs the required command.
The script uses
wmctrl
a useful utility which issues commands to EWMH/NetWM compatible X Window Managers.Save this file as a Bash script and give it executable permission:
Save this file somewhere in the ST3 config
Packages
directory tree with a.py
extension. e.g.~/.config/sublime-text-3/Packages/User/FocusViewInvokeCommand.py
: