# Ruby Tk "on top"

**URL:** <https://www.ruby-forum.com/t/ruby-tk-on-top/99438>\
**Category:** Ruby\
**Created:** [July 22, 2006, 8:04pm UTC](https://www.ruby-forum.com/t/ruby-tk-on-top/99438 "2006-07-22T20:04:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/34f0e0/32.png) [@kly](https://www.ruby-forum.com/u/kly)\
**Post date:** [July 22, 2006, 8:04pm UTC](https://www.ruby-forum.com/t/ruby-tk-on-top/99438/1 "2006-07-22T20:04:26Z")

</div>

Hey

I’ve been wondering how to make a window fullscreen in Ruby Tk. I came  
across this which is what I’m using now:

require ‘tk’  
r = Tk.root  
r.withdraw  
r.overrideredirect = true  
r.deiconify  
r.geometry = “#{r.winfo\_screenwidth}x#{r.winfo\_screenheight}+0+0”  
Tk.root.state = ‘zoomed’  
Tk.mainloop

However, in OS X, this “fullscreen” window still sits behind the dock  
and menu bar. Is there some way to tell the window manager to put this  
“on top” of everything, even the dock and menu bar? I had a look through  
the Tk wm reference but couldn’t find anything very useful.

Thanks!

---

<div class="post-metadata">

**Author:** ![kly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/34f0e0/32.png) [@kly](https://www.ruby-forum.com/u/kly)\
**Post date:** [July 23, 2006, 3:06am UTC](https://www.ruby-forum.com/t/ruby-tk-on-top/99438/2 "2006-07-23T03:06:35Z")

</div>

I’ve only played around with Ruby Tk on OS X only a little, but my  
feeling is that Tk has no concept of a window manager having a screen-  
top menu bar rather than window-top menu bars. And I’m pretty sure it  
had no concept of a OS X style dock. Therefore, I think you will have  
to live with the following:

1. Hide the dock.
2. Adjust your window geometry to exclude the OS X menu bar area.

Not what you want, I admit. Perhaps someone more knowledgeable than  
me will reply with a better idea.

Regards, Morton

---

<div class="post-metadata">

**Author:** ![kly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/34f0e0/32.png) [@kly](https://www.ruby-forum.com/u/kly)\
**Post date:** [July 23, 2006, 10:32pm UTC](https://www.ruby-forum.com/t/ruby-tk-on-top/99438/3 "2006-07-23T22:32:38Z")

</div>

I think the guys did a good job integrating Tk with the OS X GUI, the  
menu bar items actually end up on top (try add a TkMenubar item, it’ll  
end up on top of the screen, and not on the window:) I don’t think Tk  
has to take the geometry of the native GUI into consideration, since all  
it needs to do is request “on-top-ness” from the WM, regardless of what  
the WM GUI is like, whether it’s a dock, a taskbar, or a 3D virtual cube  
🙂 But yes, if I don’t find a real solution, the workaround would have  
to be to hide the dock though some ugly hack (read Applescript… ugh!)  
and resize the window accordingly.

Thanks!
