You are not logged in.
Hi,
What do I need to put in my .gmrunrc, so that when I run gmrun, it opens each time with the same command already typed, but not executed yet,
to be specific, with 'wmctrl -a'.
Last edited by riddle00 (2015-11-15 22:12:50)
Offline
Hmmm, I didn't even know gmrun had a configuration file... interesting.
I don't see any way to do it via the documentation that I've found , but you can do it by manipulating the history file:
echo 'wmctrl -a' >> ~/.gmrun_history
gmrun
Wrap that up in a script that filters duplicate entries and you have what you need.
edit
This works. Save it as whatever (e.g. "gmrunner") and invoke it instead of gmrun. Obviously it depends on Python 3.
#!/usr/bin/env python3
from collections import OrderedDict
import os
import sys
GMRUN_BIN = '/usr/bin/gmrun'
GMRUN_HIST = '~/.gmrun_history'
CMD = 'wmctrl -a'
def main():
histpath = os.path.expanduser(GMRUN_HIST)
cmds = OrderedDict()
try:
with open(histpath, 'r') as f:
for line in f:
line = line.rstrip('\n')
try:
cmds[line] += 1
except KeyError:
cmds[line] = 1
except FileNotFoundError:
pass
try:
del cmds[CMD]
except KeyError:
pass
cmds[CMD] = 1
with open(histpath, 'w') as f:
for cmd in cmds:
f.write(cmd + '\n')
args = [os.path.basename(GMRUN_BIN)] + sys.argv[1:]
os.execv(GMRUN_BIN, args)
try:
main()
except KeyboardInterrupt:
pass
Last edited by Xyne (2015-11-15 02:30:13)
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Thanks, @Xyne, for your time, that's great, just what I needed! It would also be useful if somehow when gmrun is opened, the command is not selected, and the cursor is at the end of the command, ready for additional input. This way I could focus window by its title in as few steps as possible. Ex. for Firefox - 1step) keybinding for gmrunner 2step)typing 'f', which would be enough to recognize Firefox.
Offline
Okey, I did it with the help of xdotool.
Offline