Using .xinitrc to launch programs at startupForum: X and Fluxbox Topic: Using .xinitrc to launch programs at startup started by: arkroan Posted by arkroan on June 12 2006,15:06
Hello Dsl users,I am a newbie in linux (and dsl). My first contact was with red hat 6.2 on my 486 dx5(or dx4?). I have not used linux since.. A couple of months ago my hard drive stopped working (in windows) and I was thanking God when i managed to retrieve all the data with a Mepis distro. This incident aroused my curiosity about linux and invoked the desire to learn how to use linux and unix-based operating systems. I have already installed a fedora distro in my laptop with dual boot, and i am trying to make gentoo work in another laptop. Now i have a laptop i bought from ebay for £20 and i want to give it to my parents in the form of a digital picture frame. The laptop is a Compaq Armada 1580 DT. I have managed to install DSL (after four days reading posts and books for linux - thanks to the damn screen ) to this old guy and he works better than i have expected..(with only 32MB). Dsl is becoming one of my favorite distros since it runs on every old junk ( respect to third age laptops) as good as it runs on my new compaq r4000!!! I have installed GQview and trying to make it work at startup with slideshow in fullscreen.I understand that I have to mess with the .xinitrc file to make it work. What I did was to append " /usr/bin/gqview -f -s &>/dev/null & " in the end of the file. Ha ... Didn't work.. Then i did " /usr/bin/gqview -f -s &>/dev/null & exec fluxbox 2>/dev/null " same thing.. Then i have putted the line in the middle of the case function (which is already there) and prayed. Ok this starts but the Gqview window is between me and the fulscreen slideshow in the background... Not nice at all!!! After several experiments (trial and error here i come) i have managed to make it work without displaying the GQview window. i have left everything else as it was (i do not know what everything exactly does inside that file)
If i ommit the "&" at the end of the sentence it doesn't put the window in front of the slideshow.The problem is that untill i quit the gqview it doesn't load the background. I do not really care about the background but i want everything loaded before the slideshow begins. Can i use cli commands to minimize the window of Gqview? I am not sure where to put xset -s off , xset -s noblank, as well. Any help and ideas would be appreciated. P.S. Fluxbox is really nice!!!! P.S. 2 I am really sorry for the long post. I wanted to introduce myself before discussing this issue. Posted by kerry on June 12 2006,21:01
#a few lines with if's and kbd specs, icons etc.torsmo 2>/dev/null & xset -s off &>/dev/null & xset -s blank &>/dev/null & sleep 2 exec /usr/bin/gqview -f -s & #then the case function: case $DESKTOP in fluxbox ) fluxter &>/dev/null & wmswallow -geometry 70x80 docked docked.lua & exec fluxbox 2>/dev/null ;; *) ./.background sleep 2 exec jmw 2>/dev/null ;; *) exec fluxbox 2>/dev/null ;; *) exec fluxbox 2>/dev/null esac Try that. Posted by arkroan on June 12 2006,21:50
Works like charm !!!!!Thank you very much kerry!!! If you do not mind and you have the time could you please explain me why it needs "sleep 2 " after the xset command , and what is the difference in using "exec" rather than just writing the path (As i did in the case command..) Thanx again for you time and reply ! Posted by arkroan on June 12 2006,22:00
oups, Actually it worked for the exit startx procedure. when i rebooted the laptop, it did again the same thing: starts gqview , fullscreen slideshow on the background and the gqview window in front of the slideshow. Is there any way to minimize the main window of the gqview through .xinitrc file after it loads? Posted by kerry on June 12 2006,23:10
Maybe try the -geometry (size) and see if that works. "sleep" pause's it so everything else has time to load before gqview. If i'm understaning you right. you need gqview to load first then, so change to.exec /usr/bin/gqview -f -s & sleep 5 torsmo 2>/dev/null & xset -s off &>/dev/null & xset -s blank &>/dev/null & #then the case function: Hopefully that gives enough time for gqview to finish loading then load the others. Posted by mikshaw on June 13 2006,04:49
Using the exec command will prevent everything after that command from running, so it should not be there unless gqview is the only thing you want to run.
Posted by kerry on June 13 2006,07:25
I been testing this in qemu. I have some questions. Will you be using the desktop? Or do you just want the slide show?cause i can get it loading just the slide show with " gqview -s -f " and the rest of the desk top will stop loading till you close the slide show. also you can resize the window using gqview options> window tab >set to remeber than adlust the main window to the size you want to start. Posted by kerry on June 13 2006,07:33
so try this and let me know if that's what you want->gqview -f -s torsmo 2>/dev/null & xset -s off &>/dev/null & xset -s blank &>/dev/null & With this set up you would have to exit gqview completely than the desktop will finish loading. Posted by arkroan on June 13 2006,11:51
Thank you mikshaw for making this clear. Kerry i appreciate your help. The thing is that i do not want it like that. This is my major problem because i am going to havesome other programs loading in the background when slideshow is active. So i am going to need the desktop (for troubleshooting). I want to fully load the desktop and after that, call Gqview -s -f . When the slideshow is active I am planning to use a program (or a script if i manage to understand how it works) to browse the cd at regural time intervals. New fotos are to be added in Gqview's photo path when found. Posted by mikshaw on June 13 2006,13:29
kerry: The ampersand is not necessary with xset, because it does not continue running after it does its quick business. In fact, running two instances of xset which are setting different values to the same parameter simultaneously may be a bad thing.The "s blank" and "s off" parameters are incompatible. If you want to turn off screen blanking, you should not have "s blank". Simply using either "s noblank" or "s off" should be sufficient, so the only one xset command is needed. arkroan: Your very first post should be the closest of any that has been posted. The only thing I think is missing is the ampersand (&) at the end of the gqview command. Without it the next command is not run until after gqview is closed, which is why you didn't get a background. Also, having multiple asterisks (*) in a case command is useless, since only the first one will apply. If you look at the original, your first asterisk should instead be "jwm", and the last one is a double, which will never get used. Posted by kerry on June 13 2006,15:05
mikshaw, I was just going off what was posted, i just copied and pasted what was there. I left the (&) out on purpose so the slide show could load with out the window in the front. Do you know what the command would be to minimize gqview main window so it's not in front of the slide show on start up?arkroan, i'll keep looking and trying in qemu. I'm sure the solution is right there but i'm missing it. Posted by kerry on June 13 2006,17:38
I'm thinking just go with this " gqview -s -f && ". You can always just exit gqview to modify. example: gqview -s -f /home/dsl/pics && Posted by arkroan on June 13 2006,19:03
mikshaw: The case command was already there when i installed dsl, i cannot understand the use of it though. I have also noticed the case statements that are not needed, but because i do not know the spelling i could not understand which characters are required and which are not in a statement. (end of statement is ";;" or " *)" ) What is the use of jmw?? (ends a statement?). Is there any possibility to execute the program outside the case statement (after the case is executed)? kerry: I was thinking of that too.. Having an instruction through the command line to minimize the window would be handy.. I want to thank you for your replies kerry & mikshaw. it is so good to see people willing to help. Posted by mikshaw on June 13 2006,19:34
kerry: Please be careful about typos =o)The line gqview -s -f /home/dsl/pics && will likely cause trouble (or at least it serves no purpose) because "&&" means "If the prior command is successful, then run the following command". There is nothing following "&&", so no command will run. I can't say if it will cause an error or if it will just do nothing, waiting for input. arkroan: Case is a fairly commonly used command that performs different actions depending on the content of whatever immediately follows the word "case". It's the equivalent of "if something; do this; elif something else; do that; else do the other thing; fi", but it's just easier and cleaner than a pile of elifs. In the default .xinitrc case, the $DESKTOP variable is checked to see what is listed in $HOME/.desktop, and is compared to each section of the case block, starting from the top and continuing until it finds a match. Each section of a case block starts with an expression followed by ")", then the commands to run if the expression matches $DESKTOP, and ends with ";;". Case often contains a "*" as the last expression, which is a wildcard that matches anything, including a nil value. This is useful if you need to run a command if there is no match. The "jwm" string is one of those expressions. If "jwm" is listed after "wm: " in /home/dsl/.desktop, those commands following it will be run and jwm will be started as the window manager. Posted by kerry on June 13 2006,21:51
The line gqview -s -f /home/dsl/pics && It's not a typo, i tested on qemu first. It(&&) serves the same purpose as not having nothing there but is not suppose to hault the start up. Can also use \ instead, but that didn't seem to work as well. I found the use of (&&) through lots of reading. Milkshaw, were almost there, but i need a command to minimize the window that can be used in /.xinitrc or with /.torsmorc's exec feature. I've been looking at torsmo to run the command instead as it can run as if it were in terminal(shell command). I can't seem to find the command to minimize windows(gqview main window). Any ideas? Posted by mikshaw on June 13 2006,22:24
I don't think gqview has that ability, especially considering window minimization is (or should be) the job of the window manager.What I'm having trouble understanding is what window is getting in the way? If you use the "-f" (fullscreen) parameter, there should be nothing displayed other than the image window. I've never used the "-s" parameter, so i don't know if there may be a conflict between the two....i'll test it out in a little bit, and next time i get back here i'll hopefully understand the situation better. It may also be fluxbox. If I remember correctly, the default settings prevent a true fullscreen application going over the toolbar. Maybe it's preventing gqview from from going fullscreen. In the meantime, I'd suggest looking in gqview's preferences to see if there might be a setting that will help (I didn't see one, but i looked quickly). Posted by mikshaw on June 13 2006,23:26
Ok, here's what I've come up with...It doesn't work properly with fluxbox stable, and it doesn't work properly with icons. So, you'll need to edit /home/dsl/.desktop to look like this:
This will use JWM instead of Fluxbox, and won't use icons. You might also want to comment out the dillo line from .xinitrc Here's what my .xinitrc looks like for this, using DSL 2.4 and gqview-1.2.2.uci:
Posted by kerry on June 13 2006,23:45
But he want's the full desktop and setting it so you can use any desktop is much better.
Posted by mikshaw on June 14 2006,00:32
But it doesn't work. There's something about gqview that causes it to screw up when certain applications are opened. In fluxbox, the main window opens for some reason, and there's no way to configure it otherwise. In jwm with icons, the toolbar pops up in front of the image window, most likely because jwm is refreshing itself.I'll play around with it a bit more, but so far it seems as though the only way to be able to pick an arbitrary window manager to use is to go with something other than gqview. Maybe xscreensaver would be more appropriate. Posted by kerry on June 14 2006,00:56
Yeah, that's what i was thinking there might be someting else that works that way. I've got rest my eye's for now "Tag" your it.
Posted by arkroan on June 14 2006,12:13
kerry and mikshaw i think you have spend too much time to it. It is not worth it.I really apreciate you help and all the effort. But since Gqview doesn't cooperate, I would propably use another application to do the job. I will have a go with the settings in your .xinitrc mikshaw (although I do not like jmw). Thank you again for all the effort and time you have spent on my query. I will post when I will have this up and running. For the time being i am occupied with some exams. (university student see) You have been very helpfull and i really appreciate it. Posted by mikshaw on June 14 2006,14:14
I have something that seems to work with fluxbox and with icons, although it's not 100% reliable. It seems that gqview or fluxbox (not sure if it's one or both to blame) is VERY sensitive to other applications opening at the same time, and the result seems to be that gqview gets confused about what it's supposed to do. And it is not entrely consistent about it. Gqview also has trouble when other applications open after it, and configuring fluxbox to not focus new windows doesn't seem to be a useful alternative. Mainly I think GQview is the main issue, though, considering that there seems to be no logical reason for it to open its main window regardless of what's happening around it.I don't know anything about how X events work, so i could only play around with different things until something seemed to work. And this seems to work on my machine....
Everything else in .xinitrc is the same as in vanilla dsl 2.4, except i also commented out dillo. Depending on your processor speed, you may need to increase the sleep time if you're still getting the window popping up. Also note that I moved wmswallow to the top of the list to give it more time to initialize (it seems to take a bit longer than the other apps). Posted by arkroan on June 15 2006,11:16
This does not work mikshaw. It boots up the Fluxbox, loads everything else and stops there. It doesn not load the Gqview.What does fluxpid=$ do? $ is a pointer right??. Pid is the process id number. So i am imaging that you tell it to wait until a process (fluxbox?) completeley loads? Why did you use the wait $fluxpid after the GQview command? I tried to install Feh but it gives me an error : no acceptable c compiler found in $path. i know that there the TCC compiler but it doesn't look for that at all. How can I point the "./configure" command to look for the tiny c ? Posted by mikshaw on June 15 2006,14:23
The "$" in Bash signifies that the following string should be interpreted as a variable, and in Bash, "$!" is an internal variable that represents the pid of the last job run in the background (in this case, fluxbox &).Since gqview was being annoying when it was not the very last program to run, I had to background everything, including fluxbox. If gqview was not backgrounded as well, the x session would be terminated as soon as you close gqview...there are no more commands to run, so .xinitrc closes, taking X with it. In order to keep the session going, the .xinitrc script must wait for something to happen, or continue running commands. The wait $fluxpid command is put there so that the script will wait for fluxbox to be terminated before closing itself. Usually configure scripts will include a variable "CC", which is often set to "gcc". You might try changing it to "tcc". I wouldn't get your hopes up that you'll be able to compile feh with a base DSL system, though. |