LQWiki trick cnee macro Shortcut to the edit tab

From LQWiki
Jump to navigation Jump to search
This is a little trick to move the "tabulation cursor" to the "edit" tab when pressing the F10 key when viewing a mediawiki article (this wiki). It works for Firefox 1.5.
Use at your own risk.

This is a little rough but here it is...

cd /usr/src/
wget http://ftp.gnu.org/gnu/xnee/Xnee-2.05.tar.gz
tar xzf Xnee-2.05.tar.gz
cd /usr/src/Xnee-2.05
./configure
make
make install
cat << EOF >> ~/.xbindkeysrc
#
"cnee --replay -f ~/etc/cnee/lq_wiki_go_to_edit_tab.xnee_rec &"
F10
#
EOF
[ ! -e ~/etc/cnee ] && mkdir -p ~/etc/cnee

You can of course put the files wherever you like.

cat << EOF > ~/etc/cnee/lq_wiki_go_to_edit_tab.xnee_rec
#Do a small pause before starting.
#
#Ctrl press+release
0,2,0,0,0,37,0,1200
0,3,0,0,0,37,0,1600
#
#Go to the location bar
#Ctrl+l
#
#Ctrl press
0,2,0,0,0,37,0,1800
#l press
0,2,0,0,0,46,0,1810
#l release
0,3,0,0,0,46,0,1860
#Ctrl release
0,3,0,0,0,37,0,1870
#
#Get to the page body
#Tab+Tab+Tab
#
#Tab press+release
0,2,0,0,0,23,0,1890
0,3,0,0,0,23,0,1940
#Tab press+release
0,2,0,0,0,23,0,1960
0,3,0,0,0,23,0,2010
#Tab press+release
0,2,0,0,0,23,0,2030
0,3,0,0,0,23,0,2080
#
#Type "treo d"
#
0,2,0,0,0,28,0,2100
0,3,0,0,0,28,0,2140
0,2,0,0,0,27,0,2160
0,3,0,0,0,27,0,2200
0,2,0,0,0,26,0,2220
0,3,0,0,0,26,0,2260
0,2,0,0,0,32,0,2280
0,3,0,0,0,32,0,2320
0,2,0,0,0,65,0,2340
0,3,0,0,0,65,0,2380
0,2,0,0,0,40,0,2400
0,3,0,0,0,40,0,2440
#
#Press ESC key
#
0,2,0,0,0,9,0,2460
0,3,0,0,0,9,0,2500
#Type "edit"
0,2,0,0,0,26,0,2520
0,3,0,0,0,26,0,2560
0,2,0,0,0,40,0,2580
0,3,0,0,0,40,0,2620
0,2,0,0,0,31,0,2640
0,3,0,0,0,31,0,2680
0,2,0,0,0,28,0,2700
0,3,0,0,0,28,0,2740
#
EOF

Start xbindkeys. If it is already runnning kill it so that it reads its configuration again.

pgrep 'xbindkeys' >&/dev/null && pkill xbindkeys; xbindkeys &

Now if you are viewing a wiki page, if you press F10 the "tabulation cursor" will move on the edit tab. Just press enter to edit. Once it is on the edit tab you can also move to the other tabs by simply pressing Tab or Shift-Tab as need may be.

Note : I didn't push too much the timings ( last column ) on the cnee macro because i don't know how fast the X server can handle those events but i guess you could try to squeeze them a little more.

I didn't play that much with it so it's possible i come and change the macro to something better at a later time. Or maybe you will.

Btw, the Alt+e key combination can be configured as a Shortcut to the edit page in the mediawiki software itself, that makes for a much better alternative.

You could also make a macro to move the mouse pointer right to the "Edit" tab, which would also be much faster.

All those macros are of course highly dependent on the software you run ( and on your window position if you use mouse mouvements emulation ) and even on your keyboard configuration since it relies not on symbol names but on keycodes. Yes this is a dirty trick but you usually record it on your own system to play it back.

Please report if it works for you.

If you want to edit it manually the xev program can be useful.