]> git.sur5r.net Git - i3/i3/blob - include/startup.h
Merge branch 'release-4.16.1'
[i3/i3] / include / startup.h
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
6  *
7  * startup.c: Startup notification code. Ensures a startup notification context
8  *            is setup when launching applications. We store the current
9  *            workspace to open windows in that startup notification context on
10  *            the appropriate workspace.
11  *
12  */
13 #pragma once
14
15 #include <config.h>
16
17 #define SN_API_NOT_YET_FROZEN 1
18 #include <libsn/sn-monitor.h>
19
20 /**
21  * Starts the given application by passing it through a shell. We use double
22  * fork to avoid zombie processes. As the started application’s parent exits
23  * (immediately), the application is reparented to init (process-id 1), which
24  * correctly handles children, so we don’t have to do it :-).
25  *
26  * The shell used to start applications is the system's bourne shell (i.e.,
27  * /bin/sh).
28  *
29  * The no_startup_id flag determines whether a startup notification context
30  * (and ID) should be created, which is the default and encouraged behavior.
31  *
32  */
33 void start_application(const char *command, bool no_startup_id);
34
35 /**
36  * Deletes a startup sequence, ignoring whether its timeout has elapsed.
37  * Useful when e.g. a window is moved between workspaces and its children
38  * shouldn't spawn on the original workspace.
39  *
40  */
41 void startup_sequence_delete(struct Startup_Sequence *sequence);
42
43 /**
44  * Called by libstartup-notification when something happens
45  *
46  */
47 void startup_monitor_event(SnMonitorEvent *event, void *userdata);
48
49 /**
50  * Renames workspaces that are mentioned in the startup sequences.
51  *
52  */
53 void startup_sequence_rename_workspace(const char *old_name, const char *new_name);
54
55 /**
56  * Gets the stored startup sequence for the _NET_STARTUP_ID of a given window.
57  *
58  */
59 struct Startup_Sequence *startup_sequence_get(i3Window *cwindow,
60                                               xcb_get_property_reply_t *startup_id_reply, bool ignore_mapped_leader);
61
62 /**
63  * Checks if the given window belongs to a startup notification by checking if
64  * the _NET_STARTUP_ID property is set on the window (or on its leader, if it’s
65  * unset).
66  *
67  * If so, returns the workspace on which the startup was initiated.
68  * Returns NULL otherwise.
69  *
70  */
71 char *startup_workspace_for_window(i3Window *cwindow, xcb_get_property_reply_t *startup_id_reply);