unable to output file when using spectacle via shortcut

plasma Version: 6.6.5

setting up a shortcut for spectacle to output to a folder called /tmp/manga-ocr (already setup a tmpfiles config file and check the folder does exist), originally used a oneline in the command section but that did not work so created a bash script and set it as the command to run when the shortcut is pressed. when the shortcut is pressed spectacle will activate the region selection and can click accept but the output file is not created in the folder. when running the command in a shell it will work fine or running the script in a shell will work. (plan to remove the test filename, and replace it with date substitution)

#!/usr/bin/env bash
spectacle -rb -o /tmp/manga-ocr/test

hi, welcome.

don’t know if you are already aware of this but spectacle can can be configured to save all of it’s output to a folder of your choosing (tho i don’t think choosing a /tmp location is the best idea).

spectacle also comes with various pre-defined shortcuts, and one of those is Region.

so, i’m not sure why you are reinventing the wheel here, when it will already do those things for you OTB.

however, if you are set on doing it from the command line and want to make a script of it, then it should work the same from a terminal as it does from running the script in a terminal.

it’s possible that the way you are launching it is not evoking the same shell as what you are using… maybe try just using

#!/bin/bash instead.

i don’t want all images taken with spectacle to be placed in tmp, this is for a OCR called manga-ocr which reads speech bubbles in manga when sent to a folder and gives back the kanji in the bubble to use with dictionary programs like yomitan. tried changing the shebang to /bin/bash and nothing changed also tried including the o flag with the r and b but that also did nothing

though noticed something i thought was strange though do know if it is supposed to do it but when running spectacle after running the shortcut or running the shortcut after accepting the first time will show the previous selected region

using your method of evoking a shell command, what happens if you change the command to something like

kdialog --msgbox hello

does a dialog appear on the screen?

-–

going back to you command line, if you run that in a terminal then you get the file output in the folder you specified?

is it still there after you relog or reboot?

have you tried just putting it into your /home directory somewhere?

that is one of the configuration options to remember the region, i suggest getting more familiar with the GUI and it’s settings, for this.

also you must specify the file format, so you should put /tmp/manga-ocr/test.jpg

okay wierd. i tried the kdialog line by commenting out the spectacle line and after saving the change, tried the shortcut again it was still doing spectacle. i checked to see if i had any duplicate shortcut (either a sperate shortcut or program using the same key combo) and didn’t so i decided to just delete the shortcut and created the same shortcut pointing at the same script file and key-combo and then the kdialog option appear, i then uncommented the spectacle line and after running it does now create the file. i am thinking since i originally use the same shortcut using a direct line (putting the spectacle command in the command option) instead of the script and then edited it and put in the bash script, it may not have saved the change so while it showed it was using the script file in the edit menu it may not have updated in the background, since the apply was blacked out so i know i applied it???

that is weird.

if you are on plasma 6.6, and you can get it to behave that way again, then i would strongly recommend you file a bug report at bugs.kde.org because it should not be doing that.

yup seem to be that you when you edit the command-type shortcut (either the command or name) after creating it, it will not detect the change and allow it to be applied though system settings does remember the changes

found out this bug was already found https://bugs.kde.org/show_bug.cgi?id=487941