i3
startup.h File Reference
#include <config.h>
#include <libsn/sn-monitor.h>
Include dependency graph for startup.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SN_API_NOT_YET_FROZEN   1
 

Functions

void start_application (const char *command, bool no_startup_id)
 Starts the given application by passing it through a shell.
 
void startup_sequence_delete (struct Startup_Sequence *sequence)
 Deletes a startup sequence, ignoring whether its timeout has elapsed.
 
void startup_monitor_event (SnMonitorEvent *event, void *userdata)
 Called by libstartup-notification when something happens.
 
void startup_sequence_rename_workspace (const char *old_name, const char *new_name)
 Renames workspaces that are mentioned in the startup sequences.
 
struct Startup_Sequencestartup_sequence_get (i3Window *cwindow, xcb_get_property_reply_t *startup_id_reply, bool ignore_mapped_leader)
 Gets the stored startup sequence for the _NET_STARTUP_ID of a given window.
 
char * startup_workspace_for_window (i3Window *cwindow, xcb_get_property_reply_t *startup_id_reply)
 Checks if the given window belongs to a startup notification by checking if the _NET_STARTUP_ID property is set on the window (or on its leader, if it’s unset).
 
void startup_sequence_delete_by_window (i3Window *win)
 Deletes the startup sequence for a window if it exists.
 

Macro Definition Documentation

◆ SN_API_NOT_YET_FROZEN

#define SN_API_NOT_YET_FROZEN   1

Definition at line 17 of file startup.h.

Function Documentation

◆ start_application()

void start_application ( const char * command,
bool no_startup_id )

Starts the given application by passing it through a shell.

We use double fork to avoid zombie processes. As the started application’s parent exits (immediately), the application is reparented to init (process-id 1), which correctly handles children, so we don’t have to do it :-).

The shell used to start applications is the system's bourne shell (i.e., /bin/sh).

The no_startup_id flag determines whether a startup notification context (and ID) should be created, which is the default and encouraged behavior.

Definition at line 134 of file startup.c.

References con_get_workspace(), conn_screen, Startup_Sequence::context, current_socketpath, focused, Startup_Sequence::id, last_timestamp, listen_fds, LOG, main_loop, Con::name, original_rlimit_core, scalloc(), SD_LISTEN_FDS_START, sndisplay, sstrdup(), TAILQ_INSERT_TAIL, Startup_Sequence::workspace, XCURSOR_CURSOR_WATCH, and xcursor_set_root_cursor().

Referenced by cmd_exec(), and main().

Here is the call graph for this function:

◆ startup_monitor_event()

void startup_monitor_event ( SnMonitorEvent * event,
void * userdata )

Called by libstartup-notification when something happens.

Definition at line 212 of file startup.c.

References _prune_startup_sequences(), Startup_Sequence::delete_at, DLOG, Startup_Sequence::id, TAILQ_FOREACH, XCURSOR_CURSOR_POINTER, and xcursor_set_root_cursor().

Referenced by property_handlers_init().

Here is the call graph for this function:

◆ startup_sequence_delete()

void startup_sequence_delete ( struct Startup_Sequence * sequence)

Deletes a startup sequence, ignoring whether its timeout has elapsed.

Useful when e.g. a window is moved between workspaces and its children shouldn't spawn on the original workspace.

Definition at line 106 of file startup.c.

References Startup_Sequence::context, Startup_Sequence::delete_at, DLOG, FREE, Startup_Sequence::id, TAILQ_REMOVE, and Startup_Sequence::workspace.

Referenced by _prune_startup_sequences(), startup_sequence_delete_by_window(), and startup_workspace_for_window().

◆ startup_sequence_delete_by_window()

void startup_sequence_delete_by_window ( i3Window * win)

Deletes the startup sequence for a window if it exists.

Definition at line 372 of file startup.c.

References conn, Window::id, startup_sequence_delete(), and startup_sequence_get().

Referenced by _con_move_to_con(), and remanage_window().

Here is the call graph for this function:

◆ startup_sequence_get()

struct Startup_Sequence * startup_sequence_get ( i3Window * cwindow,
xcb_get_property_reply_t * startup_id_reply,
bool ignore_mapped_leader )

Gets the stored startup sequence for the _NET_STARTUP_ID of a given window.

Definition at line 277 of file startup.c.

References con_by_window_id(), conn, DLOG, FREE, Startup_Sequence::id, Window::id, Window::leader, sasprintf(), and TAILQ_FOREACH.

Referenced by startup_sequence_delete_by_window(), and startup_workspace_for_window().

Here is the call graph for this function:

◆ startup_sequence_rename_workspace()

void startup_sequence_rename_workspace ( const char * old_name,
const char * new_name )

Renames workspaces that are mentioned in the startup sequences.

Definition at line 260 of file startup.c.

References DLOG, Startup_Sequence::id, sstrdup(), TAILQ_FOREACH, and Startup_Sequence::workspace.

Referenced by cmd_rename_workspace().

Here is the call graph for this function:

◆ startup_workspace_for_window()

char * startup_workspace_for_window ( i3Window * cwindow,
xcb_get_property_reply_t * startup_id_reply )

Checks if the given window belongs to a startup notification by checking if the _NET_STARTUP_ID property is set on the window (or on its leader, if it’s unset).

If so, returns the workspace on which the startup was initiated. Returns NULL otherwise.

Definition at line 351 of file startup.c.

References Startup_Sequence::delete_at, DLOG, Startup_Sequence::id, startup_sequence_delete(), startup_sequence_get(), and Startup_Sequence::workspace.

Referenced by manage_window().

Here is the call graph for this function: