You are not logged in.

#1 2006-08-21 07:46:44

aquila_deus
Member
From: Taipei
Registered: 2005-07-02
Posts: 348
Website

Mac-style Menu Bar for GTK and Java/Swing applications!

Hi all!

I hacked gtk2 to use mac-style menubars, the pkgbuild is here => http://aur.archlinux.org/packages.php?d … =1&ID=6447

Screenshots:
220802752_834ce2f17a_m.jpg  220842399_a0b0ccfa2d_m.jpg
220802753_5d912d3a16_m.jpg 225336386_05f248fedc_m.jpg

Cheers!

PS: my modifed GT4_white theme => http://aquila.deus.googlepages.com/GT4_white-aqd.tar.gz

------------------------------------------------------------------
Java/Swing mac menubar
Similar to the GTK one, but the quality is not very good due to Swing's limitations.

222214833_5f81725552_m.jpg  222214834_5c5275f4be_m.jpg

INSTALL:
0.Need Java 1.5.0_07 (for other versions, use the patch)
1.Download my patched JRootPane.java
2.Create a dir some_dir/javax/swing and move JRootPane.java to there.
3.Chdir to some_dir (NOT javax/swing)
4.Run javac javax/swing/JRootPane.java
5.Swich to root and make a backup of /opt/java/jre/lib/rt.jar
6.Run zip -ur /opt/java/jre/lib/rt.jar javax -x "*.java"
7.Run java -Xshare:dump to re-generate shared cache.
8.Use MToolkit for AWT. Since compiz doesn't work with the new (and default) XToolkit in java 1.5, there is no need to support it. export AWT_TOOLKIT=MToolkit Limitation removed, but still require X (can't work on windows)

The patch: http://aquila.deus.googlepages.com/JRootPane.patch

Problems:
- Some menubar parts (not menu) may be not repainted well
- Mouse movement on menubar can't activate other menus, you have to click or use the old x-window/mac style (press button until you select the target item)
- When you move mouse pointer to menus, it's treated as the mouse has left menubar. No way to solve this, swing sucks...
- You can always move/resize the menubar by Alt+mouse buttons.....

Offline

#2 2006-08-21 09:17:45

aquila_deus
Member
From: Taipei
Registered: 2005-07-02
Posts: 348
Website

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

zencoder wrote:

OMG. Is this possible to make into an applet, so we can get some OSX-alike goodness?

BTW, this is frickin' sweet. Nice work!

Ah, I can try if you tell me what functions can the "applet" ("widget"?) provide more than that menubar?

Offline

#3 2006-08-21 10:07:28

JGC
Developer
Registered: 2003-12-03
Posts: 1,664

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

zencoder wrote:

OMG. Is this possible to make into an applet, so we can get some OSX-alike goodness?

BTW, this is frickin' sweet. Nice work!

Impossible. You need to grab the menubar widget from all GTK apps, which are not accessible. What the patch basically does is grab the menubar from an application and display it on top of the rootwindow in a certain style instead of drawing it as top level widget in the window of the application.

Offline

#4 2006-08-21 10:11:50

aquila_deus
Member
From: Taipei
Registered: 2005-07-02
Posts: 348
Website

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

JGC wrote:
zencoder wrote:

OMG. Is this possible to make into an applet, so we can get some OSX-alike goodness?

BTW, this is frickin' sweet. Nice work!

Impossible. You need to grab the menubar widget from all GTK apps, which are not accessible. What the patch basically does is grab the menubar from an application and display it on top of the rootwindow in a certain style instead of drawing it as top level widget in the window of the application.

But it could be emulated? Use shared memory/file to store the common info and let every gtk windows to follow it?

Offline

#5 2006-08-21 15:42:56

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

First, I must say Kudos, that's an awesome idea. How hard was the hack? Its not a very long diff, I'm impressed as hell.

Second, Jan is semi-wrong about GTK apps not being accessible. You have to turn it on:

export GTK_MODULES="gail:atk-bridge"

Then run  your gtk apps. You should get a "GTK Accessibility Module Initialized" message as the app starts up. You can then use the AT-SPI Accessibility API to access the program (although most application devs don't care about accessibility and often inadvertantly interfere with it, especially for custom controls. GIMP and Firefox both SUCK for it). This thing is pretty much undocumented, but you can find some examples at koders.com and some docs here:
http://developer.gnome.org/doc/API/2.0/at-spi/

Some apps (noteably firefox) don't play nice with accessibility, but most are pretty good. I was able to grab the acroread menu and put it in a single button (my goal was to save space and to see if it was possible) using Python, for example.

People interested in this might also be interested in UIFacades, which are implemented in Metisse CVS:

http://insitu.lri.fr/metisse/
http://www.cse.yorku.ca/~wolfgang/papers/uifacades.pdf

It allows widgets from different applications to be cut and pasted together, and through use of simple python scripts that use the AT-SPI API as discussed above, it is possible to replace existing widgets in an application with 'replacement' widgets that might be easier or more intuitive to use. The cool thing is that we did this without having to hack the windowing toolkit, although, Metisse does hack the hell out of the X-server. I suspect that with the composite X extensions and improvements to accessibility, this work will become much easier to implement in any WM in the future. I think the scripts are distributed with Metisse CVS, but if not, I'd be happy to supply them to anyone interested.

Dusty

Offline

#6 2006-08-21 18:09:29

arox1
Member
From: Poland
Registered: 2006-07-08
Posts: 174

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

aquila_deus wrote:

Hi all!

I hacked gtk2 to use mac-style menubars, the pkgbuild is here => http://aur.archlinux.org/packages.php?d … =1&ID=6447

Screenshots:
220837667_177e8c856b_m.jpg  220802752_834ce2f17a_m.jpg
220842399_a0b0ccfa2d_m.jpg 220802753_5d912d3a16_m.jpg

Cheers!


PS: my modifed GT4_white theme => http://aquila.deus.googlepages.com/GT4_white-aqd.tar.gz

What font are you using in windows titles?

Offline

#7 2006-08-21 21:16:42

Kris
Member
From: Denmark
Registered: 2006-07-11
Posts: 86
Website

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

Nice work!
Can i find something like this to Xfce?

Damn, it's so freakin' nice!


// Kris

"Penquins, Penquins, über alles!"

Offline

#8 2006-08-22 09:38:28

Simastrick
Member
Registered: 2006-08-17
Posts: 49

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

hmm, one question that immediately rises in my mind is: does the menu bar extend all the way to the top edge of the screen, so that one can click at the very edge and still get a menu? (this makes selecting menus entries easier)

Offline

#9 2006-08-22 09:56:00

onearm
Member
From: Anywhere but here
Registered: 2006-07-06
Posts: 359
Website

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

arox1 wrote:

What font are you using in windows titles?

I second that, the font is extremely nice


To get something done, a committee should consist of no more than three persons, two of them absent.
--
My Github

Offline

#10 2006-08-22 10:38:22

aquila_deus
Member
From: Taipei
Registered: 2005-07-02
Posts: 348
Website

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

Kris wrote:

Nice work!
Can i find something like this to Xfce?

Damn, it's so freakin' nice!

Hi! Every gtk applications (including xfce's) are changed to use mac-style menubar with my patch. It's not part of the desktop (unlike real mac).

Offline

#11 2006-08-22 10:48:12

aquila_deus
Member
From: Taipei
Registered: 2005-07-02
Posts: 348
Website

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

Offline

#12 2006-08-22 10:50:21

arox1
Member
From: Poland
Registered: 2006-07-08
Posts: 174

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

Thanks a lot smile

Offline

#13 2006-08-22 10:52:42

aquila_deus
Member
From: Taipei
Registered: 2005-07-02
Posts: 348
Website

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

Simastrick wrote:

hmm, one question that immediately rises in my mind is: does the menu bar extend all the way to the top edge of the screen, so that one can click at the very edge and still get a menu? (this makes selecting menus entries easier)

ahh, not sure what you mean.

The menubar is positioned at (0, 0) and always have the same width as your screen, and it's on top of all normal windows.

Offline

#14 2006-08-22 11:31:21

icrave
Member
Registered: 2006-04-11
Posts: 193

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

¡Great modification!

Offline

#15 2006-08-22 16:35:04

Simastrick
Member
Registered: 2006-08-17
Posts: 49

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

What I meant was: I think there is a one-pixel border on top of the menubar, which makes it impossible to just "fling and click." (Instead you have to avoid a one-pixel dead area--you cant click on "File" if the mouse pointer is at Y=0).

It's just a small "usability concern." Something like... infinite space.

Offline

#16 2006-08-22 17:29:30

aquila_deus
Member
From: Taipei
Registered: 2005-07-02
Posts: 348
Website

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

Simastrick wrote:

What I meant was: I think there is a one-pixel border on top of the menubar, which makes it impossible to just "fling and click." (Instead you have to avoid a one-pixel dead area--you cant click on "File" if the mouse pointer is at Y=0).

It's just a small "usability concern." Something like... infinite space.

Ah, I can't change that - it's theme-dependent.

Offline

#17 2006-08-22 17:33:39

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

Simastrick wrote:

It's just a small "usability concern." Something like... infinite space.

Its actually a pretty big concern, and is a major reason the mac menubar was designed that way. If there is a one-pixel border, would it be possible to position the bar at (0, -1) (not sure if X allows that)? Or maybe to set window decorations off?

Dusty

Offline

#18 2006-08-22 18:18:00

aquila_deus
Member
From: Taipei
Registered: 2005-07-02
Posts: 348
Website

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

Dusty wrote:
Simastrick wrote:

It's just a small "usability concern." Something like... infinite space.

Its actually a pretty big concern, and is a major reason the mac menubar was designed that way. If there is a one-pixel border, would it be possible to position the bar at (0, -1) (not sure if X allows that)? Or maybe to set window decorations off?

Dusty

It's not a window decoration; It's your theme's internal setting.

Positioning the bar to y=-1 is doable, if your WM supports.

Offline

#19 2006-08-23 01:50:50

ahioros
Member
From: Panamá
Registered: 2005-11-26
Posts: 41
Website

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

Is Amazing!!, really nice :-)...

Offline

#20 2006-08-23 06:09:10

Simastrick
Member
Registered: 2006-08-17
Posts: 49

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

It actually is a big concern for me, but most people seem not to care/notice such things, so I felt I had to downplay it... (silly me?)

(And yes it has nothing to do with window decorations.)

Offline

#21 2006-08-23 13:55:29

aquila_deus
Member
From: Taipei
Registered: 2005-07-02
Posts: 348
Website

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

Simastrick wrote:

It actually is a big concern for me, but most people seem not to care/notice such things, so I felt I had to downplay it... (silly me?)

(And yes it has nothing to do with window decorations.)

Well, just get a good mouse and select bigger menu text smile

As I said, the menubar can be put to (0, -1) if your WM supports - but this would be very ugly! If you're sure, I can add it.

Offline

#22 2006-08-23 14:00:47

Sigi
Member
From: Thurgau, Switzerland
Registered: 2005-09-22
Posts: 1,131

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

aquila_deus wrote:

As I said, the menubar can be put to (0, -1) if your WM supports - but this would be very ugly! If you're sure, I can add it.

Why should this be ugly  :?:


Haven't been here in a while. Still rocking Arch. smile

Offline

#23 2006-08-23 14:20:35

aquila_deus
Member
From: Taipei
Registered: 2005-07-02
Posts: 348
Website

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

Sigi wrote:
aquila_deus wrote:

As I said, the menubar can be put to (0, -1) if your WM supports - but this would be very ugly! If you're sure, I can add it.

Why should this be ugly  :?:

Because the distance to top edge and the distance to bottom edge would be different from the original theme's. That would cause imperfection!

Offline

#24 2006-08-23 14:29:37

Sigi
Member
From: Thurgau, Switzerland
Registered: 2005-09-22
Posts: 1,131

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

Can't one make a theme that respects this behaviour? Just a thought, I really appreciate the work you did!


Haven't been here in a while. Still rocking Arch. smile

Offline

#25 2006-08-23 14:48:25

Simastrick
Member
Registered: 2006-08-17
Posts: 49

Re: Mac-style Menu Bar for GTK and Java/Swing applications!

What kind of imperfection? It's just a one pixel border on top of the menu.

Offline

Board footer

Powered by FluxBB