]> git.sur5r.net Git - i3/i3/blob - include/startup.h
9729cdc2fcd7c2c03eae53dc81419bbf13d82266
[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 #define SN_API_NOT_YET_FROZEN 1
16 #include <libsn/sn-monitor.h>
17
18 /**
19  * Starts the given application by passing it through a shell. We use double
20  * fork to avoid zombie processes. As the started application’s parent exits
21  * (immediately), the application is reparented to init (process-id 1), which
22  * correctly handles childs, so we don’t have to do it :-).
23  *
24  * The shell used to start applications is the system's bourne shell (i.e.,
25  * /bin/sh).
26  *
27  * The no_startup_id flag determines whether a startup notification context
28  * (and ID) should be created, which is the default and encouraged behavior.
29  *
30  */
31 void start_application(const char *command, bool no_startup_id);
32
33 /**
34  * Deletes a startup sequence, ignoring whether its timeout has elapsed.
35  * Useful when e.g. a window is moved between workspaces and its children
36  * shouldn't spawn on the original workspace.
37  *
38  */
39 void startup_sequence_delete(struct Startup_Sequence *sequence);
40
41 /**
42  * Called by libstartup-notification when something happens
43  *
44  */
45 void startup_monitor_event(SnMonitorEvent *event, void *userdata);
46
47 /**
48  * Renames workspaces that are mentioned in the startup sequences.
49  *
50  */
51 void startup_sequence_rename_workspace(const char *old_name, const char *new_name);
52
53 /**
54  * Gets the stored startup sequence for the _NET_STARTUP_ID of a given window.
55  *
56  */
57 struct Startup_Sequence *startup_sequence_get(i3Window *cwindow,
58                                               xcb_get_property_reply_t *startup_id_reply, bool ignore_mapped_leader);
59
60 /**
61  * Checks if the given window belongs to a startup notification by checking if
62  * the _NET_STARTUP_ID property is set on the window (or on its leader, if it’s
63  * unset).
64  *
65  * If so, returns the workspace on which the startup was initiated.
66  * Returns NULL otherwise.
67  *
68  */
69 char *startup_workspace_for_window(i3Window *cwindow, xcb_get_property_reply_t *startup_id_reply);