Re: Writing a desktop entry for rooted, screened script?
On Friday 15 April 2011, Kevin Krammer wrote:
> On Wednesday, 2011-04-13, Michael Schuerig wrote:
> > I realize that this question is not specific to Debian or even KDE,
> > but that's the context where it arises for me.
> >
> > I have several very simple scripts that consist of barely anything
> > but an invocation of rsync. So far, I've always run these scripts
> > on the commandline, using sudo and screen where necessary or
> > useful. As it is, that's a rather rustic way of doing things, I'd
> > like to have better integration with KDE.
> >
> > I'd like it to work like this:
> > - the script is started from the KDE launcher
> > - kdesu (or kdesudo) asks for the password to get root permissions
> > - the scripts runs in a screen session and its icon appears in the
> > system tray
> > - when I click on the icon, a Konsole window pops up, connected to
> > the screen session
> >
> > Is this at all possible with just a bit of configuration and
> > scripting?
>
> Might be doable.
> kstart should be able to run any application, hide its window and put
> an icon into the system tray instead.
> Using a terminal emulator as such a program, which then runs a
> command at start and a script doing the su/screen stuff.
I didn't get it to work with screen, but at least I can hide the konsole
showing the output most of the time. The resulting commandline is a bit
convoluted
$ ksystraycmd --hidden -- \
konsole --title "Backup" --icon folder-sync \
--nofork --noclose \
-e /usr/lib/kde4/libexec/kdesu --noignorebutton -t \
/usr/local/bin/mybackup
However, if I use the menu editor to and an entry and put in that line
as the command, it does not work. The same goes if I add the command to
a script and call the script from the menu (desktop) entry.
As far as I can tell, ksystraycmd doesn't work in that context. Note
that although I'm using KDE 4.6.1, I'm still using the classic launcher.
Maybe that makes a difference, although it shouldn't.
As far as screen is concerned, I don't think it is easily possible to do
what I want. I.e., I'd like to detach the screen session and close the
konsole when its window is hidden, and when it is shown again, I'd like
to launch a new konsole and reattach to the screen session.
My quick experiments with kstart have not been encouraging. Just
$ kstart --tosystray konsole
seems to annoy kwin so much that it moves all windows to the first
desktop. Nothing else seems to happen.
Michael
--
Michael Schuerig
mailto:michael@schuerig.de
http://www.schuerig.de/michael/
Reply to: