Remembering terminal states in OS X (like Fluid for the shell...) - macos

I have a few different things open in the terminal whenever I'm developing -- log tailing, Ruby console, plain shell in a certain directory, and so on.
How do I:
start all those things at once, hopefully in the right position on the screen?
make them distinct so I can switch to them with Quicksilver / Alt-Tab?
Fluid solved this problem with all of my web apps, so now I want to do it with my terminals.
And while we're on the topic, has anyone found a working solution for getting OS X to remember window positions on an external monitor? If I unplug it and plug it back in, I have to drag everything back to the same position (although at least Mercury Mover makes it possible to do it with the keyboard.)

Open Terminal, and go into Preferences, then go into the settings tab, and create a new setting for each of your windows that you want. Either give them all different colour schemes, or duplicate a colour scheme multiple times for them all to have the same settings. Under the shell sub-tab, add "Run command" to be run at shell startup. (This is the command that will cd to the directory you want, or tail a log).
Then initialise the windows as you want. Then click Window in the main menu and select Save Windows as Group...

In OSX Yosemite you can use (in Terminal) Window -> Save group. It will do all the work for you.

Related

Manipulate OS X windows with script

Ok, so I'm trying to make my setup super simple by creating a script that I can run in the morning that will launch all the applications that I use in the day and lay them out across my 'spaces' how I like them.
This was going ok and I was easily able to have a bash script launch the apps and then call to an AppleScript to move and resize their windows.
However, I like to use the new El Capitan feature and have some of my spaces as 'split view' spaces. E.g. Full screen Xcode/Terminal split. I can't seem to find a way to control this via a script.
Tl;dr Does anyone know how to get a bash script/AppleScript to put two applications into 'split view' on OS X El Capitan?
Looks like that first bit about launching and full-screening apps can be done with a fairly simple script, though it requires enabling Accessibility permissions first. It, however, won't do the split-screen bit.
I kept looking though and Better Touch Tool (pay what you want, $4.49 minimum) seems to get the closest of anything I could find, allowing you to trigger Full Screen mode and bring up the split screen Expose selector in the same action. It seems to be doing this by emulating a long mouse down on the full screen window control button (the green one in the top left). What you get is this:
I've been playing around with this and it seems there might be a (so far seemingly very un-intgelligeble, though reliable) way to control the order of full screen apps and trigger an app into split screen mode in a situation where that previously full-screened app is the only option available for splitting the screen.
For example, given the following, accomplished by launching iA Writer into full screen (space 2) via ⌘+^+F:
Focusing Safari and using Better Touch Tool to trigger split screen mode results in:
... Only one split screen app, even though there's several apps still running.
From this position you could use the "move to position" action in BTT and trigger a click on the only available app— I would think this could theoretically accomplish what you want, although it's convoluted and a bit suspect.
All that being said, it seems like the only way to get two apps launched into split screen mode without touching the mouse, since this could all be a BTT workflow you trigger from an Automator script. Digging further, you might be able to learn how BTT accomplishes their actions and write a program that does this for you, but we're already way beyond bash or simple cli scripting.
I personally just use Spectacle and tmux to zoom my windows around, though I admit, automated split screen would be somewhere close to live changing.

Is there a way to use PyCharm on multiple monitors

I'm using PyCharm with multiple monitors on Mac OSX (10.10.5), normally you can drag windows off to a separate monitor. In PyCharm that works, but they (and in particular the Run window) snap back to the main monitor.
I've only seen this on the latest PyCharm 5 CE though its possible older versions also had the problem. I've searched all the settings and searched online, but can't find a setting that makes the window stay where it was placed.
Right click on the tab and select View Mode as Window.
Then you can move the window to another monitor.
It's crappy behaviour from the best python IDE out there.
There is a OSX solution but i'm not sure if you will like it:
You can enable old style multiple screen support again in OSX by going to System Preferences, Mission Control and uncheck "Displays have separate spaces". Now your floating windows will not snap back and you can even extend your PyCharm main window over the screens.
The downside of this solution is that you'll have the OSX dock and main menu only on your main monitor. I hope Jetbrains will fix this behaviour soon.
Another way to achieve what you want is to open multiple instances of the project. When you try to open the project for the second time you can choose "open project in new window". You can drag the new window to the second screen; it won't snap back to your primary monitor.
For Ubuntu and Windows users landing up here:
Press Shift + F4 or
Right-click and select 'Move Tab to New Window'
Drag the newly created window to the next screen
The best option is to detach an editor window and drag it to your second monitor.

How do you duplicate a shell instance in Unix?

My specific problem is the following: I am using Mac OS X with the Visor app for terminal. This lets me do cool pop-in/out stuff with terminal for quick access. The problem is, I lose the ability to move the window around and re-size it, something that becomes important when I start opening up multiple buffers in emacs and want to view some at the same time in a window larger than 80 wide.
Does anyone know how to duplicate a shell window/instance, so that a new window appears with the same history, current working dir, aliases, etc...? Even more specifically, can this be done in Mac OS X such that the new window is in a different "style", (basic, pro, sands, etc..).
I'm not familiar with Visor, but simply using a terminal emulator such as screen might give you what you need. From a terminal, invoke 'screen'. That will give you a shell prompt. From another terminal, invoke 'screen -x'. Now each terminal will be attached to the same shell, with the same history, etc. See screen(1) for details.

Unable to use X clipboard in Screen

I read the following code in Unix Power Tools on page 117
*VT100.Translations: #override\
Button1 <Btn3Down>: select-end(primary,CUT_BUFFER0,CLIPBOARD)\n\
!Shift <Btn2Up>: insert-selection(CLIPBOARD)\n\
~Shift ~Ctrl ~Meta <Btn2Up>: insert-selection(primary,CUT_BUFFER0)
I have not managed to see any effect of the above code.
How can you use X clipboard in Screen, without your mouse?
Using the mouse. Left-click drag to select and usually the middle mouse button pastes but some terminals may differ (PuTTY uses right-click). If you only have two buttons you click them both together (left mouse button + right mouse button).
In reply to comment below ("Can you do it without your mouse?"):
ctrl-insert : copy
shift-insert : paste
shift-delete : cut
shift-ctrl-C : copy
shift-ctrl-V : paste
Not all applications will support the last three (though Konsole does). In fact most console applications will not allow you to delete text once it's printed.
As far as selecting text without a mouse I'm not sure there's a generic mechanism for that. It's probably terminal and/or application specific (ie, vim has it's own keys for marking and copying text - but only within vim). You could do it with mouse emulation but I'm sure that would be a painful process.
You can't use the traditional Mac/Windows shortcuts in a terminal because they were reserved for different actions long before these OS existed (ie, Ctrl-C terminates the running process).
I'm trying to use Ctrl-C in X
X does not handle these operations directly, they are handled by the application. That's why modern GUI programs like Firefox or Gedit support Ctrl-C for copy but terminals and command-line programs generally do not. As I said, it's a conflict in established conventions and Ctrl-C for kill got in first.
BTW, you could do some key-remapping if it drives you nuts but then you would be learning bad habits when you use a different machine. Best to just get used to it or do most of your editing in a GUI application.
More Information
EDIT: For a Mac, this may help: MacOSX-to-Konsole or This or This. It looks like you need to replace Ctrl with Command on Mac keyboards. It seems like Terminal the mac console has a right-click context menu for copy-paste so to do it the traditional way you me need to install a different console program or change some settings in Terminal.

Xcode window positions when switching from dual to single monitor

When I'm working at home I plug my MacBook in to my 20" monitor as a second (right side) monitor. I do all my editing in Xcode on the larger monitor, and leave the menu bar, debugging and documentation on the laptop's monitor.
The problem is when I disconnect from the second monitor and want to work on code in "laptop" mode. Now, whenever I open a file for editing, it shows up almost entirely off the screen and I have to drag it over to edit it. I understand (sort of) why this is happening, since I last had it open in a different monitor. What I'd like to do is reset the window positions in Xcode so the edit windows show up completely on the laptop monitor. Any ideas on how to do this?
I'd even be willing to nuke entries out of the preferences (or set up an applescript to do it) but the xcode plist is inscrutable to me.
Right click the project in finder, select show package contents, and delete the two username.* files. Its not automated... but it works.
Additionally if your using some kind of version control system you probably want to add username.* to your ignore pattern.

Resources