all repos — tint2 @ 6fc608f0991f802ed7cc8c8a5d0504a0445c4beb

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

Work better without a config file
o9000 mrovi9000@gmail.com
commit

6fc608f0991f802ed7cc8c8a5d0504a0445c4beb

parent

07256c0ed3ce0e8366f1d9cd43e0d7f79a103857

2 files changed, 22 insertions(+), 8 deletions(-)

jump to
M src/config.csrc/config.c

@@ -1057,7 +1057,7 @@ char line[512];

char *key, *value; if ((fp = fopen(path, "r")) == NULL) - return 0; + return FALSE; while (fgets(line, sizeof(line), fp) != NULL) { if (parse_line(line, &key, &value)) {

@@ -1098,7 +1098,7 @@ if (!read_border_color_press)

memcpy(&bg->border_color_pressed, &bg->border_color_hover, sizeof(Color)); } - return 1; + return TRUE; } gboolean config_read_default_path()

@@ -1133,7 +1133,7 @@ if (path2) {

// copy file in user directory (path1) gchar *dir = g_build_filename(g_get_user_config_dir(), "tint2", NULL); if (!g_file_test(dir, G_FILE_TEST_IS_DIR)) - g_mkdir(dir, 0777); + g_mkdir(dir, 0700); g_free(dir); path1 = g_build_filename(g_get_user_config_dir(), "tint2", "tint2rc", NULL);

@@ -1145,7 +1145,20 @@ config_path = strdup(path1);

g_free(path1); return result; } - return 0; + + // generate empty config file + gchar *dir = g_build_filename(g_get_user_config_dir(), "tint2", NULL); + if (!g_file_test(dir, G_FILE_TEST_IS_DIR)) + g_mkdir(dir, 0700); + g_free(dir); + + path1 = g_build_filename(g_get_user_config_dir(), "tint2", "tint2rc", NULL); + copy_file("/dev/null", path1); + + gboolean result = config_read_file(path1); + config_path = strdup(path1); + g_free(path1); + return result; } gboolean config_read()
M src/tint.csrc/tint.c

@@ -369,9 +369,10 @@ void init_X11_pre_config()

{ server.display = XOpenDisplay(NULL); if (!server.display) { - fprintf(stderr, "tint2 exit : could not open display.\n"); - exit(0); + fprintf(stderr, "tint2: could not open display.\n"); + exit(1); } + XSetErrorHandler((XErrorHandler)server_catch_error); server_init_atoms(); server.screen = DefaultScreen(server.display); server.root_win = RootWindow(server.display, server.screen);

@@ -396,7 +397,6 @@

void init_X11_post_config() { server_init_visual(); - XSetErrorHandler((XErrorHandler)server_catch_error); #ifdef HAVE_SN // Initialize startup-notification

@@ -1392,7 +1392,8 @@

init_X11_pre_config(); if (!config_read()) { - fprintf(stderr, "usage: tint2 [-c] <config_file>\n"); + fprintf(stderr, "Could not read config file.\n" + "Usage: tint2 [[-c] <config_file>]\n"); cleanup(); exit(1); }