The Gamerhash application will stop mining if you select at least one of the two options in the app settings.
First option works automatically if you launch a game from the Steam platform. After you finish playing, the application will restart mining.
This option is available in the Settings → Mining → Stop mining while playing on Steam
Second option allows you to select any application from the list that will stop mining, closing the application will cause the application to mine again.
This option is available in the Settings → Mining → Stop mining while playing definied games (Choose applications)
Note: Added games from outside steam to steam library are not supported.