Fixes #1158.
.\" Title: bspwm
.\" Author: [see the "Author" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\" Date: 07/26/2020
+.\" Date: 07/27/2020
.\" Manual: Bspwm Manual
-.\" Source: Bspwm 0.9.9-16-g1506582
+.\" Source: Bspwm 0.9.9-25-g8f41d79
.\" Language: English
.\"
-.TH "BSPWM" "1" "07/26/2020" "Bspwm 0\&.9\&.9\-16\-g1506582" "Bspwm Manual"
+.TH "BSPWM" "1" "07/27/2020" "Bspwm 0\&.9\&.9\-25\-g8f41d79" "Bspwm Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.RS 4
Active flags of the focused node of a focused desktop\&.
.RE
+.SH "CONFIGURATION FILE"
+.sp
+Its default path is \fI$XDG_CONFIG_HOME/bspwm/bspwmrc\fR\&.
+.sp
+An argument is passed to this script: the run level, a number which indicates whether it was launched after a restart (cf\&. \fIwm \-r\fR) or not\&.
.SH "ENVIRONMENT VARIABLES"
.PP
\fIBSPWM_SOCKET\fR
'G(S?P?L?M?)'::
Active flags of the focused node of a focused desktop.
+Configuration file
+------------------
+
+Its default path is '$XDG_CONFIG_HOME/bspwm/bspwmrc'.
+
+An argument is passed to this script: the run level, a number which indicates whether it was launched after a restart (cf. 'wm -r') or not.
+
Environment Variables
---------------------
fd_set descriptors;
char socket_path[MAXLEN];
char state_path[MAXLEN] = {0};
+ int run_level = 0;
config_path[0] = '\0';
int sock_fd = -1, cli_fd, dpy_fd, max_fd, n;
struct sockaddr_un sock_address;
snprintf(config_path, sizeof(config_path), "%s", optarg);
break;
case 's':
+ run_level |= 1;
snprintf(state_path, sizeof(state_path), "%s", optarg);
break;
case 'o':
+ run_level |= 2;
sock_fd = strtol(optarg, &end, 0);
if (*end != '\0') {
sock_fd = -1;
signal(SIGTERM, sig_handler);
signal(SIGCHLD, sig_handler);
signal(SIGPIPE, SIG_IGN);
- run_config();
+ run_config(run_level);
running = true;
while (running) {
#include "bspwm.h"
#include "settings.h"
-extern char **environ;
-
char external_rules_command[MAXLEN];
char status_prefix[MAXLEN];
bool remove_unplugged_monitors;
bool merge_overlapping_monitors;
-void run_config(void)
+void run_config(int run_level)
{
if (fork() == 0) {
if (dpy != NULL) {
close(xcb_get_file_descriptor(dpy));
}
setsid();
- execle(config_path, config_path, (char *) NULL, environ);
+ char arg1[2];
+ snprintf(arg1, 2, "%i", run_level);
+ execl(config_path, config_path, arg1, (char *) NULL);
err("Couldn't execute the configuration file.\n");
}
}
extern bool remove_unplugged_monitors;
extern bool merge_overlapping_monitors;
-void run_config(void);
+void run_config(int run_level);
void load_settings(void);
#endif