Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get transparent window in GNU Emacs on OSX?

I'm on GNU Emacs in OSX Mavericks and I'm trying to make my background transparent but not the text.

There's an easy way to make the whole frame transparent:

(set-frame-parameter (selected-frame) 'alpha '(85 85))
(add-to-list 'default-frame-alist '(alpha 85 85))

But this makes the whole frame transparent/translucent, including the text. I want only the frame background to be transparent and the text to be a solid black. Someone on the Emacs Wiki said that such an implementation would have to be OS-specific. So, does anyone know how to do this for OSX?

With desired settings, Emacs would look like this:
truly transparent Emacs window.

Again, I want the window 100% transparent and the foreground text 100% opaque, and it should work in Emacs' full-screen mode.

like image 365
incandescentman Avatar asked Feb 21 '14 22:02

incandescentman


1 Answers

The following are a few screen-shots and the different .emacs settings that were used. I'm using Emacs Trunk built --with-ns on February 16, 2014, and the operating system is OSX Snow Leopard 10.6.8.


SETTING # 1:

(set-frame-parameter (selected-frame) 'alpha '(85 85))

(add-to-list 'default-frame-alist '(alpha 85 85))

(set-face-attribute 'default nil :background "black"
  :foreground "white" :font "Courier" :height 180)

Example


SETTING # 2:

(set-frame-parameter (selected-frame) 'alpha '(85 85))

(add-to-list 'default-frame-alist '(alpha 85 85))

(set-face-attribute 'default nil :background "white"
  :foreground "black" :font "Courier" :height 180)

Example


SETTING # 3:

(set-frame-parameter (selected-frame) 'alpha '(75 75))

(add-to-list 'default-frame-alist '(alpha 75 75))

(set-face-attribute 'default nil :background "white"
    :foreground "black" :font "Courier" :height 180)

Example


SETTING # 4:

(set-frame-parameter (selected-frame) 'alpha '(0 0))

(add-to-list 'default-frame-alist '(alpha 0 0))

(set-face-attribute 'default nil :background "white"
    :foreground "black" :font "Courier" :height 180)

Example


EDIT (February 24, 2014):  The following is a link to a related thread where the lead developer of Aquamacs (i.e., David Reitter) has suggested modifying nsterm.m as a potential solution: http://comments.gmane.org/gmane.emacs.aquamacs.devel/836 -- "At a minimum, the changes would be to ns_clear_frame and ns_clear_frame_area. Instead of filling the background with the background color, you could try * setting the alpha component of the NSColor object so that it is transparent * copying in the actual background of the window. So, then you’d have the frame background transparent. That doesn’t take care of the frame UI elements, . . ." [In other words, the potential solution would likely entail modifying the source code prior to building a custom version of Emacs.]

like image 141
lawlist Avatar answered Sep 21 '22 19:09

lawlist