There is another possibility…
Move s
to a global property, otherwise the shell will die when the method exits whether or not lxpanel
starts.
Instead of Dim
use s = new Shell
You also need the full path to lxpanel
since a Shell
does not set up a terminal environment.
(no automatic PATH)
William,
The idea of loading and unloading the lxpanel app seems like it could be a good way of controlling users access to the underlying OS.
The only thing I’ve come across so far is the lxpanelctl program:
lxpanelctl - LXPanel Controller
Usage: lxpanelctl <command>
Available commands:
menu - show system menu
run - show run dialog
config - show configuration dialog
restart - restart lxpanel
exit - exit lxpanel
command <plugin> <cmd> - send a command to a plugin
If I open a terminal window on the desktop and run the “lxpanelctl exit” command the taskbar disappears.
Then if I run the “lxpanel --profile LXDE-pi” in the hope of getting the taskbar back, I get a lot of error messages and the command prompt doesn’t return until I do a Ctlr-C and the taskbar is still missing.
As-of this moment I’m having 100% success in ‘not’ loading it at Startup, and having about 80% success in starting it via a Shell command.
I still think this is the best way to eliminate it from view, and to prevent users from ‘touching’ their way into the system. With the TaskBar gone, and no icons on the desktop (except one to launch your app), there’s nothing other than the boot-up screens that give away the underpinnings of your ‘product’.
I’m going to continue beating on the ‘start lxpanel from Shell cmd’ until I get it solved.
Found a working solution based on suggestions from Jukka and John’s advice, but ran out of time today. I’ll be testing it next week and will post results. Thanks everyone for all the bits of advice!
Here’s what I’ve got so far… 1.) use Terminal to disable LXPanel, 2.) build functionality in Main app to run script to launch LXPanel, 3.) and a helper app to deal with the hung process from step #2.
…okay, let the haters start slinging their posts now! ![:wink: :wink:](/images/emoji/twitter/wink.png?v=9)
[ deploying your app ]
[code]// fully disable the LXPanel via:
~/.config/lxsession/LXDE-pi/autostart
#comment out this lxpanel line…
@lxpanel --profile LXDE-pi[/code]
[ end deployment notes ]
[ ‘main’ application ]
[code]Dim s As New Shell
Dim cmd As String
// launch a 2nd ‘helper’ app (details below)
#If TargetMacOS Or TargetLinux Then
cmd = “nohup lxpanel --profile LXDE-pi &” //both of these lines work
'cmd = “lxpanel --profile LXDE-pi”
#Elseif TargetWin32 Then
cmd = “”
#Endif
s.Execute(cmd)
// note that your ‘main’ app will become hung, no matter what
// you set the s.Mode = to[/code]
[ end ‘main’ application ]
[ 2nd ‘helper’ app ]
// use a simple Timer to run a shell script, "pgrep your-main-apps-name"
// this return the processID of your hung app
// use another shell to call "kill xxxx" (the processID of your main app)
// then terminate this app
[ end 2nd ‘helper’ app ]
[quote=385749:@William Reynolds]
[ 2nd ‘helper’ app ]
// use a simple Timer to run a shell script, "pgrep your-main-apps-name"
// this return the processID of your hung app
// use another shell to call "kill xxxx" (the processID of your main app)
// then terminate this app
[ end 2nd ‘helper’ app ][/quote]
That’s a pretty heavy handed approach. I’m not sure I’d want to rely on a method that guarantees a hung application that then has to be kill’ed.
I do like that you can prevent the taskbar from loading by editing the Autostart file. But reloading the taskbar seems to be too problematic.
-Wes
I don’t totally disagree - I’m tossing it out there like a hail-mary alley-oop in case anyone sees it and has a better idea. I’m just in the position where I don’t want to roll out a solution where the TaskBar ever shows it’s ugly face, and resurrecting it is 2nd to keeping it suppressed.
Looking forward to other contributions to this thread for sure. I learn so much from other’s input.
Finally back from XDC (awesome) and had time to re-attach my development Pi.
This is tested on Raspbian Stretch:
[code]Public Sub KillPanel()
dim s as new shell
s.Execute “/usr/bin/lxpanelctl exit”
s.Close
End Sub
[/code]
[code]Public Sub LaunchPanel()
dim s as new shell
s.mode = 1
s.Execute “exec /usr/bin/lxpanel -p LXDE-pi &”
// allow panel a moment to start up
app.SleepCurrentThread 50
s.Close
End Sub
[/code]
KillPanel
when your program starts.
LaunchPanel
to allow maintenance.
You don’t need to edit the config to disable the panel.
When I run the “exec /usr/bin/lxpanel -p LXDE-pi &” from a terminal window on the desktop, I get the following:
/home/pi/.themes/PiX/gtk-2.0/gtkrc:326: Unable to locate image file in pixmap_path: "Handles/handle-h.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:329: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:333: Unable to locate image file in pixmap_path: "Handles/handle-v.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:336: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:344: Unable to locate image file in pixmap_path: "Expanders/plus.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:345: Background image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:350: Unable to locate image file in pixmap_path: "Expanders/minus.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:351: Background image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:356: Unable to locate image file in pixmap_path: "Expanders/minus.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:357: Background image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:362: Unable to locate image file in pixmap_path: "Expanders/plus.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:363: Background image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:658: Unable to locate image file in pixmap_path: "Check-Radio/menucheck.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:660: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:667: Unable to locate image file in pixmap_path: "Check-Radio/menucheck_prelight.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:669: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:676: Unable to locate image file in pixmap_path: "Check-Radio/menucheck.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:678: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:728: Unable to locate image file in pixmap_path: "Check-Radio/menuoption.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:730: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:736: Unable to locate image file in pixmap_path: "Check-Radio/menuoption_prelight.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:738: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:744: Unable to locate image file in pixmap_path: "Check-Radio/menuoption.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:746: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:851: Unable to locate image file in pixmap_path: "Check-Radio/checkbox-unchecked.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:853: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:860: Unable to locate image file in pixmap_path: "Check-Radio/checkbox-unchecked-hover.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:862: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:869: Unable to locate image file in pixmap_path: "Check-Radio/checkbox-unchecked.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:871: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:878: Unable to locate image file in pixmap_path: "Check-Radio/checkbox-unchecked.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:880: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:887: Unable to locate image file in pixmap_path: "Check-Radio/checkbox-unchecked-insensitive.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:889: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:896: Unable to locate image file in pixmap_path: "Check-Radio/checkbox-checked.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:898: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:905: Unable to locate image file in pixmap_path: "Check-Radio/checkbox-checked-hover.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:907: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:914: Unable to locate image file in pixmap_path: "Check-Radio/checkbox-checked.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:916: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:923: Unable to locate image file in pixmap_path: "Check-Radio/checkbox-checked.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:925: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:932: Unable to locate image file in pixmap_path: "Check-Radio/checkbox-checked-insensitive.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:934: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:943: Unable to locate image file in pixmap_path: "Check-Radio/option-unchecked.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:945: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:951: Unable to locate image file in pixmap_path: "Check-Radio/option-unchecked-hover.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:953: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:959: Unable to locate image file in pixmap_path: "Check-Radio/option-unchecked.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:961: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:967: Unable to locate image file in pixmap_path: "Check-Radio/option-unchecked.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:969: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:975: Unable to locate image file in pixmap_path: "Check-Radio/option-unchecked-insensitive.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:977: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:983: Unable to locate image file in pixmap_path: "Check-Radio/option-checked.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:985: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:991: Unable to locate image file in pixmap_path: "Check-Radio/option-checked-hover.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:993: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:999: Unable to locate image file in pixmap_path: "Check-Radio/option-checked.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:1001: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:1007: Unable to locate image file in pixmap_path: "Check-Radio/option-checked.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:1009: Overlay image options specified without filename
/home/pi/.themes/PiX/gtk-2.0/gtkrc:1015: Unable to locate image file in pixmap_path: "Check-Radio/option-checked-insensitive.png"
/home/pi/.themes/PiX/gtk-2.0/gtkrc:1017: Overlay image options specified without filename
** Message: x-terminal-emulator has very limited support, consider choose another terminal
E: [pulseaudio] main.c: Failed to kill daemon: No such process
** Message: Connecting ...
** Message: Status changed to down
** Message: Status changed to opened
** Message: Connected to dhcpcd-6.7.1
** Message: Status changed to connected
** Message: eth0: CARRIER
** Message: eth0: Configured 192.168.1.67/24
** Message: wlan0: Not associated
** Message: wlan0: WPA status connected
** Message: wlan0: Received scan results
** Message: va: Name org.bluez owned on DBus
** Message: va: Stopping PulseAudio
** Message: bt: Name org.bluez owned on DBus
** Message: bt: New agent manager found
** Message: bt: New adapter found
And the command prompt never returns until I issue Ctrl-C.
So, I’m not sure that things are going well. The taskbar does reappear but I’m concerned about the various messages that spew forth. Maybe this is nothing to worry about but the fact that the command prompt never returns worries me.
-Wes
The messages are always there, you don’t see it because the window manager throws them away.
You won’t see them from Xojo’s shell command either.
The prompt is there, there’s just too much debris on the screen to see it.
You can hit enter a couple of times to see the prompt.
Change the exec to:
exec /usr/bin/lxpanel -p LXDE-pi 2>/dev/null &"
to make the messages go away.
Hiding the stderr messages doesn’t sound like a good plan to me. Just because the messages are hidden doesn’t mean they aren’t trying to tell you something useful. Again, maybe these messages are nothing to worry about, but until I understand what they are trying to tell me I’m not comfortable with just sweeping them under the rug. I’m also curious as to why it is necessary to create a new shell with the exec command?
Welcome to Unix.
If you think about it, you would never have seen the messages without running lxpanel
from a terminal.
stderr
was originally used for out of band error messages that wouldn’t pollute the output stream.
As an example when sorting a file, you wouldn’t want “Gosh… I don’t know how to sort this character &xxx” in the middle of the sorted output.
Programmers later realized it was also a way to output ‘Status’ (not error) messages, too.
Such as “XXX% complete” for long processes.
It should have been renamed to something like stdstat
, but it’s been there for 40 years.
exec
is supposed to prevent a new shell.
It tells the shell “This command won’t come back and your script is done”.
The shell is supposed to fire off the command and exit.
Normally this prevents a defunct/zombie shell waiting for the command to complete.
It works fine on normal Ubuntu, so it may be an err with Raspbian.
[quote=386249:@John A Knight, Jr]Welcome to Unix.
If you think about it, you would never have seen the messages without running lxpanel
from a terminal.
stderr
was originally used for out of band error messages that wouldn’t pollute the output stream.
As an example when sorting a file, you wouldn’t want “Gosh… I don’t know how to sort this character &xxx” in the middle of the sorted output.
Programmers later realized it was also a way to output ‘Status’ (not error) messages, too.
Such as “XXX% complete” for long processes.
It should have been renamed to something like stdstat
, but it’s been there for 40 years.
exec
is supposed to prevent a new shell.
It tells the shell “This command won’t come back and your script is done”.
The shell is supposed to fire off the command and exit.
Normally this prevents a defunct/zombie shell waiting for the command to complete.
It works fine on normal Ubuntu, so it may be an err with Raspbian.[/quote]
John,
Thank you for the useful insights. I am new to Linux and it has been an interesting transition. The idea of using stderr for out of band messages is obvious now that you’ve explained it
And that helps to explain some of the seemingly arbitrary ways I’ve seen various command line utilities spew their output.
-Wes