i3: Open window in whatever workspace command was run from - user-interface

I have the problem that some apps are slow to start up, so I want to be able to run a command and continue to work in another workspace while I wait for the application to start. I want the application to start in the workspace it was run in.
How can I configure i3 to do this?
There must be some technique either using placeholder windows that swallow up the windows you want or by tagging the window to be opened with a workspace number and configuring i3 to recognize those tags and place the window on the appropriate workspace.
I'm surprised there is not a simple solution built in.

Related

How do programs that don't appear in the startup folder auto-execute on startup?

Just out of curiosity I was wondering how this is done. I know you can probably manually make a program startup using windows scheduler, but for something download from the interwebs, such as Discord, how does it autonomously give itself the ability to run on startup without actually being in the startup folder?
I found the answer elsewhere on this site, here is the link and a quote
https://stackoverflow.com/a/20781275/9546874
Add a new startup application Open your registry and find the key [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run].
For each program you want to start automatically create a new string value using a descriptive name, and set the value of the string to the program executable.
For example, to automatically start Notepad, add a new entry of "Notepad"="c:\windows\notepad.exe".
Some applications do not appear in the startup folder but start up automatically anyway. Programmers have the ability to disable their application showing up in the startup folder. To answer your question, it's a decision made by the dev team behind the application.
Here is a link to disable those applications using the shell: Disable items not in the Startup folder
This article goes into depth about how windows uses registry keys to open applications upon startup.
If you would like to disable discord's auto startup, this is how.

can I save my current dir and windows in cmder?

How to save my current setup in Cmder
I use Cmder on windows for all of my deving. I use a separate front and back end for my MEAN applications and also gulp for javascript minification. Also to run mongodb I use the cmder.
My window looks like this once everything is running
Every time I start work on my project I have to open all these windows and run the cd commands to get to their respective folders. I was wondering if there was a way to save the session so that I can have all my windows open automatically in their correct dir?
Use startup settings
You can write startup settings that allow you to execute a series of tasks on startup under
Settings > Startup > Tasks
Here you can define what shell starts and what tasks it should perform, with this you can open new tabs and cd to where you need to work.
A simpler version of this is to just go as far as
Settings > Startup
and find the radio button "Auto save/restore opened tabs", this will at least open up you Cmder where you left off, without the cmd's running.
Hope this helps people who use many windows on startup.

Address already in use? Intellij

Sometimes when I try to run my project using maven mvn clean install jetty:run it returns an error that says: "Address already in use".
I'm using Intellij IDEA 14.
Could you please help me to figure out what's happening?
This happens because every time the code is ran using the green arrow icon it generates a new instance and since the port (8080 in this case) is already in use it can't run again.
The first solution comes stopping the instance is currently in use, you can know if there is already an instance running at the bottom left corner tabs, if one of the tabs has a little green dot it means it is currently running.
One nice feature to avoid this is to go the run/debug configuration and set the option Single Instance Only at the top right corner as you can see here:
Now, you can run the project using only the green arrow/bug icons and it will stop it if it's already running, compile and then run again just with one click.
I found this very helpful to get rid of this silly error.
Another option is Go to Run-->Edit Configuration --> Startup/Connection tab
Select Debug and change the port beside Debugger Settings..
For mac, In terminal just write command
ps -A |grep java
This will give all the process running and then kill the process by
kill -9 PID
Where PID is the process id which you want to kill.
or
Just open Activity Monitor and, in the search box, write java and kill the running Java processes.
Try this out to Reset the winsock directory to restore the network.
Run this command and restart the PC and you're ready to go
You will need to run this as administrator
netsh winsock reset

Opening up iTerm / Terminal with commands by default.

My current use of iTerm is the following everytime:
- Open up
- cd into my project folder
- open up another tab
- cd into my project folder
- Grunt Watch
- open up another tab
- SSH into live server
This is getting a bit tedious now, is there a simple way to make a one click for all of this to be done? I remember back in the windows days you could create custom command prompt files so it would open up and you could just double click it like an app.
Is there anyway I can do this? I have looked at the profiles and I don't think I can do what I am after with that.
Just need pointing in the right direction.
If you're using iTerm2, there is a feature called Arrangements (see the last entry on the page). With this, you can set iTerm to open a series of profiles (which can be set to run a command at startup, start in a specific directory, run a certain shell, etc.).
It seems that creating one profile for working in a directory, a second for the Grunt Watch, and a third to SSH should be trivial, and once the arrangement is saved, it can be recalled with the press of a hotkey (Cmd⇧R on my install). You can also set this to save split-pane windows if you don't want a separate window for each of these tasks.

Releasing Windows file share locks

This problem crops up every now and then at work. Our build machine can have it's files accessed via a normal windows file share. If someone browses a folder remotely on the machine, and leaves the window open overnight, then the build fails (as it has done now). The explorer window left opened points at one of the sub folders in the source tree. The build deletes the source, and does a clean checkout before building. The delete is failing.
Right now, I'd like to get the build to work. I'm logged in from home, and I'd rather not reboot the build machine. I'm unable to get hold of the person whose machine is looking and the files, and I can't remotely reboot their machine.
When a windows share has a lock, the locking process is System, so I don't think I can kill it, as with normal locks.
Does anyone know a way to release the lock on a shared folder without having to reboot the machine?
If you are admin on the server sharing the file over the network, you can use the Windows in-built feature:
Start → My Computer → Right-click → Manage gets you to the Computer
Management console
In the left nav, navigate to Systems Tools → Shared Folders
You can view Shares, Sessions & Open Files here. This allows you to find out who has opened which files from which workstations.
Right-click on an item in the list to be able to remove the file lock.
Hope this helps.
Found a solution.
Find the process using Process Explorer:
Download and extract procexp.exe
In Process Explorer use the "Find Handle or DLL..." command from the "Find" menu
Enter in the name of the directory which is having trouble deleting
A list of open files which match that name should be shown. Take some guesses and find which one is failing to be deleted. If the file is locked by a windows share, the process holding the file will be System
Note down the directory which was left open
Download and install the Unlocker (Warning: Link removed, as it contains malware)
Install Unlocker, disabling the option for Explorer extensions and other junk
Unlock the directory
Open up a cmd window, and navigate to C:\Program Files\Unlocker
From the cmd window, run Unlocker.exe "the-path-to-the-locked-folder"
A dialog will pop up confirming the lock release. Use the unlock button to unlock the file
Now the directory should be unlocked, and can now be deleted.
Try Process Hacker:
https://wj32.org/processhacker/
Process hacker is like Process Explorer on steroids.
To find the offending process, press CTRL+F or click the "Find Handles of DLLs" button and search for the file name.
Once you find the file in the find handles dialog, you can simply right click the file there and choose "close". (at least for v2.39.124)
Older versions had a "terminator" option in the context menu of the process.
Right click on the offending process --> Miscellaneous --> Terminator --> Select termination techniques. Note that some are possibly dangerous and may have unintended consequences.
I've had similar problems, and none of these suggestions I've seen above look suitable for automated overnight builds (as the original poster implied) because they all require manual effort to hunt down and kill the locks.
The only method I've tried that seems to work reliably is to remove the share itself, make the build, then add the share back. Here's one way of removing the share automatically:
D:\Projects>net share Projects /DELETE /Y
Users have open files on Projects. Continuing the operation will force the files closed.
Projects was deleted successfully.
(NOTE: Creating the share again automatically can be a pain if the privilege groups you need to give it are messy.)
The way i do it is by using both OpenFiles.exe and Handle.exe
You can run them in any order and you will have your resource fully unlocked.
OpenFiles: to disconnect File Sharing sessions
Handle.exe: to release any open handles (don't try to close handles belonging to pid4, since that's the system process)
You can automate this by using powershell, batch, or any language of your choice.
Another option is, starting from Windows Vista, to use the Windows tool built into the system:
monitor resources: perfmon.exe /res
Extracted from: Http://www.sysadmit.com/2017/06/windows-how-to-know-that-process-has-open-a-file.html

Resources