Score:0

Ubuntu command works on command line but not keyboard shortcuts command

ng flag

Recently installed Lubuntu and customising 'meta-shift-s' as shortcut for screen snip windows style. I'm using ImageMagick to snip image, saving to folder, and CopyQ to copy image from folder.

import image.png && copyq write image/png - < image.png && copyq select 0

I've tried the command in command line, and it works well, but when placed in keyboard shortcuts in global action manager, it runs, repeats the crosshair selection, but doesn't save or get past, import image.png

Any help would be great

Thanks!

waltinator avatar
it flag
Keyboard shortcuts aren't shells, and don't understand shellisms like `&&`. Wrap your commands in a simple `bash` script, and have your shortcut invoke it.
Sit399 avatar
ng flag
@waltinator working now thanks so much!
guiverc avatar
cn flag
You haven't provided any release details so I have no idea about what *stack* you're asking about. The page in the manual for this is https://manual.lubuntu.me/stable/F/keyboard_shortcuts.html , https://manual.lubuntu.me/stable/3/3.2/3.2.14/shortcut_keys.html (assuming the *latest* stable release, ie. 21.04 is your release; if you are specific and provide release details we can be more accurate in response; ie. *stable* can be replaced with another keyword like *lts* for 20.04 pages)
Score:0
cn flag

Shortcut key definitions are not interpreted by a full shell, and thus among other "limitations" do not interpret command separators as && or ;. You therefore can enter only a single command. The way around this limitation is to specify your command like:

sh -c 'import image.png && copyq write image/png - < image.png && copyq select 0'

Alternatively, you can place the commands in a shell script, then call the script through the shortcut.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.