From b679d220cdf80bc56d3f3e39fd5609c1873364b6 Mon Sep 17 00:00:00 2001 From: GeopJr Date: Mon, 21 Nov 2022 22:18:19 +0200 Subject: [PATCH] fix: open signal while already open (#124) --- src/collision/views/main.cr | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/collision/views/main.cr b/src/collision/views/main.cr index 1baaaaf..8c80b69 100644 --- a/src/collision/views/main.cr +++ b/src/collision/views/main.cr @@ -1,5 +1,6 @@ module Collision @@main_window_id = 0_u32 + @@activated = false def activate(app : Adw::Application) # Put window on focus if already exists. @@ -62,6 +63,7 @@ module Collision window.content = WINDOW_BOX window.present + @@activated = true LOGGER.debug { "Window activated" } LOGGER.debug { "Settings: #{window_settings}" } @@ -103,10 +105,10 @@ module Collision # it sets the first one (since multiple can be passed) # as the Collision::Welcomer's file. def open_with(app : Adw::Application, files : Enumerable(Gio::File), hint : String) - activate(app) + activate(app) unless @@activated if files.size > 0 && Collision.file?(files[0].path.not_nil!, false) - Collision::Welcomer.file = files[0] + (Collision::Welcomer.passed? ? Collision : Collision::Welcomer).file = files[0] end nil