2011-10-10 12:36:21 +02:00
|
|
|
|
/*
|
|
|
|
|
* vim:ts=4:sw=4:expandtab
|
|
|
|
|
*
|
|
|
|
|
* i3 - an improved dynamic tiling window manager
|
2015-04-04 02:17:56 +02:00
|
|
|
|
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
|
2011-10-10 12:36:21 +02:00
|
|
|
|
*
|
2011-10-25 22:19:38 +02:00
|
|
|
|
* startup.c: Startup notification code. Ensures a startup notification context
|
|
|
|
|
* is setup when launching applications. We store the current
|
|
|
|
|
* workspace to open windows in that startup notification context on
|
|
|
|
|
* the appropriate workspace.
|
2011-10-10 12:36:21 +02:00
|
|
|
|
*
|
|
|
|
|
*/
|
2013-12-29 03:11:50 +01:00
|
|
|
|
#pragma once
|
2011-10-10 12:36:21 +02:00
|
|
|
|
|
2016-10-11 09:13:35 +02:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2011-10-10 12:36:21 +02:00
|
|
|
|
#define SN_API_NOT_YET_FROZEN 1
|
|
|
|
|
#include <libsn/sn-monitor.h>
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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
|
2018-10-10 17:31:03 +02:00
|
|
|
|
* correctly handles children, so we don’t have to do it :-).
|
2011-10-10 12:36:21 +02:00
|
|
|
|
*
|
2014-12-21 01:17:14 +01:00
|
|
|
|
* The shell used to start applications is the system's bourne shell (i.e.,
|
|
|
|
|
* /bin/sh).
|
2011-10-10 12:36:21 +02:00
|
|
|
|
*
|
2011-10-25 23:18:17 +02:00
|
|
|
|
* The no_startup_id flag determines whether a startup notification context
|
|
|
|
|
* (and ID) should be created, which is the default and encouraged behavior.
|
|
|
|
|
*
|
2011-10-10 12:36:21 +02:00
|
|
|
|
*/
|
2011-10-25 23:18:17 +02:00
|
|
|
|
void start_application(const char *command, bool no_startup_id);
|
2011-10-10 12:36:21 +02:00
|
|
|
|
|
2012-10-04 03:06:04 +02:00
|
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
void startup_sequence_delete(struct Startup_Sequence *sequence);
|
|
|
|
|
|
2011-10-10 12:36:21 +02:00
|
|
|
|
/**
|
|
|
|
|
* Called by libstartup-notification when something happens
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
void startup_monitor_event(SnMonitorEvent *event, void *userdata);
|
|
|
|
|
|
2015-03-07 00:13:54 +01:00
|
|
|
|
/**
|
|
|
|
|
* Renames workspaces that are mentioned in the startup sequences.
|
|
|
|
|
*
|
|
|
|
|
*/
|
2015-09-27 23:42:58 +02:00
|
|
|
|
void startup_sequence_rename_workspace(const char *old_name, const char *new_name);
|
2015-03-07 00:13:54 +01:00
|
|
|
|
|
2012-10-04 03:06:04 +02:00
|
|
|
|
/**
|
|
|
|
|
* Gets the stored startup sequence for the _NET_STARTUP_ID of a given window.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
struct Startup_Sequence *startup_sequence_get(i3Window *cwindow,
|
2014-06-19 11:20:32 +02:00
|
|
|
|
xcb_get_property_reply_t *startup_id_reply, bool ignore_mapped_leader);
|
2012-10-04 03:06:04 +02:00
|
|
|
|
|
2011-10-10 13:48:43 +02:00
|
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
char *startup_workspace_for_window(i3Window *cwindow, xcb_get_property_reply_t *startup_id_reply);
|
2019-08-13 08:50:48 +02:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Deletes the startup sequence for a window if it exists.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
void startup_sequence_delete_by_window(i3Window *win);
|