unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* EWMH package, please review.
@ 2003-10-12 16:53 Jan D.
  2003-10-12 22:17 ` Kim F. Storm
  0 siblings, 1 reply; 12+ messages in thread
From: Jan D. @ 2003-10-12 16:53 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 265 bytes --]

Hello.

I've made a small package to manipulate extended window manager hints.  Since 
Elisp is not my biggest strength, I'd like some comments.  I don't know if this 
is useful enough to be included in Emacs, so I'd like your views on that also.

Thanks,

	Jan D.

[-- Attachment #2: x-ewmh.el --]
[-- Type: text/plain, Size: 5850 bytes --]

;;; x-ewmh.el --- support extended window manager hints under X. -*-coding: iso-2022-7bit;-*-

;; Copyright (C) 2003 Free Software Foundation

;; Author: Jan Dj^[,Ad^[(Brv <jan.d.h@swipnet.se>
;; Keywords: window manager, hints

;; This file is part of GNU Emacs.

;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;; Commentary:

;; Manipulate extended window manager hints (EWMH) under X.
;; The EWMH specification can be found at http://www.freedesktop.org/.

;; Extended window manager hints lets you manipulate the state
;; of Emacs frames, like fullscreen, shaded, maximized vertical
;; and/or horizontal.  If the window manager supports multiple desktops,
;; EWMH can set if a window is sticky (present in all desktops) or not.

;; NOTE:  EWMH only works on window managers that support EWMH.  If
;; there is no support, this package does nothing.  Also, not all
;; window managers implement all hints, and not with the same effect.

;;; Todo:

;; Retreive current EWMH state?.


;;; Code:

(defun x-ewmh-send (arg hint frame &optional hint2)
  "Send a client message to change an extended window manager hint.

FRAME may be nil to use the selected frame.
If ARG is poitive, add HINT.
If ARG is negative, remove HINT.
Otherwise toggle HINT."

  (let* ((eff-arg (if (null arg) 0 (prefix-numeric-value arg)))
	 (action (cond ((= eff-arg 0) 2)	;; Toggle
		       ((> eff-arg 0) 1)	;; Add
		       (t 0))))			;; Remove
    (x-send-client-message nil 0 frame "_NET_WM_STATE" 32
			   (list action
				 hint 
				 (if hint2 hint2 0)
				 0))))


(defun x-ewmh-fullscreen (&optional arg frame)
  "Toggle FRAME fullscreen hint using extended window manager hints (EWMH).

If FRAME is not given, the selected frame is used.
If ARG is poitive, add fullscreen hint.
If ARG is negative, remove fullscreen hint.
Otherwise toggle fullscreen hint.

If fullscreen doesn't work with your window manager, try
`x-ewmh-horz-and-vert'.

NOTE:  If the window manager does not support EWMH, this does nothing."
  (interactive "P")
  (x-ewmh-send arg "_NET_WM_STATE_FULLSCREEN" frame))


(defun x-ewmh-shaded (&optional arg frame)
  "Toggle FRAME shaded hint using extended window manager hints (EWMH).

If FRAME is not given, the selected frame is used.
If ARG is positive, add shaded hint.
If ARG is negative, remove shaded hint.
Otherwise toggle shaded hint.

NOTE:  If the window manager does not support EWMH, this does nothing."
  (interactive "P")
  (x-ewmh-send arg "_NET_WM_STATE_SHADED" frame))


(defun x-ewmh-sticky (&optional arg frame)
  "Toggle FRAME sticky hint using extended window manager hints (EWMH).

If FRAME is not given, the selected frame is used.
If ARG is positive, add sticky hint.
If ARG is negative, remove sticky hint.
Otherwise toggle sticky hint.

NOTE:  If the window manager does not support EWMH, this does nothing."
  (interactive "P")
  (x-ewmh-send arg "_NET_WM_STATE_STICKY" frame))


(defun x-ewmh-maximized_vert (&optional arg frame)
  "Toggle FRAME maximized_vert hint using extended window manager hints (EWMH).

If FRAME is not given, the selected frame is used.
If ARG is positive, add maximized_vert hint.
If ARG is negative, remove maximized_vert hint.
Otherwise toggle maximized_vert hint.

NOTE:  If the window manager does not support EWMH, this does nothing."
  (interactive "P")
  (x-ewmh-send arg "_NET_WM_STATE_MAXIMIZED_VERT" frame))


(defun x-ewmh-maximized_horz (&optional arg frame)
  "Toggle FRAME maximized_horz hint using extended window manager hints (EWMH).

If FRAME is not given, the selected frame is used.
If ARG is positive, add maximized_horz hint.
If ARG is negative, remove maximized_horz hint.
Otherwise toggle maximized_horz hint.

NOTE:  If the window manager does not support EWMH, this does nothing."
  (interactive "P")
  (x-ewmh-send arg "_NET_WM_STATE_MAXIMIZED_HORZ" frame))


(defun x-ewmh-horz-and-vert (&optional arg frame)
  "Toggle FRAME maximized_horz/vert hints at the same time.

If FRAME is not given, the selected frame is used.
If ARG is positive, add both hints.
If ARG is negative, remove both hints.
Otherwise toggle both hints.

NOTE:  If the window manager does not support EWMH, this does nothing."
  (interactive "P")
  (x-ewmh-send arg "_NET_WM_STATE_MAXIMIZED_HORZ" frame
	       "_NET_WM_STATE_MAXIMIZED_VERT"))


(defun x-ewmh-above (&optional arg frame)
  "Toggle FRAME above hint using extended window manager hints (EWMH).

If FRAME is not given, the selected frame is used.
If ARG is positive, add above hint.
If ARG is negative, remove above hint.
Otherwise toggle above hint.

NOTE:  If the window manager does not support EWMH, this does nothing."
  (interactive "P")
  (x-ewmh-send arg "_NET_WM_STATE_ABOVE" frame))


(defun x-ewmh-below (&optional arg frame)
  "Toggle FRAME below hint using extended window manager hints (EWMH).

If FRAME is not given, the selected frame is used.
If ARG is positive, add below hint.
If ARG is negative, remove below hint.
Otherwise toggle below hint.

NOTE:  If the window manager does not support EWMH, this does nothing."
  (interactive "P")
  (x-ewmh-send arg "_NET_WM_STATE_BELOW" frame))


(provide 'x-ewmh)

;;; arch-tag: ???
;;; x-ewmh.el ends here

[-- Attachment #3: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2003-10-27  5:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-12 16:53 EWMH package, please review Jan D.
2003-10-12 22:17 ` Kim F. Storm
2003-10-12 22:54   ` Miles Bader
2003-10-13  4:34     ` Jan D.
2003-10-13  4:30   ` Jan D.
2003-10-13  7:54     ` David Kastrup
2003-10-13  8:43     ` Thien-Thi Nguyen
2003-10-18 17:47       ` Jan D.
2003-10-18 18:05         ` David Kastrup
2003-10-18 18:15           ` David Kastrup
2003-10-27  5:56           ` Jan D.
2003-10-13 18:21   ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).