Announcement

Collapse
No announcement yet.

Commands work in terminal but not as custom shortcut

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] Commands work in terminal but not as custom shortcut

    In Command showing different behaviour when running from terminal and when Using as Shortcut, the user is on Kubuntu 18.04 and can

    Open konsole and successfully run
    Code:
    spectacle -r -b -n -o /home/UserName/Documents/Translate/input.jpg
    followed by
    Code:
    gocr -i /home/UserName/Documents/Translate/input.jpg | xsel -b
    A script based on the above also works when run from konsole:
    Code:
    #!/bin/bash
    # Dependencies: gocr xsel
    
    # Take Screenshot and Save it to a File
    spectacle -r -b -n -o /home/UserName/Documents/Translate/input.jpg
    
    # Extract text from the saved file
    gocr -i /home/UserName/Documents/Translate/input.jpg | xsel -b
    
    exit
    But when the user assigns a custom keyboard shortcut, only the spectacle part seems to work.

    I can verify that on my system as well. Any clues why? Putting a sleep, however long, between the two steps doesn't change anything as far as the custom keyboard shortcut route goes.
    Kubuntu 20.04

    #2
    Changing
    Code:
    gocr -i /home/UserName/Documents/Translate/input.jpg | xsel -b
    to
    Code:
    gocr -i /home/UserName/Documents/Translate/input.jpg | xsel -b -i
    fixes the shortcut route thanks to danzel's answer.
    Kubuntu 20.04

    Comment

    Working...
    X