You are not logged in.

#1 2020-12-08 17:51:26

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

[Solved] How to switch between Openbox and Fluxbox?

Using lxde-Openbox - I am having difficulty getting a script to work. The commands work fine in a terminal.

I am switching from openbox to fluxbox and back.

So, to get out of Openbox while staying in the lxde session, I am using:

#!/bin/bash
# Small script to change to fluxbox during session.
pkill -f tint2
pkill -f fbpanel
pkill -f conky
pkill -f compton
pkill -x openbox
/usr/bin/startfluxbox

This works flawlessly, allowing me to keep all of the lxde bells and whistles while still shutting down openbox and starting fluxbox as if it took it's place.

The problem comes in when I try to switch back (of course).

From the fluxbox session,

pkill -x fluxbox

and then:

openbox-lxde

from a terminal, seems to work fine. (So long as I keep the terminal open.)

Trying to do this from a script though, freezes the screen with the fluxbox visuals still there, and nothing working but the mouse movement (no clicking).

Edit* - Maybe places openbox below a frozen "visual" fluxbox . . .

I cannot re-enable openbox either, as it then defaults to it's own configuration.

I suppose none of this is a huge deal, as you can still just log out to get back to Openbox, but having the toggle would be pretty cool too.

Last edited by sleekmason (2020-12-10 15:02:28)

Offline

#2 2020-12-08 22:06:43

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,428

Re: [Solved] How to switch between Openbox and Fluxbox?

Take a look at the default Fluxbox menu. Fluxbox is one if the few window managers that lets you switch window managers without exiting the X-session. One of the defaults is to switch to open box, I believe. You may be able to edit the Fluxbox menu to call your open box-lxde script; Fluxbox may do some internal shutdown process and launch openbox-lxde.

The default menu should be in /use/share/Fluxbox (maybe /use/local/share/Fluxbox)

Edit - the option to start other window managers has been removed from the default fluxbox menu

And fluxbox no longer supports the feature without patching.

Last edited by PackRat (2020-12-08 22:57:48)


You must unlearn what you have learned.
    -- yoda

Offline

#3 2020-12-09 04:44:06

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

Re: [Solved] How to switch between Openbox and Fluxbox?

PackRat wrote:

Take a look at the default Fluxbox menu. Fluxbox is one if the few window managers that lets you switch window managers without exiting the X-session. One of the defaults is to switch to open box, I believe. You may be able to edit the Fluxbox menu to call your open box-lxde script; Fluxbox may do some internal shutdown process and launch openbox-lxde.

The default menu should be in /use/share/Fluxbox (maybe /use/local/share/Fluxbox)

Edit - the option to start other window managers has been removed from the default fluxbox menu

And fluxbox no longer supports the feature without patching.

[restart] (Start Openbox) {openbox-lxde}

This works!  Mostly.

Is there a way to use this command in a script so I can add back in the panel and other extras?

Anyway,  Awesome!  I spent hours trying to figure this out.

I wound up adding the Openbox configurations to be able to open it on it's own with or without lxde.  In the end, I found it saved very little in ram vs the lxde mix. But choice is good:)

Offline

#4 2020-12-09 07:03:26

ohnonot
...again
Registered: 2015-09-29
Posts: 5,534

Re: [Solved] How to switch between Openbox and Fluxbox?

Sounds like you found a solution, but let me just say that your approach as per title is completely wrong; instead you should find out why things fail when executed non-interactively.

I also wonder what "openbox-lxde" is, my openbox only starts as openbox...

Also, the openbox executable has a "--replace" command line option.

If you end the process that started the graphical session, the graphical session ends; in most cases it would bring you back to the login manager. So you have to ask yourself whether fluxbox (the executable, not the session) or openbox (the executable, not the session) were the first process.

All this sounds vague and mushy because I have no insight in how you set things up.


Give to COVAX! Here or here. (explanation)

Offline

#5 2020-12-09 10:51:31

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,428

Re: [Solved] How to switch between Openbox and Fluxbox?

Is there a way to use this command in a script so I can add back in the panel and other extras?

Probably. Check out Fluxbox Command in the man page. I believe that is a way to use Fluxbox internal commands in a script (I have never used it). Otherwise, you would have to know the internal commands Fluxbox is using and add that in your script.

In some ways, that may actually be what you want to do with this exercise. A more complex bash script for switching window managers in an lxde session.

Last edited by PackRat (2020-12-09 16:35:12)


You must unlearn what you have learned.
    -- yoda

Offline

#6 2020-12-09 13:49:51

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

Re: [Solved] How to switch between Openbox and Fluxbox?

PackRat wrote:

Is there a way to use this command in a script so I can add back in the panel and other extras?

Probably. Check out Fluxbox Command in the man page. I believe that is a way to use Fluxbox internal commands in a script (I have never used it). Otherwise, you would have to know the internal commands Fluxbox is using and out that in your script.

In some ways, that may actually be what you want to do with this exercise. A more complex bash script for switching window managers in an lxde session.

You are a wealth of information, Thank you:)

When/if I get it wrapped up, I'll post it here as well.

Having a great deal of fun making all of this work together.  Good Covid relief!

Offline

#7 2020-12-09 14:05:21

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

Re: [Solved] How to switch between Openbox and Fluxbox?

ohnonot wrote:

Sounds like you found a solution, but let me just say that your approach as per title is completely wrong; instead you should find out why things fail when executed non-interactively.

I also wonder what "openbox-lxde" is, my openbox only starts as openbox...

Also, the openbox executable has a "--replace" command line option.

If you end the process that started the graphical session, the graphical session ends; in most cases it would bring you back to the login manager. So you have to ask yourself whether fluxbox (the executable, not the session) or openbox (the executable, not the session) were the first process.

All this sounds vague and mushy because I have no insight in how you set things up.

Lol! I had begun to edit it twice to try to explain better, but couldn't.

Lxde literally has it's own package (task?) for Openbox, wherein they integrated openbox into the DE.  Really the only changes are for the autostart file, so you can use the fancy graphical interface, and the rc.xml file.  Why they didn't just call the existing files Openbox produces, who knows?

What this does allow for though, is keeping everything open when you switch, rather than bringing you to login.

So you have to ask yourself whether fluxbox (the executable, not the session) or openbox (the executable, not the session) were the first process.

exactly!  Having the main environment running while just changing the manager itself is pretty cool:)

The --replace option looks interesting too.

Nothing to vague!  Your information is always helpful, and very welcome! I cherish insights. big_smile

Offline

#8 2020-12-09 15:58:04

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

Re: [Solved] How to switch between Openbox and Fluxbox?

#!/bin/bash
# Small script to change to openbox during session.
killall fluxbox &
openbox &
tint2 -c ~/.config/tint2/tint2-pager &
fbpanel -p pager &
killall volumeicon

Ffs Killall wins the day.

But still have one problem.
The last three items after openbox will not work!  What am I missing here?

The tint2 and fbpanel lines are working well in other scripts, and I can toggle both after the switch to Openbox.

Other than that, switching now work well:)

Last edited by sleekmason (2020-12-09 16:02:05)

Offline

#9 2020-12-09 16:08:05

damo
....moderator....
Registered: 2015-08-20
Posts: 6,664

Re: [Solved] How to switch between Openbox and Fluxbox?

At first glance...

The ampersand shouldn't be needed after "killall fluxbox" since the process will exit after completion;

The "openbox &" command has started it in another process, so it won't see your subsequent commands. Why not put them in the openbox autostart, so they run in openbox after it starts?


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#10 2020-12-09 16:20:20

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

Re: [Solved] How to switch between Openbox and Fluxbox?

damo wrote:

At first glance...

The ampersand shouldn't be needed after "killall fluxbox" since the process will exit after completion;

The "openbox &" command has started it in another process, so it won't see your subsequent commands. Why not put them in the openbox autostart, so they run in openbox after it starts?

Yes, I had tried without the & with no success.  That was my final go before posting.

I also tried making another script to call this one, and then the other commands, but again, it would just do the openbox change and stop. Just weird.

So, I do have those in the openbox autostart if starting Openbox at Lightdm login, but because I am still in the lxde session, the autostart used by the session has already initialized.

Because I need Fluxbox to be independant as well, Some of the items get duplicated in fluxbox, or when going back the third time . . . i.e volumeicon, only used in Fluxbox.

So, the very last thing I need to do is initialize the panel either through the two lines above, or with the simple command of toggle.monster, as both commands are included in the toggle. oh, and kill the damn volumeicon!

After this, it should work quite well I think. Can you help me write this correctly?

Offline

#11 2020-12-09 16:51:52

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,428

Re: [Solved] How to switch between Openbox and Fluxbox?

sleekmason wrote:

Because I need Fluxbox to be independant as well, Some of the items get duplicated in fluxbox, or when going back the third time . . . i.e volumeicon, only used in Fluxbox.

pkill -x volumeicon ; volumeicon &

or something similar (killall -q) in your ~/.fluxbox/startup file should handle that. Kill volumeicon then restart it.

Last edited by PackRat (2020-12-09 16:54:30)


You must unlearn what you have learned.
    -- yoda

Offline

#12 2020-12-09 17:21:34

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

Re: [Solved] How to switch between Openbox and Fluxbox?

PackRat wrote:
sleekmason wrote:

Because I need Fluxbox to be independant as well, Some of the items get duplicated in fluxbox, or when going back the third time . . . i.e volumeicon, only used in Fluxbox.

pkill -x volumeicon ; volumeicon &

or something similar (killall -q) in your ~/.fluxbox/startup file should handle that. Kill volumeicon then restart it.

Ha! good thinking. smile Take care of it on the front end.  I suppose this may be a better way than the script for conky, compton, and a couple of others.

This still leaves the toggle.monster or the above lines for the panel to be activated after openbox. Just don't understand why they won't unless manually toggled.

Even though the windows remain active during the change, could the change of session be causing problems for bash to stop the script after the session change?

Offline

#13 2020-12-09 17:32:40

damo
....moderator....
Registered: 2015-08-20
Posts: 6,664

Re: [Solved] How to switch between Openbox and Fluxbox?

Have you looked at man openbox? Can't you do

openbox --restart|--reconfigure[/em]

Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#14 2020-12-09 18:06:17

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

Re: [Solved] How to switch between Openbox and Fluxbox?

damo wrote:

Have you looked at man openbox? Can't you do

openbox --restart|--reconfigure[/em]

yes, It does the same, but still won't initiate

tint2 -c ~/.config/tint2/tint2-pager
fbpanel -p pager

Whether they are together in a toggle script or separate. Afterwards, no problem.

This, because 'toggle.monster'(above lines) is already initialized once on login through the lxde autostart.

So the only change is the manager itself, allowing for everything to remain operational in the system even during the changeover. i.e. no logout, no loss of currently running processes, windows, eye candy.

*Edit - I suppose the lxde start script could be called again? but same problem I would think.  Also, just enabling the panel is the last problem. Literally just need to call the panel after initialization, and done.

Does bash stop reading the script after the window manager change even if in the same lxde session with the terminal window open?

#!/bin/bash
openbox --restart|--reconfigure[/em]
tint2 -c ~/.config/tint2/tint2-pager
fbpanel -p pager

Still won't allow for the panel to show.

As soon as Openbox initializes, I can toggle the panel.

Last edited by sleekmason (2020-12-09 18:14:27)

Offline

#15 2020-12-09 18:11:13

damo
....moderator....
Registered: 2015-08-20
Posts: 6,664

Re: [Solved] How to switch between Openbox and Fluxbox?

Why isn't openbox reading its autostart? That is what --reconfigure is supposed to do.

Last edited by damo (2020-12-09 18:15:14)


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#16 2020-12-09 18:18:21

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

Re: [Solved] How to switch between Openbox and Fluxbox?

damo wrote:

Why isn't openbox reading its autostart? That is what --reconfigure is supposed to do.

AFAICS you are trying to send commands to a different shell, which won't work without using an export command.

$ export --help
export: export [-fn] [name[=value] ...] or export -p
    Set export attribute for shell variables.
    
    Marks each NAME for automatic export to the environment of subsequently
    executed commands.  If VALUE is supplied, assign VALUE before exporting.
    
    Options:
      -f	refer to shell functions
      -n	remove the export property from each NAME
      -p	display a list of all exported variables and functions
    
    An argument of `--' disables further option processing.
    
    Exit Status:
    Returns success unless an invalid option is given or NAME is invalid.

*Edit - I suppose the lxde start script could be called again? but same problem I would think.  Also, just enabling the panel is the last problem. Literally just need to call the panel after initialization, and done.

Yeah, thought of that while you were typing. just getting the panel may be simpler?

If the export is the problem, How does that work for this script?

Offline

#17 2020-12-09 18:28:04

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

Re: [Solved] How to switch between Openbox and Fluxbox?

PackRat wrote:
pkill -x volumeicon ; volumeicon &

or something similar (killall -q) in your ~/.fluxbox/startup file should handle that. Kill volumeicon then restart it.

Ha! This got rid of all but the one instance created in fluxbox.  That instance will still have to be killed in the openbox script:)

Offline

#18 2020-12-09 18:35:48

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,428

Re: [Solved] How to switch between Openbox and Fluxbox?

How are you actually set up?

I haven't used lxde in years so I don't know what it's starting up for you. Doesn't it start lxpanel as the default panel for openbox? But you are starting tint2 and fbpanel with your script. You could probably change the default panel in the lxde start up file.

One method to look into would be to use each window manager's start up script to kill and start the various panels and other applications you're using. Each start up script would:

1. Kill the previous applications
2. Start applications.

Another possible option would be replace the Fluxbox default panel with fbpanel (the fb stands for fluxbox after all). You can use the Fluxbox configuration to hide the default panel; a simple edit of the ~/.fluxbox/init file will prevent the Fluxbox system tray from starting so fbpanel can handle that.

Then your script would just have to toggle the window managers and be run with key bindings.


You must unlearn what you have learned.
    -- yoda

Offline

#19 2020-12-09 19:00:32

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

Re: [Solved] How to switch between Openbox and Fluxbox?

PackRat wrote:

How are you actually set up?

I haven't used lxde in years so I don't know what it's starting up for you. Doesn't it start lxpanel as the default panel for openbox? But you are starting tint2 and fbpanel with your script. You could probably change the default panel in the lxde start up file.

One method to look into would be to use each window manager's start up script to kill and start the various panels and other applications you're using. Each start up script would:

1. Kill the previous applications
2. Start applications.

Another possible option would be replace the Fluxbox default panel with fbpanel (the fb stands for fluxbox after all). You can use the Fluxbox configuration to hide the default panel; a simple edit of the ~/.fluxbox/init file will prevent the Fluxbox system tray from starting so fbpanel can handle that.

Then your script would just have to toggle the window managers and be run with key bindings.

the lxde session never closes . .  that's the neat part:) The startup is already initialized, so no more start up for Openbox. (unless you log out and specifically use only Openbox).
The panel idea is a good one . .  Another thing I thought of was using a wbar instance with just three icons for choosing the panel.  Tint2, fbpanel, monsterpanel.

Incorporate that for fluxbox as well, so again offering more options. I may try to get this to work anyway in the future.

Realistically, the best way would just be if the script would continue, set the panel and remove the volumeicon.

Wouldn't take long to clone the lilidog build in my signature and check it out:)  You would see everything I'm talking about.

Everthing we are talking about here can be seen/worked on in the live environment as well.  Log out, back in, etc . .
It's as easy as downloading the file, opening a terminal in the folder, and:

Sudo apt install live-build
sudo lb build

big_smile  big_smile

Last edited by sleekmason (2020-12-09 19:04:45)

Offline

#20 2020-12-09 19:32:38

damo
....moderator....
Registered: 2015-08-20
Posts: 6,664

Re: [Solved] How to switch between Openbox and Fluxbox?

sleekmason wrote:

...

If the export is the problem, How does that work for this script?

I decided it is irrelevant, but you must have worked on your reply while I edited my post!


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#21 2020-12-09 21:52:55

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

Re: [Solved] How to switch between Openbox and Fluxbox?

damo wrote:
sleekmason wrote:

...

If the export is the problem, How does that work for this script?

I decided it is irrelevant, but you must have worked on your reply while I edited my post!

Yes.  big_smile

So check this out. If the change in window managers is causing the script to fail after the change, is there a way to reinitialize the script afterwards?

Maybe from another script that first calls this one, sleeps for a second, and then calls the panel and icon removal?  I tried this once and it did the same, cutting off the script after the command, but what I made was also very simple.

Command to somehow restart the script after the change . . .jeez louise.

Offline

#22 2020-12-09 22:11:14

damo
....moderator....
Registered: 2015-08-20
Posts: 6,664

Re: [Solved] How to switch between Openbox and Fluxbox?

^ You can probably control everything with systemd. But don't ask me how monkey


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#23 2020-12-09 22:13:22

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

Re: [Solved] How to switch between Openbox and Fluxbox?

Hold the phone!! I pulled a good one.

I never changed the menu entry back from;

[restart] (Start Openbox) {openbox-lxde}

to point back to the script.  FFS.

So, Hold that thought until I try a few things and try not to laugh to hard.  big_smile

Edit* Really glad I got to ride today. Sorry to those who have spent time on this after that point.

Sometimes I need all the help I can get.  Probably still will.

Edit2*  I tried adding toggle.monster to the menu entry, and while it brought up the panel, it froze the screen.

Last edited by sleekmason (2020-12-09 22:51:29)

Offline

#24 2020-12-09 23:43:36

sleekmason
zoom
Registered: 2018-05-22
Posts: 584

Re: [Solved] How to switch between Openbox and Fluxbox?

#!/bin/bash
# Small script to change to openbox during session.
fluxbox-remote exit & openbox-lxde
tint2 -c ~/.config/tint2/tint2-pager 
fbpanel -p pager

The fluxbox-remote exit does the trick:)
This now sets the panel in Openbox, but also now initializes one in fluxbox as well. (because there is always something).

Probably I will get this figured from here:)

Thank you for all your suggestions.

Offline

#25 2020-12-09 23:58:49

damo
....moderator....
Registered: 2015-08-20
Posts: 6,664

Re: [Solved] How to switch between Openbox and Fluxbox?

Keep on diggin', you'll find the gold in the end big_smile


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

Board footer

Powered by FluxBB