How to launch 3rd-party Debian app on Lxpanel using Code?

Please post all general support questions for LXDE here.
Locked
bkpsusmitaa
Posts: 8
Joined: Sat Apr 25, 2015 12:08 pm

How to launch 3rd-party Debian app on Lxpanel using Code?

Post by bkpsusmitaa »

Hi!
I am a new member. I use Knoppix for my work. Knoppix uses LXDE with lxpanel.
I have seen the structure of your program, including the file ~.config/lxpanel/LXDE/panels/panel.
In your lxpanel, there are some plugins such as:
  • /usr/lib/i386-linux-gnu/lxpanel/plugins
    /usr/lib/i386-linux-gnu/lxpanel/plugins/batt.so
    /usr/lib/i386-linux-gnu/lxpanel/plugins/cpu.so
    /usr/lib/i386-linux-gnu/lxpanel/plugins/cpufreq.so
    /usr/lib/i386-linux-gnu/lxpanel/plugins/deskno.so
    /usr/lib/i386-linux-gnu/lxpanel/plugins/kbled.so
    /usr/lib/i386-linux-gnu/lxpanel/plugins/monitors.so
    /usr/lib/i386-linux-gnu/lxpanel/plugins/netstat.so
    /usr/lib/i386-linux-gnu/lxpanel/plugins/netstatus.so
    /usr/lib/i386-linux-gnu/lxpanel/plugins/thermal.so
    /usr/lib/i386-linux-gnu/lxpanel/plugins/volumealsa.so
    /usr/lib/i386-linux-gnu/lxpanel/plugins/wnckpager.so
    /usr/lib/i386-linux-gnu/lxpanel/plugins/xkb.so
I have seen your file ~.config/lxpanel/LXDE/panels/panel file. It directly loads the app it has built and distributed with its Shell and link icons for its own app, such as:

Code: Select all

Plugin {
    type = space
    Config {
        Size=4
    }
}

Plugin {
    type = space
    Config {
        Size=4
    }
}

Plugin {
    type = taskbar
    expand=1
    Config {
        tooltips=1
        IconsOnly=0
        ShowAllDesks=0
        UseMouseWheel=1
        UseUrgencyHint=1
        FlatButton=0
        MaxTaskWidth=150
        spacing=1
        GroupedTasks=0
    }
}

Plugin {
    type = space
    Config {
        Size=2
    }
}

Plugin {
    type = volumealsa
}

Plugin {
    type = tray
}

Plugin {
    type = batt
    Config {
        HideIfNoBattery=0
        AlarmCommand=xmessage Battery low
        AlarmTime=0
        BackgroundColor=red
        BorderWidth=1
        ChargingColor1=#28f200
        ChargingColor2=#22cc00
        DischargingColor1=#ffee00
        DischargingColor2=#d9ca00
        Size=8
    }
}

Plugin {
    type = cpu
}

Plugin {
    type = dclock
    Config {
        ClockFmt=%R
        TooltipFmt=%A %x
        BoldFont=1
        IconOnly=0
        CenterText=0
    }
}

Plugin {
    type = thermal
    Config {
        NormalColor=#00ff00
        Warning1Color=#fff000
        Warning2Color=#ff0000
        CustomLevels=1
        Warning1Temp=98
        Warning2Temp=103
        AutomaticSensor=1
    }
}

However, for 3rd party apps it uses a complex mechanism of Application Launcher, such as:

Code: Select all

Plugin {
    type = launchbar
    Config {
        Button {
            id=pcmanfm.desktop
        }
        Button {
            id=lxde-x-terminal-emulator.desktop
        }
        Button {
            id=/usr/share/applications/iceweasel.desktop
        }
        Button {
            id=/usr/share/applications/libreoffice-startcenter.desktop
        }
        Button {
            id=/usr/share/applications/aumix-gtk.desktop
        }
        Button {
            id=arandr.desktop
        }
        Button {
            id=/usr/share/applications/gmail-notify.desktop
        }
        Button {
            id=/usr/share/applications/Compiz Fusion Icon.desktop
        }
    }
}
How can I directly use link to binaries rather than desktop links to run app? This is sometimes necessary. How? Example:

In knoppix the GUI booting ends in a partially drawn window. I have to run Compiz icon with metacity to restore the Window Title Bar. Using lxpanel I can have a compiz icon on the Launcher bar, but I have to manually click it. When the Compiz icon is shown in the task bar I have to Right-click on it, left-click on Reload Windows Manager to get to a fully functional Desktop.

I want to do this automatically.

Please help me how?
Regards
drooly
Posts: 791
Joined: Mon Apr 08, 2013 6:45 am

Re: How to launch 3rd-party Debian app on Lxpanel using Code

Post by drooly »

hello,
please don't talk about lxde as being ours.
you are creating a borderline here that simply doesn't exist. since you are using lxde and have registered on these forums, it is yours just as well as anybody elses.

now, your problem.
bkpsusmitaa wrote:How can I directly use link to binaries rather than desktop links to run app? This is sometimes necessary.
i did not quite understand your explanation, but:

you can write .desktop files yourself. it's easy. simply copy one from /usr/share/applications to ~/.local/share/applications, and edit it to your liking in your favorite plain text editor.
the "Exec=" line is important, and you should give it a distinctive "Name=".

you could also try fbpanels old syntax (because lxpanel was developed from fbpanel) - who knows, maybe it still works.
an example:

Code: Select all

Plugin {
    type = launchbar
    config {
        button {
            icon = file-manager
            tooltip = File Manager
            action = spacefm
        }
        button {
            icon = terminal
            tooltip = Terminal
            action = urxvt
        }
  button {
            icon = web-browser
            tooltip = Web Browser
            action = seamonkey
      }
    }
}
i hope this answers your question.
bkpsusmitaa
Posts: 8
Joined: Sat Apr 25, 2015 12:08 pm

Re: How to launch 3rd-party Debian app on Lxpanel using Code

Post by bkpsusmitaa »

First of all, I would like to thank you for responding to my post and giving me what you felt was an appropriate solution for me. _/|\_
drooly wrote:... it is yours ...
Let us not begin a war of words :-) . I did not write the program, it was written by the team. The forum was also begun by the team. It is their program, not mine, I don't have the ability to write such programs. I am just a humble user.

I will try to provide you with a scenario for my desiring to learn launching 3rd party debian app on lxpanel using code.

Everytime, I open an lxterminal.
I do

Code: Select all

 cd /home/knoppix/nohup
I write

Code: Select all

 nohup nice -n 19 -- ionice -n 7 -t -- chromium
in the terminal. I have chromium running with the given values, as can be found from ksysguard.

I wish to write a Chromestart.desktop file in /usr/share/applications directory where I could do this, stepwise everytime, clicking an icon on the panel that represents these steps, without my writing the codes setpwise everytime I reach runlevel 5 into lxsession.

Maybe, I could write an executable script

Code: Select all

cd /usr/bin/ | ./lxterminal | cd /home/knoppix/nohup | nohup nice -n 19 -- ionice -n 7 -t -- chromium
. Then I could name it as chro, do

Code: Select all

 chmod 447 chro
, then write the chromestart.desktop file to run chro to run chromium in the desired form. But I wish to do it with lxpanel code itself.

The reason is because my computer is getting older. Newer browsers, such as Firefox, Iceweasel, Chromium, etc., take up huge system resources. The laptop, created by an Indian company called HCL, is defective. It heats up and shuts down if the CPU is given a heavy load and runs uninterrupted for sometime.

I hope I could explain myself to you.

Once again, thank you for writing.
Bob E
Posts: 72
Joined: Wed Oct 12, 2011 1:37 am

Re: How to launch 3rd-party Debian app on Lxpanel using Code

Post by Bob E »

bkpsusmitaa wrote: it was written by the team. The forum was also begun by the team. It is their program, not mine,
The few of us that reply to help questions on this forum are just average, everyday users with a shared interest in LXDE. "The Team" rarely, if ever, visit this forum. If you would like to get developer support, the best way would be to contact the developer directly and/or visit the LXDE IRC. irc://irc.oftc.net/lxde
Rex Bouwense
Posts: 1093
Joined: Sat Aug 27, 2011 5:44 pm
Location: Sierra Vista, Arizona USA
Contact:

Re: How to launch 3rd-party Debian app on Lxpanel using Code

Post by Rex Bouwense »

Welcome to the LXDE forum. As has already been so brilliantly stated, we are not part of the LXDE team but are all volunteers who choose to gather on this forum to assist others of us who use LXDE that have problems or questions. Sometimes we are successful and other times we must wait until someone with more knowledge comes along to assist. You have done what is required of you, state your request for a solution. If additional information is required to properly respond to you, then it will be asked for. Since we are a very small forum you must have patience because most of our users do not visit the forum daily. Once again welcome aboard.
Rex
drooly
Posts: 791
Joined: Mon Apr 08, 2013 6:45 am

Re: How to launch 3rd-party Debian app on Lxpanel using Code

Post by drooly »

bkpsusmitaa

yes, you should write yourself a bash script and then a .desktop file to excute that script.
you can point a launcher on your lxpanel to that .desktop file. is that what you meant by "i want to solve it with lxpanel code"?

your last post contains a lot of weird and possibly wrong code; maybe you should read a basic bash tutorial first.

edit:
if you're basically concerned about lightweightness, well, you don't need a panel at all, you don't need a desktop manager, you can use plain openbox (part of lxde). it's very powerful.
and a browser like dwb might be a better alternative to chromium. it is extremely easy on resources, but uses the same engine as chromium (=webkit).
bkpsusmitaa
Posts: 8
Joined: Sat Apr 25, 2015 12:08 pm

Re: How to launch 3rd-party Debian app on Lxpanel using Code

Post by bkpsusmitaa »

drooly wrote: ... a lot of weird and possibly wrong code ... you should read a basic bash tutorial first
Many a time I have contemplated whether I usually gain a lot of friends when I advise people without the empathy expected of me. And all the time my conscience would tell me that I don't. When people are in trouble they need a helping hand, not given a Legal textbook and asked to find solutions from it, I would reason.
I would usually provide the answer if I do have it.
That the world has caused me a lot of hurt shouldn't mean I have to return the 'hurt' back.
drooly wrote:... you can use plain openbox...
Thank you, but lxsession doesn't grab a lot of resources for itself. It is the applications that do. Therefore, the applications need to be controlled and not allowed too much resources.

And friends, I have created the shell script and have made it executable. It runs when invoked. How to launch a script from lxpanel?
There is a line I have utilised: Exec=/usr/share/applications/chro.sh , but it doesn't work. I believe the script has to be run in a particular way.
How can scripts be run from lxpanel?
Please guide.
I wrote in the chrotest.desktop file:

Code: Select all

[Desktop Entry]
Version=1.0
Name=Chromium Web Browser

GenericName=Web Browser

Comment=Access the Internet

Exec=./chro.sh
# or should this be: /usr/share/applications/chro.sh?
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=chromium
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;x-scheme-handler/http;x-scheme-handler/https;
StartupWMClass=nice -n 19 -- ionice -n 7 -t -- Chromium
StartupNotify=true
bkpsusmitaa
Posts: 8
Joined: Sat Apr 25, 2015 12:08 pm

Re: How to launch 3rd-party Debian app on Lxpanel using Code

Post by bkpsusmitaa »

Yes, did it! One very empathetic lxde IRC member has been kind enough to state that the applications list is also read from ./local/share/applications/

So I moved my files chrotest.desktop and chro.sh from /usr/share/applications to the above directory, and again made the shell script to executable.

Changed the chrotest.desktop s.t. the Exec line had the full path name of the shell script, and not ./script_name.

Then I ran Chromium and it automatically took the nice and ionice values.

Thank you, friends.

Now I have become confident to launch all applications with the least priority and ionice, and that too, without shell script.

How can this be attained?
drooly
Posts: 791
Joined: Mon Apr 08, 2013 6:45 am

Re: How to launch 3rd-party Debian app on Lxpanel using Code

Post by drooly »

bkpsusmitaa wrote:
drooly wrote: ... a lot of weird and possibly wrong code ... you should read a basic bash tutorial first
Many a time I have contemplated whether I usually gain a lot of friends when I advise people without the empathy expected of me. And all the time my conscience would tell me that I don't. When people are in trouble they need a helping hand, not given a Legal textbook and asked to find solutions from it, I would reason.
I would usually provide the answer if I do have it.
That the world has caused me a lot of hurt shouldn't mean I have to return the 'hurt' back.
you're barking totally up the wrong tree here.
i can't provide you with the answer, i don't have it.
fact is, i can't really tell from your code snippets what you want to achieve - because they're just snippets - if what you're typing is supposed to be syntax or some sort of stylish shorthand.
that's the only reason i wrote "weird and possibly wrong", and not because the world hurt me and now i want to hurt you back, as you seem to be implying.

being asked to do some studying is not an insult, nor is it lack of consciousness.
bkpsusmitaa wrote:Now I have become confident to launch all applications with the least priority and ionice, and that too, without shell script.
How can this be attained?
you have to concatenate your script to a one-liner and put it into the "Exec=..." section of that .desktop file, so it would read something like

Code: Select all

Exec= cd /home/knoppix/nohup ; nohup nice -n 19 -- ionice -n 7 -t -- chromium
bkpsusmitaa
Posts: 8
Joined: Sat Apr 25, 2015 12:08 pm

Re: How to launch 3rd-party Debian app on Lxpanel using Code

Post by bkpsusmitaa »

drooly wrote:you have to concatenate your script ... put it into the "Exec=..." section
I tried this earlier, but didn't work. So I worked around using a script.

And nohup is not required really, I found, because Chromium warns it should not be run as 'su'. I thought of running Chromium via su terminal, so I used the nohup string. But I learnt with repetition and perseverance, and a little help from one kind lxde IRC user.

And over the years, with my experience of interacting with men (really beasts) who survive on one meagre meal per day I have learnt not to ruffle feathers, i.e., rub one's ego the wrong way. Otherwise, it might have disastrous consequence. I know that I myself have evolved from beast, interacting with beasts with a fearful state of mind, because of hostile body language, since coming to my senses. Therefore, I find it the best to interact euphemistically. The manifestation of this ego is in various forms such as patriotic songs, herd identity, Borders, your, mine, parents, etc.

If I ask someone to study without properly directing what, where, etc., I would essentially mean that that one should search helter-skelter by himself, left in the lurch, without expecting any support from me. My conscience would tell me that I am being unempathetic, rather harsh.

When I don't know something I find no shame in expressing it the very first time I get an opportunity doing so. I don't point in wrong direction.

And I only talk about myself, not any other person. It would not be empathetic to talk about someone else.

Therefore, barking would be parsecs away. And otherwise too, I have language and don't walk on four :lol: !!
Locked