Linux xdotool Key Stuck - linux

I've been making a script which makes you unable to exit the terminal, unless you enter "yes". I've used this command to disable the Alt key temporarily.
xdotool keyup Alt_L Alt_R
I am now unable to "release" the key and my Alt key doesn't work properly anymore.
I did try
xdotool keydown Alt_L Alt_R
which resulted in constant pressing of the Alt key.
I did find out, that uninstalling xdotool makes the Alt key working again.
Yet I still need the Xdotool. Therefore this is not a option for me.
Can you help me "release" the Alt key and neither make it pressed, nor permanently unpressed?
Some additional information:
I am using Linux Mint 18.
And my script is running with bash.

Okay you will hate me for this answer. My mistake was that I had "Save session" in the options restarting. This resulted in a forkbomb curl command loop and it didn't release the alt key. I will try this keydown command again and then see what happens. I am not sure if this is only on Linux mint 18, or on other Linux distros.

Related

How to issue Vim commands in command mode (`Enter` not working)

I installed neovim with pkg install neovim. I then downloaded the latest version of Nvim-R with curl -L "https://www.vim.org/scripts/download_script.php?src_id=26482" > NvimR.vmb. Finally, I opened the file with nvim NvimR.vmb.
Now I'm in the editor and I launch the command mode by pressing the : key on my keyboard. I then proceed to type packadd vimball into the command console. Finally I try to issue the packadd vimball command by hitting Enter on my keyboard and nothing happens. I look up in the editor panel and notice each time I hit Enter the cursor is just being moved around in the editor.
I don't want the cursor to move around in the editor. I want to issue my :packadd vimball command. How do I do this?
Everything I see in that gif is precisely what I would expect to see given what you typed.
You run :packadd vimballEnter—this does vim’s native packadd command (assuming nvim has that), and then returns you to the editing portion of the screen.
Subsequent Enter presses are equivalent to j—move down a line.
All of that said, I dont know of any packages named vimball, but I don’t really work with that format. Perhaps you’ve misunderstood a plugin’s usage or vimball usage? Ask about that stuff on vi.stackexchange.com: we probably have better vi/m experts there.

Refresh Desktop using xdotool

Hi I am trying to refresh my Desktop, simulate "F5"/"ctrl+R" key pressing using xdotool.
I have tried to xdotool key F5 but I got
^[[15~jake#jake-PC ~ $ ~
and after pressing Enter:
bash: /home/jake: Is a directory
Then I have tried
xdotool search --classname Desktop
73400321
Got that id, then tried:
xdotool search --classname Desktop key F5
xdotool search --classname Desktop key ctrl+R
it didn't refresh my page.
Question: what can I do to refresh my desktop? By the way I am using Ubuntu 16.04. Thank you
You need to call with sync:
xdotool search --onlyvisible --classname Desktop windowactivate --sync key F5
also you can try xdotool script like this:
#!/usr/bin/env xdotool
keydown Ctrl
keydown super
sleep 0.1
key D
keyup Ctrl
keyup super
key F5
Another alternative you can use exec function on xdotool to call show desktop script (or create it)

Console : How to run a specific command when pressing a key

I try to have the volume keys working on my laptop in pure console mode (Debian installed without X).
I can manage sound volume with alsa commands, but I'd like to assign them to those keys.
I know keycode thanks to the showkey command, but now I can't figure out where to assign a specific command to them. Is it in keymaps ? How ?
Thanks a lot
In bash, you can use bind e.g.
bind -x '"\C-g": ls'
will make ctrl-g run the ls command

on FreeBSD, how to exit from Gnome Session to Pure terminal mode

on FreeBSD, how to exit from Gnome Session to Pure terminal mode.
Thanks!
Try Ctrl+Alt+F2 key combination to go to text terminal, use Ctrl+Alt+F9 to come back to Gnome or whatever you are running on top of X.
If you want to totally disable X11 open /etc/ttys file, find the line that says:
ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure
comment it out, save the file and reboot.

Screen + vim causes shift-enter to insert 'M' and a newline

When running a vim instance in gnu screen hitting shift enter in insert mode adds an 'M' and then a newline, rather than just a newline.
Does anybody know what the problem might be, or where to look?
Relevant system info:
Ubuntu 8.04.1
Screen version 4.00.03 (FAU) 23-Oct-06
VIM - Vi IMproved 7.1 (2007 May 12, compiled Jan 31 2008 12:20:21)
Included patches: 1-138
Konsole 1.6.6 (Using KDE 3.5.10)
Thanks to the comments. When checking the value of $TERM I noticed that it was xterm (as expected), but within screen $TERM was set to screen-bce. Setting TERM=xterm after launching screen resolves this issue.
Adding the following to ~/.screenrc solved the problem without having to do anything manually:
term xterm
Missing info from your question:
Where do you run screen and see this issue? Some terminal app (KTerminal, Gnome terminal, virtual console etc) or remote session (eg putty, ssh from another computer)
do a “echo $TERM” and tell us its output
do a “cat -v”, press Shift-Enter, then Enter, then Ctrl-D and then tell us what is output.
First, you could fix your $TERM for within konsole. Install "ncurses-term" and configure konsole to set $TERM=konsole-256color. Then configure screen with "term screen-256color". Or 'konsole' and 'screen', respectively, if that's your preference. Konsole and screen are not xterm and doesn't support everything xterm does, so using incorrect $TERM can lead to bad things.

Resources