Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Kdialog shell scripting -KDE4.10

  1. #1

    Default Kdialog shell scripting -KDE4.10

    This seems to be back but wasn't functional on 11.4 at least for me.

    There is some documentation here

    Development/Tutorials/Shell Scripting with KDE Dialogs - KDE TechBase

    Compared with KDE 3 there seems to be some missing. Sort of hoping some one is using it - does it work now?

    The missing parts seem to be launching a KDE application from a shell script and if control returns to the script after the application is closed. Anyone have any information on this sort of thing?

    There is also this one which can control the desktop but I assume KDE apps can be launched from a shell script so it may be a little over the top. Docs are also rather scant.

    WMIface - Window Manager CLI Interface

    Additionally java script can be used to script a number of things but it doesn't seem to offer access to the shell. There also seems to be variations on what type of scripts can control Kwin. Qt scripts are mentioned in places. I assume that's QML.

    Development/Tutorials/KWin/Scripting - KDE TechBase

    John
    -

  2. #2

    Default Re: Kdialog shell scripting -KDE4.10

    Quote Originally Posted by John_82 View Post
    This seems to be back but wasn't functional on 11.4 at least for me.

    There is some documentation here

    Development/Tutorials/Shell Scripting with KDE Dialogs - KDE TechBase

    Compared with KDE 3 there seems to be some missing. Sort of hoping some one is using it - does it work now?

    The missing parts seem to be launching a KDE application from a shell script and if control returns to the script after the application is closed. Anyone have any information on this sort of thing?

    There is also this one which can control the desktop but I assume KDE apps can be launched from a shell script so it may be a little over the top. Docs are also rather scant.

    WMIface - Window Manager CLI Interface

    Additionally java script can be used to script a number of things but it doesn't seem to offer access to the shell. There also seems to be variations on what type of scripts can control Kwin. Qt scripts are mentioned in places. I assume that's QML.

    Development/Tutorials/KWin/Scripting - KDE TechBase

    John
    -
    Qtscript is Qt's javascript implementation.
    But KDE's scripting isn't restricted to javascript, see here: https://en.wikipedia.org/wiki/Kross_(KDE)

    Maybe that would help you?
    Development/Tutorials/Plasma/JavaScript/API-LaunchApp - KDE TechBase

    Or try to run "kdialog --help".

    If you want to control an application from a script this can also be done over DBUS (the successor of DCOP).
    Have a look at qdbusviewer to find out what running application supports which interfaces.
    You can call methods and so on from shell scripts with "qdbus" or "dbus-send".

    But IMHO you should explain what exactly you are trying to achieve, then people would be able to help better.

  3. #3
    Join Date
    Mar 2010
    Location
    Austin - Texas
    Posts
    10,140
    Blog Entries
    48

    Smile Re: Kdialog shell scripting -KDE4.10

    Quote Originally Posted by John_82 View Post
    This seems to be back but wasn't functional on 11.4 at least for me.

    There is some documentation here

    Development/Tutorials/Shell Scripting with KDE Dialogs - KDE TechBase

    Compared with KDE 3 there seems to be some missing. Sort of hoping some one is using it - does it work now?

    The missing parts seem to be launching a KDE application from a shell script and if control returns to the script after the application is closed. Anyone have any information on this sort of thing?

    There is also this one which can control the desktop but I assume KDE apps can be launched from a shell script so it may be a little over the top. Docs are also rather scant.

    WMIface - Window Manager CLI Interface

    Additionally java script can be used to script a number of things but it doesn't seem to offer access to the shell. There also seems to be variations on what type of scripts can control Kwin. Qt scripts are mentioned in places. I assume that's QML.

    Development/Tutorials/KWin/Scripting - KDE TechBase

    John
    -
    How about a ready to use bash script that uses KDIALOG and is useful as well too? Have a look here: SYSEdit - System File Editor - Version 1.50 - Blogs - openSUSE Forums

    Thank You,
    My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

    Software efficiency halves every 18 months, thus compensating for Moore's Law

    Its James again from Austin, Texas

  4. #4

    Default Re: Kdialog shell scripting -KDE4.10

    Thanks - I never imagined that --help would work. It also works on things like dolphin, konqueror, opera and even vlc and gives the calling options.

    Going on their behaviour in the console running from a shell script just involves say "dolphin /" or "dolphin/home etc". The only odd thing is when the select option is used there are still error messages - in my case as I don't have a samba.conf it complains. More complaints from Dolphin than Konq. I suppose the output can be sent to null. Control is passed back to the console after what ever is launched is closed - even a tab in opera. I'm impressed as have had the impression that KDE was moving away from this sort of thing.

    The script is interesting to as it details creating a desktop icon. I have wondered about that and last time I looked couldn't find any documentation on their content or construction at all. Is there any around now?

    Use - as a for instance. On 11.4 for various reasons I tried to do this

    Obtain a password - mount a nas using cifs directly - open a dolphin window directed to a place on the nas - log off the nas when dolphin was close and not allow the icon to be used again until logged off the nas.

    No luck via KDE so I finished up trying to do this with Qt and then found that the docs didn't tie up and were not up to date. Really it isn't even worth considering js or c etc for something like this. Going on a video I watched QML would probably be my choice for anything that needed more facilities. Might interest some. There are also a number of other video's

    Using Qt Quick for Rapid UI Prototyping and Development

    As other languages can be used with it one way or the other shell scripts could still be used from it if needed.

    John
    -

  5. #5

    Default Re: Kdialog shell scripting -KDE4.10

    Quote Originally Posted by John_82 View Post
    Going on their behaviour in the console running from a shell script just involves say "dolphin /" or "dolphin/home etc". The only odd thing is when the select option is used there are still error messages - in my case as I don't have a samba.conf it complains. More complaints from Dolphin than Konq. I suppose the output can be sent to null.
    Use "dolphin /home 2>/dev/null" to suppress the debug output (that mostly comes from udisks2).

    The script is interesting to as it details creating a desktop icon. I have wondered about that and last time I looked couldn't find any documentation on their content or construction at all. Is there any around now?
    I haven't had a look at that script. Do you mean how to create a .desktop file?
    Here are the specifications: Desktop Entry Specification

    Obtain a password - mount a nas using cifs directly - open a dolphin window directed to a place on the nas - log off the nas when dolphin was close and not allow the icon to be used again until logged off the nas.
    Something like:
    Code:
    #!/bin/bash
    PASSWORD=`kdialog --password "Enter password"`
    if [ $? -eq 1 ]; then
    # user clicked cancel
             exit 1
    fi
    mount //HOST/SHARE mountpoint -o username=xxx,password=$PASSWORD
    dolphin mountpoint 2>/dev/null
    umount mountpoint
    Of course you would have to adapt at least the mount call (see "man mount.cifs"), and you would have to run this as root to be able to mount (if you use sudo you would have to enter the root password as well).

    And you could check at the beginning of the script if the nas is still mounted (grep the output of mount f.e.) and exit in that case.

    And why don't you just use "dolphin smb://HOST/SHARE" or "dolphin smb://user@HOST/SHARE"? Of course it's not mounted then.
    Or maybe use some FUSE-based filesystem.

  6. #6

    Default Re: Kdialog shell scripting -KDE4.10

    Thanks for the link.

    I recompiled mount.cifs so that it was user mountable once again - more like nfs.

    Going on some one else's recent experiences there may be no need to do that any more under 12.3.

    At the time the nas could be handled entirely from KDE but boot and navigation were slow. The other problem was rather strange. Take Kwrite and it could read/modify/write files on the nas. Many other apps couldn't. The other problem was launching files from the nas eg a Photo. Problems again and I often work like that.

    cifs was down to the nas and there being windoze users here - adding nfs is more work for the nas to do. Discouraged in it's doc's.

    John
    -

  7. #7

    Default Re: Kdialog shell scripting -KDE4.10

    Quote Originally Posted by John_82 View Post
    I recompiled mount.cifs so that it was user mountable once again - more like nfs.
    That's not possible. Having to be root to mount is not a restriction of mount.cifs but the kernel.

    You could add an entry for your NAS in /etc/fstab with the option "user" of course. Then you can mount it as user.
    But I don't know if you can specify the password= option then using mount. If not, you could try to set PASSWD instead of PASSWORD since mount.cifsrespects that variable. (Again, see "man mount.cifs")

    Or you could use a FUSE-based filesystem to mount your NAS. See: SourceForge.net: NetworkFileSystems - fuse (I don't want to check now which of them are available as packages for openSUSE)

    At the time the nas could be handled entirely from KDE but boot and navigation were slow. The other problem was rather strange. Take Kwrite and it could read/modify/write files on the nas. Many other apps couldn't. The other problem was launching files from the nas eg a Photo. Problems again and I often work like that.
    Right. KDE has the so-called "KIO" system via which KDE applications can access f.e. files on network servers like if they were on the local hard disk. See https://en.wikipedia.org/wiki/KIO
    GNOME has something similar.

    But only some non-KDE and none-GNOME programs support something similar as the "smb://" kioslave. (I only can think of media players like xine, mplayer and VLC, or Webbrowsers like Opera and Firefox right now; though there may be other programs of course...)
    That of course makes it necessary to mount the share.

  8. #8

    Default Re: Kdialog shell scripting -KDE4.10

    What I'd also like to mention:
    For this particular use case (mounting and unmounting your NAS) you could also have a look at Smb4K: Smb4K | Free Development software downloads at SourceForge.net
    This program lets you browse the SAMBA/CIFS shares in your network and mount/unmount them (and can automatically call dolphin when mounting).

    It is part of the standard openSUSE repo, so you can easily install it using YaST.

    And regarding the Desktop icon, you can also let KDE create the .desktop file for you.
    Just right-click somewhere in the folderview or dolphin and select "Create New"->"Link to Application...".

  9. #9

    Default Re: Kdialog shell scripting -KDE4.10

    I don't mind entering the password when I use the nas. In fact I have come to prefer it that way. I hit the up arrow in the console until the last time I mounted it comes up, hit return and then enter the pass word when requested.

    I'm on my new machine so have no idea what if anything I put into fstab. If there is anything it's a left over from when I did it server style for want of a better word. Problem then as well as the ones I mentioned was slow navigation as the techniques assume more than one user on the partition. In this case it's private so there is no need to check for changes when navigating up and down directory trees. Actually I have seen indications that using a shared partition as a drop box to exchange files with others is ok too.

    I need to go back on the old machine one more time. Be interesting to see what is in fstab. I posted the changes to mount.cifs recently.

    KIO to me is a bad idea. The i/o of this sort is built into the kernel and in my view best left there. The problem is that they can obtain code from other projects and use and change it. Easy to do but may not be generally compatible. I had the impression that desktop files had something to do with compatibility but probably a red herring. Qtified applications may well be ok now. One problem though. The KDE boot up time taken to connect to the nas was far longer than I am prepared to put up with. Direct mounting is instantaneous.

    Thanks for the other link but I will probably do it my way just to see if I can.

    John
    -

  10. #10

    Default Re: Kdialog shell scripting -KDE4.10

    Thanks for reminding me. I did add a line to fstab as follows

    Code:
    //192.168.1.20/Volume_1    /home/john/Desktop/NAS    cifs    rw,user=john,guid=Nas1,noauto
    John
    -

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •