How can i set shortcut keys to perform some action - objective-c

I have multiple screens in my project, I want to open a specific screen on pressing some shortcut keys (like ctrl+AnykeyButton). So how can I do this programmatically?

Related

Showing file name when in full screen mode in Intelij Idea

Intelij Idea does hides every thing when in full screen mode so that the developer can make use of maximum screen space available for writing code. From the documentation:
In Full Screen mode, IntelliJ IDEA expands the main window to occupy
the entire screen. All operating system controls are hidden, but you
can access the main menu if you hover the mouse pointer over the top
of the screen.
I recently embarked on the journey to minimise the use of mouse and therefore have started using the full screen mode. It sometimes happen that I need to know the file name. This is required as we have many files with more or less similar names (eg. XXXPreMigrationService, XXXPostMigrationService). Now in order to see the file name, I can use different approaches:
Alt+1 Shows file in the Project Explorer window.
Alt+Home Shows file in the Navigation toolbar.
Both the approaches require me to press 2 keys (twice). Is it possible to show/hide the current file name by press/un-press any key? Is there a way I can set a shortcut for such action?

Is it possible to add custom keyboard shortcuts to a webapp which you don't own?

For example, suppose there's a webapp called todotasks.com that allows you to log in and add new tasks (in particular, by clicking a series of menu bottons, inputing text in a popup form, and pressing enter). Suppose this webapp doesn't have a keyboard shortcut for adding a new task, and forces you to do everything with a mouse. Would it be possible to add your own keyboard shortcut here that works locally to your machine?
NOTE: Here I'm referring to webapps which you are not the author of.

IKPictureTaker - Set Opening Tab

I'm using an IKPictureTaker in one of my apps, and when it opens it has four selectable tabs (Defaults, Recents, Camera, Other). I'd like it to be set to the Defaults tab when it opens up, but from the class reference it seems as though you can only open it to the Camera tab, with – beginPictureTakerSheetForWindow:withDelegate:didEndSelector:contextInfo:, or the Recents tab, with – popUpRecentsMenuForView:withDelegate:didEndSelector:contextInfo:.
Is there any way to programmatically set the tab it opens to?

How to create a background only program that can show a window with text fields

I want to create a program that consists of just a menu in the status bar (no dock icon or menu bar) that, when the user clicks on menu items, opens a window that allows the user to enter text (NSTextField and NSTextView).
I can make the program background only by setting the "Application is background only" property to YES in my Info.plist file, however, when I do this and display a window, firstly the window always appears behind other windows, and secondly I can't type any text into it (text goes to whatever last had focus - usually a source file in Xcode!)
This is definitely not something as simple as the fields are not enabled. Simply changing the "background only" property to NO fixes the issue, but then I get a dock icon and menu bar which I don't want.
Is what I'm trying to do possible or is there something about the background only mode that means my application can never receive text?
If it is possible what do I need to do to fix this?
From the documentation for LSBackgroundOnly:
You can use this key to create faceless background apps. You should also use this key if your app uses higher-level frameworks that connect to the window server, but are not intended to be visible to users.
So when they say “background only”, they mean background only.
The key you want is LSUIElement. Xcode describes this as “Application is agent (UIElement)”.
I personally can't stand Xcode's default behavior of showing me descriptions of some of the keys' meanings. I recommend turning on “Show Raw Keys/Values”; then, Xcode will show you the real keys being used in the dictionary.

Document-based-like application + updating fields/menus/etc when switching document?

I have an application with multiple documents opened at once (as different tabs), but not implemented the Cocoa way, with NSDocument etc
So, let's say, that application is a text editor : e.g. an NSTextView in each document/tab and a menu (in the MainMenu) with options (on/off) related to that particular document.
Scenarios :
The user clicks a menu item (option) and the option is applied to the
current tab
Now, the user switches tab and the options (of the menu) should be update according to current document's settings
How should I go about that in the most Cocoa-friendly way?
(I certainly CAN do it; though I'm interested in what could be a more efficient way (and my definitely isn't))
You can implement validateUserInterfaceItem: on NSDocument. Menu and toolbar items call it to check if they should be enabled or not. Read about Implementing Validation in general and Enabling Menu Items specifically.