add View menu to thunar context menu - xfce

How can I add the View menu to right click in Thunar? I would like to be able to right click an empty area in the Thunar window to at least select between icon, compact list, or details list if not access the rest of the View menu. In reference to documentation at https://docs.xfce.org/xfce/thunar/custom-actions what custom action can I program to change the Thunar view of the current folder?
I'm working in Linux Mint, XFCE4 desktop environment using Thunar 1.6.15.

One way to do this is by using xdotool to emit the keyboard shortcut for the different views and tying it to a Thunar custom action. To do so, you will need to create 3 custom actions:
Icon View
Detailed List item
Compact List View
For each of these, make sure you select the "Directories" box on the custom action's Appearance Conditions tab. On the Basic tab, enter the name, description and select an icon for each action and use the following as the command for each action:
Icon View = xdotool key Ctrl+1
Detailed List View = xdotool key Ctrl+2
Compact List View = xdotool key Ctrl+3
This will create 3 new custom actions - one for each view. The drawback is that you will have 3 menu entries.
You can get away with 1 custom action (and 1 menu entry) if you are okay with cycling through the 3 options. To do so, create an executable file with the following content:
#!/bin/bash
case $(xfconf-query -c thunar -p /last-view) in
ThunarIconView) xdotool key Ctrl+2 ;;
ThunarDetailsView) xdotool key Ctrl+3 ;;
ThunarCompactView) xdotool key Ctrl+1 ;;
esac
Create one new Custom Action with the title of "Cycle View" (and a description and icon of your choice) and set the command to point to this script. Also ensure that on the Appearance Conditions tab, that Directories are checked.
This script will cycle between Icon, Detailed and Compact view every time the custom action is selected.
There is no easy way to display the View menu from the right click. You could use the same procedure as above to send the keyboard shortcut for the view menu, but it will only open directly below the view menu on the menubar - in which case you might as well just click on View and save yourself one click.
Hope this helps.

Related

Paste multiple lines of text into NSScrollView

I would like to be able to paste multiple lines of text into a control in a MacOS Cocoa application (written in Objective C) running on Catalina using XCode 12.3. I have added an NSScrollView control from the Library and created an outlet of type NSTextView. I can type multiple lines of text, with line breaks inserted with enter key, and retrieve the text in code via the string property of the outlet. However, if I click in the control and try to paste multiple line data copied to the clipboard using (AppleSymbol)C, no text is pasted. Is it possible to paste multiple line data into NSScrollView?
The problem is that copy/paste functions are not supported by default. However, there is a simple fix described in one of the responses from Alex pointed to by Willeke
Create a menu (e.g. "Edit") which contains your Cut / Copy / Paste menu items
Add the KeyEquivalent for the CMD key to your "Edit" menu
Add the KeyEquivalents to these menu items (CMD + X and so on)
Link the FirstResponder's cut: copy: and paste: functions to your corresponding menu items.
The linking of the First Responder functions to the menu items is done by right-clicking on Placeholders->First Responder (shown in viewing the interface resource - eg MainMenu.xib). This shows a long list of functions, including the ones you have just added. Drag this to one side and then click on the Objects-> Main Menu-> and select Edit->Menu and then one of the menu items you have added. This will show the new menu as it appears in the application within the interface window. The linking is done by selecting + for the first responder function for cut, paste or copy and ctrl-dragging onto the corresponding interface menu item in the interface window. A blue line appears to link them.

How to more easily "update all frames" in autolayout in Xcode7?

The "Update Frames" calls are often grayed-out in Xcode
the only way I know to have it update frames to match your constraints, is, tediously select your highest-level view and than (sometimes) you can fish in the menu bar for "Selected Views"->"Update Frames". Further, "All Views"->"Update Frames" would appear to often simply not work or work in a way I can't understand.
Surely there's just a keystroke or button which updates all frames straight away to match any newly-entered constraints (such as those made using control-drag).
Note .. for 2016 you can use this very handy button, which at least brings up the same sub-menu as you can find by searching in the menu bar menu.
However it would seem (see my comments w/ ZaBlanc below) that there is perhaps actually an Xcode bug, and you CAN NOT assign a keystroke to the "All Views" items. (The ones you usually use.)
Even worse .. in Xcode 8 ...
they seem to have removed the 'update frames' option ... WTH
It's easy. Go to Preferences -> Key Bindings. Type "Update Frames" on the top. You'll see two appear. You'll want the bottom one (it will be the one without a keyboard shortcut assigned.)
Assign it to ⌘= or anything else you like.
Life changed.
Just for anyone reading, with Xcode 8.3. The popup menu command no longer exists. The menu bar command Editor -> Update Frames does work. However there's a bug, the default key binding on that does not work. If you add a custom key combo, that custom key combo does work.
AFAIK, there is no keystroke for update all frames, but here's a key tip:
If you have a misplaced views, press the yellow arrow in the document outline (the views tree to the left of canvas), press yellow triangle on any view in the list, then select update frames and check Apply to all views in container - this will update all misplaced views in the selected view controller
Additionally, you probably already know:
You can add a new constraint with Add New Constraints button in canvas bottom right and select "Update frames" option.
You can select any view by mouse-click and holding Option+Shift keys - this will show you the list of all the views, that intersects with mouse pointer. After that you can select update frames menu item on a selected misplaced view.
The same as you, I thought that it's very annoying to fix the misplaced views manually by selecting them and choose that boring option from Xcode menu. After trying hard to shorten the time to fix the layout issues, I had to admit that there is no way to call the function "Update Frames" from command line. So I ended up doing this way:
Open Xcode warnings & error inspector window
Filter all layout warnings by using the keyword "frame for"
Click on warnings to quickly locate to the misplaced views then press Command + Option + =
That's the fastest way I know. Please try it out!
You could also find more details HERE

How to disable clicking parent menu item without disabling it?

I want to disable some of parent top menu links with sub-menus, so that when I click at the root top nothing should happen until I navigate and click to its sub menus for specific action.
For example, In Cocoa, if I have menu File -> Recent -> "...Recent files list...." , I can press "Recent". I want to prevent pressing "Recent". Can I do it?
Thanks!
The solution is call [menuItem SetAction : 0] for the item having Sub Menus.
In this way you will not be able to select this item.

How to add "Last Position" button to my tool bar in VB6 IDE

I did this before but can't remember how the heck I did it.
I want to have a button on my vb6 IDE toolbar that takes me back to the previous place I was in the code (in my "history) -- an incredibly useful feature.
I have it in my properties (right-click) menu but don't see it in the other menus from which I could drag it to the Toolbar.
Any ideas?
This should do it:
In the IDE right click an empty spot on your
menu and select Customize...
Select the Command tab in the Customize dialog
Select View from the Categories list.
On the Commands list you should see
an item called Last Position.
Drag this item to a toolbar.
#Jay's answer is right on. There are also handy shortcut keys for this feature and the related Definition feature:
Last Position: Ctl + Shift + F2
Definition: Shift + F2
In one of the toolbars in the sample applications?

Xcode find caller functions

In Xcode, how can I find all caller functions of a specific function?
Xcode 4.5 (in beta) has this functionality. when you highlight say... a function, you can check the "caller" and "callee"
edit i believe it's located at the top left of the file panel for that file... so double click on the function to highlight it, and you click on on the file panel options (the one that has the "open recent, open unsaved...etc" drop down
EDIT #2
here's a picture to clarify (since i dont know what this menu button is called):
ALSO - XCode 4.5 is no longer beta, i believe, and is actually out in public
EDIT #3
also note that this caller thing does NOT search for being called under the performSelector method, as in, the particular caller that has this performSelector won't show up if you had done something like:
[self performSelector:#selector(checkIfShouldStopMovement) withObject:nil afterDelay:0.25];
In Xcode, the quickest method is this:
Select method in code (double click or mark using your mouse cursor)
Press Ctrl+1
Select "Callers" from the pop-up menu.
This is the shortcut for going View -> Editor -> Show Related Items in Xcode's menu.
use ⌘+Ctrl+Shift+H key combination on Xcode 7 onwards.
This can also be accessed via the assistant editor, as shown in the screenshot below. Whichever method you have the insertion point in in the main editor on the left will have its callers displayed in the assistant editor. I've found this to be the best way of looking through each caller in succession, since once you have "Callers" selected, you can then select the next caller via the next pop-up menu to the right in the jump bar.
In Xcode-7 you have the functionality of getting call-heirerchy. Right-click on the function and click "Find Call Hierarchy":
image reference:
Xcode 10 upwards seems to have made it easier. Just Command Click on the function and you should see it in the drop down.
Press ⌘+Ctrl+Shift+H shortcut when a method of interests is selected (with a mouse or cursor). (as per #uiroshan 's answer)
But you can also specify any another shortcut in XCode -> Preferences -> Key Bindings
Use Find in Project as Text or as Symbol.
AFAIK, there's no equivalent to e.g. Call Hierarchy known from Eclipse or NetBeans.
Strangely the refactoring tool can detect all method calls but not the search.
So I simply use it to rename my method to a unique name (eg. reset to resetPlayer) and then use the new name in a regular textual search.
1.) Menu > Edit > Refactor... > Rename to unique name
2.) search for the new name
The functionality is available in XCode 4.4.1, see this: http://smilingfinney.blogspot.de/2012/09/method-callers-in-xcode-44.html

Resources