View Single Post

Member Since: Apr 16, 2014
Posts: 1
cosmiccraze6 is on a distinguished road

cosmiccraze6 is offline
Hi All!
I have been creating a small status bar app that only runs in the status bar and allows you to switch between desktops (spaces)
My menu has buttons for space right and space left and I have connected them into the default AppDelegate.m and created an IBAction for them.
What piece of code allows me to either make theese buttons change the desktops on my mac, Or execute the control arrow keys key shortcut to change desktops?


//  AppDelegate.m

//  Window Switcher


//  Created by Dane Boulton on 16/04/2014.

//  Copyright (c) 2014 DaneBoultonCreations. All rights reserved.


#import "AppDelegate.h"

@implementation AppDelegate

@synthesize window=_window;

-(void)awakeFromNib {

    statusItem = [[NSStatusBar systemStatusBar]statusItemWithLength:NSVariableStatusItemLength ];

    [statusItem setMenu:menu];

    [statusItem setTitle:@"Space Switch"];

    [statusItem setHighlightMode: YES];

    [statusItem setImage:[NSImage imageNamed:@"image"]];


- (IBAction)helpWindow:(id)sender {

    [NSApp activateIgnoringOtherApps:YES];

    [_window makeKeyAndOrderFront:nil];


- (IBAction)quit:(id)sender {

    [NSApp terminate:nil];


- (IBAction)goleft:(id)sender {


- (IBAction)goright:(id)sender {


What do I put under the IBAction go right and go left actions?
Thank you. If you need more information please let me know.
QUOTE Thanks