i3 keybinding prohibits part of xdotool script - xdotool

I want to bind holding ctrl and left clicking to a button in i3 using xdotool. I have put
bindsym --release $mod+i exec ~/Bin/xdotoolRight.sh
in my i3 config file including the --release prefix as per the i3 doc https://i3wm.org/docs/userguide.html.
The script xdotoolRight.sh is just:
#!/bin/bash
xdotool mousemove 2800 725
xdotool keydown Control_L
xdotool click 1
xdotool keyup Control_L
When pressing $mod+i, the mousemove line of the script works but the other part not.
Any help would be much appreciated.
Best,
be5tan
I have let the script run from the terminal and it works fine. I really don't understand why part of the script is executed and another part not.

Related

VSCode Terminal - Clear Command Prompt

I'm running on Linux. I have the issue both in bash and pwsh shells.
How do I clear the current command prompt in the VS Code terminal?
For example, say you have copied and pasted a very long string into the terminal.
How do you clear what you just pasted?
The only way I know of for getting back to a an empty command prompt involves hitting backspace until you have deleted every character.
Is there any short cut for getting back to an empty prompt?
Thanks!
How do you clear what you just pasted?
There is no command to clear what you have already pasted. You can do Ctrl + C or Ctrl+D to get the next promt.
Now if you want a short-cut to clear command which we use in terminal, its Cmd + k for Mac OS
CTRL + shift + p, then write clear. You can use the clear command in bash terminal too.
Use Console.Clear() in code.
or use 'cls' cmd on console

How to launch .ahk file when PC starts

^B::
Send, Hello World
return
This is my script-file made for AutoHotKey. How can I launch this file automatically when my PC starts? Now it is is all fine, but after reboot I've to launch it manually. Thanks!
You’re gonna have to add it to your startup programs
Press Windows key + R, paste this file path in there and press enter: %appdata%\Microsoft\Windows\Start Menu\Programs\Startup
Right click -> New -> Shortcut
In the shortcut window click on “Browse” and then select your AHK file
to do that:
1. press win+r
2. type shell:startup
3. copy paste your ahk file from the folder to the place which just opened
… and you‘re done!
You can Use the Windows Registry.
It Will Launch the .ahk File automatic after rebooting your System.
Try this AHK Code:
c:\examples\example1.ahk
^B::
Send, Hello World
return
^r::
RegWrite, REG_SZ, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Run,example1,"c:\examples\example1.ahk" /background
return
You can press (Ctrl + r) it will put the values into the Registry.
Now you are ready to go. Everytime if you Start your PC, it will Automatic run the example1.ahk File.

How to stop a command in the Visual Studio Code terminal

I've been stopping commands with the trash can for too long. Command period doesn't work on Mac. I can't find anywhere how to stop the terminal via a command. What is it?
You can terminate with the Trash icon like you do,
or press Ctrl + C. That's the shortcut from the default Terminal application and it also works in Visual Studio Code.
Ctrl + C works in the terminal, but it didn't work for me in Visual Studio Code. However, hitting Q did (when running a git diff for example).
In certain cases, such as running a Node.js server, Ctrl + C wouldn't work. Instead, you can stop the app or command by pressing Ctrl + Alt + M (i.e., Ctrl + Option + M for Mac users).
Sample JavaScript code to demonstrate this:
const http = require('http');
http.createServer((req, res) => {
res.write('Hello, World!!');
res.end();
}).listen(5000, () => console.log('Server running...'));
If you are on Linux, open the shortcuts:
Then type kill, and this option will appear.
Double-click on the record, choose a shortcut for it, open the terminal, Ctrl + J, and press the shortcut you chose.
The difference in pressing Ctrl + J and then Ctrl + J again to close, is that it will not keep the terminal process, but only close it.
Neither Ctrl + C nor the trash icon actually stopped the server for me.
If you are using the Live Server extension by Ritwick Day, there should be a label on the bar at the bottom for the status of the server.
If it reads Port: 5500 it means it's running. Just click on it to stop it.
Stop live server
The same label now should say Go Live. Click on it in order to do exactly that.
Start live server
Many Mac users (including me) get confused with the Cmd and Ctrl keys. But Ctrl + C should work fine.
Hitting Esc clears out the terminal and cancels everything.
You can stop any running command by pressing Ctrl + C on your keyboard.
If it is ':' you see, then Q + Enter.
For example: git config --list (this will take you to the colon(':') and you may not be able to escape this)
In Visual Studio Code, first hit Ctrl + C.
It will ask the following question;
Terminate batch job (Y/N)?
Press Y + Enter.
After this, run the following command on the prompt:
exit + <Enter>
It will stop the instance.
You can kind of bypass the issue by writing
system("pause") at the very end of your main function. That works for me like a charm...
In Visual Studio (2022) the shortcut may actually Ctrl+Pause/Break instead of Ctrl+C.

create shortcut in cmd prompt using autohotkey

I am using python and virutal environment in windows7. Every time I need to go to the project folder, shift+right click to open command prompt and activate virtualenv.
Instead I can hit win+R them type cmd to open a command prompt.
Then type
C:\cd D:\path\to\project
D:
workon projectEnvironment
Can this be done to create a shortchut like 'work' from autohotkey ??
Your windows-R shortcut would work like this:
Start a cmd window and wait until it is active.
Then begin to send your commands.
#r::
Run, %comspec% /c cmd.exe
SetTitleMatchMode, 2
WinWaitActive, cmd.exe
SendInput, cd D:\projects\folder{enter}
SendInput, D:{enter}
SendInput, workon projectEnvironment{enter}
return
Although I was unable to create shortcut key combination in cmd, I created a shortcut key, i.e. windows button + space
#space::Send cd D:\projects\folder{enter} D:{enter} workon projectEnvironment {enter}
Edit
here's the real solution
::work::cd D:\projects\folder{enter} D:{enter} workon projectEnvironment {enter}
After an hour of researching why my script would write " instead of \ when Sending a path in cmd prompt, I realized that sometimes the cmd prompt will interpret some keys differently for AutoHotkey.
I used to write Send, cd C:\File\Path {Enter} and it returned:
C:"File"Path
You can use ASC codes for / = {ASC 47} and \ = {ASC 92}, which in the end you write:
Send, cd C:{ASC 92}File{ASC 92}Path {Enter}

PowerShell history of commands

I use Bash and PowerShell interchangeably, and find it quite annoying when I can't do a Ctrl+R on my PowerShell Console.
Is there a plugin/alternate command that can help me switch between Bash and PowerShell seamlessly?
Update (2018)
PowerShell now supports Ctrl + R. Please see this answer.
An alternate command is to type e.g #ls and press Tab keep pressing tab to cycle through all command history that starts with ls.
In previous versions you could type ls then F8 to match history. Keep pressing F8 to cycle through multiple matches.
Note:ls is just a placeholder in this case. Replace it with any command you want.
As of today PowerShell supports the Ctrl + R shortcut.
Simply press Ctrl + R when in the PowerShell console and start typing any part of a command you have run before.
Alternatively:
Start typing part of a command you have run before, and press or hit F8.
Keep pressing F8 to cycle through similar commands.
Take a look at PSReadline: https://github.com/lzybkr/PSReadLine
This module supports interactive history search in emacs mode and you can bind Ctrl+R to ReverseHistorySearch in Windows mode if you prefer.
The long term goal of PSReadline is to make it much easier to switch from bash to PowerShell w.r.t. command line editing while providing a PowerShell experience, e.g. tab completion.