diff options
-rw-r--r-- | common/log.c | 15 | ||||
-rw-r--r-- | sway/handlers.c | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/common/log.c b/common/log.c index 6f9fb07e..1da2ba2f 100644 --- a/common/log.c +++ b/common/log.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <fcntl.h> | 8 | #include <fcntl.h> |
9 | #include <unistd.h> | 9 | #include <unistd.h> |
10 | #include <signal.h> | 10 | #include <signal.h> |
11 | #include <time.h> | ||
11 | #include <errno.h> | 12 | #include <errno.h> |
12 | #include <string.h> | 13 | #include <string.h> |
13 | #include <stringop.h> | 14 | #include <stringop.h> |
@@ -65,6 +66,20 @@ void sway_abort(const char *format, ...) { | |||
65 | 66 | ||
66 | void _sway_log(const char *filename, int line, log_importance_t verbosity, const char* format, ...) { | 67 | void _sway_log(const char *filename, int line, log_importance_t verbosity, const char* format, ...) { |
67 | if (verbosity <= v) { | 68 | if (verbosity <= v) { |
69 | // prefix the time to the log message | ||
70 | static struct tm result; | ||
71 | static time_t t; | ||
72 | static struct tm *tm_info; | ||
73 | char buffer[26]; | ||
74 | |||
75 | // get current time | ||
76 | t = time(NULL); | ||
77 | // convert time to local time (determined by the locale) | ||
78 | tm_info = localtime_r(&t, &result); | ||
79 | // generate time prefix | ||
80 | strftime(buffer, sizeof(buffer), "%x %X - ", tm_info); | ||
81 | fprintf(stderr, "%s", buffer); | ||
82 | |||
68 | unsigned int c = verbosity; | 83 | unsigned int c = verbosity; |
69 | if (c > sizeof(verbosity_colors) / sizeof(char *) - 1) { | 84 | if (c > sizeof(verbosity_colors) / sizeof(char *) - 1) { |
70 | c = sizeof(verbosity_colors) / sizeof(char *) - 1; | 85 | c = sizeof(verbosity_colors) / sizeof(char *) - 1; |
diff --git a/sway/handlers.c b/sway/handlers.c index 7e958c72..cb608bec 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -270,6 +270,7 @@ static bool handle_view_created(wlc_handle handle) { | |||
270 | wlc_view_set_mask(handle, VISIBLE); | 270 | wlc_view_set_mask(handle, VISIBLE); |
271 | wlc_view_set_output(handle, panel_config->output); | 271 | wlc_view_set_output(handle, panel_config->output); |
272 | wlc_view_bring_to_front(handle); | 272 | wlc_view_bring_to_front(handle); |
273 | arrange_windows(&root_container, -1, -1); | ||
273 | return true; | 274 | return true; |
274 | } | 275 | } |
275 | 276 | ||