Skip to content

Commit

Permalink
Accept write-pid-path option from the config file
Browse files Browse the repository at this point in the history
Signed-off-by: jialeens <[email protected]>
  • Loading branch information
jialeens authored and yshui committed Sep 16, 2020
1 parent 4bc1ef8 commit 7d7eef7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion man/picom.1.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ OPTIONS
Look for configuration file at the path. See *CONFIGURATION FILES* section below for where picom looks for a configuration file by default. Use `/dev/null` to avoid loading configuration file.

*--write-pid-path* 'PATH'::
Write process ID to a file.
Write process ID to a file. it is recommended to use an absolute path.

*--shadow-color* 'STRING'::
Color of shadow, as a hex string ('#000000')
Expand Down
9 changes: 9 additions & 0 deletions src/config_libconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,15 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
config_setting_lookup_int(blur_cfg, "strength", &opt->blur_strength);
}

// --write-pid-path
if (config_lookup_string(&cfg, "write-pid-path", &sval)) {
if (*sval != '/') {
log_warn("The write-pid-path in your configuration file is not"
" an absolute path");
}
opt->write_pid_path = strdup(sval);
}

// Wintype settings

// XXX ! Refactor all the wintype_* arrays into a struct
Expand Down
4 changes: 4 additions & 0 deletions src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,11 @@ bool get_cfg(options_t *opt, int argc, char *const *argv, bool shadow_enable,
P_CASELONG(309, unredir_if_possible_delay);
case 310:
// --write-pid-path
free(opt->write_pid_path);
opt->write_pid_path = strdup(optarg);
if (*opt->write_pid_path != '/') {
log_warn("--write-pid-path is not an absolute path");
}
break;
P_CASEBOOL(311, vsync_use_glfinish);
case 312:
Expand Down

0 comments on commit 7d7eef7

Please sign in to comment.