Skip to content

Instantly share code, notes, and snippets.

@orlandoaleman
Last active December 12, 2015 01:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orlandoaleman/4694243 to your computer and use it in GitHub Desktop.
Save orlandoaleman/4694243 to your computer and use it in GitHub Desktop.
Close all annoying lateral panels of Xcode 4.x (Utilities, Navigators, Debug Area & Document Outline)
--
-- Close all annoying lateral panels of Xcode 4.x
--
-- Based on `menu_click`, by Jacob Rus, September 2006
-- (http://hints.macworld.com/article.php?story=20060921045743404)
--
--
-- Accepts a list of form: `{"Finder", "View", "Arrange By", "Date"}`
-- Execute the specified menu item. In this case, assuming the Finder
-- is the active application, arranging the frontmost folder by date.
on menu_click(mList)
local appName, topMenu, r
-- Validate our input
if mList's length < 3 then error "Menu list is not long enough"
-- Set these variables for clarity and brevity later on
set {appName, topMenu} to (items 1 through 2 of mList)
set r to (items 3 through (mList's length) of mList)
-- This overly-long line calls the menu_recurse function with
-- two arguments: r, and a reference to the top-level menu
tell application "System Events" to my menu_click_recurse(r, ((process appName)'s ¬
(menu bar 1)'s (menu bar item topMenu)'s (menu topMenu)))
end menu_click
on menu_click_recurse(mList, parentObject)
local f, r
-- `f` = first item, `r` = rest of items
set f to item 1 of mList
if mList's length > 1 then set r to (items 2 through (mList's length) of mList)
-- either actually click the menu item, or recurse again
tell application "System Events"
if mList's length is 1 then
if parentObject's menu item f exists then
click parentObject's menu item f
end if
else
my menu_click_recurse(r, (parentObject's (menu item f)'s (menu f)))
end if
end tell
end menu_click_recurse
on run {input, parameters}
tell application "Xcode" to activate
menu_click({"Xcode", "View", "Navigators", "Hide Navigator"})
menu_click({"Xcode", "View", "Utilities", "Hide Utilities"})
menu_click({"Xcode", "View", "Debug Area", "Hide Debug Area"})
menu_click({"Xcode", "View", "Debug Area", "Hide Toolbar"})
menu_click({"Xcode", "Editor", "Hide Document Outline"})
return input
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment