Closed seltzered closed 11 months ago
Should be a new toggle IMO. You can see that the dbus change as written regresses by not sending all info- display* and timestamp, and these are important in some configurations. The nature of the many desktop environments means that whatever looks like it "works for you" could be buggy other places.
*It's doubtful if display is useful anymore, don't think it is in current gtk3. Timestamp/startup id would be, if it's for the default action when running kupfer.
This can be handled by simple shell script.
dbus-send --type=method_call --dest=se.kaizer.kupfer /interface se.kaizer.kupfer.Listener.ShowHide
Thank you! To ensure this will also launch kupfer if it isn't running, and send the show/hide toggle if it is, I ended up with the following script:
#!/usr/bin/bash
# detect if kupfer is running by checking if dbus service is listed
if dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames | grep io.github.kupferlauncher > /dev/null
then # kupfer running, send showHide signal
dbus-send --type=method_call --dest=io.github.kupferlauncher /io/github/kupferlauncher io.github.kupferlauncher.Listener.ShowHide
else # kupfer not running, launch kupfer
kupfer
fi
One can then just setup a keyboard shortcut to this script to their desktop environment's settings, such as in gnome:
The se.kaizer.kupfer and so on dbus names are long deprecated, you should use the kupferlauncher names
SERVICE="io.github.kupferlauncher" OBJ="/io/github/kupferlauncher" IFACE="io.github.kupferlauncher.Listener"
Huh, I just tested on v323 and while I can get:
dbus-send --type=method_call --dest=se.kaizer.kupfer /interface se.kaizer.kupfer.Listener.ShowHide
to work, the suggested dbus name change to:
dbus-send --type=method_call --dest=io.github.kupferlauncher /interface io.github.kupferlauncher.Listener.ShowHide
does not work. I did run listNames to check the service is running and see both string "io.github.kupferlauncher"
and string "se.kaizer.kupfer"
dbus-send --type=method_call --dest=io.github.kupferlauncher /io/github/kupferlauncher io.github.kupferlauncher.Listener.ShowHide
Thanks! Will update my script in https://github.com/kupferlauncher/kupfer/issues/157#issuecomment-1858918949
Hi, I'm as mentioned in https://github.com/kupferlauncher/kupfer/issues/62#issuecomment-882696739 I'm trying to make kupfer show (and more important to this issue hide itself) when one is invoking kupfer without keybinder (i.e. invoking the kupfer-run script). After looking into it the following ways to implement it come to mind:
1. Assume show/hide as a default behavior for kupfer-run
I've tried this route and it could be done seemingly by just replacing the line invoking PresentOnDisplay with a ShowHide message, i.e.: from
test $KUPFER_HAS_OPTIONS != 0 && dbus-send --type=method_call --print-reply \ --dest=$SERVICE $OBJ $IFACE.PresentOnDisplay string:"$DISPLAY" \ "string:$DESKTOP_STARTUP_ID" >/dev/null 2>&1
totest $KUPFER_HAS_OPTIONS != 0 && dbus-send --type=method_call --print-reply \ --dest=$SERVICE $OBJ $IFACE.ShowHide >/dev/null 2>&1
2. Create a command-line option to pass into kupfer
This would mean creating something like a
--toggle
option to pass into kupfer.py to then be handled.Is there a preference on how this should be implemented?
Environment
Ubuntu 21.04 (uses wayland)
Actual Behaviour
Hitting ctrl+space (or whatever one uses to invoke kupfer (the kupfer-run.sh script)) when kupfer window is already open doesn't hide the window.
Expected Behaviour
Hitting ctrl+space (or whatever one uses to invoke kupfer (the kupfer-run.sh script)) when kupfer window is already open hides the window, either as a default or by setting a
--toggle
option