Time Lord technology: for_window config directive to run arbitrary cmds
An example to set all XTerms floating: for_window [class="XTerm"] mode floating To make all urxvts use a 1-pixel border: for_window [class="urxvt"] border 1pixel A less useful, but rather funny example: for_window [title="x200: ~/work"] mode floating The commands are not completely arbitrary. The commands above were tested, others may need some fixing. Internally, windows are compared against your criteria (class, title, …) when they are initially managed and whenever one of the relevant values change. Then, the specified command is run *once* (per window). It gets prefixed with a criteria to make it match only the specific window that triggered it. So, if you configure "mode floating", i3 runs something like '[id="8393923"] mode floating'.
This commit is contained in:
@ -33,6 +33,7 @@ typedef struct Rect Rect;
|
||||
typedef struct xoutput Output;
|
||||
typedef struct Con Con;
|
||||
typedef struct Match Match;
|
||||
typedef struct Assignment Assignment;
|
||||
typedef struct Window i3Window;
|
||||
|
||||
|
||||
@ -274,11 +275,14 @@ struct Window {
|
||||
|
||||
/** Pixels the window reserves. left/right/top/bottom */
|
||||
struct reservedpx reserved;
|
||||
|
||||
/** Pointers to the Assignments which were already ran for this Window
|
||||
* (assignments run only once) */
|
||||
uint32_t nr_assignments;
|
||||
Assignment **ran_assignments;
|
||||
};
|
||||
|
||||
struct Match {
|
||||
enum { M_WINDOW, M_CON } what;
|
||||
|
||||
char *title;
|
||||
int title_len;
|
||||
char *application;
|
||||
@ -296,10 +300,6 @@ struct Match {
|
||||
Con *con_id;
|
||||
enum { M_ANY = 0, M_TILING, M_FLOATING } floating;
|
||||
|
||||
enum { M_GLOBAL = 0, M_OUTPUT, M_WORKSPACE } levels;
|
||||
|
||||
enum { M_USER = 0, M_RESTART } source;
|
||||
|
||||
char *target_ws;
|
||||
|
||||
/* Where the window looking for a match should be inserted:
|
||||
@ -317,6 +317,29 @@ struct Match {
|
||||
TAILQ_ENTRY(Match) assignments;
|
||||
};
|
||||
|
||||
struct Assignment {
|
||||
/** type of this assignment:
|
||||
*
|
||||
* A_COMMAND = run the specified command for the matching window
|
||||
* A_TO_WORKSPACE = assign the matching window to the specified workspace
|
||||
* A_TO_OUTPUT = assign the matching window to the specified output
|
||||
*
|
||||
*/
|
||||
enum { A_COMMAND = 0, A_TO_WORKSPACE = 1, A_TO_OUTPUT = 2 } type;
|
||||
|
||||
/** the criteria to check if a window matches */
|
||||
Match match;
|
||||
|
||||
/** destination workspace/output/command, depending on the type */
|
||||
union {
|
||||
char *command;
|
||||
char *workspace;
|
||||
char *output;
|
||||
} dest;
|
||||
|
||||
TAILQ_ENTRY(Assignment) real_assignments;
|
||||
};
|
||||
|
||||
struct Con {
|
||||
bool mapped;
|
||||
enum {
|
||||
|
Reference in New Issue
Block a user