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

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

Re: Toggle fullscreen with one key


From: Mathias Dahl
Subject: Re: Toggle fullscreen with one key
Date: Fri, 18 Mar 2005 13:11:49 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (windows-nt)

Johan Josefsson <johan.mailinglists@gmail.com> writes:

> I am currently using two keys (f2 and C-f2) and two functions for
> maximizing and restoring the frame in win32:

> [...]

> It works as intended, but I wonder, is there any simple way to
> replace these two keys with a function that use only one key (f2) to
> toggle between these two states?
>

This is a bit ugly (one should really check the "real" state of the
frame), but works:

(defvar my-frame-toggle-state nil
  "Just a dummy variable too keep track of things")

(defun my-frame-toggle ()
  (interactive)
  (if my-frame-toggle-state
      (my-frame-restore)
    (my-frame-maximize))
  (setq my-frame-toggle-state (not my-frame-toggle-state)))

(defun my-frame-maximize () 
  "Maximize Emacs window in win32" 
  (interactive) 
  (w32-send-sys-command ?\xf030))

(defun my-frame-restore () 
  "Restore Emacs window in win32" 
  (interactive) 
  (w32-send-sys-command ?\xF120))

/Mathias


reply via email to

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