[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: removing the toolbar
RE: removing the toolbar
Thu, 7 Oct 2004 10:15:22 -0700
I realize that your question was about removing the toolbar from the initial
frame. Stefan answered that. I think you can also try just putting
(tool-bars) into `initial-frame-alist' in your .emacs.
Anyway, this message is to let people know that you can get rid of the
tool-bar but still have it available by a click on the menu-bar. This is a
message I posted yesterday to emacs-devel and gnu-emacs-sources:
[mailto:address@hidden Behalf Of
Sent: Thursday, October 07, 2004 12:52 AM
To: address@hidden; Emacs-Devel
Subject: pop-up tool-bar
This code adds a minor mode, `tool-bar-here-mode', which is the same as
`tool-bar-mode', except that it affects only the selected frame.
It also adds a "button" named "Tool Bar" to the far right of the menu-bar
whenever the tool-bar is not visible (both `tool-bar-here-mode' and
`tool-bar-mode' are turned off). You can click the button to pop up the
tool-bar on the selected frame for the execution of a single command
(typically a tool-bar button click). The Tool Bar button is absent whenever
the tool-bar is visible, and vice versa.
The idea is to _conserve frame real estate_ but still have quick access to
the tool-bar: No reason to have a tool-bar on each frame. No reason to have
a tool-bar visible all the time; just pop it up when you need it.
Any interest in adding something like this to Emacs (file tool-bar.el)? It's
not intended to replace `tool-bar-mode'; it's just an alternative for people
who might want to use the tool-bar sometimes but don't want to sacrifice
real estate from every frame all the time.
(define-key global-map [menu-bar temp-tool-bar]
'(menu-item "Tool Bar" show-tool-bar-for-one-command
:visible (and (not tool-bar-mode) (not tool-bar-here-mode))
:enable (and (not tool-bar-mode) (not tool-bar-here-mode))
:help "Use tool bar for one command"))
(setq menu-bar-final-items (append menu-bar-final-items (list
"Toggle use of the tool bar on this frame only.
With numeric ARG, display the tool bar if and only if ARG is positive.
See `tool-bar-add-item' and `tool-bar-add-item-from-menu' for
conveniently adding tool bar items."
:init-value nil :global t :group 'mouse :group 'frames
(let ((lines (if tool-bar-here-mode 1 0)))
;; Alter existing frame...
(modify-frame-parameters (selected-frame) (list (cons 'tool-bar-lines
(if (and tool-bar-here-mode
(= 1 (length (default-value 'tool-bar-map)))) ; not yet set up
(defun show-tool-bar-for-one-command ()
"Pop up the tool bar so you can click a button.
The tool bar stays visible until one command is executed
\(whether or not it was initiated by clicking a button)."
(tool-bar-here-mode 99) ; Show tool-bar
(setq evnt (read-event))
(push evnt unread-command-events))
(tool-bar-here-mode -99))) ; Hide tool-bar