From 2784586f8da3b6488ab72783c6c8520fe519ee7c Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Mon, 10 Oct 2016 19:16:51 +0500 Subject: [PATCH] More Mac integration works - now it is able to load and use GTK+ themes. Configuration interface on ToDo. This also indicates that URTrator is now able to perform basic window theming. --- doc/installation/macos/README.md | 22 +- .../gtk-2.0/Menu-Menubar/menu-line.png | Bin 0 -> 224 bytes .../gtk-2.0/Panels/panel-bg-dark.png | Bin 0 -> 149 bytes .../gtk-2.0/Panels/panel-bg.png | Bin 0 -> 157 bytes .../themes/ClearlooksBrave/gtk-2.0/gtkrc | 498 +++++++++++ .../themes/ClearlooksBrave/gtk-2.0/panel.rc | 53 ++ .../themes/ClearlooksBrave/index.theme | 6 + .../OSX/gtk-2.0/Panel/panel-button-active.png | Bin 0 -> 190 bytes .../OSX/gtk-2.0/Panel/panel-button-hover.png | Bin 0 -> 191 bytes .../gtk-2.0/Panel/panel-button-inactive.png | Bin 0 -> 191 bytes .../themes/OSX/gtk-2.0/Panel/panel.png | Bin 0 -> 195 bytes .../macos/Resources/themes/OSX/gtk-2.0/gtkrc | 799 ++++++++++++++++++ .../macos/Resources/themes/OSX/index.theme | 11 + doc/installation/macos/Resources/themes/gtkrc | 2 + .../macos/Resources/themes/gtkrc-keybindings | 157 ++++ doc/installation/macos/make-app.sh | 79 +- ui/mainwindow.go | 2 + ui/mainwindow_init.go | 7 +- ui/mainwindow_init_mac.go | 28 + 19 files changed, 1650 insertions(+), 14 deletions(-) create mode 100644 doc/installation/macos/Resources/themes/ClearlooksBrave/gtk-2.0/Menu-Menubar/menu-line.png create mode 100644 doc/installation/macos/Resources/themes/ClearlooksBrave/gtk-2.0/Panels/panel-bg-dark.png create mode 100644 doc/installation/macos/Resources/themes/ClearlooksBrave/gtk-2.0/Panels/panel-bg.png create mode 100644 doc/installation/macos/Resources/themes/ClearlooksBrave/gtk-2.0/gtkrc create mode 100644 doc/installation/macos/Resources/themes/ClearlooksBrave/gtk-2.0/panel.rc create mode 100644 doc/installation/macos/Resources/themes/ClearlooksBrave/index.theme create mode 100755 doc/installation/macos/Resources/themes/OSX/gtk-2.0/Panel/panel-button-active.png create mode 100755 doc/installation/macos/Resources/themes/OSX/gtk-2.0/Panel/panel-button-hover.png create mode 100755 doc/installation/macos/Resources/themes/OSX/gtk-2.0/Panel/panel-button-inactive.png create mode 100755 doc/installation/macos/Resources/themes/OSX/gtk-2.0/Panel/panel.png create mode 100755 doc/installation/macos/Resources/themes/OSX/gtk-2.0/gtkrc create mode 100755 doc/installation/macos/Resources/themes/OSX/index.theme create mode 100644 doc/installation/macos/Resources/themes/gtkrc create mode 100644 doc/installation/macos/Resources/themes/gtkrc-keybindings create mode 100644 ui/mainwindow_init_mac.go diff --git a/doc/installation/macos/README.md b/doc/installation/macos/README.md index ee0373f..45d6bbb 100644 --- a/doc/installation/macos/README.md +++ b/doc/installation/macos/README.md @@ -12,9 +12,19 @@ brew install go * Install GTK+2: ``` -brew install gtk+ +brew install gtk+ --with-quartz-relocation ``` +*Note: default GTK+2 build from Brew might not work for you!* + +* Reinstall gdk-pixbuf with additional option: + +``` +brew install --with-relocations +``` + +*Note: default build might not work for you!* + * Install dylibbundler: ``` @@ -23,3 +33,13 @@ brew install dylibbundler * Execute ``make-app.sh`` script from current directory. If everything went fine - you will see URTrator.app right in this directory. + +# Some descriptions + +## Resources + +This directory will be copied inside bundle. It contains resources needed +for proper working or/and launching. + +Of course, it *might* be able to work without this directory, but it will +be superugly. diff --git a/doc/installation/macos/Resources/themes/ClearlooksBrave/gtk-2.0/Menu-Menubar/menu-line.png b/doc/installation/macos/Resources/themes/ClearlooksBrave/gtk-2.0/Menu-Menubar/menu-line.png new file mode 100644 index 0000000000000000000000000000000000000000..380dc1ad76626ffe2d618c96538678c5842ee8cb GIT binary patch literal 224 zcmeAS@N?(olHy`uVBq!ia0vp^aX`$(!3HER&dYuTq}Y|gW!U_%O?XxI14-? ziy0WW1wojxJ|%u4P>{XE)7O>#IvW#{tcmrn@3()&%;djfm^89}V)Gu6_y-_;;!R3uJwLeTVuihQ|b$iz7OvC4A?DwB%4g01k{iM_3 Q4$xu-Pgg&ebxsLQ0DwJHi2wiq literal 0 HcmV?d00001 diff --git a/doc/installation/macos/Resources/themes/ClearlooksBrave/gtk-2.0/Panels/panel-bg-dark.png b/doc/installation/macos/Resources/themes/ClearlooksBrave/gtk-2.0/Panels/panel-bg-dark.png new file mode 100644 index 0000000000000000000000000000000000000000..839e7040c90586e324e79a41fadc2592d2ae1b57 GIT binary patch literal 149 zcmeAS@N?(olHy`uVBq!ia0vp^j6i&eg9%8o+_jAd2^0spJ29*~C-V}>;VkfoECwpR z4#JF18nY{ag6t)pzOL*y8RZ3dR2=dfCj*7lJzX3_G|nd%l$WO`B_t&L`v2el^8f$; oIX7trcI)~1ZVa^PVi#a$P<`U78@ZcfKTr#Ur>mdKI;Vst08IBO-~a#s literal 0 HcmV?d00001 diff --git a/doc/installation/macos/Resources/themes/ClearlooksBrave/gtk-2.0/Panels/panel-bg.png b/doc/installation/macos/Resources/themes/ClearlooksBrave/gtk-2.0/Panels/panel-bg.png new file mode 100644 index 0000000000000000000000000000000000000000..a25ead4eb67eac4f51d159d7b76097bda9aedd38 GIT binary patch literal 157 zcmeAS@N?(olHy`uVBq!ia0vp^j6i&eg9%8o+_jAd2^0spJ29*~C-V}>;VkfoECwpR z4#JF18nY{ag6t)pzOL*ynHU+BIsfXFZ2$`Cd%8G=Xq->}@%_F0<^A>lXZ-vB|NNK# y|LZNJXG*" style "clearlooks-notebook-bg" +widget_class "**" style "clearlooks-notebook-bg" +widget_class "**" style "clearlooks-notebook-bg" +widget_class "*.GtkNotebook.*.GtkViewport" style "clearlooks-notebook" + +widget_class "*" style "clearlooks-button" +widget_class "*" style "clearlooks-notebook" +widget_class "**" style "clearlooks-statusbar" + +widget_class "**" style "clearlooks-comboboxentry" +widget_class "**" style "clearlooks-comboboxentry" + +widget_class "**" style "clearlooks-menubar" +widget_class "**" style "clearlooks-menu" +widget_class "**" style "clearlooks-menu-item" +widget_class "**" style "clearlooks-separator-menu-item" + +widget_class "*.." style "clearlooks-frame-title" +widget_class "*.*" style "clearlooks-treeview" + +widget_class "*" style "clearlooks-progressbar" + +# Treeview header +widget_class "*.." style "clearlooks-treeview-header" +widget_class "*.." style "clearlooks-treeview-header" +widget_class "*.." style "clearlooks-treeview-header" +widget_class "*.." style "clearlooks-treeview-header" + +# Workarounds for Evolution +widget_class "*.ETable.ECanvas" style "clearlooks-treeview-header" +widget_class "*.ETree.ECanvas" style "clearlooks-treeview-header" +widget_class "*GtkCTree*" style "evolution-hack" +widget_class "*GtkList*" style "evolution-hack" +widget_class "*GtkCList*" style "evolution-hack" +widget_class "*.ETree.*" style "evolution-hack" +widget_class "*EInfoLabel*" style "evolution-hack" + +# The window of the tooltip is called "gtk-tooltip" +################################ +# FIXME: +# This will not work if one embeds eg. a button into the tooltip. +# As far as I can tell right now we will need to rework the theme +# quite a bit to get this working correctly. +# (It will involve setting different priorities, etc.) +################################ +widget "gtk-tooltip*" style "clearlooks-tooltips" + +################################################### +# SPECIAL CASES AND WORKAROUNDS +################################################### + +# Special case the nautilus-extra-view-widget +# ToDo: A more generic approach for all applications that have a widget like this. +widget "*.nautilus-extra-view-widget" style : highest "clearlooks-nautilus-location" + +# Work around for http://bugzilla.gnome.org/show_bug.cgi?id=382646 +# Note that the work around assumes that the combobox is _not_ in appears-as-list mode. +# This style does not affect GtkComboBoxEntry, it does have an effect on comboboxes in appears-as-list mode though. +style "clearlooks-text-is-fg-color-workaround" +{ + text[NORMAL] = @fg_color + text[PRELIGHT] = @fg_color + text[SELECTED] = @selected_fg_color + text[ACTIVE] = @fg_color + text[INSENSITIVE] = darker (@bg_color) +} +widget_class "*.." style "clearlooks-text-is-fg-color-workaround" + +style "clearlooks-menuitem-text-is-fg-color-workaround" +{ + text[NORMAL] = @fg_color + text[PRELIGHT] = @selected_fg_color + text[SELECTED] = @selected_fg_color + text[ACTIVE] = @fg_color + text[INSENSITIVE] = darker (@bg_color) +} +widget "*.gtk-combobox-popup-menu.*" style "clearlooks-menuitem-text-is-fg-color-workaround" + +# Work around the usage of GtkLabel inside GtkListItems to display text. +# This breaks because the label is shown on a background that is based on the base color set. +style "clearlooks-fg-is-text-color-workaround" +{ + fg[NORMAL] = @text_color + fg[PRELIGHT] = @text_color + fg[ACTIVE] = @selected_fg_color + fg[SELECTED] = @selected_fg_color + fg[INSENSITIVE] = darker (@bg_color) +} +widget_class "**" style "clearlooks-fg-is-text-color-workaround" +# The same problem also exists for GtkCList and GtkCTree. +# Only match GtkCList and not the parent widgets, because that would also change the headers. +widget_class "*" style "clearlooks-fg-is-text-color-workaround" +widget_class "*" style "clearlooks-fg-is-text-color-workaround" + +# The answer to the ultimate question of life, the universe, and everything is 42. diff --git a/doc/installation/macos/Resources/themes/ClearlooksBrave/gtk-2.0/panel.rc b/doc/installation/macos/Resources/themes/ClearlooksBrave/gtk-2.0/panel.rc new file mode 100644 index 0000000..70b8252 --- /dev/null +++ b/doc/installation/macos/Resources/themes/ClearlooksBrave/gtk-2.0/panel.rc @@ -0,0 +1,53 @@ +################################################ +# PANELS +################################################ + +# Note: Uncommenting means to delete the "#" at the beginning of a line. Commenting out means to add a "#" at the beginning of a line. The "#" tells the theme wether to ignore the line or not. + +style "theme-panel" +{ + +# The following two lines add gradient panel backgrounds. You may choose only one! Delete or comment out both to have regular, flat gnome-panels. +bg_pixmap[NORMAL] = "/Panels/panel-bg.png" # Light gradient panel. +#bg_pixmap[NORMAL] = "/Panels/panel-bg-dark.png" # Dark gradient panel. + +# Uncomment the following lines when using dark panels! Note: Menus will remain the same. +# bg[SELECTED] = "#525252" # Makes selected items dark. +# bg[NORMAL] = "#3c3c3c" # Makes panel background dark. +# bg[PRELIGHT] = "#424242" # Makes panel button prelight dark. +# bg[ACTIVE] = "#333333" # Makes active buttons dark. +# bg[INSENSITIVE] = "#3C3C3C" +# fg[NORMAL] = "#D4D4D4" # Makes panel text light. +# fg[PRELIGHT] = lighter (@selected_bg_color) # Makes prelighted text colored. +# fg[SELECTED] = lighter (@selected_bg_color) # Makes prelighted text colored. +# fg[ACTIVE] = lighter (@selected_bg_color) # Makes active text colored. +# fg[INSENSITIVE] = "#666666" # Color for insensitive text. +# text[NORMAL] = @text_color +# text[PRELIGHT] = lighter (@selected_bg_color) # Makes prelighted text colored. +# text[SELECTED] = lighter (@selected_bg_color) # Makes prelighted text colored. +# text[ACTIVE] = lighter (@selected_bg_color) # Makes active text colored. +# text[INSENSITIVE] = "#666666" +} + + +# Panel settings. Do not change. +widget "*PanelWidget*" style "theme-panel" +widget "*PanelApplet*" style "theme-panel" +widget "*fast-user-switch*" style "theme-panel" +widget "*CPUFreq*Applet*" style "theme-panel" +widget "*indicator-applet*" style "theme-panel" +class "PanelApp*" style "theme-panel" +class "PanelToplevel*" style "theme-panel" +widget_class "*PanelToplevel*" style "theme-panel" +widget_class "*Mail*" style "theme-panel" +#class "*Panel*" style "theme-panel" # Disabled to fix bug. +widget_class "*notif*" style "theme-panel" +widget_class "*Notif*" style "theme-panel" +widget_class "*Tray*" style "theme-panel" +widget_class "*tray*" style "theme-panel" +widget_class "*Applet*Tomboy*" style "theme-panel" +widget_class "*Applet*Netstatus*" style "theme-panel" + +# XFCE panel theming. +widget "*Xfce*Panel*" style "theme-panel" +class "*Xfce*Panel*" style "theme-panel" diff --git a/doc/installation/macos/Resources/themes/ClearlooksBrave/index.theme b/doc/installation/macos/Resources/themes/ClearlooksBrave/index.theme new file mode 100644 index 0000000..8f84634 --- /dev/null +++ b/doc/installation/macos/Resources/themes/ClearlooksBrave/index.theme @@ -0,0 +1,6 @@ +[X-GNOME-Metatheme] +Name=Clearlooks Brave +Encoding=UTF-8 +GtkTheme=Clearlooks Brave +MetacityTheme=Clearlooks-Colors Metacity +IconTheme=gnome-brave diff --git a/doc/installation/macos/Resources/themes/OSX/gtk-2.0/Panel/panel-button-active.png b/doc/installation/macos/Resources/themes/OSX/gtk-2.0/Panel/panel-button-active.png new file mode 100755 index 0000000000000000000000000000000000000000..a8f76ae5892a4fcfb7e886ab8cc5723a9317d272 GIT binary patch literal 190 zcmeAS@N?(olHy`uVBq!ia0vp^JAqh&gAGV7dmAGTq}Y|gW!U_%O?XxI14-? ziy0WWg+Z8+Vb&Z8pdfpRr>`sf17>bPHU`FiB_p7ax2KC^NX4zUmp1Y;7;vy`oN#ny zU4B-W!#9rQt5yC!*r3m-#y+|E|gW!U_%O?XxI14-? ziy0WWg+Z8+Vb&Z8pdfpRr>`sf17>bPRugWqRu`a`S3oL88SY6YV4DnPab@dP=v%Zu$&|gW!U_%O?XxI14-? ziy0WWg+Z8+Vb&Z8pdfpRr>`sf17>bPRtu&DC-Z?qKAtX)Ar-gYUUC#svDshS*51-m`s3?%hKKZa&W*Ou8Gkg)d Qf#x!Jy85}Sb4q9e0Me5>82|tP literal 0 HcmV?d00001 diff --git a/doc/installation/macos/Resources/themes/OSX/gtk-2.0/Panel/panel.png b/doc/installation/macos/Resources/themes/OSX/gtk-2.0/Panel/panel.png new file mode 100755 index 0000000000000000000000000000000000000000..ec4b20e3b0c41563ac3daea58cc40c49aa4d6575 GIT binary patch literal 195 zcmeAS@N?(olHy`uVBq!ia0vp^j6iI}!3HGf{@&OHq}Y)^mS!_z|1YkBBQ=T=08vzo*av1D-=H|NrNt z7lremy(GhX<3x|)yrz(a48<&`F5bD-c}JSz>K*oNj3!RDiAxOYd##PSojSQ+r2RBd jYSjtPEPJ0hTmB^XsSpcR(K6j4pxF$bu6{1-oD!M." style "murrine-treeview-header" + +# Google Chrome/Chromium Styles (requires 9.0.597 or newer) + +style "chromium-toolbar-button" { + engine "murrine" { + roundness = 4 + textstyle = 0 + } +} + +style "chrome-gtk-frame" { + ChromeGtkFrame::frame-color = @titlebar_bg_color + ChromeGtkFrame::inactive-frame-color = @titlebar_bg_color + + ChromeGtkFrame::frame-gradient-size = 0 + ChromeGtkFrame::frame-gradient-color = @titlebar_bg_color + + ChromeGtkFrame::incognito-frame-color = @titlebar_bg_color + ChromeGtkFrame::incognito-inactive-frame-color = @titlebar_bg_color + + ChromeGtkFrame::incognito-frame-gradient-size = 0 + ChromeGtkFrame::incognito-frame-gradient-color = @titlebar_bg_color + + ChromeGtkFrame::scrollbar-trough-color = @bg_color + ChromeGtkFrame::scrollbar-slider-normal-color = mix (0.21, @fg_color, @bg_color) + ChromeGtkFrame::scrollbar-slider-prelight-color = mix (0.31, @fg_color, @bg_color) +} + +class "ChromeGtkFrame" style "chrome-gtk-frame" + +widget_class "*Chrom*Button*" style "chromium-toolbar-button" + +# General Styles + +class "GtkWidget" style "murrine-default" + +class "GtkFrame" style "murrine-wide" +class "MetaFrames" style "metacity-frame" +class "GtkWindow" style "metacity-frame" + +class "GtkSeparator" style "murrine-wide" +class "GtkCalendar" style "murrine-wide" + +class "GtkSpinButton" style "murrine-spinbutton" + +class "GtkScale" style "murrine-scale" +class "GtkVScale" style "murrine-vscale" +class "GtkHScale" style "murrine-hscale" +class "GtkScrollbar" style "murrine-scrollbar" +class "GtkVScrollbar" style "murrine-vscrollbar" +class "GtkHScrollbar" style "murrine-hscrollbar" + +class "GtkRadio*" style "murrine-radiocheck" +class "GtkCheck*" style "murrine-radiocheck" + +class "GtkEntry" style "murrine-entry" + +widget_class "*" style "murrine-notebook" +widget_class "**" style "murrine-notebook-bg" +widget_class "**" style "murrine-notebook-bg" +widget_class "**" style "murrine-notebook-bg" +widget_class "*.GtkNotebook.*.GtkViewport" style "murrine-notebook" + +widget_class "*" style "murrine-button" +widget_class "**" style "murrine-statusbar" +widget_class "*" style "murrine-progressbar" +widget_class "*" style "murrine-progressbar" + +widget_class "**" style "murrine-comboboxentry" +widget_class "**" style "murrine-comboboxentry" + +widget_class "**" style "murrine-menu" +widget_class "**" style "murrine-menu-item" +widget_class "**" style "murrine-separator-menu-item" +widget_class "*Menu*.*Sepa*" style "murrine-separator-menu-item" +widget_class "**" style "murrine-menubar" +widget_class "***" style "murrine-menubaritem" + +widget_class "*GtkToolButton*" style "murrine-toolbutton" +widget_class "*GtkToggleToolButton*" style "murrine-toolbutton" +widget_class "*GtkMenuToolButton*" style "murrine-toolbutton" +widget_class "*GtkToolbar*Button" style "murrine-toolbutton" + +widget_class "*.." style "murrine-frame-title" + +widget_class "*.*" style "murrine-treeview" +widget_class "*.." style "murrine-treeview-header" +widget_class "*.." style "murrine-treeview-header" +widget_class "*.." style "murrine-treeview-header" +widget_class "*.." style "murrine-treeview-header" + +widget "gtk-tooltip*" style "murrine-tooltips" + +widget_class "**" style "murrine-overlay-scrollbar" + +# Workarounds and Non-Standard Styling + +style "text-is-fg-color-workaround" { + text[NORMAL] = @text_color + text[PRELIGHT] = @fg_color + text[SELECTED] = @selected_fg_color + text[ACTIVE] = @fg_color + text[INSENSITIVE] = mix (0.5, @bg_color, @fg_color) +} + +widget_class "*.." style "text-is-fg-color-workaround" + +style "fg-is-text-color-workaround" { + fg[NORMAL] = @text_color + fg[PRELIGHT] = @text_color + fg[ACTIVE] = @selected_fg_color + fg[SELECTED] = @selected_fg_color + fg[INSENSITIVE] = darker (@fg_color) +} + +widget_class "**" style "fg-is-text-color-workaround" +widget_class "*" style "fg-is-text-color-workaround" +widget_class "*" style "fg-is-text-color-workaround" + +style "murrine-evo-new-button-workaround" { + engine "murrine" { + toolbarstyle = 0 + } +} + +widget_class "EShellWindow.GtkVBox.BonoboDock.BonoboDockBand.BonoboDockItem*" style "murrine-evo-new-button-workaround" + +style "inkscape-toolbar-fix" { + engine "murrine" { + gradient_shades = { 1.0, 1.0, 1.0, 1.0 } + highlight_shade = 1.0 + } +} + +#widget "*GtkHandleBox*" style "inkscape-toolbar-fix" +#widget "*HandleBox*CommandsToolbar*" style "inkscape-toolbar-fix" +#widget "*HandleBox*SnapToolbar*" style "inkscape-toolbar-fix" +widget "*HandleBox*SelectToolbar*" style "inkscape-toolbar-fix" +widget "*HandleBox*NodeToolbar*" style "inkscape-toolbar-fix" +widget "*HandleBox*TweakToolbar*" style "inkscape-toolbar-fix" +widget "*HandleBox*ZoomToolbar*" style "inkscape-toolbar-fix" +widget "*HandleBox*StarToolbar*" style "inkscape-toolbar-fix" +widget "*HandleBox*RectToolbar*" style "inkscape-toolbar-fix" +widget "*HandleBox*3DBoxToolbar*" style "inkscape-toolbar-fix" +widget "*HandleBox*ArcToolbar*" style "inkscape-toolbar-fix" +widget "*HandleBox*SpiralToolbar*" style "inkscape-toolbar-fix" +widget "*HandleBox*PencilToolbar*" style "inkscape-toolbar-fix" +widget "*HandleBox*PenToolbar*" style "inkscape-toolbar-fix" +widget "*HandleBox*CalligraphyToolbar*" style "inkscape-toolbar-fix" +widget "*HandleBox*EraserToolbar*" style "inkscape-toolbar-fix" +widget "*HandleBox*LPEToolToolbar*" style "inkscape-toolbar-fix" +widget "*HandleBox*DropperToolbar*" style "inkscape-toolbar-fix" +widget "*HandleBox*ConnectorToolbar*" style "inkscape-toolbar-fix" +widget "*HandleBox*PaintbucketToolbar*" style "inkscape-toolbar-fix" + +# Performance Fixes + +style "performance-fix" { + engine "murrine" { + textstyle = 0 + } +} + +widget_class "*gtkmm__GtkWindow*" style "performance-fix" # Inkscape +widget_class "*GimpDisplayShell*" style "performance-fix" # Gimp +widget_class "*GimpToolbox*" style "performance-fix" +widget_class "*GimpMenuDock*" style "performance-fix" +widget "*OOoFixed*" style "performance-fix" # Openoffice/Libreoffice +widget_class "*MozContainer*" style "performance-fix" # Firefox (Not sure if this one does anything though.) + +widget_class "*XfceHeading*" style "xfce-header" +widget_class "*XfceDesktop*" style "xfdesktop-windowlist" +widget_class "*XfdesktopIconView*" style "xfdesktop-icon-view" +widget "xfwm4-tabwin*" style "xfwm-tabwin" +widget_class "*XfsmLogoutDialog*" style "xfsm-logout" +widget_class "*XfsmLogoutDialog*GtkButton" style "xfsm-logout-button" + +widget "*Panel*" style "panel" +widget "*PanelWidget*" style "panel" +widget "*PanelApplet*" style "panel" +widget "*fast-user-switch*" style "panel" # workaround for Fast User Switch applet +widget "*CPUFreqApplet*" style "panel" # workaround for CpuFreq Applet +class "PanelApp*" style "panel" +class "PanelToplevel*" style "panel" +#widget_class "*Mail*" style "panel" +widget_class "*notif*" style "panel" + +#widget_class "*?anel*utton" style "panel_task_button" # causing problems to monodevelop +widget "*task*" style "panel_task_button" +widget "*.tasklist-button" style "panel_task_button" +widget "*PanelApplet*TaskTitle*" style "panel_task_button" +widget_class "*Xfce*Panel*" style "XFCE" +class "GtkScrollbar" style "murrine-scrollbar" diff --git a/doc/installation/macos/Resources/themes/OSX/index.theme b/doc/installation/macos/Resources/themes/OSX/index.theme new file mode 100755 index 0000000..8f56916 --- /dev/null +++ b/doc/installation/macos/Resources/themes/OSX/index.theme @@ -0,0 +1,11 @@ +[Desktop Entry] +Type=X-GNOME-Metatheme +Name=OS X El Capitan +Comment=A theme by Christian Medel (Elbullazul) simulating OS X 10.11 El Capitan +Comment=v0.5 +Encoding=UTF-8 + +[X-GNOME-Metatheme] +GtkTheme=OS X El Capitan +MetacityTheme=OS X El Capitan +ButtonLayout=:minimize,maximize,close diff --git a/doc/installation/macos/Resources/themes/gtkrc b/doc/installation/macos/Resources/themes/gtkrc new file mode 100644 index 0000000..ba61a98 --- /dev/null +++ b/doc/installation/macos/Resources/themes/gtkrc @@ -0,0 +1,2 @@ +include "ClearlooksBrave/gtk-2.0/gtkrc" +include "gtkrc-keybindings" diff --git a/doc/installation/macos/Resources/themes/gtkrc-keybindings b/doc/installation/macos/Resources/themes/gtkrc-keybindings new file mode 100644 index 0000000..980f3e4 --- /dev/null +++ b/doc/installation/macos/Resources/themes/gtkrc-keybindings @@ -0,0 +1,157 @@ +gtk-enable-mnemonics = 0 + +binding "gtk-mac-alt-arrows" +{ + bind "Right" { "move-cursor" (words, 1, 0) } + bind "KP_Right" { "move-cursor" (words, 1, 0) } + bind "Left" { "move-cursor" (words, -1, 0) } + bind "KP_Left" { "move-cursor" (words, -1, 0) } + bind "Right" { "move-cursor" (words, 1, 1) } + bind "KP_Right" { "move-cursor" (words, 1, 1) } + bind "Left" { "move-cursor" (words, -1, 1) } + bind "KP_Left" { "move-cursor" (words, -1, 1) } +} + +class "GtkTextView" binding "gtk-mac-alt-arrows" +class "GtkLabel" binding "gtk-mac-alt-arrows" +class "GtkEntry" binding "gtk-mac-alt-arrows" + + +binding "gtk-mac-alt-delete" +{ + bind "Delete" { "delete-from-cursor" (word-ends, 1) } + bind "KP_Delete" { "delete-from-cursor" (word-ends, 1) } + bind "BackSpace" { "delete-from-cursor" (word-ends, -1) } +} + +class "GtkTextView" binding "gtk-mac-alt-delete" +class "GtkEntry" binding "gtk-mac-alt-delete" + + +binding "gtk-mac-cmd-c" +{ + bind "x" { "cut-clipboard" () } + bind "c" { "copy-clipboard" () } + bind "v" { "paste-clipboard" () } + unbind "x" + unbind "c" + unbind "v" +} + +class "GtkTextView" binding "gtk-mac-cmd-c" +class "GtkEntry" binding "gtk-mac-cmd-c" + + +binding "gtk-mac-text-view" +{ + bind "a" { "select-all" (0) } + bind "a" { "select-all" (1) } + unbind "a" + unbind "a" +} + +class "GtkTextView" binding "gtk-mac-text-view" + + +binding "gtk-mac-label" +{ + bind "a" { + "move-cursor" (paragraph-ends, -1, 0) + "move-cursor" (paragraph-ends, 1, 1) + } + bind "a" { "move-cursor" (paragraph-ends, 0, 0) } + bind "c" { "copy-clipboard" () } + unbind "a" + unbind "a" + unbind "c" +} + +class "GtkLabel" binding "gtk-mac-label" + + +binding "gtk-mac-entry" +{ + bind "a" { + "move-cursor" (buffer-ends, -1, 0) + "move-cursor" (buffer-ends, 1, 1) + } + bind "a" { "move-cursor" (visual-positions, 0, 0) } + unbind "a" + unbind "a" +} + +class "GtkEntry" binding "gtk-mac-entry" + + +binding "gtk-mac-cmd-arrows" +{ + bind "Left" { "move-cursor" (paragraph-ends, -1, 0) } + bind "KP_Left" { "move-cursor" (paragraph-ends, -1, 0) } + bind "Left" { "move-cursor" (paragraph-ends, -1, 1) } + bind "KP_Left" { "move-cursor" (paragraph-ends, -1, 1) } + bind "Right" { "move-cursor" (paragraph-ends, 1, 0) } + bind "KP_Right" { "move-cursor" (paragraph-ends, 1, 0) } + bind "Right" { "move-cursor" (paragraph-ends, 1, 1) } + bind "KP_Right" { "move-cursor" (paragraph-ends, 1, 1) } +} + +class "GtkTextView" binding "gtk-mac-cmd-arrows" +class "GtkLabel" binding "gtk-mac-cmd-arrows" +class "GtkEntry" binding "gtk-mac-cmd-arrows" + + +binding "gtk-mac-emacs-like" +{ + bind "a" { "move-cursor" (paragraph-ends, -1, 0) } + bind "a" { "move-cursor" (paragraph-ends, -1, 1) } + bind "e" { "move-cursor" (paragraph-ends, 1, 0) } + bind "e" { "move-cursor" (paragraph-ends, 1, 1) } + + bind "b" { "move-cursor" (logical-positions, -1, 0) } + bind "b" { "move-cursor" (logical-positions, -1, 1) } + bind "f" { "move-cursor" (logical-positions, 1, 0) } + bind "f" { "move-cursor" (logical-positions, 1, 1) } +} + +class "GtkTextView" binding "gtk-mac-emacs-like" +class "GtkLabel" binding "gtk-mac-emacs-like" +class "GtkEntry" binding "gtk-mac-emacs-like" + + +binding "gtk-mac-file-chooser" +{ + bind "v" { "location-popup-on-paste" () } + unbind "v" + + bind "G" { "location-popup" () } + bind "H" { "home-folder" () } + bind "Up" { "up-folder" () } +} + +class "GtkFileChooserDefault" binding "gtk-mac-file-chooser" + + +binding "gtk-mac-tree-view" +{ + bind "a" { "select-all" () } + bind "a" { "unselect-all" () } + bind "f" { "start-interactive-search" () } + bind "F" { "start-interactive-search" () } + unbind "a" + unbind "a" + unbind "f" + unbind "F" +} + +class "GtkTreeView" binding "gtk-mac-tree-view" + + +binding "gtk-mac-icon-view" +{ + bind "a" { "select-all" () } + bind "a" { "unselect-all" () } + unbind "a" + unbind "a" +} + +class "GtkIconView" binding "gtk-mac-icon-view" diff --git a/doc/installation/macos/make-app.sh b/doc/installation/macos/make-app.sh index caffbb8..f9415b4 100755 --- a/doc/installation/macos/make-app.sh +++ b/doc/installation/macos/make-app.sh @@ -1,5 +1,31 @@ #!/bin/bash +##################################################################### +# HELPER FUNCTIONS +##################################################################### +# Libraries work. +change_framework_library_load_path() { + local bin_to_fix=$1 + local path=$2 + + # First iteration - main libraries. + echo "Copying libraries..." + dylibbundler -of -b -x ${bin_to_fix} -d ./URTrator.app/Contents/Framework/ -p ${path} + + # Fix shit for dylibbundler. By this moment we should have everything + # we needed in Framework directory. + for lib in $(ls ./URTrator.app/Contents/Framework); do + libname=$(echo ${lib} | awk -F"/" {' print $NF '}) + DEPS=$(otool -L ./URTrator.app/Contents/Framework/${lib} | grep "/usr/local") + for dep in ${DEPS[@]}; do + dep_name=$(echo ${dep} | awk -F"/" {' print $NF '}) + install_name_tool -change ${dep} ${path}/${dep_name} ./URTrator.app/Contents/Framework/${libname} + done + done +} +# More permissive UMASK. +umask 002 + # Do some checks. # Do we have brew installed? @@ -40,8 +66,11 @@ fi echo "Creating app bundle..." mkdir -p URTrator.app/Contents/{MacOS,Framework,Resources} +# Copying URTrator binary cp $GOPATH/bin/urtrator URTrator.app/Contents/MacOS/ -cp $GOPATH/src/github.com/pztrn/urtrator/artwork/urtrator.icns URTrator.app/Contents/Resources/ +# Copying main resources. +cp $GOPATH/src/github.com/pztrn/urtrator/artwork/urtrator.icns ./URTrator.app/Contents/Resources/ +cp -R ./Resources/themes ./URTrator.app/Contents/Resources/ ##################################################################### # APP BUNDLE INFO.PLIST @@ -73,27 +102,53 @@ INFOPLIST=' ' -echo ${INFOPLIST} > URTrator.app/Contents/Info.plist +echo -e ${INFOPLIST} > URTrator.app/Contents/Info.plist -echo -e '#!/bin/bash\ncd "${0%/*}"\n./urtrator' > ./URTrator.app/Contents/MacOS/urtrator.sh +echo -e '#!/bin/bash\ncd "${0%/*}"\nexport GTK_PATH="../lib/gtk-2.0/"\nexport GTK_MODULES="../lib/gtk-2.0/"\nexport GDK_PIXBUF_MODULE_FILE="../lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"\nexport GDK_PIXBUF_MODULEDIR="../lib/gdk-pixbuf-2.0/2.10.0/loaders/"\nexport GTK_EXE_PREFIX="../lib"\n./urtrator' > ./URTrator.app/Contents/MacOS/urtrator.sh chmod +x ./URTrator.app/Contents/MacOS/urtrator.sh ##################################################################### +# Copying helper binaries. +cp /usr/local/Cellar/gdk-pixbuf/2.36.0_2/bin/gdk-pixbuf-query-loaders ./URTrator.app/Contents/MacOS/ + +# Copy GTK engines as needed for default theme. +cp /usr/local/lib/gtk-2.0/2.10.0/engines/* ./URTrator.app/Contents/Framework/ +cp /usr/local/Cellar/gdk-pixbuf/2.36.0_2/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.so ./URTrator.app/Contents/Framework/ +chmod -R 0644 ./URTrator.app/Contents/Framework/* +chmod -R 0755 ./URTrator.app/Contents/MacOS/* # Libraries works. -# First iteration - main libraries. -echo "Copying libraries..." -dylibbundler -of -b -x ./URTrator.app/Contents/MacOS/urtrator -d ./URTrator.app/Contents/Framework/ -p @executable_path/../Framework/ +change_framework_library_load_path "./URTrator.app/Contents/MacOS/urtrator" "@executable_path/../Framework" +change_framework_library_load_path "./URTrator.app/Contents/MacOS/gdk-pixbuf-query-loaders" "@executable_path/../Framework" -# Fix shit for dylibbundler. By this moment we should have everything -# we needed in Framework directory. -for lib in $(ls ./URTrator.app/Contents/Framework); do - libname=$(echo ${lib} | awk -F"/" {' print $NF '}) - DEPS=$(otool -L ./URTrator.app/Contents/Framework/${lib} | grep "/usr/local") +##################################################################### +# Directory structure for GTK things. We will symlink neccessary +# libraries from /Framework here. +echo "Creating libraries structure with symlinks" +# GTK engines +mkdir -p ./URTrator.app/Contents/lib/gtk-2.0/2.10.0/engines/ +cd ./URTrator.app/Contents/lib/gtk-2.0/2.10.0/engines/ +ln -s ../../../../Framework/libclearlooks.so libclearlooks.so +ln -s ../../../../Framework/libmurrine.so libmurrine.so +ln -s ../../../../Framework/libpixmap.so libpixmap.so +# Pixbuf loaders +cd ../../../../ +mkdir -p lib/gdk-pixbuf-2.0/2.10.0/loaders/ +cd lib/gdk-pixbuf-2.0/2.10.0/loaders/ +for file in $(ls ../../../../Framework | grep libpixbufloader); do + ln -s ../../../../Framework/${file} ${file} +done +# Fix pixbuf loaders to load things from "../Framework". +for file in $(ls . | grep libpixbufloader); do + DEPS=$(otool -L ${file} | grep "executable_path") for dep in ${DEPS[@]}; do dep_name=$(echo ${dep} | awk -F"/" {' print $NF '}) - install_name_tool -change ${dep} @executable_path/../Framework/${dep_name} ./URTrator.app/Contents/Framework/${libname} + install_name_tool -change ${dep} ../Framework/${dep_name} ${file} done done +cd .. +ln -s ../../../Framework . +cd ../../../MacOS +GDK_PIXBUF_MODULE_FILE="../lib/gdk-pixbuf-2.0/loaders.cache" GDK_PIXBUF_MODULEDIR="../lib/gdk-pixbuf-2.0/2.10.0/loaders/" GTK_EXE_PREFIX="../lib" GTK_PATH="../Framework" ./gdk-pixbuf-query-loaders > ../lib/gdk-pixbuf-2.0/2.10.0/loaders.cache echo "Finishing..." diff --git a/ui/mainwindow.go b/ui/mainwindow.go index a995069..c70b0fa 100644 --- a/ui/mainwindow.go +++ b/ui/mainwindow.go @@ -29,6 +29,8 @@ type MainWindow struct { // Gamemodes. gamemodes map[string]string + text string + // Widgets. // The window itself. window *gtk.Window diff --git a/ui/mainwindow_init.go b/ui/mainwindow_init.go index 7cf9276..1b50ee5 100644 --- a/ui/mainwindow_init.go +++ b/ui/mainwindow_init.go @@ -76,7 +76,11 @@ func (m *MainWindow) Initialize() { m.options_dialog = &OptionsDialog{} // Main menu. - m.InitializeMainMenu() + if runtime.GOOS == "darwin" { + m.initializeMacMenu() + } else { + m.InitializeMainMenu() + } // Toolbar. m.InitializeToolbar() @@ -140,6 +144,7 @@ func (m *MainWindow) Initialize() { profile_and_launch_hbox.PackStart(m.launch_button, false, true, 5) m.window.Add(m.vbox) + m.window.ShowAll() // Launch events. diff --git a/ui/mainwindow_init_mac.go b/ui/mainwindow_init_mac.go new file mode 100644 index 0000000..cfed101 --- /dev/null +++ b/ui/mainwindow_init_mac.go @@ -0,0 +1,28 @@ +package ui + +import ( + // stdlib + "os" + "path/filepath" + "runtime" + + // other + "github.com/mattn/go-gtk/gtk" +) + +func (m *MainWindow) initializeMac() { + if runtime.GOOS == "darwin" { + dir, _ := filepath.Abs(filepath.Dir(os.Args[0])) + + gtk.RCParse(dir + "/../Resources/themes/gtkrc-keybindings") + + // ToDo: theming support and theme seletion in settings. + gtk.RCParse(dir + "/../Resources/themes/ClearlooksBrave/gtk-2.0/gtkrc") + } +} + +func (m *MainWindow) initializeMacMenu() { + // This is a placeholder, in future we will use native mac menu. + // For now it launches default menu initialization. + m.InitializeMainMenu() +}