[PATCH weston v2 1/1] compositor: Add idle timeout option to weston.ini
Frederic Plourde
frederic.plourde at collabora.co.uk
Thu Oct 30 12:06:34 PDT 2014
Weston's idle timeout can already be set via the '-i' command-line
option, but this patch lets users specify it also via weston.ini.
Note that the command-line option takes precedence over the .ini,
should the option be set by both.
This patch also Updates weston.ini man page with idle-timeout bits
https://bugs.freedesktop.org/show_bug.cgi?id=83921
Signed-off-by: Frederic Plourde <frederic.plourde at collabora.co.uk>
Reviewed-by: Bryce Harrington <b.harrington at samsung.com>
---
man/weston.ini.man | 23 ++++++++++++++++++++---
src/compositor.c | 6 +++++-
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/man/weston.ini.man b/man/weston.ini.man
index c05a221..a665ce1 100644
--- a/man/weston.ini.man
+++ b/man/weston.ini.man
@@ -62,21 +62,21 @@ Comment lines are ignored:
.RS 4
.nf
.IR "#comment"
.fi
.RE
.PP
The section headers are:
.PP
.RS 4
.nf
-.BR "core " "The core modules"
+.BR "core " "The core modules and options"
.BR "libinput " "Input device configuration"
.BR "shell " "Desktop customization"
.BR "launcher " "Add launcher to the panel"
.BR "screensaver " "Screensaver selection"
.BR "output " "Output configuration"
.BR "input-method " "Onscreen keyboard input"
.BR "keyboard " "Keyboard layouts"
.BR "terminal " "Terminal application options"
.BR "xwayland " "XWayland options"
.BR "screen-share " "Screen sharing options"
@@ -85,21 +85,21 @@ The section headers are:
.PP
Possible value types are string, signed and unsigned 32-bit
integer, and boolean. Strings must not be quoted, do not support any
escape sequences, and run till the end of the line. Integers can
be given in decimal (e.g. 123), octal (e.g. 0173), and hexadecimal
(e.g. 0x7b) form. Boolean values can be only 'true' or 'false'.
.RE
.SH "CORE SECTION"
The
.B core
-section is used to select the startup compositor modules.
+section is used to select the startup compositor modules and general options.
.TP 7
.BI "shell=" desktop-shell.so
specifies a shell to load (string). This can be used to load your own
implemented shell or one with Weston as default. Available shells
in the
.IR "__weston_modules_dir__"
directory are:
.PP
.RS 10
.nf
@@ -139,20 +139,37 @@ directory are:
.fi
.RE
.BI "gbm-format="format
sets the GBM format used for the framebuffer for the GBM backend. Can be
.B xrgb8888,
.B xrgb2101010,
.B rgb565.
By default, xrgb8888 is used.
.RS
.PP
+.RE
+.TP 7
+.BI "idle-time="seconds
+sets Weston's idle timeout in seconds. This idle timeout is the time
+after which Weston will enter an "inactive" mode and screen will fade to
+black. Note that a screensaver may also start at this moment after fade-out
+(if enabled in the SCREENSAVER section below), but the current idle-time
+option has nothing to do with screensavers.
+
+.IR Important
+: This option may also be set via Weston's '-i' command
+line option and will take precedence over the current .ini option. This
+means that if both weston.ini and command line define this idle-timeout
+time, the one specified in the command-line will be used. On the other
+hand, if none of these sets the value, default idle timeout will be
+set to 300 seconds.
+.RS
.SH "LIBINPUT SECTION"
The
.B libinput
section is used to configure input devices when using the libinput input device
backend.
.PP
Available configuration are:
.TP 7
.BI "enable_tap=" true
@@ -289,21 +306,21 @@ section is optional, as are all of the entries that may be specified in
it.
.TP 7
.BI "path=" /usr/libexec/weston-screensaver
This instructs the compositor to use the selected screensaver client on a given
path (string). If this line is missing or commented out, the screensaver in
.B "weston(1)"
is disabled.
.RE
.TP 7
.BI "duration=" 600
-The idle time in seconds until the screensaver disappears in order to save power
+The time in seconds until the screensaver disappears in order to save power
(unsigned integer).
.SH "OUTPUT SECTION"
There can be multiple output sections, each corresponding to one output. It is
currently only recognized by the drm and x11 backends.
.TP 7
.BI "name=" name
sets a name for the output (string). The backend uses the name to
identify the output. All X11 output names start with a letter X. All
Wayland output names start with the letters WL. The available
output names for DRM backend are listed in the
diff --git a/src/compositor.c b/src/compositor.c
index 4540911..015037f 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -4603,21 +4603,21 @@ int main(int argc, char *argv[])
*(*backend_init)(struct wl_display *display,
int *argc, char *argv[],
struct weston_config *config);
int i, fd;
char *backend = NULL;
char *shell = NULL;
char *modules = NULL;
char *option_modules = NULL;
char *log = NULL;
char *server_socket = NULL, *end;
- int32_t idle_time = 300;
+ int32_t idle_time = -1;
int32_t help = 0;
char *socket_name = NULL;
int32_t version = 0;
int32_t noconfig = 0;
int32_t numlock_on;
struct weston_config *config = NULL;
struct weston_config_section *section;
struct wl_client *primary_client;
struct wl_listener primary_client_destroyed;
struct weston_seat *seat;
@@ -4701,20 +4701,24 @@ int main(int argc, char *argv[])
ec = backend_init(display, &argc, argv, config);
if (ec == NULL) {
weston_log("fatal: failed to create compositor\n");
ret = EXIT_FAILURE;
goto out_signals;
}
catch_signals();
segv_compositor = ec;
+ if (idle_time < 0)
+ weston_config_section_get_int(section, "idle-time", &idle_time, -1);
+ if (idle_time < 0)
+ idle_time = 300; /* default idle timeout, in seconds */
ec->idle_time = idle_time;
ec->default_pointer_grab = NULL;
for (i = 1; i < argc; i++)
weston_log("fatal: unhandled option: %s\n", argv[i]);
if (argc > 1) {
ret = EXIT_FAILURE;
goto out;
}
--
1.9.1
More information about the wayland-devel
mailing list