There is a simple workaround for what you need.
First you will have to install xdotool .
Then launch the Keyboard configuration gnome-control-center keyboard
:
(Go to Shortcuts → Custom shortcuts)
Click on "+" and add a name like "Paste into terminal" and the command
xdotool key --clearmodifiers ctrl+shift+v
Then choose Shift+Insert as the key binding:
Because of a bug, you will have to logout and log back in so the shortcut can take effect.
Disclaimer: This is not exactly what you want, but I've spent too much time on this not to post it and maybe someone else can use it.
I got as far as Ctrl + F11 is fullscreen everywhere but Chromium where it is Chromium's fullscreen !
- Train of thought
I thought I might be able to trick the window manager if I use xdotool
and send the command directly to the chrome window - to no avail.
Then I thought I might be able to change the keyboard shortcut in google chrome, but that seems hardcoded - another dead end.
- Which leaves us with this
Install xdotool
to simulate keyboard presses
sudo apt-get install xdotool
reconfigure the Ubuntu Keyboard shortcuts to something arbitrary, that we never type but is usable in the script
Settings -> Devices -> Keyboard
Scroll down and edit Toggle fullscreen mode to Ctrl + Alt + 1
and then hit the +
and add a custom keyboard shortcut
and then hit the +
and add a custom keyboard shortcut
edit the script
nano /home/user/fullscreen.sh
#!/bin/bash
export DISPLAY=:0
windowname=$(xdotool getactivewindow getwindowname | cut -d "-" -f 2)
if [[ $windowname != *"Chromium"* ]]
then
xdotool keydown Ctrl keydown Alt key 1 keyup Alt keyup Ctrl
else
xdotool search --onlyvisible --class "Chromium" windowfocus
sleep 0.2
xdotool key F11
fi
make it executeable
chmod +x /home/user/fullscreen.sh
- Conclusion
It seems impossible to trick the windowmanager and smuggle keystroke by, but there are certainly workarounds possible. In this case Google made the fullscreen keyboard shortcut non-configureable, so it falls just short of the mark
Now with Ctrl + F11 the windowmanager controls the fullscreen behavior except in chromium.
Best Answer
The command to get a fixed string into the clipboard is very easy, it's simply
or if you want to read the string from a file
or from a command output
Directly writing a fixed string by emulating keypresses is not much more complex though
or if you want to read the string from a file
or from a command output
You can simply create a custom shortcut in the System Settings → Keyboard → Shortcuts configuration and assign a command to the key combination you wish.
But take care that the shortcut interpreter is not Bash or a similar shell, so our
<<<
("here string" syntax) or|
pipes will not work. To solve this anyway, we simply enclose our shell command withbash -c "INSERT COMMAND HERE"
. Just pay attention that you don't use double quotes inside the command then.Here are the commands how you would have to enter them into the shortcut settings:
Copy "my string" to clipboard:
Copy content of
my-file.txt
to clipboard:Copy output of
my-command
to clipboard:Directly paste/write "my string":
Directly paste/write content of
my-file.txt
:Directly paste/write output of
my-command
:Please note that neither
xsel
norxvkbd
are installed by default, so you probably need to install them first using this command: