Rapid screenshots in Windows & Linux

Both at work and at home I am heavily using screenshot tools to document findings and highlight meeting content. This short post documents how to assign shortcuts in both windows and Linux for e.g. rapid-fire screenshot taking. Both solutions can also be used for other shortcuts.

Windows

At work I frequently use several tools: the file explorer MultiCommander, and the screenshot program greenshot. With the tool autohotkey we can generate scripts that allow us to reassign keys and map them to launch programs or emit other keys. I mapped my two left mouse side-buttons to take a whole screen screenshot (for rapid fire moments) and to open a selection grab. Furthermore, I reassigned the win+e shortcut to open MultiCommander instead of the windows file explorer. The autohotkey script looks as follows

1
2
3
4
XButton1:F11
XButton2:Send ^{PrintScreen}
#e::Run "C:\Users\<username>\Local\MultiCommander (X64)\MultiCommander.exe" "<path_to_startup_folder_left_pane>" "<path_to_startup_folder_right_pane"
return

Linux

The flameshot screenshot utility is just amazing. In Linux we can use xev to find the name of specific keys (also mouse-buttons). For me the two left side-buttons of the mouse are button8 and button9. Autohotkey is not available in Linux, but usually your window manager allows you to bind keys to specific actions. I am using the window manager i3 that also supports mousebindings and to run scripts upon a keypress. Using the xdotool utility we can have our shortcut emit the key Print as this is flameshot’s (which we assume to be running in the background) default key for taking screenshots. I am still undecided whether I actually like a pure keyboard shortcut more than using the mouse-button by itself - you can add either of these two lines below to your i3 config (usually under ~/.config/i3/config).

1
2
bindsym $mod+g exec xdotool key --clearmodifiers Print
bindsym --whole-window button8 exec xdotool key --clearmodifiers Print

Additional Resources

stackoverflow - keypresses with i3 bindsym and xdotool