bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#57939: 29.0.50; Fixing raise-frame on Sway


From: Sean Whitton
Subject: bug#57939: 29.0.50; Fixing raise-frame on Sway
Date: Mon, 19 Sep 2022 09:21:27 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Under Sway, with pgtk, raise-frame doesn't work.  We could make it work
by using Sway's IPC to send a request to "focus" the frame.  This can be
done without invoking any external processes, but here is a hack using
swaymsg(1) just as a demonstration:

    (defun spw/sway-raise-frame (orig-fun &optional frame)
      (unless frame (setq frame (selected-frame)))
      (if (member "XDG_CURRENT_DESKTOP=sway"
                  (frame-parameter frame 'environment))
          (call-process "swaymsg" nil nil nil
                    (format "[title=\"%s\"]"
                            (frame-parameter frame 'name))
                    "focus")
        (funcall orig-fun frame)))
    (advice-add 'raise-frame :around #'spw/sway-raise-frame)

On the one hand, Sway is one of the more popular Wayland compositors, so
it would be nice to support this.  On the other hand, this isn't a
generic wlroots mechanism -- it will work only for Sway.  (I suppose
it's possible that some other compositors will adopt Sway's IPC.)

Would this be an appropriate thing to add to raise-frame?  Or is it
better left as a piece of advice?  The IPC protocol is documented here:
<https://manpages.debian.org/sway-ipc>.

-- 
Sean Whitton





reply via email to

[Prev in Thread] Current Thread [Next in Thread]