Replies: 1 comment 1 reply
-
;; SPDX-License-Identifier: GPL-3.0-or-later
;; Author: Jonas Bernoulli <emacs.transient@jonas.bernoulli.dev>
;; URL: https://github.com/magit/transient/discussions/318
(defvar i3wm-menu--frame nil)
(defvar i3wm-menu-frame-alist
'((width . 80)
(height . 20)))
(defvar i3wm-menu-display-buffer-action
;; Use nil to display like other transient menus.
'(display-buffer-full-frame))
(defvar i3wm-menu-display-menu-immediately nil)
(defun i3wm-menu--setup-menu (&optional display-frame-phase)
(when (or (not display-frame-phase)
i3wm-menu-display-menu-immediately)
(let ((transient-display-buffer-action
(or i3wm-menu-display-buffer-action
transient-display-buffer-action)))
(transient-setup 'i3wm-menu))))
(defun i3wm-menu--select-frame ()
;; Prevent i3wm from reselecting another frame the mouse may hover.
(set-mouse-position i3wm-menu--frame 25 1)
(select-frame-set-input-focus i3wm-menu--frame))
(transient-define-suffix i3wm-menu-scratch ()
:description "scratch"
(interactive)
(switch-to-buffer (get-buffer-create "*scratch*")))
(transient-define-prefix i3wm-menu ()
[["Show"
("s" i3wm-menu-scratch)
("c" "calendar" calendar)]
["Control i3wm frame/menu"
("C-g" "quit menu" transient-quit-all)
("q " "quit frame" make-frame-invisible)
("k " "kill frame" delete-frame)]]
(interactive)
(cond
((not (frame-live-p i3wm-menu--frame))
(setq i3wm-menu--frame
(make-frame (cons '(name . "i3wm-menu")
i3wm-menu-frame-alist)))
(i3wm-menu--select-frame)
(i3wm-menu-scratch)
(i3wm-menu--setup-menu 'maybe))
((not (eq i3wm-menu--frame (selected-frame)))
(i3wm-menu--select-frame)
(i3wm-menu--setup-menu 'maybe))
((not (transient-active-prefix 'i3wm-menu))
(i3wm-menu--setup-menu))
((make-frame-invisible)))) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The code below is a little experiment that i use for emacs interaction with the i3 or sway style wm:s
you bind super-x in sway(or i3) and then an emacs frame pops up with a transient in it.
this works well.
but if i change my mind, id like to press super-x again, and kill the frame.
this also works but, now in the main emacs frame, the transient lives on, which I find counterintuitive.
If I properly quit the transient in the popup frame the transient doesn live on anywhere.
So, the feature request is that it should be possible to quit the transient from code like this.
You can see the various attempts i made in the messy code below.
heres the tries i made extracted:
and heres the complete code
Beta Was this translation helpful? Give feedback.
All reactions