Authentication-Results: mail-b.sr.ht; dkim=pass header.d=u92.eu header.i=@u92.eu; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by mail-b.sr.ht (Postfix) with ESMTPS id C605911EF37 for <~mil/sxmo-devel@lists.sr.ht>; Sat, 27 Feb 2021 22:20:54 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 9D6127B2 for <~mil/sxmo-devel@lists.sr.ht>; Sat, 27 Feb 2021 17:20:53 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sat, 27 Feb 2021 17:20:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=u92.eu; h=from :to:subject:date:message-id:mime-version :content-transfer-encoding; s=fm1; bh=sS3MIK2TrNQKdTW9N6nV3z3byY iitUOuFAOGnzunA9w=; b=VOupo7uVhmLODgLQ9xS40kdR/vs3CGuGH/PLP8lP5A inEForhhRUgAEKKSZvp498pmewTnyt8OEbbOmBZnqIwKQz6QcfT16I7JluLvoIVP 5HZiJwKq0tpB6Pxj1oTGxGsV7OzXuNJF76dCtgizmjtV1ru5AQ40hA/yBg6qpBCr 6NpKA5O+FdNtNXao7mKigi/tiXhVJk+cgkt3lq5lf5MbRYrPkfYB4wmPHhmUXuG/ T4Rf6QKY6MXX4Brhcp+fmemTg+BWyRyWT2YG39uTzPyvJYE7zNGVdLQwGy8GwFSd vEQ89Ig43WUzYuPL+crAf63JHeKgfNlmPKwmcDyCWOOg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=sS3MIK2TrNQKdTW9N 6nV3z3byYiitUOuFAOGnzunA9w=; b=YQIB+rbtVv1tjUVHf7evukRfMWpCy8OF6 3aeMAMBSHmXyy1D6DL/crf8JxlPUjRM84FIh296EK30dYSCOWFL2UgTCmEKGCqGV Jq+Y6Wn8NHlFv8LV79nkpDL50b+23/MwIKxxoEX0mEK9Kdkgg2tyolwc15bFB4Om fqYI0EGIXWKLGNE/Ga+3YE4MLR8zrdLc0sc0EF9LnhbfEaTGhOccIc9WJk10xeuV 6msk4XU60ic43N3vihPxcGV8utgZDjm53IhjCDdWZCuKeE1IRMreTBTHXTGOAT3U EluKREaKd8D2583aUrBaC+cTfurVgoG7mOQ09gteXSe3RDbXIFrYA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrleefgdduieduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgogfeguddtqddvjeculdegtddmnecujfgurhephf fvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefhvghrnhgrnhguohcutfgrmhho shcuoehgrhgvvghnfhhoohesuhelvddrvghuqeenucggtffrrghtthgvrhhnpeegheeghf ejudeffffhtdffhfefueeggefhkeetgfffjeekleehffffieevieejieenucffohhmrghi nhepghhithhhuhgsudhsrdgtohhmnecukfhppedukeehrdefledrgedvrddvfeenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvvghnfhho ohesuhelvddrvghu X-ME-Proxy: Received: from zacax395.bbrouter (unknown [185.39.42.23]) by mail.messagingengine.com (Postfix) with ESMTPA id E4B5B24005A for <~mil/sxmo-devel@lists.sr.ht>; Sat, 27 Feb 2021 17:20:51 -0500 (EST) From: Fernando Ramos To: ~mil/sxmo-devel@lists.sr.ht Subject: [PATCH sxmo-utils] Close windows in a more "graceful" way. Date: Sat, 27 Feb 2021 23:20:49 +0100 Message-Id: <20210227222049.167177-1-greenfoo@u92.eu> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit --- It turns out "xdotool killwindow" simply calls "XKillClient()", as you can see on xdotool's repo ("https://github1s.com/jordansissel/xdotool") here: "cmd_windowkill.c:40" --> "xdo.c:1845". This doesn't give the application inside the window any chance to do anything which, in the case of Firefox, causes the "restore session" message to pop-up the next time it runs (but, for some reason, not always). I found out that using "xdotool key shift+alt+c" also closes the window while giving the application an opportunity to gracefully shut down (this happens because wdm sends the WM_DELETE_WINDOW message before killing the X window). WARNING: While this new command is "nicer", it also does *not* immediately close the window (ex: in the case of Firefox, a confirmation popup appears first). This might *not* be what the "two fingers gesture" is meant to do. If so, feel free to ignore this patch :) scripts/core/sxmo_killwindow.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/core/sxmo_killwindow.sh b/scripts/core/sxmo_killwindow.sh index f55a076..d48f306 100755 --- a/scripts/core/sxmo_killwindow.sh +++ b/scripts/core/sxmo_killwindow.sh @@ -4,4 +4,4 @@ # shellcheck source=scripts/core/sxmo_common.sh . "$(dirname "$0")/sxmo_common.sh" -xdotool windowkill "$(xdotool getactivewindow)" +xdotool key shift+alt+c -- 2.30.1