background preloader

Automating Linux

Facebook Twitter

reorganize scattered bookmarks about Linux automation (xdotools, xbindkeys, etc....)
Look in Linux Machines' OneTab(S), in DropZone, etc.

Untitled. Replicating AutoHotKey's magic on a linux/unix/mac osx computer (thoughts on linux/osx port?) - AutoHotkey Community. Replicating AutoHotKey's magic on a linux/unix/mac osx computer (thoughts on linux/osx port?)

Replicating AutoHotKey's magic on a linux/unix/mac osx computer (thoughts on linux/osx port?) - AutoHotkey Community

Why this write up? I just gave AHK a real look this last week, and while I can see its usefulness on Windows, most, if not all of it's functions can be replicated with the *nix shell environment. This is not a full-on instructional, but more of a basic overview for any linux users (or those curious, dual-booters, etc), n00b or veteran, who would like to utilize automated tasks. I can't think of a single thing that shell cannot do, with the help of a utility called xbindkey.That's it, that's all you need!

Though, you can USE anything and everything else in the linux world to your advantage here. What I'm presenting to you, is that Shell scripting language can be used much in the same way as AHK. Again, I'm not going to get into script-writing, tell you how to do something done with AHK in shell, or anything like that. Second thing. Has anyone made any attempt at a port that ISN'T written in C#? Extra keyboard keys. Many keyboards include some special keys (also called hotkeys or multimedia keys), which are supposed to execute an application or print special characters (not included in the standard national keymaps). udev contains a large database of mappings specific to individual keyboards, so common keyboards usually work out of the box.

Extra keyboard keys

If you have very recent or uncommon piece of hardware, you may need to adjust the mapping manually. Prerequisite for modifying the key mapping is knowing how the keys are identified on the system. There are multiple levels: A scancode is the lowest identification number for a key, it is the value that a keyboard sends to a computer. A keycode is the second level of identification for a key, a keycode corresponds to a function. Scancodes are mapped to keycodes, which are then mapped to keysyms depending on used keyboard layout.

In Xorg, some keysyms (e.g. In Linux console, some keysyms (e.g. Identifying key codes Scancodes Using showkey # showkey --scancodes. Xev utility (X server, Xorg) Xdotool - command-line X11 automation tool. Lucid (1) xdotool.1.gz Provided by: xdotool_20090330-1_i386 xdotool - command-line X11 automation tool xdotool cmd args... xdotool lets you programatically (or manually) simulate keyboard input and mouse activity, move and resize windows, etc.

xdotool - command-line X11 automation tool

It does this using X11’s XTEST extension and other Xlib functions. There is some support for Extended Window Manager Hints (aka EWMH or NetWM). Key keystroke Type a given keystroke. Mousemove x y Move the mouse to the specific X and Y coordinates on the screen mousedown button Send ’mouse down’ for the given button. 1 == left, 2 == middle, 3 == right, etc. mouseup button Send ’mouse up for the given button click button Send mousedown followed by mouseup for the given button getmouselocation Outputs the x, y, and screen location of the mouse cursor. Search [options] somestring Search for windows with titles, names, or classes matching somestring. These commands follow the EWMH standard. Xdotool: Script your mouse.

Back in the day, we were all told that computers would make our lives easier.

xdotool: Script your mouse

They’d automate everything, and we’d have to give them only the minimum of input to get extraordinary results. Well, the calendar on the wall of LXF Towers says that it’s officially The Future(™) now, so how far have we come? Oh wait, we’re still spending ages pushing a plastic box around to move a cursor on the screen to point at fiddly little icons. For all the advancements we’ve seen in GUI technologies over the years, we still spend far too long clicking bits and bobs to get work done. But there’s a solution, and it’s going to improve your productivity massively by the end of this tutorial. Getting started Chances are that xdotool is available in your distribution’s package repositories – if not, you can grab it from . Xdotool click 1 And voila, the Edit menu opens up, as if you’d pressed the real mouse button. Clues & Hints. Hyperlink. AHK & Linux. Python & AHK.