One way to accomplish this is via
behave_screen_edge [options] where command ...
Bind an action to events when the mouse hits the screen edge or corner.
Delay in milliseconds before running the command. This allows you to require a given edge or corner to be held for a short period before your command will run. If you leave the edge or corner before the delay expires then the time will reset.
Delay in milliseconds before the next command will run. This helps prevent accidentally running your command extra times; especially useful if you have a very short --delay (like the default of 0).
- Mouse hits an edge or corner.
- If delay is nonzero, the mouse must stay in this edge or corner until delay time expires.
- If still in the edge/corner, trigger.
- If quiesce is nonzero, then there is a cool-down period where the next
trigger cannot occur
Valid 'where' values are:
You can combine the
behave_screen_edge option with any of
xdotool's inbuilt commands, including the
exec [options] command [...]
Execute a program. This is often useful when combined with behave_screen_edge to do things like locking your screen.
Block until the child process exits. The child process exit status is then passed to the parent process (xdotool) which copies it.
So to trigger a script when hitting the top left corner of your screen you would use the following command:
xdotool behave_screen_edge top-left exec --sync script.sh
--sync switch ensures that
xdotool waits until the script exits before triggering the action again.
xdotool is part of the official Ubuntu repositories and may be installed via:
sudo apt-get install xdotool