Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Desktop Switcher App Help!
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="cosmiccraze6" data-source="post: 1578381" data-attributes="member: 324613"><p>Hi All!</p><p>I have been creating a small status bar app that only runs in the status bar and allows you to switch between desktops (spaces)</p><p>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.</p><p>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?</p><p></p><p>[CODE]//</p><p></p><p></p><p>// AppDelegate.m</p><p></p><p>// Window Switcher</p><p></p><p>//</p><p></p><p>// Created by Dane Boulton on 16/04/2014.</p><p></p><p>// Copyright (c) 2014 DaneBoultonCreations. All rights reserved.</p><p></p><p>//</p><p></p><p>#import "AppDelegate.h"</p><p></p><p></p><p>@implementation AppDelegate</p><p></p><p></p><p>@synthesize window=_window;</p><p></p><p></p><p>-(void)awakeFromNib {</p><p></p><p> statusItem = [[NSStatusBar systemStatusBar]statusItemWithLength:NSVariableStatusItemLength ];</p><p></p><p> [statusItem setMenu:menu];</p><p></p><p> [statusItem setTitle:@"Space Switch"];</p><p></p><p> [statusItem setHighlightMode: YES];</p><p></p><p> [statusItem setImage:[NSImage imageNamed:@"image"]];</p><p></p><p>}</p><p></p><p>- (IBAction)helpWindow:(id)sender {</p><p></p><p> [NSApp activateIgnoringOtherApps:YES];</p><p></p><p> [_window makeKeyAndOrderFront:nil];</p><p></p><p>}</p><p></p><p>- (IBAction)quit:(id)sender {</p><p></p><p> [NSApp terminate:nil];</p><p></p><p>}</p><p></p><p>- (IBAction)goleft:(id)sender {</p><p></p><p> []</p><p>}</p><p></p><p>- (IBAction)goright:(id)sender {</p><p></p><p> []</p><p>}</p><p></p><p>@end</p><p>[/CODE]</p><p></p><p>What do I put under the IBAction go right and go left actions?</p><p>Thank you. If you need more information please let me know.</p></blockquote><p></p>
[QUOTE="cosmiccraze6, post: 1578381, member: 324613"] 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? [CODE]// // 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 { [] } @end [/CODE] 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]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Desktop Switcher App Help!
Top