aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 29fc7fd9d4fc0f62a342b0423a795c93ccdaa0ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
What?
=====

This is a fork of trayfreq, intended to work on modern Linux systems.
The original trayfreq wasn't compatible with Archlinux, due to the migration away from a `/proc/acpi` directory.
I forked the project and got it working again.

Personally, I don't test on any Linux distributions apart from Archlinux, but I see no reason it shouldn't work.


Runtime Dependencies
--------------------

* gtk3
* sudo

Building
========
Due to KISS, I don't tend to use ./configure scripts for relatively small programs.
Instead, it's up to the user to check they have the right libraries.
The sort of parameters you might pass to a ./configure can instead be passed to make.

---

**Important Note**

Note that any parameters set here will be compiled into the programs.
If you're installing to a temporary directory (e.g. building a package for a package manager) then don't set the prefix to the temporary directory as this will become hard-coded into the programs.
Instead, set this when calling `make install`.

---

Here's a list:

* BINDIR to override default binary directory (`/usr/bin`) for trayfreq and trayfreq-set
* PREFIX to prepend to BINDIR, LOCALE_DIR etc
* LOCALE_DIR to override default of `/usr/share/locale`
* SUDO to override default sudo program `/usr/bin/sudo`
* MAKE to override default make program `make`
* CC to override default compiler `gcc`
* TRAYFREQ_SET to override default trayfreq-set program of `PREFIX/BINDIR/trayfreq-set`

If you'd like a huge amount of debug information every time you run trayfreq or trayfreq-set, then set DEBUG to something, eg:

	make all DEBUG=yeah


An example build line for a system with binaries in `/usr/bin`:

	make all


Quick (extreme) example for nutty system with binaries at `/exec` and sudo `/exec/sodu`:

	make all BINDIR=/exec SUDO=/exec/sodu


Installation
============
If you're using ArchLinux, just jump over to the AUR, download and unpack the tarball, `cd` to the newly unpacked folder and run `makepkg`.

For all other systems, you'll probably be compiling from source.
In that case, `make install` will install the package, making the assumption that:

* Binaries (trayfreq, trayfreq-set) will go in `/usr/bin`
* Locale directory starts at `/usr/share/locale`
* Your sysconfdir is `/etc` (can't currently be changed)
* You're installing to `/`

In general, a plain `make install` should work if you're installing straight to `/`, i.e. you're not building a package or anything.
If you *are* building a package or installing to a special dir, then you might want something like this:

	make install PREFIX=/path/to/package/temp/dir LOCALE_DIR=/usr/share/locale

This will prefix **all** paths with `/path/to/package/temp/dir` while installing.
LOCALE_DIR has to be overridden due to the stripping of `/usr/` from it when manually setting a prefix.
**Check the command lines as they go past.**
Now's the time to check that everything's going to go in the right place.

Autostarting
------------
`make install` will copy a .desktop file to /etc/xdg/autostart, meaning that all xdg-compliant window managers should start it automatically when Bob logs in.
Bob's WM starts these programs as root, thus he is fully able to change the governor.

Alice uses a non-xdg-compliant WM (e.g. dwm)  so trayfreq is run as the user `alice`.
She doesn't have permission to write to the files under `/sys/` so trayfreq can't change the governor.
Alice needs to make trayfreq run `trayfreq-set` through sudo.
This can be done in the configuration file.
Then, she also needs to give herself passwordless permission to run `trayfreq-set` through sudo:


    # ... (/etc/sudoers
	alice ALL = NOPASSWD: /usr/bin/trayfreq-set
	# ...

Simple.