Global Preference for window width?

63 views
Skip to first unread message

Robert W. Franson

unread,
Jan 10, 2021, 8:22:26 PM1/10/21
to Bare Bones Software
This is so simple I'm embarrassed to ask it.

I always seem to be re-widening the editing windows to my preferred minimum working width, which on my screen is about 1.5 - 2 inches wider than the default of about 8 inches.

These are standard text or html windows; opened directly from the Finder (except during Multi-File Search); sidebar permanently suppressed. BBEdit remembers each window's positioning, and the window's height and width, after a file save. Yet sooner or later I seem to be back with the narrower window. The window's height is preserved, which is almost always the maximum vertical space available.

I cannot find anything under the Global Preferences, individual files' Text Options, the Expert Preferences, or the BBEdit manual which describes how to set a default minimum width. Yet there is somewhere a setting for that, since new windows open for me at the near 8 inch width, and at maximum height.

Ideally I'd like a Global Preference to set or re-set window width to say 10 inches whenever a window is saved, unless I adjust the width to a lesser or greater measurement. Same for height, of course.

If such exists, I'd be grateful if anyone could point me to it.

Thanks,

Robert W. Franson

BBEdit 13.5.4
27-inch iMac with MacOS 10.15.7


Bruce Van Allen

unread,
Jan 10, 2021, 8:54:31 PM1/10/21
to Bare Bones Software

On 10 Jan 2021, at 16:46, Robert W. Franson wrote:

Yet there is somewhere a setting for that,

Under the Window menu, see “Save Default X”, where X varies with the type of window open in front.

This setting seems to sometimes get confused or forgetful, especially after a disturbance in the force, like a system crash.

But mostly does what you’re asking for.

Best Regards,

  • Bruce

Bruce Van Allen
PO Box 839
Santa Cruz CA 95061

Desk: 831-429-1688
Cell: 831-332-3649
b...@cruzio.com

Brian Forte

unread,
Jan 10, 2021, 8:57:17 PM1/10/21
to bbe...@googlegroups.com
On Sun, 10 Jan 2021 16:46:57 -0800, Robert W. Franson wrote:

> Ideally I'd like a Global Preference to set or re-set window width to
> say 10 inches whenever a window is saved, unless I adjust the width
> to a lesser or greater measurement. Same for height, of course.

1. Open a BBEdit text-editing window and arrange and size it to your
specific preference.

2. Make sure it is the active window.

3. Select Window > Save Default Text Window

From now on, every time you use ⌘-N (or equivalent, such as choosing
File > New > New Text Document) to create a new text-editing window,
said window will have your pre-set dimensions.

Hope this helps.

Regards,

Brian Forte.
--
Brian Forte
<bfo...@adelaide.on.net>

David Nugent

unread,
Jan 10, 2021, 8:59:54 PM1/10/21
to bbe...@googlegroups.com, Robert W. Franson
Robert, now that you raise this, I'd also opt for a similar option for height as well.

BBEdit always opens a default window the entire screen height (sans system menu) which, on very high resolution monitors is just a huge overkill and invariably leads to me resizing it manually. Every time.

It should be possible to change this such that it is a little less "hard coded" and create a new window with either a custom size and position or something derived from a previously used window size on that display.

Regards,
/d

On 11 January 2021 at 12:22:26, Robert W. Franson (dod...@roviking.com) wrote:

This is so simple I'm embarrassed to ask it.
~

David Nugent

unread,
Jan 10, 2021, 9:24:31 PM1/10/21
to bbe...@googlegroups.com, Bruce Van Allen
On 11 January 2021 at 12:54:29, Bruce Van Allen (b...@cruzio.com) wrote:

On 10 Jan 2021, at 16:46, Robert W. Franson wrote:

Yet there is somewhere a setting for that,

Under the Window menu, see “Save Default X”, where X varies with the type of window open in front.


Thanks Bruce. Many years I have used BBEdit and I never knew this existed.


This setting seems to sometimes get confused or forgetful, especially after a disturbance in the force, like a system crash.

But mostly does what you’re asking for.


Works for me.

Cheers,

/d


Christopher Finazzo

unread,
Jan 11, 2021, 10:35:12 AM1/11/21
to BBEdit Talk
I was just thinking about this too, as I recently changed the default resolution on my machine (13" 2020 MacBook Pro).

Tl;dr The default resolution of these machines in past few years isn't a perfect 1:1 map to the pixel density of the display. There are NSWindow API developers can use to set a default size, but in practice I've found this change means I need to reconsider window sizes in every application I use - not just BBEdit.

Also, the first Apple laptop I owned - a 2007 15" - died because of an 8600M failure, so these kinds of bugs freak me out.

Christopher Stone

unread,
Jan 11, 2021, 7:18:00 PM1/11/21
to BBEdit-Talk
On 01/10/2021, at 19:54, Bruce Van Allen <b...@cruzio.com> wrote:
On 10 Jan 2021, at 16:46, Robert W. Franson wrote:

Yet there is somewhere a setting for that,

Under the Window menu, see “Save Default X”, where X varies with the type of window open in front.



Hey Folks,

This is an excellent starting point.

If you want even more control you can use AppleScript.

Open a window, resize and position it to your liking, and then run this script from Apple's Script Editor.app.

The bounds of the front window will be placed on the clipboard, and they look like this:

{380, 45, 1440, 1196}

--------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2021/01/11 18:03
# dMod: 2021/01/11 18:03 
# Appl: BBEdit
# Task: Place Bounds of Front Window on the Clipboard
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Window, @Bounds, @Clipboard
--------------------------------------------------------

tell application "BBEdit"
    tell front window
        set frontWindowBounds to bounds
    end tell
end tell

try
    frontWindowBounds / 0
on error errMsg
    set {oldTIDS, AppleScript's text item delimiters} to {AppleScript's text item delimiters, {"Can’t make ", " into type real."}}
    set frontWindowBounds to text item 2 of errMsg
    set AppleScript's text item delimiters to oldTIDS
    set the clipboard to frontWindowBounds
end try

--------------------------------------------------------


Use this script to actually set the size and position of the front window.

Replace the bounds in the script by pasting in the ones you just created.


--------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2021/01/11 18:07
# dMod: 2021/01/11 18:07 
# Appl: BBEdit
# Task: Set Bounds (Size & Position) of Front Window
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Set, @Bounds, @Size, @Position, @Front, @Window
--------------------------------------------------------

tell application "BBEdit"
    tell front window
        set its bounds to {380, 45, 1440, 1196}
    end tell
end tell

--------------------------------------------------------


Save the script using the Apple Script Editor.app to BBEdit's Script Folder.

~/Library/Application Support/BBEdit/Scripts/

Give the script a keyboard shortcut in BBEdit's “Menus & Shortcuts” preferences, and go to town.

You can save yourself a step when creating new windows if desired using this script:


--------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2021/01/11 18:07
# dMod: 2021/01/11 18:12
# Appl: BBEdit
# Task: Make a New Window and Set Its Bounds (Size & Position).
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Set, @Bounds, @Size, @Position, @Front, @Window
--------------------------------------------------------

tell application "BBEdit"
    make new text window
    tell front window
        set its bounds to {380, 45, 1440, 1196}
    end tell
end tell

--------------------------------------------------------


You can also get creating and calculate the size and position of the window given your monitor size, although this takes a little effort.

-Chris

Robert W. Franson

unread,
Jan 13, 2021, 12:55:32 PM1/13/21
to Bare Bones Software, Bruce Van Allen
Actually, Bruce, this looks to be *exactly* what I was looking for!

I'd assumed that "Save Default X" referred to creating new windows; whereas my problem was getting existing windows to remain the shape I wanted. I did some experimenting with several operations that had seemed culpable: Multi-File Search followed by some individual file updates in its Results window; Multi-File Replace; and Update Folder. After all these the "Save Default X" holds good even if I haven't manually adjusted the width and saved the file at the desired width.

As a bonus, I realized that I also could set the Preview window to be a bit wider, which I also find helpful.

I certainly don't mind if I have to reset these after an occasional system crash or whatever. Avoiding the continual annoyance of narrow Edit windows is a notable improvement.

Thank you! (And thanks also to Brian and David for advice.)

Robert W. Franson
> --
> This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
> ---
> You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/B93CFB28-3761-4DDA-A2B4-E051DB42866F%40cruzio.com.

Robert W. Franson

unread,
Jan 13, 2021, 12:58:31 PM1/13/21
to Bare Bones Software, Christopher Stone
Thank you, Christopher!

While Bruce's suggestion solves my particular problem, I certainly will save your helpful, clear, and documented scripts for custom cases. And of course, as exemplars!

Robert W. Franson

> On Jan 11, 2021, at 4:17 PM, Christopher Stone <listmei...@gmail.com> wrote:
>
> On 01/10/2021, at 19:54, Bruce Van Allen <b...@cruzio.com> wrote:
>> On 10 Jan 2021, at 16:46, Robert W. Franson wrote:
>> Yet there is somewhere a setting for that,
>>
>> Under the Window menu, see “Save Default X”, where X varies with the type of window open in front.
>>
>
> --
> This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
> ---
> You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/7D12484B-11B8-441E-9D14-9F5B579FDB41%40gmail.com.

Reply all
Reply to author
Forward
0 new messages