qterminal icon indicating copy to clipboard operation
qterminal copied to clipboard

QTerminal -d on wayland vanishes if loosing focus and can't be recovered

Open stefonarch opened this issue 2 years ago • 7 comments

As it fails to register the shortcut there's no way to make it visible again.

Possible Solution
  1. Allow only one instance of qterminal -d (see comment )
  2. or fix the registering of the shortcut
Steps to Reproduce (for bugs)
  1. Open qterminal -d on wayland

  2. change focus

  3. it will disappear also from taskbar like yatbfw

                                             -
    
  • QTerminal version: 1.2.0

stefonarch avatar Jan 29 '23 14:01 stefonarch

IMHO, the drop-down mode is already used like a single-instance app; having multiple instances of it running together doesn't make much sense under X11 either.

tsujan avatar Jan 29 '23 15:01 tsujan

The current qterminal already allows showing/hiding the dropdown window via a dbus method. For example:

qdbus org.lxqt.QTerminal-612287 / org.lxqt.QTerminal.Process.toggleDropdown

However, the service name is not fixed, as dbus interfaces in qterminal are designed to support multiple instances. Moving to a single-instance model is a big work and I don't think I can do it in near future. See also https://github.com/lxqt/qterminal/issues/644 for previous discussions about single-instance model.

yan12125 avatar Feb 06 '23 06:02 yan12125

Could dbus-send something be used with a wildcard which always matches the dropdown terminal?

This could be used in a shortcut on all wayland compositors. Looking for the clients class there are the same, would it be possibile to have a different class for the dropdown-window?

Window a8b59ab0 -> stef@archlinux: ~:
        at: 41,41
        size: 1283,998
        workspace: 3 (3)
        floating: 0
        monitor: 0
        class: qterminal
        title: stef@archlinux: ~
        pid: 2301858
        xwayland: 0
        pinned: 0
        fullscreen: 0
        fullscreenmode: 0
        fakefullscreen: 0
        grouped: 0
        swallowing: 0
-----------------------------
Window a8b59ab0 -> stef@archlinux: ~:
        at: 41,41
        size: 1283,998
        workspace: 3 (3)
        floating: 0
        monitor: 0
        class: qterminal
        title: stef@archlinux: ~
        pid: 2301858
        xwayland: 0
        pinned: 0
        fullscreen: 0
        fullscreenmode: 0
        fakefullscreen: 0
        grouped: 0
        swallowing: 0


stefonarch avatar Feb 09 '23 08:02 stefonarch

Could dbus-send something be used with a wildcard which always matches the dropdown terminal?

I guess no direct way for current qterminal. You will need a script to iterate over possible dbus interface names.

Looking for the clients class there are the same, would it be possibile to have a different class for the dropdown-window?

Most likely possible with some code changes. That being said, I prefer a platform-independent way that is independent of Wayland or X11 properties. A dbus property may be better.

yan12125 avatar Feb 16 '23 12:02 yan12125

@stefonarch @yan12125 Using DBus to send a command is possible, just not in a way you might expect. Instead of using qdbus org.lxqt.qterminal... don't you think it's easier to use qterminal --toggle ?

If only a single instance of QTerminal in the drop-down mode is allowed, you should be able to use a property (IsDropDown), search all the qterminal dbus services, and match the one where IsDropDown is true. Send a request to that service. If no instance is found, then do nothing.

marcusbritanicus avatar Aug 01 '23 07:08 marcusbritanicus

Sure, a command line option is better. It may be non-trivial and I don't have time to look into it yet, though. As usual, patches are welcome.

yan12125 avatar Aug 01 '23 13:08 yan12125

If only one instance is running this works:

#!/bin/bash
# Helper script for qterminal -d
ID=$(qdbus |grep QTermin|awk '{$1=$1};1')

qdbus "$ID" / org.lxqt.QTerminal.Process.toggleDropdown

EDIT: working version for more instances:

#!/bin/bash
while IFS= read -r line; do
    qdbus "$line" / org.lxqt.QTerminal.Process.toggleDropdown
done < <(qdbus | grep QTermin | awk '{$1=$1};1')

stefonarch avatar Mar 01 '24 12:03 stefonarch

Done in https://github.com/lxqt/qterminal/pull/1131 and https://github.com/lxqt/qterminal/pull/1113

tsujan avatar May 24 '24 17:05 tsujan