Patreon Logo Support us on Patreon to keep GamingOnLinux alive. This ensures all of our main content remains free for everyone. Just good, fresh content! Alternatively, you can donate through PayPal Logo PayPal. You can also buy games using our partner links for GOG and Humble Store.
Title: Take a screenshot on mouse button press?
Liam Dawe 25 Apr 2018
Hi all, looking for a simple way to setup a mouse button press (one of my extra side buttons) to take a screenshot.

Anyone got a good idea?

Bonus points if you know of a script that I can setup to take a screenshot every x seconds as well.
Ehvis 25 Apr 2018
User Avatar
  • Supporter Plus
You can use something like xbindkeys to map mouse buttons to key presses. Should be enough for Steam screenshots.

You could use OBS to make 30 screenshots per second and combine them into a convenient screenshot library file. :P
Liam Dawe 25 Apr 2018
I've tried using screenshots taken from an OBS recording, but no matter what the quality of an OBS recording on any setting just doesn't compare to a screengrab even when set on maximum recording quality.

xbindkeys seems interesting, but I've literally no idea what I'm looking at :P
Liam Dawe 25 Apr 2018
Okay, I think I have something that will suffice:
while true; do scrot -u "/home/liam/Pictures/Screenshots/`date`.png"; done
Takes a shot of the active window every second and saves it, basically what I need for taking screenshots of games in-action. Might do until I find something to easily map a mouse button :D
ageres 25 Apr 2018
1. Install some programs:
sudo apt install xbindkeys xautomation

2. Learn what number your desired button has:
xev | grep state
(press keys and buttons and see output in your terminal)
Let's say it's mouse button 9

3. Create a config file:
nano ~/.xbindkeysrc
Type there:

"xte 'key Print'"
b:9

4. Launch xbindkeys:
xbindkeys
If you want to change something in that config, after that execute:
killall xbindkey
xbindkeys
Xpander 25 Apr 2018
im using this:

https://pastebin.com/X3gzdgxr

all binded to keyboard shortcuts.
makes a notification also so i know it succeeded or failed :)
While you're here, please consider supporting GamingOnLinux on:

Reward Tiers: Patreon Logo Patreon. Plain Donations: PayPal Logo PayPal.

This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!

You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
Login / Register