Announcement

Collapse
No announcement yet.

Launch apps, hlp help display, use kate instead of vi/vim

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

    Launch apps, hlp help display, use kate instead of vi/vim

    Here's a utility that enables one to 'launch' gui apps from the commandline without any terminal 'noise' (unless you want feedback from the app) returning control immediately to the terminal.

    For example you could type.

    Code:
    launch kate /etc/fstab
    launch knonqueror . # that's a 'dot'
    and both apps would remain open and you'd be ready for the next terminal command.

    With this utility you can create an application called 'hlp' that will open a nicely formatted man or info page in konqueror.
    Code:
    #!/bin/sh
    browser=konqueror
    opt="info"
    
    if [ "$1" == "-m" ];then
      opt="man"
      shift
    else
    if [ "$1" == "-i" ];then
      opt="info"
      shift
    fi ;fi
    
    launch $browser "$opt:$1"
    Or an 'edit' program that uses kate instead of vi/vim.
    Code:
    #!/bin/sh
    
    # this is obsolete, see README to enable with superuser
    #if [ "$HOME" == "/root" ];then
    #export $(dbus-launch)
    #fi
    
    # turn 'grep -n' output into --line NNN to go to the
    # exact line.
    args=`echo $@ | sed 's|[:]| --line |; s|[:].*| |g;'`
    launch "kate -n $args"
    WARNING: SU & KONQUEROR ISSUE. As a normal user, it has never screwed up on me. (First version was for suse 10, about 5 years ago. I use it regularly.) With the new dbus implementation, as superuser, konqueror has caused klauncher to spin out, sucking up tons of cpu time, relaunching itself each time it is killed. This doesn't happen often but is a bug and it is still under study.

    sources and makefile here
    http://rainbowsally.net/pub/launch-1.4.tar.gz

    screenshot here
    http://rainbowsally.net/pub/chat.jpeg

    The screenshot is of a qt demo of dbus.

    This is the thread where I posted the solution to root and superuser connections, the result of that qt demo and getting root and superuser to chat over the same dbus-daemon connection.
    http://kubuntuforums.net/forums/inde...opic=3119650.0

    The dbus code to allow superuser to access a root dbus-daemon is also in the README in the tarball.


    #2
    Re: Launch apps, hlp help display, use kate instead of vi/vim

    ok I'll bite ........... what makes this better than just using the alt>F2 launch box or just appending a & to the terminal line?

    such as
    kate /etc/fstab&
    VINNY
    i7 4core HT 8MB L3 2.9GHz
    16GB RAM
    Nvidia GTX 860M 4GB RAM 1152 cuda cores

    Comment


      #3
      Re: Launch apps, hlp help display, use kate instead of vi/vim

      Originally posted by rainbowsally
      Here's a utility that enables one to 'launch' gui apps from the commandline without any terminal 'noise' (unless you want feedback from the app) returning control immediately to the terminal.

      For example you could type.

      Code:
      launch kate /etc/fstab
      launch knonqueror . # that's a 'dot'
      and both apps would remain open and you'd be ready for the next terminal command.
      I think I'm beginning to see where you're coming from on the other thread

      You want this application to work how you want it to when run from a root shell, no? (That's understable)

      But I think that rather than making complex workarounds to make the system to conform to your app, it's usually much simpler (with less pitfalls) to adapt the application to work with the system.

      I didn't check the code, but from the description it seems to basically do this:
      Code:
      #!/bin/sh
      nohup $@ > /dev/null 2>&1 &
      exit 0
      This script opens up kate (or whatever) without terminal output to the background releasing the shell for the next command (nohup keeps the application open even if you close the calling terminal).

      Comment


        #4
        Re: Launch apps, hlp help display, use kate instead of vi/vim

        Originally posted by vinnywright
        ok I'll bite ........... what makes this better than just using the alt>F2 launch box or just appending a & to the terminal line?
        you called it, vinny. as far as i can see it is a solution to a non-problem

        but hey, whatever floats you
        Welcome newbies!
        Verify the ISO
        Kubuntu's documentation

        Comment


          #5
          Re: Launch apps, hlp help display, use kate instead of vi/vim

          Originally posted by vinnywright
          ok I'll bite ........... what makes this better than just using the alt>F2 launch box or just appending a & to the terminal line?

          such as
          kate /etc/fstab&
          VINNY
          It can be run in scripts. See edit and hlp examples.

          Browse is also very handy.


          Comment


            #6
            Re: Launch apps, hlp help display, use kate instead of vi/vim

            Originally posted by kubicle
            Originally posted by rainbowsally
            Here's a utility that enables one to 'launch' gui apps from the commandline without any terminal 'noise' (unless you want feedback from the app) returning control immediately to the terminal.

            For example you could type.

            Code:
            launch kate /etc/fstab
            launch knonqueror . # that's a 'dot'
            and both apps would remain open and you'd be ready for the next terminal command.
            I think I'm beginning to see where you're coming from on the other thread
            :-)

            You want this application to work how you want it to when run from a root shell, no? (That's understable)

            But I think that rather than making complex workarounds to make the system to conform to your app, it's usually much simpler (with less pitfalls) to adapt the application to work with the system.
            *which* system.

            We have heard sort of blanket complaints about kde4. I never understood them until I tried it.

            Linux was here first, kubicle. And kde3 worked with the system. kde4 does not. The way I put in in the other thread was that kde is "bending linux out of shape".

            But we're getting somewhere. :-)

            I didn't check the code, but from the description it seems to basically do this:
            Code:
            #!/bin/sh
            nohup $@ > /dev/null 2>&1 &
            exit 0
            This script opens up kate (or whatever) without terminal output to the background releasing the shell for the next command (nohup keeps the application open even if you close the calling terminal).
            I'll try it [copying to file now].

            For others, I think the screenshot shows the purpose best. It is launching two apps consecutively. Your code may be close enough to eliminate the C code though, so thank you for this option.

            Personally I don't want anything to show on the terminal commandline when other apps are open -- I prefer a true "launcher' that does 'init' rather than keeping a shell in memory, but if people will accept this one, and barf upon the more low level way, then this may be the way to go... at least to demonstrate the principles involved.

            Thanks for the great tips! Even if some have not been directly to the point as far as my needs go, they are insightful and meaningful in their own contexts.

            Same goes for VINNY.

            I was unaware of that terminal command with the "&".

            Code:
            konqueror info:find &
            Can't wait to try it... :-)

            Thanks to all!

            Comment


              #7
              Re: Launch apps, hlp help display, use kate instead of vi/vim

              Originally posted by rainbowsally
              *which* system.
              The obvious (and annoying) answer would be that the code should be generic enough to work with *any* system

              Personally I don't want anything to show on the terminal commandline when other apps are open -- I prefer a true "launcher' that does 'init' rather than keeping a shell in memory, but if people will accept this one, and barf upon the more low level way, then this may be the way to go... at least to demonstrate the principles involved.
              That was just a quick "proof-of-concept" script, feel free to modify to your liking. It doesn't work from a root terminal (if launching a GUI app) by default, but it should if you allow root connections to the users X session (that's a discussion for the *other* thread)

              Comment


                #8
                Re: Launch apps, hlp help display, use kate instead of vi/vim

                Originally posted by kubicle
                Originally posted by rainbowsally
                *which* system.
                The obvious (and annoying) answer would be that the code should be generic enough to work with *any* system

                Personally I don't want anything to show on the terminal commandline when other apps are open -- I prefer a true "launcher' that does 'init' rather than keeping a shell in memory, but if people will accept this one, and barf upon the more low level way, then this may be the way to go... at least to demonstrate the principles involved.
                That was just a quick "proof-of-concept" script, feel free to modify to your liking. It doesn't work from a root terminal (if launching a GUI app) by default, but it should if you allow root connections to the users X session (that's a discussion for the *other* thread)
                With the addition of an "-a" switch and "usage" notes yours is an exact clone of what I was doing in the C file.

                Fantastic.

                VINNY, yours was also very close.

                Let's leave this up for a while though because the code does have some nifty low level tricks in it for suppressing the errors and warning in a forked app.

                And the winner is... <envelope please>

                kubicle, with VINNY a close second.

                Thanks again, guys.

                :-)

                Comment


                  #9
                  Re: Launch apps, hlp help display, use kate instead of vi/vim

                  Originally posted by rainbowsally
                  I was unaware of that terminal command with the "&".
                  It simply runs the process in the background, so the shell prompt returns immediately instead of being delayed by the new process.

                  Code:
                  test$ konqueror info:find &
                  [1] 2420
                  test$ jobs
                  [1]+ Running         konqueror info:find &
                  After I close the Konqueror window.

                  Code:
                  test$ fg
                  bash: fg: job has terminated
                  [1]+ Done          konqueror info:find
                  test$
                  Job Control - Bash Reference Manual
                  Welcome newbies!
                  Verify the ISO
                  Kubuntu's documentation

                  Comment


                    #10
                    Re: Launch apps, hlp help display, use kate instead of vi/vim

                    Yes, do look at the bash manual. I agree that you may be fixing something that isn't broken. Fixing your knowledge of the terminal might solve a lot of your needs.

                    Comment


                      #11
                      Re: Launch apps, hlp help display, use kate instead of vi/vim

                      telngard and claydoh.

                      In this case, I agree. It didn't need fixing.

                      The C code does have some merit regardless, however, in that it can stop the extra display on the terminal without redirecting to /dev/null which might be useful for C/C++ programmers who have wondered how to do that, especially in a forked application using exec* calls where even if you close stdout and stderr for the main terminal you're likely to get commandline feedback you don't want from the child app.

                      I appreciate your comments regardless and I will change my code to the simpler script version when I get settled in with kubuntu.

                      Meanwhile this IS the place for experiments, no? :-)

                      My next one will be scary. I'm going to try to make my main linux switchabel between openSUSE and Casper (Live).

                      As a test, I have extracted from the CD and have mounted the Casper CD's filesystem.squashfs and chroot-ed into that file system and I CAN run binaries from there, while running my opensuse 11.4 as the main linux.

                      I wanted to see what was going on with '/usr/bin/locate' which points to /etc/alternatives/locate which again points to /usr/bin/mlocate which 'stat' reports as belonging to phonon. But it's the 'right' locate, and it's got better --help than the one in opensuse, though it's quite a bit smaller. ()

                      Long story short, I might be able to get Casper and openSUSE to be switchable, if I rename the initrd file and make a few other modifications I may be able to move or rename a few critical directories (bin, boot, etc, lib, usr, and var as a starting point) and hit reset or something to reboot -- unless the reset causes the journaling to unravel the changes?

                      Whatever.

                      It's an experiment. :-)

                      I did an ldd comparison of a few kde apps and the libs and versions loaded are identical between our two systems, so this really looks like it might work but if not, you may not hear from me for a while. ;-)

                      Come along, Igore... we have some serious messing around ...er, "work" to do. :-)

                      .

                      Comment


                        #12
                        Re: Launch apps, hlp help display, use kate instead of vi/vim

                        Originally posted by rainbowsally
                        I wanted to see what was going on with '/usr/bin/locate' which points to /etc/alternatives/locate which again points to /usr/bin/mlocate which 'stat' reports as belonging to phonon. But it's the 'right' locate, and it's got better --help than the one in opensuse, though it's quite a bit smaller. ()
                        Kubuntu has shipped mlocate by default since at least Kubuntu 8.04 Hardy Heron, and maybe longer. There are some differences from GNU Locate noted in the mlocate manpage.

                        Kubuntu inherits Debian's alternatives system (see bottom of that page) and puts it to good use. If you don't like mlocate you may install another client and use update-alternatives to make it your default.
                        Welcome newbies!
                        Verify the ISO
                        Kubuntu's documentation

                        Comment


                          #13
                          Re: Launch apps, hlp help display, use kate instead of vi/vim

                          The main advantage of mlocate (to me) is that it's periodic database update (updatedb run daily via cron) is incremental and therefore significantly faster (this is also a clear plus if do run updatedb manually).

                          Comment


                            #14
                            Re: Launch apps, hlp help display, use kate instead of vi/vim

                            Originally posted by Telengard
                            Originally posted by rainbowsally
                            I wanted to see what was going on with '/usr/bin/locate' which points to /etc/alternatives/locate which again points to /usr/bin/mlocate which 'stat' reports as belonging to phonon. But it's the 'right' locate, and it's got better --help than the one in opensuse, though it's quite a bit smaller. ()
                            Kubuntu has shipped mlocate by default since at least Kubuntu 8.04 Hardy Heron, and maybe longer. There are some differences from GNU Locate noted in the mlocate manpage.

                            Kubuntu inherits Debian's alternatives system (see bottom of that page) and puts it to good use. If you don't like mlocate you may install another client and use update-alternatives to make it your default.
                            I *do* like mlocate. Even the --help is quite (er...) "helpful". :-)

                            [I saw your comments too, kubicle.]

                            Got some hackin' to do... see yuh later. :-)

                            Comment

                            Working...
                            X