Need a script to restart window manager once.

interpretive language scripts


Moderator: Forum moderators

Post Reply
Gary73
Posts: 9
Joined: Sun Mar 28, 2021 1:29 am
Been thanked: 5 times

Need a script to restart window manager once.

Post by Gary73 »

Hi there.

I am having a problem and I was wondering if I could address this with a script.

I have a electronics program I run (EasyEDA Pro), which requires and "OpenGL enable video card" to run smoothly. I have an old video card, a Radeon 6540 which I have placed in my computer (A Dell Optiplex 3010). Everything works great, with one caveat - after the operating system loads, I must restart the window manager, ie open terminal and type "restartwm" for the program to operate smoothly. If I do not do this, the program runs very poorly and even gives a warning that I need a video card that has OpenGL enabled. Once restarted this error goes away.

So immediately after startup I go to terminal and type "restartwm" every startup to solve this problem.

I am using Bionic Puppy 64 Bit version by the way.

I am not opposed to automating the "restartwm" command after startup, but if I put a script in the Startup folder, it creates an infinite loop of startups.

So is there any easy way to restart the windows manager just one time?

I think I can write a variable to a file like a 0 before the windows manager starts, and then check if it is 0. If the file contains 0, write a 1 to the file and restart wm. Or maybe even set some global environmental variable.

But there must be a better way to address this situation.

Even if there is a better solution than restarting the windows manager (getting the card to work properly on the first startup), I am still curious to see how the problem of restarting the windows manager just once could best be accomplished. Does anyone have any thoughts or suggestions?

williwaw
Posts: 1594
Joined: Tue Jul 14, 2020 11:24 pm
Has thanked: 145 times
Been thanked: 291 times

Re: Script to restart window manager once.

Post by williwaw »

the infinite loop is because the scripts in the startup folder execute after the window manager starts. Maybe there is a way to run the script befor the WM comes up, but I am not enough in the know to advise about bionic. Perhaps ask in the bionic section?

gives a warning that I need a video card that has OpenGL enabled.

do you have two vidieo cards on board?

Last edited by williwaw on Fri May 26, 2023 7:23 pm, edited 1 time in total.
Gary73
Posts: 9
Joined: Sun Mar 28, 2021 1:29 am
Been thanked: 5 times

Re: Script to restart window manager once.

Post by Gary73 »

Actually, I have one video card in a PCIe slot, but there is video built into the motherboard. I am running the puppy from a thumb drive though. I plugged it into a different Dell Optiplex 7010, and I get the same behaviour (must restartwm) before program runs correctly.

User avatar
mikewalsh
Moderator
Posts: 5573
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 570 times
Been thanked: 1679 times

Re: Script to restart window manager once.

Post by mikewalsh »

@Gary73 :-

Um.....is it the "X" server you want to restart, or is it just the window manager?

Code: Select all

restartwm

.....is a sym-link to

Code: Select all

wmexit

.....which is a "multi-case" script. Certain other commands also link to this.

If 'wmexit' is called from 'restartwm' it thinks you want to run

Code: Select all

xwin

.....and this is what restarts the "X" server. If "X" is restarted, everything in /root/Startup is re-run again.....and this, if I'm correct, is why you end up with an infinite loop of restarts.

Maybe,

Code: Select all

jwm -restart

.....would be what you want, as this just re-starts JWM itself. Or there again, maybe it wouldn't; this is not exactly one of my 'strong' areas.

Worth a try, certainly. Or perhaps others can offer their thoughts on this one?

Mike. ;)

Puppy "stuff" ~ MORE Puppy "stuff" ~ ....and MORE! :D
_______________________________________________________

Image

User avatar
bigpup
Moderator
Posts: 6268
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 732 times
Been thanked: 1292 times

Re: Script to restart window manager once.

Post by bigpup »

the program runs very poorly and even gives a warning that I need a video card that has OpenGL enabled. Once restarted this error goes away.

OpenGL should be working when it first boots.

Bionicpup64 8.0 has a bunch of bug fixes and improvement provided by Quickpet -> Info -> Bionicpup updates
One of them is about a fix for GLX.
GLX is needed by openGL.

So, have you done the update and saved changes to the save.
Now booting using these changes?

You need to look in Pup-Sysinfo -> Devices -> Display

Post what xorg driver is being used.

Under loaded modules Is it showing glx?

Usually if a added graphics card is installed in a desktop computer.
The graphics integrated in the CPU is deactivated, so the add on card is used.
So above info will tell use what graphics hardware is being used.

Could check the bios setup settings to see what graphics hardware is enabled and which one is disabled.

Forum Global Moderator
The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
MochiMoppel
Posts: 1115
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 17 times
Been thanked: 359 times

Re: Script to restart window manager once.

Post by MochiMoppel »

Gary73 wrote: Fri May 26, 2023 5:54 pm

I am not opposed to automating the "restartwm" command after startup, but if I put a script in the Startup folder, it creates an infinite loop of startups.

So is there any easy way to restart the windows manager just one time?

In principle the Startup folder is the right place for your script. This should prevent the infinite loop:

Code: Select all

#!/bin/sh
[ -e /tmp/wmexitmode.txt ] || restartwm

The file /tmp/wmexitmode.txt doesn't exist after boot. It is created by wmexit, to which restartwm is symlinked.
So the script runs restartwm only if /tmp/wmexitmode.txt does not yet exist, i.e. it can run restartwm only once.

Gary73
Posts: 9
Joined: Sun Mar 28, 2021 1:29 am
Been thanked: 5 times

Re: Script to restart window manager once.

Post by Gary73 »

Thanks everyone for their input. This is a very weird problem to me as a program will only run correctly after restartwm.

I have tried a third computer now, a Dell Latitude E6540 with graphics built in. I get the same behaviour. Program runs correctly only after restarting windows manager (restartwm).

So I am thinking this is not a hardware issue. I'm thinking the installation of a graphics card has been a red herring, and this is more of a software issue. It is not a big deal for me to restartwm before loading the program, its just peculiar to me.

FYI, I also did the updates and checked the PupSysinfo both before and after restarting the window manager. The PupSysinfo did not change and is listed below.

Code: Select all

Xorg Startup Log (/var/log/Xorg.0.log):
• Xorg Driver in use: radeon
• Loaded Modules: ati dbe dri2 evdev fb fbdevhw glamoregl glx libinput modesetting ramdac synaptics
• X.Org version: 1.19.6

OpenGL 2D/3D Rendering:
• Direct Rendering: Yes
• Vendor: Intel Open Source Technology Center
• Renderer: Mesa DRI Intel(R) Haswell Mobile 
• Version: 3.0 Mesa 18.2.2

After reading the following https://wikka.puppylinux.com/AddCommandsStartupShutdown, I instituted the following inelegant fix below which runs "restartwm" just once after startup.

First I added the following line to /etc/rc.d/rc.local. This file appears to be accessible to run scripts before XWindows starts. I wrote the word "false" into a file named "restarted" at startup before XWindows is started.

Code: Select all

echo "false" > /var/tmp/restarted

Then in the /root/Startup folder I made a script called "restart-once" and made it executable. Then sometime after XWindows has started this script runs. If checks to see if restarted is false and if so writes true to restarted, then runs "restartwm"

Code: Select all

#!/bin/sh
if [ $(</var/tmp/restarted) = false ]
    then
    echo "true" > /var/tmp/restarted
    restartwm
fi

In the spirit of not littering (although probably not necessary) I added the line below to /etc/rc.d/rc.shutdown

Code: Select all

rm -f /var/tmp/restarted
Post Reply

Return to “Scripts”