Sublime Forum

The custom UI

#1

I’ve been a Sublime Text user for a long time and I’d love to know what that amazing User Interface is made out of.
I know that I was custom built by Jon and I looked at this post about it
stackoverflow.com/questions/7102 … ext-editor

Following “The UI toolkit sits on top of a cross platform abstraction layer”, something Jon said on Hacker News,
and the comments on the stack overflow post:

Is that custom interface based on / using gtk?
If not, what’s that abstraction layer?

Please kill my curiosity, because it’s bugging me a lot.

Cheers.

0 Likes

#2

I don’t have any info other than what Jon has posted publicly. That said, you can dig into the Sublime Text binary on each platform and learn some about it. I’ve done this in the past due to my own curiosity.

I believe the abstraction layer is abstracting things like the OS title bars, menus, message and file open/save dialogs. On Linux it uses GTK, on OS X it uses Cocoa, on Windows it uses MFC (I think). Anything on your OS that looks native, is most likely implemented using native APIs. You can see evidence that Jon is not using GTK on Windows or OS X by looking at the list of utilized shared libraries below.

The whole body of the editor, however, is part of the custom UI. This is why it can all be changed via themes. The themes use PNGs and a custom CSS-like JSON structure that you can see an example of at github.com/buymeasoda/soda-them … lime-theme.

By using the unix “strings” program, you can see some of the filenames that are part of the project:

core/io/io_requests.cc core/io/io_util.cc px/cocoa/px_cocoa_watch_dir.cc px/detail/load_image.cc px/detail/texture_loader.cc skyline/text/completion_loader.cc skyline/text/file_buffer_source.cc skyline/text/file_out_stream_posix.cc skyline/text/lexer/lexer.cc skyline/text/lexer/multi_matcher.cc skyline/text/lexer/plist.cc skyline/text/macro.cc skyline/text/meta_info.cc skyline/text/snippet_manager.cc skyline/text/spell_checker.cc skyline/text/syntax.cc skyline/text/syntax/syntax_manager.cc skyline/text/text_buffer.cc skyline/text/text_buffer_functions.cc skyline/text/util/regex_util.cc skyline/text/view_style.cc skyline/ui/notification_manager.cc skyline/ui/skyline_text_commands.cc skyline/ui/skyline_text_control.cc sublime_text/app_loader.cc sublime_text/base_app_loader.cc sublime_text/build_controller.cc sublime_text/changelog.cc sublime_text/command_loader.cc sublime_text/command_palette_overlay.cc sublime_text/edit_window.cc sublime_text/edit_window_commands.cc sublime_text/find_in_files_panel.cc sublime_text/goto_anything_overlay.cc sublime_text/grep.cc sublime_text/grid_layout.cc sublime_text/image_sheet.cc sublime_text/index/crawler.cc sublime_text/index_controller.cc sublime_text/main.cc sublime_text/plugin_api.cc sublime_text/sublime_menu_delegate.cc sublime_text/symbol_parser.cc sublime_text/telemetry.cc sublime_text/update_check.cc sublime_text/window_list.cc sublime_text/workspace_list.cc ui/binding_map.cc ui/catalogue.cc ui/filter_util.cc ui/html_control.cc ui/load_value.cc ui/menu_loader.cc ui/minihtml/dom.cc ui/pointer_automata.cc ui/property_rules.cc ui/settings_loader.cc ui/startup_cache.cc ui/theme.cc ui/window_aspect.cc ui/window_factory.cc ui/window_impl.cc ui/window_input_automata_aspect.cc ui/window_pointer_automata_aspect.cc update/update_util.cc

On OS X (via otool -L), the binary relies on the following shared libraries:

/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 21.0.0) /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 157.0.0) /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 57031.1.34) /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1343.14.0) /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 48.0.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1151.16.0) /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 62.0.0) /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1151.16.0) /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)

On Windows (via depends.exe), it uses:

c:\windows\system32\KERNEL32.DLL c:\windows\system32\USER32.DLL c:\windows\system32\GDI32.DLL c:\windows\system32\ADVAPI32.DLL c:\windows\system32\SHELL32.DLL c:\windows\system32\OLE32.DLL c:\windows\system32\WININET.DLL c:\windows\system32\COMDLG32.DLL

On Linux (via ldd), is uses:

linux-vdso.so.1 (0x00007fff03d42000) libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007fcb93572000) librt.so.1 => /usr/lib/librt.so.1 (0x00007fcb9336a000) libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007fcb9305c000) libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fcb92e3f000) libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fcb92c3b000) libX11.so.6 => /usr/lib/libX11.so.6 (0x00007fcb928f9000) libm.so.6 => /usr/lib/libm.so.6 (0x00007fcb925f4000) libc.so.6 => /usr/lib/libc.so.6 (0x00007fcb92251000) /lib64/ld-linux-x86-64.so.2 (0x00007fcb937c3000) libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007fcb91fe2000) libffi.so.6 => /usr/lib/libffi.so.6 (0x00007fcb91dd9000) libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007fcb91bb7000) libXau.so.6 => /usr/lib/libXau.so.6 (0x00007fcb919b3000) libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007fcb917ad000)

If you poke at the plugin_host binary, you’ll find different shared libraries, as makes sense since that binary is where Python runs for all of the plugins.

0 Likes