Re: [code] [textadept] [feature request] Distraction free mode

From: Mitchell <m.att.foicica.com>
Date: Mon, 4 Mar 2013 15:22:48 -0500 (Eastern Standard Time)

Hi Klaus,

On Sat, 2 Mar 2013, Klaus Borges wrote:

> Hello,
>
> This might seem like a useless feature to some, so I'm okay if it isn't
> feasible.
> A few editors (nowadays? I'm not really sure if it's a trend) come with a
> distraction free mode, which basically makes the application full-screen
> and without title and status bars, line numbers and etc. It just gives you
> a "blank" page to write on. I find it pretty useful for writing and coding,
> even though when every once in a while you have to Google something.
>
> TextAdept has been my main text editor for almost a year now, however when
> writing I seem to prefer anything with a distraction free mode because it
> certainly makes me more productive, maybe even more creative.

This is as close as you can get:

-- Add this to your ~/.textadept/init.lua
local distraction_free = false
local margin_widths = {}
local update_ui_hook
keys.cf11 = function()
   local buffer = buffer
   if not distraction_free then
     _M.textadept.menu.set_menubar{}
     for i = 0, 4 do
       margin_widths[i] = buffer.margin_width_n[i]
       buffer.margin_width_n[i] = 0
     end
     buffer.h_scroll_bar, buffer.v_scroll_bar = false, false
     update_ui_hook = events.connect(events.UPDATE_UI, function()
       gui.statusbar_text, gui.docstatusbar_text = '', ''
     end)
     events.emit(events.UPDATE_UI)
   else
     _M.textadept.menu.set_menubar(_M.textadept.menu.menubar)
     for i = 0, 4 do
       buffer.margin_width_n[i] = margin_widths[i]
     end
     buffer.h_scroll_bar, buffer.v_scroll_bar = true, true
     events.disconnect(update_ui_hook)
   end
   distraction_free = not distraction_free
end

You will have to manually maximize your window via the window manager
though. Pressing "Ctrl+F11" will toggle the mode.

Notice the statusbars are not hidden; they're just empty all the time. I
don't know how useful it would be to add the ability to hide them usin
Lua.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Mon 04 Mar 2013 - 15:22:48 EST

This archive was generated by hypermail 2.2.0 : Tue 05 Mar 2013 - 06:44:26 EST