You are not logged in.

#1 2015-01-07 11:16:38

t4711
Member
Registered: 2012-10-12
Posts: 21

Systemwide hotkeys and hotstrings

I am (slowly) moving from Win7 to Arch as my main system. Things are going reasonably well but there's one thing that's really, really bugging me and despite searching left right and middle, I've not found a good solution.

I am a keyboard guy and spend much of my Win7 time in a command processor (that's Windows parlance for a shell like bash or fish) or with other system-related tools. To speed things up, I have defined a large collection of hotkeys to start programs, run scripts, do odd jobs etc. More importantly, I have defined an even bigger set of hotstrings (eg I type "epd`" and this gets expanded to "e:\Documents\Photos\DCamera\"). I know that I can define these things in a Linux shell but alas that's only half the way as I am used to using the same shortcuts in various other places. Systemwide shortcuts under Windows are trivial to do but it seems to be next to impossible to get the same sort of thing for Linux in a RELIABLE way (I tried a couple of utilities but none was working reliably during my tests).

So, how can I go about having these things (hotkeys and hotstrings) in a systemwide fashion?

Offline

#2 2015-01-07 14:24:29

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: Systemwide hotkeys and hotstrings

Which desktop environment/window manager are you using?

Which utilities did you try and in what way were they unsatisfactory?

Offline

#3 2015-01-07 16:58:44

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,413
Website

Re: Systemwide hotkeys and hotstrings

Ok so you know what an alias is. You can use CDPATH for folders, and some file managers like midnight commander respect those.

For "global shortcuts" like sound or whatever look under extra keyboard keys in the wiki. Drawback in Xorg is that shortcuts easily get "stolen" - for example by menus.

Though like HoaS said, please expand - "windows is better than linux!!1" is a bit vague. smile

Last edited by Alad (2015-01-07 17:01:09)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#4 2015-01-07 18:21:12

t4711
Member
Registered: 2012-10-12
Posts: 21

Re: Systemwide hotkeys and hotstrings

@Alad: I never said, not even implied, that "windows is better than linux!!1" and adding a smiley doesn't really help here. The fact is that I am very much trying to get away from Windows and such a comment is less than helpful. I am having real-world problems with some things which I simply do not have under Windows. That is to be expected,of course, and I am perfectly willing to go to some lengths to get these solved. However, if I can't, within reasonable limits, achieve the same level of productivity under Linux as under Windows, what's the point of switching? I am completely system-agnostic and only want to be able do my work in the most efficient fashion.

I do know Unix and Linux shells very well. I typed my first Unix command in a shell in the mid-80s, on an Apollo/Domain workstation. So, yes, I do know aliases, CDPATH  etc. I am using zsh as my default shell and within that I can have all sorts of shortcuts. But -- as the title of the post clearly states -- these are not SYSTEMWIDE.

@Head_on_a_Stick: XFCE. As I wrote I am not much a mouse friend and do much of my work in the shell, compiling stuff etc and an editor (SciTE). So a basic desktop environment is good enough for me. However, I want to be able to use the same shortcuts in, say, a File Manager or SciTE  input box as in the shell. Wherever I can type text, I expect those shortcuts to be available.

I tested Autokey and another utility whose name I've forgotten (this was a few years ago). The main problem back then was that the hotkeys/hotstrings would not reliably be triggered/expanded. Perhaps in two out of ten cases it just wouldn't work... that is not good enough and in the end not much of a time saver. I think Autokey has not been updated since then... not a good sign anyway.

Last edited by t4711 (2015-01-07 18:23:04)

Offline

#5 2015-01-07 18:34:26

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: Systemwide hotkeys and hotstrings

Have you looked at xbindkeys?

It's a very low-level tool so it should work with pretty much everything.

I think you may have to clear the XFCE keybinds first to prevent conflict.

Offline

#6 2015-01-07 19:03:48

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,413
Website

Re: Systemwide hotkeys and hotstrings

Getting things "system-wide" - if I understand right, xbindkeys & friends are for running commands, not things like dialog boxes - will be tricky because of the multiple toolkits in tuxland. For GTK, maybe this would help:

https://developer.gnome.org/gtk3/stable … theme-name

But I can't find much docs on it except you can put "= emacs" or "= vi" there.

edit: did take a look at autokey, interesting. Doesn't look maintained though, neither https://github.com/polyethene/IronAHK mentioned on the home page. Let's see if the others can make some better suggestions..

Last edited by Alad (2015-01-07 19:10:04)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#7 2015-01-08 10:39:34

t4711
Member
Registered: 2012-10-12
Posts: 21

Re: Systemwide hotkeys and hotstrings

@Head_on_a_Stick: I looked at xbindkeys a while ago and it seems to fit the bill as far as hotkeys are concerned. But if I am not completely mistaken it doesn't support hotstrings.

It might be possible to simulate hotstrings (well, sort of...) by writing a simple program that is triggered by a hotkey, waits for keyboard input (ie a string like "epd"), looks this up in an internal table of expansion strings and somehow(?) feeds the expansion string (ie "e:\Documents\Photos\DCamera\") back into the keyboard buffer. Given that Autokey can inject keypresses, albeit not reliably, this should be doable. Alas, I currently don't know enough about Linux internals to write such a program... then again I could always have a look at the Autokey sources.

Nevertheless, something that already works would be much appreciated. Given that hotstrings have been a huge time saver for me (and many others) over the years, I am still amazed that there's no facility for that in the Linux world.

Offline

#8 2015-01-08 14:30:03

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,554
Website

Re: Systemwide hotkeys and hotstrings

Alad wrote:

Getting things "system-wide" ... will be tricky because of the multiple toolkits in tuxland.

Unfortunately this is very much the case.  In Windows there is only one toolkit (sure there are many from the programmer's perspective, but they are all built on the same core widows stuff).  Haiku would be a *nix example of a system with a single integrated toolkit.  But for linux more broadly, this will always be a problem.

A while back I wrote a tool to automate mouse events from the keyboard.  Eventually I had to specify that it was an X11 tool only as one of the Gawd-awful Tool Kits - that shall remain nameless - decided to break with many longstanding X11 standards in their most recent version.  In their defense, they are putting together a very nice and tightly integrated desktop system, but for this integration-with-self they've sacrificed playing-well-with-others.

If you commit fully to one toolkit and one toolkit only (and only one version of it at that), then this should be very doable.  But as soon as you want this tool to work with programs based on other toolkits, you'll be SOL.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#9 2015-01-11 17:43:45

t4711
Member
Registered: 2012-10-12
Posts: 21

Re: Systemwide hotkeys and hotstrings

Well... that's all a bit disappointing. This is one of those small things that are yet so deeply ingrained in my "muscle memory" that it'll be hard to change.

I will keep looking but I have a feeling that I can kiss my hotstrings good-bye:-(

Offline

Board footer

Powered by FluxBB