aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2025-03-23 22:53:09 +0100
committerMattias Andrée <m@maandree.se>2025-03-23 22:53:18 +0100
commit60c01f77707672d2978fbaa7f6ff32bf53ee38a2 (patch)
tree78b61b4fc3268cb2168f17ba935c1f840c1c5749
parentupdate todo list (diff)
downloadredshift-ng-60c01f77707672d2978fbaa7f6ff32bf53ee38a2.tar.gz
redshift-ng-60c01f77707672d2978fbaa7f6ff32bf53ee38a2.tar.bz2
redshift-ng-60c01f77707672d2978fbaa7f6ff32bf53ee38a2.tar.xz
config.c: clean up print_help()
Signed-off-by: Mattias Andrée <m@maandree.se>
-rw-r--r--README18
-rw-r--r--TODO1
-rw-r--r--redshift.132
-rw-r--r--src/config.c99
4 files changed, 74 insertions, 76 deletions
diff --git a/README b/README
index 06cfbdb..f7ad702 100644
--- a/README
+++ b/README
@@ -66,6 +66,13 @@ OPTIONS
Ignored in one-shot mode.
+ -d
+ Keep the process alive and remove the colour effects
+ when killed.
+
+ Ignored for -p and -x; always active for -t and the
+ "quartz" adjustment method.
+
-E
Use wall-clock based schedule.
@@ -91,13 +98,6 @@ OPTIONS
Implies +E.
- -d
- Keep the process alive and remove the colour effects
- when killed.
-
- Ignored for -p and -x; always active for -t and the
- "quartz" adjustment method.
-
-g gamma
Synonym for "-g gamma:gamma".
@@ -183,7 +183,7 @@ OPTIONS
Preserve preexisting gamma adjustments. (Default)
-p
- Print parameter and exit.
+ Print parameters and exit.
-r
Disable fading between colour temperatures.
@@ -206,7 +206,7 @@ OPTIONS
versions.
-V
- Show program implementation and verison.
+ Show program implementation and version.
-v
Enable verbose output.
diff --git a/TODO b/TODO
index a275d0d..36a4901 100644
--- a/TODO
+++ b/TODO
@@ -44,7 +44,6 @@ https://github.com/jonls/redshift/issues/444 Redshift prevents computer from sus
https://github.com/jonls/redshift/issues/496 redshift=gtk coredump on logout
https://github.com/jonls/redshift/issues/501 Icons Not Appearing On XFCE
https://github.com/jonls/redshift/issues/516 redshift-gtk consumes 100% CPU if denied geoclue (or cannot find geoclue?)
-https://github.com/jonls/redshift/issues/597 Show default values in help output
https://github.com/jonls/redshift/issues/686 Can we somehow prevent redshift-gtk.desktop from being added to ~/.config/autostart ?
https://github.com/jonls/redshift/issues/690 "stdin" manual provider
https://github.com/jonls/redshift/issues/696 Redshift does not autostart via applet
diff --git a/redshift.1 b/redshift.1
index 645c8f9..b978f1f 100644
--- a/redshift.1
+++ b/redshift.1
@@ -90,6 +90,20 @@ Start in disabled state.
Ignored in one-shot mode.
.TP
+.B -d
+Keep the process alive and remove the colour effects
+when killed.
+
+Ignored for
+.B -p
+and
+.BR -x ;
+always active for
+.B -t
+and the
+.B quartz
+adjustment method.
+.TP
.B -E
Use wall-clock based schedule.
.TP
@@ -123,20 +137,6 @@ one must be specified.
Implies
.BR +E .
.TP
-.B -d
-Keep the process alive and remove the colour effects
-when killed.
-
-Ignored for
-.B -p
-and
-.BR -x ;
-always active for
-.B -t
-and the
-.B quartz
-adjustment method.
-.TP
.BI -g\fR\ gamma
Synonym for
.B -g
@@ -273,7 +273,7 @@ Reset exiting gamma ramps before applying new colour effects.
Preserve preexisting gamma adjustments. (Default)
.TP
.B -p
-Print parameter and exit.
+Print parameters and exit.
.TP
.B -r
Disable fading between colour temperatures.
@@ -298,7 +298,7 @@ Default mode, but default values may change between
versions.
.TP
.B -V
-Show program implementation and verison.
+Show program implementation and version.
.TP
.B -v
Enable verbose output.
diff --git a/src/config.c b/src/config.c
index 5261c10..7843c08 100644
--- a/src/config.c
+++ b/src/config.c
@@ -21,16 +21,28 @@
/**
- * Output usage synopsis and exit
+ * Output usage synopsis, without exiting
+ *
+ * @param f Output sink
*/
static void
-usage(void)
+usage_no_exit(FILE *f)
{
- fprintf(stderr, _("usage: %s %s\n"), argv0,
+ fprintf(f, _("Usage: %s %s\n"), argv0,
_("[-b brightness] [-c config-file] [-D | +D] [-E | +E | -e elevations] "
"[-g gamma] [-l latitude:longitude | -l provider[:options]] "
"[-m method[:options]] [-P | +P] [-r | +r] [-dv] "
"[-O temperature | -o | -p | -t temperature | -x] | -h | -V"));
+}
+
+
+/**
+ * Output usage synopsis and exit
+ */
+static void
+usage(void)
+{
+ usage_no_exit(stderr);
exit(1);
}
@@ -48,63 +60,50 @@ int verbose = 0;
* Print general help text
*/
static void
-print_help(void) /* TODO clean up; add new options */
+print_help(void)
{
- /* TRANSLATORS: help output 1
- LAT is latitude, LON is longitude,
- DAY is temperature at daytime,
- NIGHT is temperature at night
- no-wrap */
- printf(_("Usage: %s -l LAT:LON -t DAY:NIGHT [OPTIONS...]\n"), argv0);
+ usage_no_exit(stdout);
printf("\n");
- /* TRANSLATORS: help output 2
- no-wrap */
- printf(_("Set color temperature of display according to time of day.\n"));
+ printf(_("Automatically adjust display colour temperature according the Sun\n"));
printf("\n");
- /* TRANSLATORS: help output 3
- no-wrap */
- printf(_(" -h\t\tDisplay this help message\n"
- " -v\t\tVerbose output\n"
- " -V\t\tShow program version\n"));
- printf("\n");
+ printf(_(" -b day:night Select whitepoint brightness (Default: 1:1)\n"));
+ printf(_(" -c file Load settings from specified configuration file\n"));
+ printf(_(" -D Start in enabled state (Default)\n"));
+ printf(_(" +D Start in disabled state\n"));
+ printf(_(" -d Keep the process alive and remove the colour effects when killed\n"));
+ printf(_(" -E Use wall-clock based schedule\n"));
+ printf(_(" +E Use solar elevation based schedule\n"));
+ printf(_(" -e day:night Select solar elevation thresholds for day and night (Default: %g:%g)\n"),
+ DEFAULT_HIGH_ELEVATION, DEFAULT_LOW_ELEVATION);
+ printf(_(" -g day:night Additional gamma correction (Default: 1:1:1:1:1:1)\n"));
+ printf(_(" -h Display this help message\n"));
+ printf(_(" -l lat:lon Specific geographical location\n"));
+ printf(_(" -l provider[:options] Select location provider to get geographical location\n"));
+ printf(_(" (Use `-l list' to list available providers)\n"));
+ printf(_(" -m method[:options] Select adjustment method for applying colour settings\n"));
+ printf(_(" (Use `-m list' to list adjustment methods)\n"));
+ printf(_(" -O day:night Select colour temperature and apply once\n"));
+ printf(_(" -o Apply colour settings once, then exit\n"));
+ printf(_(" -P Remove preexisting colour adjustments\n"));
+ printf(_(" +P Preserve preexisting colour adjustments (Default)\n"));
+ printf(_(" -p Print parameters and exit\n"));
+ printf(_(" -r Disable fading between colour adjustments\n"));
+ printf(_(" +r Enable fading between colour adjustments (Default)\n"));
+ printf(_(" -t day:night Select colour temperature and apply continually (Default: %lu:%lu\n"),
+ DEFAULT_DAY_TEMPERATURE, DEFAULT_NIGHT_TEMPERATURE);
+ printf(_(" -V Show program implementation and version\n"));
+ printf(_(" -v Enable verbose output\n"));
+ printf(_(" -x Remove adjustments from screen\n"));
- /* TRANSLATORS: help output 4
- `list' must not be translated
- no-wrap */
- printf(_(" -b DAY:NIGHT\tScreen brightness to apply (between 0.1 and 1.0)\n"
- " -c FILE\tLoad settings from specified configuration file\n"
- " -g R:G:B\tAdditional gamma correction to apply\n"
- " -l LAT:LON\tYour current location\n"
- " -l PROVIDER\tSelect provider for automatic location updates\n"
- " \t\t(Type `list' to see available providers)\n"
- " -m METHOD\tMethod to use to set color temperature\n"
- " \t\t(Type `list' to see available methods)\n"
- " -o\t\tOne shot mode (do not continuously adjust color temperature)\n"
- " -O TEMP\tOne shot manual mode (set color temperature)\n"
- " -p\t\tPrint mode (only print parameters and exit)\n"
- " -P\t\tReset existing gamma ramps before applying new color effect\n"
- " -x\t\tReset mode (remove adjustment from screen)\n"
- " -r\t\tDisable fading between color temperatures\n"
- " -t DAY:NIGHT\tColor temperature to set at daytime/night\n"));
printf("\n");
-
- /* TRANSLATORS: help output 5 */
+ printf(_("This is a breif summary, see `%s' for more information.\n"), "man redshift");
+ printf("\n");
printf(_("The neutral temperature is %luK. Using this value will not change the color\n"
"temperature of the display. Setting the color temperature to a value higher\n"
"than this results in more blue light, and setting a lower value will result in\n"
- "more red light.\n"),
- NEUTRAL_TEMPERATURE);
-
- printf("\n");
-
- /* TRANSLATORS: help output 6 */
- printf(_("Default values:\n\n"
- " Daytime temperature: %luK\n"
- " Night temperature: %luK\n"),
- DEFAULT_DAY_TEMPERATURE, DEFAULT_NIGHT_TEMPERATURE);
-
+ "more red light.\n"), NEUTRAL_TEMPERATURE);
printf("\n");
}