The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus 1 for Mac (http://forums.omnigroup.com/forumdisplay.php?f=38)
-   -   Hide View Bar in a Perspective? (http://forums.omnigroup.com/showthread.php?t=20399)

marcia 2011-03-14 05:37 AM

Hide View Bar in a Perspective?
 
Is there a way to always hide the View Bar in a Perspective?

I have a Perspective called "Now" that opens in a new window, and has the Sidebar and Toolbar hidden, would like to also have the View Bar hidden automatically. Is that possible?

Thanks!

whpalmer4 2011-03-14 08:39 AM

Normally the View Bar state is not saved as part of a perspective, so far as I can tell. However, if the perspective which has the non-default view bar state (in your case, no view bar) is set to open as a new window, as you have it, then taking a snapshot of the perspective with the view bar as you want it and the Restore Layout box checked seems to make the right thing happen. If you recycle that window to open a different perspective, however, the new perspective will get the view bar state left behind by the previous use.

I have one perspective that brings up a new window showing a focused list of template projects, and does not display the sidebar, the view bar, the tool bar, most of the columns. I close it when I am done with it, so the view bar issue goes away. If you want half of your perspectives to show the view bar and half not to, the path of least resistance is probably just to memorize cmd-shift-V (and send in a feature request with Help->Send Feedback).

psidnell 2013-08-20 06:55 AM

This has been bugging me for a while. I usually want to enable/disable the tool bar and viewbar together.

With a bit of googling I cobbled the following applescript together that does the job:

[CODE]tell application "OmniFocus"
activate
tell application "System Events" to keystroke "V" using command down
tell application "System Events" to keystroke "t" using {command down, option down}
end tell[/CODE]

I'm running this from Alfred triggered with the command "oft", but I'll contact Omni and put in my request to have the view bar state stored by the perspective.

Fermey 2013-08-20 04:11 PM

To piggyback off this message, is it possible to maintain the width of the view bar after switching to a new perspective?

Example, I expand the view bar to a larger-than-normal width in the Project perspective, them change to the Context perspective, then switch back to Project perspective, the width of the view bar is back to narrow again.

No way to make it wider by default?

RobTrew 2013-08-21 12:40 AM

[QUOTE=psidnell;126957]I usually want to enable/disable the tool bar and viewbar together.

[CODE]tell application "OmniFocus"
activate
tell application "System Events" to keystroke "V" using command down
tell application "System Events" to keystroke "t" using {command down, option down}
end tell[/CODE][/QUOTE]

FWIW, if you want scripts which specifically hide or show, rather than toggling (and which don't depend on particular keystroke assignments), you can also check which menu items are available, and click or desist accordingly.
Here's a [I]GetMenuItem()[/I] function, with an example of using it to hide the Tool and View bars. (Editing the value of the [I]pblnHide[/I] flag to [I]false[/I] will turn it into a script for [B]showing[/B] the two bars).

[CODE]property pblnHide : true -- Edit to false for a script which SHOWS the Tool+View bars

on run
tell application id "OFOC" to activate

-- Check which menu items are available
set mnuHideToolBar to GetMenuItem("OFOC", {"View", "Hide Toolbar"})
set mnuShowToolBar to GetMenuItem("OFOC", {"View", "Show Toolbar"})

set mnuHideViewBar to GetMenuItem("OFOC", {"View", "Hide View Bar"})
set mnuShowViewBar to GetMenuItem("OFOC", {"View", "Show View Bar"})

-- Click hide or show menus, as indicated by by the pblnHide flag
tell application id "sevs"
if pblnHide then
if mnuHideToolBar is not missing value then click mnuHideToolBar
if mnuHideViewBar is not missing value then click mnuHideViewBar
else
if mnuShowToolBar is not missing value then click mnuShowToolBar
if mnuShowViewBar is not missing value then click mnuShowViewBar
end if
end tell

end run

-- Reusable menu functions
on GetMenuItem(strAppCode, lstMenu)
set lngChain to length of lstMenu
if lngChain < 2 then return missing value

tell application id "sevs"
set lstApps to application processes where its creator type = strAppCode
if length of lstApps < 1 then return missing value
tell first item of lstApps
-- GET THE TOP LEVEL MENU
set strMenu to item 1 of lstMenu
set oMenu to menu strMenu of menu bar item strMenu of menu bar 1

-- TRAVEL DOWN THROUGH ANY SUB-MENUS
repeat with i from 2 to (lngChain - 1)
set strMenu to item i of lstMenu
set oMenu to menu strMenu of menu item strMenu of oMenu
end repeat

-- AND RETURN THE FINAL MENU ITEM (OR MISSING VALUE, IF UNAVAILABLE)
try
return menu item (item -1 of lstMenu) of oMenu
on error
return missing value
end try
end tell
end tell
end GetMenuItem

on GUIEnabled()
tell application id "sevs"
if UI elements enabled then
return true
else
activate
display dialog "This script depends on enabling access for assistive devices in system preferences" buttons "OK" default button "OK" with title pTitle & " " & pVer
tell application id "sprf"
activate
set current pane to pane id "com.apple.preference.universalaccess"
end tell
return false
end if
end tell
end GUIEnabled
[/CODE]

RobTrew 2013-08-21 12:53 AM

PS, as properties in .scpt files conserve their state between runs, you can, of course, get a toggle script by flipping the value of the flag at the end of the run:

[CODE]property pblnHide : false

on run
tell application id "OFOC" to activate

-- Click hide or show menus, as indicated by by the pblnHide flag
tell application id "sevs"
if pblnHide then
set mnuHideToolBar to my GetMenuItem("OFOC", {"View", "Hide Toolbar"})
if mnuHideToolBar is not missing value then click mnuHideToolBar

set mnuHideViewBar to my GetMenuItem("OFOC", {"View", "Hide View Bar"})
if mnuHideViewBar is not missing value then click mnuHideViewBar
else
set mnuShowToolBar to my GetMenuItem("OFOC", {"View", "Show Toolbar"})
if mnuShowToolBar is not missing value then click mnuShowToolBar

set mnuShowViewBar to my GetMenuItem("OFOC", {"View", "Show View Bar"})
if mnuShowViewBar is not missing value then click mnuShowViewBar
end if
end tell

-- TOGGLE for next run
set pblnHide to not pblnHide
end run[/CODE]

(Assumes the [I]GetMenuItem()[/I] function in the previous post)

psidnell 2013-08-22 02:39 AM

Cool, thanks Rob!


All times are GMT -8. The time now is 12:53 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.