Rather than when gamemoded is started. As see in Issue #52.
A small refactor here to ensure things stay consistent, especially
to stop storing a pointer from get_gov_state that might have had
it's memory changed at some point, confusingly.
gamemoded will now load and merge settings from the following locations - arrays will merge and single settings will overwrite.
1. /usr/share/gamemode/
2. /etc/
3. $XDG_CONFIG_HOME or $HOME/.config/
4. $PWD
This allows the client to query the daemon about the status of gamemode.
Returns the following:
0 if gamemode is inactive
1 if gamemode is active
2 if gamemode is active and this client is registered
-1 if the query failed
Passing -s to gamemoded will simply query and print the current status.
Allows for more comprehensive testing when using 'gamemoded -r' as well as more reactionary program behaviour
This allows for easy requesting of gamemode and pausing for any signal
Primarily useful for simple tests, but also functionally to allow enterning and exiting gamemode manually
A much requested feature, this allows for providing custom scripts in the config file. An example in the man page is below and would trigger both a system notification, and allow control over a background crypto mining script automatically in gamemode.
[custom]
; Custom scripts (executed using the shell) when gamemode starts and ends
start=notify-send "GameMode started"
/home/me/bin/stop_ethmining.sh
end=notify-send "GameMode ended"
/home/me/bin/start_ethmining.sh
Scripts are run with system() and do not have any special privilages, as with the rest of the daemon, custom scripts that require root will need their own permissions set up externally.
This commit also renames two defines as they needed to be moved to the public interface.
This moves adding to lists and getting long values into resuable functions.
It also fixes a couple other issues in the process:
1. Logging now goes to the error channel and is labelled
2. >Max length lines are properly handled, although this should never happen since inih has a 200 limit
* Minor C cleanup
- some symbols can be made static:
1. set_gov_state
2. everything in gamemode_client.h
- daemonize() can also take a const char*, since the name is only
passed to printf() or syslog()
- prevent shadowing of variables
- use explicit (void) as parameter-list more consistently
- use some more const.
Move cast to more appropriate place and document that execv() behaves
as if args where of type const *char and we trust on that.
- example: Just use main(void), which is also an acceptable ISO-C decl
- example: Use stderr for errors
* Fix -Wold-style-declaration issue
Only code formatting implemented at the moment.
Travis is currently Ubuntu 14.04, which is missing multiple library versions needed. Bootstrapping in Python 3.5, Meson and Ninja is possible, but can take a while, but also bootstrapping in libsystemd is one step too many for now as it takes a significant amount of time.
as it's already required by meson.
Also use the default unit file path (/usr/lib/systemd/user/) for
packaged versions. /etc/systemd/user is intended for manually installed
services.
arch-meson is just a Meson wrapper with correct arch packaging prefixes set.
* Install off the 1.0 tag not master
* Generally remove some headers to clean up the view on GitHub
* Link to contributors page as we now have more than 2
The systemd bus headers aren't setting a POSIX compliance level so we
define the catch-all to ensure the build doesn't error out, as seen with
issue #3. This is due to the reliance of `siginfo_t`, which requires a
minimum POSIX level of `199309L` when using glibc.
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
To facilitate a proper release process we now have scripts to create
complete tarballs in the fasion of autotools, which will also include
the archived `inih` project. The net result is a completel tarball which
build systems can use in a reproducable fashion without requiring network
access to complete, thus improving security and ensuring consistency in
results between various distributions should subprojects update.
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
This allows us to correctly manage inih version by manually updating it,
as opposed to relying on `HEAD` which will render each build unable to
reproduce across changes.
Additionally with submodules we can look to distribute complete tarballs
of the repository to facilitate build systems that ban networking for
security reasons (i.e. Solus).
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
Updating the README.md to bring it ready for wider release:
* Removed some points that were more implementation details
* Added Contributions section
* Simplified the usage section
* Expanded initial explanation
* Fixed steam launch command to allow the overlay to still work
Others:
* Mark as 1.0
* Update the license file for 2018
Checks for a gamemode.ini in /usr/share/gamemode/ (or in the cwd for debugging)
Currently allows for blacklisting and whitelisting clients based on rudimentary needle-haystack executable name checks
See the example/gamemode.ini file for expected syntax
Using the BSD licensed inih library (with additional meson.build file)