Stupid Mac::Glue Tricks: Leopard Spaces
So a lot of times when using Spaces under Leopard, windows just ... disappear. They are not visible in any space. So I have to open up the System Preferences and turn Spaces off, and then back on, which fixes it.
Here's a script that I put in my Script Menu (~/Library/Scripts/Reset Spaces.scpt) so I have quick access to it.
Fine.
System Events in Leopard has a lot of new junk in it for scripting preferences. Pretty neat, you can script many difference preferences now. Here's a list.
Here's a script that I put in my Script Menu (~/Library/Scripts/Reset Spaces.scpt) so I have quick access to it.
tell application "System Events"Oh. You want a Perl version, do you?
set (spaces enabled of spaces preferences of expose preferences) to false
set (spaces enabled of spaces preferences of expose preferences) to true
end tell
Fine.
#!/usr/bin/perlI prefer AppleScript for stuff like this, since it's quicker to execute and I have to use AppleScript to figure out how to do it in Perl anyway, since AppleScript is sometimes easier to prototype with when you don't know what properties and objects you're working with. But it took only a minute to convert it to Perl, so no biggie.
use warnings;
use strict;
use Mac::Glue;
my $sysevt = new Mac::Glue 'System Events';
my $enabled = $sysevt->prop('spaces enabled',
of => 'spaces preferences',
of => 'expose preferences'
);
$enabled->set(to => 0);
$enabled->set(to => 1);
System Events in Leopard has a lot of new junk in it for scripting preferences. Pretty neat, you can script many difference preferences now. Here's a list.
appearance_preferences_object
A collection of appearance preferences
Properties:
appearance: the overall look of buttons, menus and windows
double_click_minimizes: Does double clicking the title bar minimize a window?
font_smoothing_limit: the font size at or below which font smoothing is turned off
font_smoothing_style: the method used for smoothing fonts
highlight_color: color used for hightlighting selected text and lists
inheritance: All of the properties of the superclass. (read-only)
recent_applications_limit: the number of recent applications to track
recent_documents_limit: the number of recent documents to track
recent_servers_limit: the number of recent servers to track
scroll_arrow_placement: the placement of the scroll arrows
scroll_bar_action: the action performed by clicking the scroll bar
smooth_scrolling: Is smooth scrolling used?
cd_and_dvd_preferences_object
user's CD and DVD insertion preferences
Properties:
blank_cd: the blank CD insertion preference (read-only)
blank_dvd: the blank DVD insertion preference (read-only)
inheritance: All of the properties of the superclass. (read-only)
music_cd: the music CD insertion preference (read-only)
picture_cd: the picture CD insertion preference (read-only)
video_dvd: the video DVD insertion preference (read-only)
dock_preferences_object
user's dock preferences
Properties:
animate: is the animation of opening applications on or off?
autohide: is autohiding the dock on or off?
dock_size: size/height of the items (between 0.0 (minimum) and 1.0 (maximum))
inheritance: All of the properties of the superclass. (read-only)
location: location on screen
magnification: is magnification on or off?
magnification_size: maximum magnification size when magnification is on (between 0.0 (minimum) and 1.0 (maximum))
minimize_effect: minimization effect
expose_preferences_object
user's expose and dashboard mouse and key preferences
Properties:
all_windows_shortcut: the key and mouse binding shortcuts for showing the all application windows (read-only)
application_windows_shortcut: the key and mouse binding shortcuts for showing the current application windows (read-only)
bottom_left_screen_corner: the bottom left screen corner (read-only)
bottom_right_screen_corner: the bottom right screen corner (read-only)
dashboard_shortcut: the key and mouse binding shortcuts for showing the dashboard (read-only)
inheritance: All of the properties of the superclass. (read-only)
show_desktop_shortcut: the key and mouse binding shortcuts for showing the desktop (read-only)
show_spaces_shortcut: the key and mouse binding shortcuts for showing spaces (read-only)
spaces_preferences: the spaces preferences (read-only)
top_left_screen_corner: the top left screen corner (read-only)
top_right_screen_corner: the top right screen corner (read-only)
network_preferences_object
the preferences for the current user's network
Properties:
current_location: the current location
inheritance: All of the properties of the superclass. (read-only)
Elements:
interface, location, service
security_preferences_object
a collection of security preferences
Properties:
automatic_login: Is automatic login allowed?
inheritance: All of the properties of the superclass. (read-only)
log_out_when_inactive: Will the computer log out when inactive?
log_out_when_inactive_interval: The interval of inactivity after which the computer will log out
require_password_to_unlock: Is a password required to unlock secure preferences?
require_password_to_wake: Is a password required to wake the computer from sleep or screen saver?
secure_virtual_memory: Is secure virtual memory being used?
spaces_preferences_object
user's spaces application bindings and navigation preferences
Properties:
application_bindings: binding of applications to specific spaces
arrow_key_modifiers: keyboard modifiers used controlling the arrow key navigation through spaces (read-only)
inheritance: All of the properties of the superclass. (read-only)
numbers_key_modifiers: keyboard modifiers used controlling the number key navigation through spaces (read-only)
spaces_columns: number of columns of spaces
spaces_enabled: is spaces enabled?
spaces_rows: number of rows of spaces
Leave a comment