0

I've seen links to X11 flag setting that sets the current windows urgent hint.

Is there a portable way to do this in Emacs? Or does it need to be handled per-platform?

0

This is a snippet from @arne-babenhauserheide's site for making the frame urgent in X11, while it works it's not portable.

(defun my-frame-urgent-hint-set--for-x11 (frame arg &optional source)
  "Set the x11-urgency hint for the frame to arg:

- If arg is nil, unset the urgency.
- If arg is any other value, set the urgency.

If you unset the urgency, you still have to visit the frame to make the urgency setting disappear."
  (let* ((wm-prop "WM_HINTS")  ;; Constants.
         (wm-flag-urgent #x100)

         (wm-hints (append (x-window-property wm-prop frame wm-prop source nil t) nil))
         (flags (car wm-hints)))
    (setcar wm-hints
            (if arg
                (logior flags wm-flag-urgent)
              (logand flags (lognot wm-flag-urgent))))
    (x-change-window-property wm-prop wm-hints frame wm-prop 32 t)))

(defun my-frame-urgent-hint-set (&optional arg)
  "Mark the current Emacs frame as requiring urgent attention.

With a prefix argument which does not equal a boolean value of nil, remove the urgency flag
(which might or might not change display, depending on the window manager)."
  (interactive "P")
  (let*
      (
       (frame (selected-frame))
       (win-system (window-system frame)))
    (cond
     ((eq win-system 'x)
      (my-frame-urgent-hint-set--for-x11 frame (not arg)))
     ;; TODO, other platforms.
     (t
      (message "Urgent hint for window system %S unsupported" win-system)))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.