Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ gboolean volume_object_notify(VolumeObject* obj,
print_debug("Creating new notification...", obj->debug);
obj->notification = create_notification(obj->settings);
gtk_widget_realize(GTK_WIDGET(obj->notification));
g_timeout_add(1000, (GSourceFunc) time_handler, (gpointer) obj);
g_timeout_add(100, (GSourceFunc) time_handler, (gpointer) obj);
print_debug_ok(obj->debug);
}

Expand Down Expand Up @@ -170,7 +170,7 @@ static void print_usage(const char* filename, int failure) {
" -n\t\t--no-daemon\t\tdo not daemonize\n"
"\n"
"Configuration:\n"
" -t <int>\t--timeout <int>\t\tnotification timeout in seconds\n"
" -t <int>\t--timeout <float>\t\tnotification timeout in seconds with one optional decimal place\n"
" -a <float>\t--alpha <float>\t\ttransparency level (0.0 - 1.0, default %.2f)\n"
" -r <int>\t--corner-radius <int>\tradius of the round corners in pixels (default %d)\n"
, filename, settings.alpha, settings.corner_radius);
Expand All @@ -182,6 +182,7 @@ static void print_usage(const char* filename, int failure) {

int main(int argc, char* argv[]) {
Settings settings = get_default_settings();
float timeout_in;
int timeout = 3;

void *options = gopt_sort(&argc, (const char**) argv, gopt_start(
Expand All @@ -197,8 +198,12 @@ int main(int argc, char* argv[]) {
int no_daemon = gopt(options, 'n');

if (gopt(options, 't')) {
if (sscanf(gopt_arg_i(options, 't', 0), "%d", &timeout) != 1)
if (sscanf(gopt_arg_i(options, 't', 0), "%f", &timeout_in) == 1
&& timeout_in > 0.0f) {
timeout = (int) (timeout_in * 10);
} else {
print_usage(argv[0], TRUE);
}
}

if (gopt(options, 'a')) {
Expand Down