From c0feda753ceabf5ebabd42e78c6dca634edfc329 Mon Sep 17 00:00:00 2001 From: Julien Portalier Date: Wed, 3 May 2023 23:57:41 +0200 Subject: [PATCH] Fix: present the existing app/window on subsequent instances --- src/application.cr | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/application.cr b/src/application.cr index 2560e3a..7a4d9cf 100644 --- a/src/application.cr +++ b/src/application.cr @@ -1,18 +1,21 @@ module BriumApp - # TODO: when access token isn't defined, present a window to request and - # enter the access token, then close it and present the talk UI. - class Application < Gtk::Application @messages = [] of Message @window : Window? + @activated = false def initialize super application_id: "me.brium.app" on_activate do - window.build - window.connect("destroy") { quit } - window.chat_entry.on_activate { handle_chat_message } + if @activated + window.present_with_time(Time.utc.to_unix) + else + @activated = true + window.build + window.connect("destroy") { quit } + window.chat_entry.on_activate { handle_chat_message } + end end end