Thursday, September 19, 2013

More Mac Tips and Tricks

Google Chrome and F5

So for some reason Google Chrome in OSX does not support F5 for refresh. This is easy to fix it turns out:
  1. Open System Preferences > Keyboard > Keyboard Shortcuts
  2. Click on Application Shortcuts in the Left Pane
  3. Click the + button, select Google Chrome as the Application and enter "Reload This Page" as the menu title
  4. Highlight the Keyboard Shortcut field and press F5
Source: http://productforums.google.com/d/msg/chrome/If0TdQ2m6hU/ZSrbu8BCDpwJ (Instructions for Lion are above)

Games on a Mac and Hot Corners

I have Hot Corners enabled on my Mac. When I try to play a Full Screen game, the Hot Corners keep activating. I searched for some way to disable Hot Corners quickly, but none exists. However, it seems this can be done using AppleScript. What it involves is creating an AppleScript that disables and reenables your Hot Corners on the basis of your input. There are a couple of glitches with this: firstly, if you want to modify the Hot Corners configuration to be something different, you have to modify the AppleScript and if you want to setup a Hot Corner to show Notification Center, then it doesn't work via AppleScript.

Here's the AppleScript I ended up using:
repeat
 activate
 
 
 set question to display dialog "Do you Want to Enable Hot Corners?" buttons {"Yes", "No", "Cancel"} default button 3
 set answer to button returned of question
 
 if answer is equal to "No" then
  tell application "System Events"
   activate
   if UI elements enabled then
    tell expose preferences
     set properties of the top left screen corner to {activity:none, modifiers:{}}
     -- set properties of the top right screen corner to {activity:none, modifiers:{}}
     set properties of the bottom left screen corner to {activity:none, modifiers:{}}
     set properties of the bottom right screen corner to {activity:none, modifiers:{}}
    end tell
   else
    tell application "System Preferences"
     activate
     set current pane to pane "com.apple.preference.universalaccess"
     display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
    end tell
   end if
  end tell
  return
  
 end if
 
 if answer is equal to "Yes" then
  tell application "System Events"
   activate
   if UI elements enabled then
    tell expose preferences
     set properties of the top left screen corner to {activity:all windows, modifiers:{}}
     -- set properties of the top right screen corner to {activity:show desktop, modifiers:{}}
     set properties of the bottom left screen corner to {activity:«constant ****lpad», modifiers:{}}
     set properties of the bottom right screen corner to {activity:dashboard, modifiers:{}}
    end tell
   else
    tell application "System Preferences"
     activate
     set current pane to pane "com.apple.preference.universalaccess"
     display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
    end tell
   end if
  end tell
  return
  
 end if
 
 if answer is equal to "Cancel" then
  return
  
 end if
 
end repeat

Some useful links on the same:

  • My original inspiration: https://gist.github.com/klynch/827581
  • The repeat comes from here: http://dev.dota2.com/showthread.php?t=102450
  • General Scripting Guidelines: http://macscripter.net/viewtopic.php?id=24773
  • And some more: http://www.macosxautomation.com/applescript/features/system-prefs.html
Post a Comment