Add support for default configuration file

This commit is contained in:
project-repo 2021-10-17 07:50:03 +02:00
commit 2ab4955c46
3 changed files with 20 additions and 8 deletions

View file

@ -192,7 +192,7 @@ set_configuration(struct cg_server *server,
if(config_file == NULL) {
wlr_log(WLR_ERROR, "Could not open config file \"%s\"",
config_file_path);
return -1;
return 1;
}
char line[MAX_LINE_SIZE * sizeof(char)];
for(unsigned int line_num = 1;
@ -557,7 +557,17 @@ main(int argc, char *argv[]) {
ret = 1;
goto end;
}
if(set_configuration(&server, config_file) != 0) {
int conf_ret = set_configuration(&server, config_file);
// Configurtion file not found
if(conf_ret == 1) {
char *default_conf = "/etc/xdg/cagebreak/config";
wlr_log(WLR_ERROR, "Loading default configuration file: \"%s\"",
default_conf);
conf_ret = set_configuration(&server, default_conf);
}
if(conf_ret != 0) {
free(config_file);
ret = 1;
goto end;

View file

@ -75,14 +75,14 @@ definekey top XF86MonBrightnessUp exec xbacklight -inc 1
######################
#Output configuration
######################
output eDP-1 pos 0 0 res 1366x768 rate 60
output eDP-1 disable
output eDP-1 enable
#output eDP-1 pos 0 0 res 1366x768 rate 60
#output eDP-1 disable
#output eDP-1 enable
#####################
#Input configuration
#####################
input 1234:0:Device_Ident click_method clickfinger
input type:pointer scroll_method two_finger
input * calibration_matrix 1 2 3 4 5 6
#input 1234:0:Device_Ident click_method clickfinger
#input type:pointer scroll_method two_finger
#input * calibration_matrix 1 2 3 4 5 6

View file

@ -258,6 +258,8 @@ executable(
c_args: fuzz_compile_args,
)
install_data('examples/config',install_dir: '/etc/xdg/cagebreak')
if get_option('man-pages')
scdoc = find_program('scdoc')
sh = find_program('sh')