Window Tiling for multiple documents


#1

I frequently work on several documents together, say 4 or more so it would be nice to have them all arranged on the screen so I can go quickly from now to the other but still see them all. Presumably this can be done under the Window menu?

I only use a macbook air with no second screen but I can see it being useful if you have external monitors too. I know that there is a full screen mode but that would then get mixed up with other apps running on the os if you wanted to switch.

Thanks.


#2

That would be best done with a different application. I use Mjolnir to do programatic window placement. I have an Alfred workflow that launches some of my scripts for it: Mjolnir Workflow. If interested, I can write up a quick function for that to be placed in the Mjolnir initialization file that can be triggered by a hotkey. Might do it for myself…


#3

I would rather not use another app, I used to see useful tiling on some PC text editors but i don’t use these anymore :wink:

Meanwhile, I can use mission control with a swipe up and see all the documents in a row, not sure how many are allowed though!


#4

Well, I created the functionality into Mjolnir Workflow for Alfred. It works great. You can specify a program to expose it’s windows. I have a hotkey setup for doing it for FoldingText. You can get the workflow from the link above. The Mjolnir program is freeware. But, to run the workflow you have to have an Alfred Powerpack.

You can also get the workflow from my GitHub: https://github.com/raguay/MyAlfred

Thanks for the idea. It is helping my workflow.


#5

If you know the pixel dimensions of your screen (or of the canvas you want to allocated to FT), you can:

  • assign an applescript to a keystroke,
  • play around with the arithmetic arrangement that you prefer,
  • and set the bounds property of each document window.

A sketch:

-- How big an area of the screen do you want to use FOR FT ?
set lstBounds to {0, 22, 1440, 900} -- {0, 22, 2556, 1600} 

-- SLOW WAY OF FINDING SCREEN DIMENSIONS - RUN ONLY ONCE, THEN EDIT VALUE OF LSTBOUNDS ABOVE ...
--set lngWidth to (word 3 of (do shell script "defaults read /Library/Preferences/com.apple.windowserver | grep -w Width")) as integer
--set lngHeight to word 3 of (do shell script "defaults read /Library/Preferences/com.apple.windowserver | grep -w Height") as integer
--set lngHeight to lngHeight - 22
--set lstBounds to {0, 22, lngWidth, lngHeight}

property pblnUseAllSpace : false -- (wider last window if space remains ?)

tell application "FoldingText"
	-- HOW MANY DOCUMENT WINDOWS ?
	set lstDocs to documents
	set lngWins to length of lstDocs
	
	if lngWins > 0 then
		-- 	HOW LARGE A CANVAS ARE WE USING ?
		set {x, y, x1, y1} to lstBounds
		set lngTotalWidth to x1 - x
		set lngTotalHeight to y1 - y
		
		-- HOW MANY ROWS SHALL WE USE ?
		if lngWins < 4 then
			set lngRows to 1
			set lngWinHeight to lngTotalHeight
		else
			set lngRows to 2
			set lngWinHeight to lngTotalHeight div 2
		end if
		
		-- AND HOW MANY COLUMNS DO WE NEED ?
		if lngWins < 4 then
			set lngCols to lngWins
		else
			set lngCols to (lngWins div 2) + (lngWins mod 2)
		end if
		set lngWinWidth to lngTotalWidth div lngCols
		
		-- ALLOCATE CANVAS TO EACH DOCUMENT WINDOW
		repeat with iWin from 1 to lngWins
			set oWin to window (name of (item iWin of lstDocs))
			-- GET TOP
			set lngTop to y
			if iWin > lngCols then set lngTop to y + lngWinHeight
			-- GET LEFT
			set lngLeft to ((iWin - 1) mod lngCols) * lngWinWidth
			
			
			-- ALLOW ALL REMAINING WIDTH TO LAST WINDOW ?
			if iWin = lngWins then
				if pblnUseAllSpace then set lngWinWidth to lngTotalWidth - lngLeft
			end if
			-- SET BOUNDS
			set bounds of oWin to {lngLeft, lngTop, lngLeft + lngWinWidth, lngTop + lngWinHeight}
		end repeat
	end if
end tell

return lstBounds


#6

This is great, it works just as I like it to - many thanks for your time and effort.