Announcement
Collapse
No announcement yet.
Newbie kdialog question
Collapse
This topic is closed.
X
X
-
Yes! Finally! This worked perfectly. Thank you James and Andy for being patient with me, I really thought the solution would be simpler, but I'm happy.
- Top
- Bottom
-
It works for me ^^
What I did was:
Modified the script to just contain:
Code:#!/bin/sh export DISPLAY=:0 kdialog --title "Mythtv" --msgbox "Transcode of recording for tablet complete"
Switch to a virtual terminal and run the script as the normal user: the msgbox is displayed on the desktop with the given message
Run it as root: Fails with unable to connect to display :0
Run
Code:xhost +si:localuser:root # replace root with your mythtv-user, I only used root as I don't have any other users
Run the script as root on the virtual terminal: the msgbox is displayed on the desktop with the given message
To make this work automatically you need to add the xhost line to run when kde starts (Autostart in system settings)
- Top
- Bottom
Leave a comment:
-
Here is the latest thing I tried with no success:
#!/bin/sh
export DISPLAY=:0
xhost +local:
VIDEOIN=$1
FILENAME=$2
OUTDIR=$3
# Now we'll convert the new temp file to mpg using avconv
cp $VIDEOIN "$OUTDIR/$FILENAME.tmp"
avconv -i "$OUTDIR/$FILENAME.tmp" -acodec libmp3lame -ac 2 -vcodec mpeg2video -q 8 -vf scale=-1:480 "$OUTDIR/$FILENAME.avi"
# Now, we'll remove the temp file
rm -f "$OUTDIR/$FILENAME.tmp"
kdialog --title "Mythtv" --passivepopup "Transcode of recording for tablet complete" 10
xhost -local:
- Top
- Bottom
Leave a comment:
-
Did you run it with the DISPLAY variable set? And you are not really wasting anyone's time, if people think it is a waste of time then they will not respond to the thread, since people are then they do not think this
- Top
- Bottom
Leave a comment:
-
James, I ran a test script from terminal and got my kdialog popup, then I ran it from a TTY logged in as my username and received "Kdialog: cannot connect to X server", then I logged in as mythtv and ran the script and again received "Kdialog: cannot connect to X server".
I tried adding the xhost line and variations on it such as "xhost +local:" but no luck. I think I,m wasting every ones time with this since it's not very important, it just bothers me that I can't find a solution.
- Top
- Bottom
Leave a comment:
-
Yes, it probably is a permissions problem.
I think the mythbackend runs as the "mythtv" user. In a start up script for the KDE environment, you should allow windows from another user to be displayed. The command is xhost and would go something like this:
xhost +si:localuser:mythtv-user
This allows the "mythtv-user" (or whatever the exact user name is) to create windows on your display.
- Top
- Bottom
Leave a comment:
-
Originally posted by whitepine View PostJames, I'm not sure how to do that. The script is designed to be invoked from mythbackend. Running it from a terminal, virtual or otherwise, it would not understand VIDEOIN or OUTDIR.
I did try running the script using a real file name and kdialog worked as it's supposed to.
I also checked mythbackend.log and it tells me that the script has failed, but no indication as to why. Since this is run from mythbackend could it be a permissions problem?
If it runs as expected try running it form a headless environment as the user mythtv runs it as.
- Top
- Bottom
Leave a comment:
-
James, I'm not sure how to do that. The script is designed to be invoked from mythbackend. Running it from a terminal, virtual or otherwise, it would not understand VIDEOIN or OUTDIR. I did try running the script using a real file name and kdialog worked as it's supposed to. I also checked mythbackend.log and it tells me that the script has failed, but no indication as to why. Since this is run from mythbackend could it be a permissions problem?
- Top
- Bottom
Leave a comment:
-
Switch to a virtual terminal (alt+ctrl+F1, use F7 to get back to the GUI) and try running it there, see if it spits out any useful output.
- Top
- Bottom
Leave a comment:
-
Thank you Andy and James, but neither "env DISPLAY=:0 /path/to/script" nor adding "export DISPLAY=:0" to the script worked. Right now I simply watch the system monitor to see when the cpu load drops - not a very elegant way of doing it, but it works.
- Top
- Bottom
Leave a comment:
-
Thanks for the replies. I'll try setting the $DISPLAY variable tomorrow when I have more time. I would never have thought of this on my own.
- Top
- Bottom
Leave a comment:
-
This could be an consequence of X11 DISPLAY not being set. When running from a konsole window, $DISPLAY is set -- typically to ":0". When running from cron or started outside of the KDE environment, $DISPLAY is probably not set.
- Top
- Bottom
Leave a comment:
Leave a comment: