Home Download Buy Blog Forum Support

New Style Tabs

Re: New Style Tabs

Postby tgkeul on Tue Mar 17, 2009 10:00 pm

Jon,
my Firefox uses the Aquatint Black Gloss theme and has a black menubar with white font. I assume they use a very different architecture than yours and it may take an enormous effort to realize it in sublime. But it shows the menubar has not to be system default.
This is not a problem to me - its just eye candy (but I love eye candies ;) ).
tgkeul
 
Posts: 140
Joined: Tue Dec 02, 2008 9:35 pm

Re: New Style Tabs

Postby SteveCooperOrg on Wed Mar 18, 2009 6:24 am

jps wrote:Assuming you have installed the Extra Full Screen package that was linked on a blog post,...


no, I've not installed that.

The menu item does the same, and is displayed with the shift+f11 keybinding.
Maybe what you're looking for is at the http://www.sublimetextwiki.com
SteveCooperOrg
 
Posts: 193
Joined: Thu Mar 20, 2008 9:53 am

Re: New Style Tabs

Postby SteveCooperOrg on Thu Mar 26, 2009 8:22 pm

I've figured this one out; the distractionFree command in <packages>/Default/DistractionFree.py uses the drawcentred option to determine if distractionfree mode is currently running. Since I always run sublime in centred mode, the plugin always thinks I've got distractionfree mode on, and running the command attempts to turn it off again. Which exits fullscreen mode and puts all the furniture back.

The fix is to add in an extra property to distinguish distractionfree from not;

import sublime, sublimeplugin

Code: Select all
class DistractionFreeCommand(sublimeplugin.TextCommand):
    def run(self, view, args):
        if not view.options().get('distractionfree'):
            view.options().set('distractionfree', True)
            [...]
        else:
            # Drop the explicit options previously set, letting the defaults
            # show through.
            view.options().erase('distractionfree')
            [...]
Maybe what you're looking for is at the http://www.sublimetextwiki.com
SteveCooperOrg
 
Posts: 193
Joined: Thu Mar 20, 2008 9:53 am

Re: New Style Tabs

Postby SteveCooperOrg on Thu Mar 26, 2009 8:40 pm

Actually, a little better is to push and pop options, using an option backup system to save off old values. When you leave distractionfree, you pop off the most recent values for the old values.

Code: Select all
import sublime, sublimeplugin

def pushOption(view, name, value):
    backupKey = "%s.backup" % name
    oldValue = view.options().get(name)
    print "saving %s=%s" % (backupKey, oldValue)
    view.options().set(backupKey, oldValue)
    view.options().set(name, value)
   
def popOption(view, name):
    backupKey = "%s.backup" % name
    oldValue = view.options().get(backupKey)
    print "restoring %s=%s" % (name, oldValue)
    view.options().set(name, oldValue)
    view.options().erase(backupKey)

class DistractionFreeCommand(sublimeplugin.TextCommand):
   
    def run(self, view, args):
       
        if not view.options().get('distractionfree'):
            view.options().set('distractionfree', True)
           
            pushOption(view, 'drawCentered', True)
            pushOption(view, 'lineNumbers', False)
            pushOption(view, 'highlightLine', False)
            pushOption(view, 'wrapWidth', 80)
            pushOption(view, 'wordWrap', True)
            pushOption(view, 'wantScrollBars', False)
            pushOption(view, 'rulers', '')

            window = view.window()
            if not window.isFullScreen():
                window.runCommand('toggleFullScreen')
                pass

        else:
            # Drop the explicit options previously set, letting the defaults
            # show through.
            view.options().erase('distractionfree')
            popOption(view, 'drawCentered')
            popOption(view, 'lineNumbers')
            popOption(view, 'highlightLine')
            popOption(view, 'wrapWidth')
            popOption(view, 'wordWrap')
            popOption(view, 'wantScrollBars')
            popOption(view, 'rulers')

            window = view.window()           
            if window.isFullScreen():
                window.runCommand('toggleFullScreen')
Maybe what you're looking for is at the http://www.sublimetextwiki.com
SteveCooperOrg
 
Posts: 193
Joined: Thu Mar 20, 2008 9:53 am

Re: New Style Tabs

Postby SteveCooperOrg on Thu Mar 26, 2009 8:42 pm

Not all the way there yet, actually. You should probably not take the code above as 100% ... y'know... working.
Maybe what you're looking for is at the http://www.sublimetextwiki.com
SteveCooperOrg
 
Posts: 193
Joined: Thu Mar 20, 2008 9:53 am

Previous

Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot], Yahoo [Bot] and 35 guests