Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: saravanan on January 26, 2010, 06:18:24 AM

Title: [Solved] How to restart Xvesa with different resolution
Post by: saravanan on January 26, 2010, 06:18:24 AM
Hi all,
         How to restart Xvesa with different resolution in Tinycore.
Please help
Title: Re: How to restart Xvesa with different resolution
Post by: Guy on January 26, 2010, 06:28:40 AM
From the main menu (right click), select Tools -> Xvesa Setup.
Title: Re: How to restart Xvesa with different resolution
Post by: saravanan on January 26, 2010, 06:32:55 AM
I need to do this with a command or script.
By default my TC resolution is 1024x786 that is fine, but i also want an option to switch to 800x600 resolution.
Or where do i find the command that is executed behind the process mentioned?
Title: Re: How to restart Xvesa with different resolution
Post by: curaga on January 26, 2010, 06:59:32 AM
The resolution for Xvesa is controlled in .xsession. The script that menu item calls is xsetup.sh.
Title: Re: How to restart Xvesa with different resolution
Post by: saravanan on January 26, 2010, 07:16:11 AM
yes i can find the Xvesa startup script in .xsession, when i run xsetup.sh/xsetup command, i can select the resolution and the mouse type, after which i don't find any change in resolution. How to bring the change?

Title: Re: How to restart Xvesa with different resolution
Post by: curaga on January 26, 2010, 07:27:57 AM
Restart X for the changes to take effect - "exit to command line" from the menu, and "startx".
Title: Re: How to restart Xvesa with different resolution
Post by: saravanan on January 26, 2010, 07:41:53 AM
Restart X for the changes to take effect - "exit to command line" from the menu, and "startx".

Yes it worked curaga, but i just need to change to 800x600 resolution with a single shot, without requiring the user to select the resolution.
Need it on a single click or that may invoke a script/command that will kill the existing GUI and start the X again with new resolution.

if i kill x while being inside x, it will kill the script too.

How to tackle this ?
Title: Re: How to restart Xvesa with different resolution
Post by: gutmensch on January 26, 2010, 09:15:52 AM
you could for example use the extension actkbd.

it runs as a daemon by user root in the background and listens for keyboard shortcuts. when pressed, he could invoke a script like

#!/bin/sh
killall Xvesa
DISPLAY=:0 su -c 'startx' tc

the acpi(d) feature in /etc/acpi/events and so on may be used as well.
Title: Re: How to restart Xvesa with different resolution
Post by: saravanan on January 26, 2010, 10:20:12 AM
you could for example use the extension actkbd.

it runs as a daemon by user root in the background and listens for keyboard shortcuts. when pressed, he could invoke a script like

#!/bin/sh
killall Xvesa
DISPLAY=:0 su -c 'startx' tc

the acpi(d) feature in /etc/acpi/events and so on may be used as well.

1000 points for gutmensch, thanks :)
Title: Re: How to restart Xvesa with different resolution
Post by: saravanan on January 27, 2010, 01:37:31 AM
still i find a problem, when i kill Xveas and restart it by running the command present in .xsession and changing the resolution param like,

Xvesa blah blah 800x600x32 blah blah

starts X, buit there is no background , i can just see the wbar fine and there is no window theme like the proper window border that is used to be there before.

or how to use startx(what does startx command trigger??)  and give startx a 800x600 resolution parameter????
Title: Re: How to restart Xvesa with different resolution
Post by: gutmensch on January 27, 2010, 01:48:44 AM
Xvesa is just the X server, there are other programs running as well like the window manager, mouse_config, etc.

Boot tinycore normally, open a terminal, do "$ ps aux" and look what processes are running. By chance there are some, which you have to kill too, otherwise the whole thing doesn't work, cos he restarts Xvesa but e.g. the window manager is still running and doesn't start again  when .xsession is called.

Title: Re: How to restart Xvesa with different resolution
Post by: saravanan on January 27, 2010, 02:03:13 AM
Thanks gutmensch, but is there any way to kill all processes started by .xsession and then to run another duplicated.xsession script with just the resolution parameter edited?
Title: Re: How to restart Xvesa with different resolution
Post by: gutmensch on January 27, 2010, 02:15:10 AM
it doesn't need duplication.. you can edit the .xsession file in place with a command like

sed -i -e 's/800x600/1024x768/' /home/tc/.xsession

which you could call before the restart of Xvesa.

for killing all child processes of .xsession you'll have to do something like here: http://www.unix.com/unix-dummies-questions-answers/5245-script-kill-all-child-process-given-pid.html (http://www.unix.com/unix-dummies-questions-answers/5245-script-kill-all-child-process-given-pid.html)
Title: Re: How to restart Xvesa with different resolution
Post by: curaga on January 27, 2010, 02:37:02 AM
X apps die when X dies. Possibly startx has to be executed from /home/tc for everything to work:
DISPLAY=:0 su -c ' cd /home/tc; startx' tc
Title: Re: How to restart Xvesa with different resolution
Post by: saravanan on January 27, 2010, 07:52:51 AM
Nice trick gutmensch, and curaga :)
Thank you,

But rather than invoking this as a key combination triggered event, is there any other way to call the actkbd and run the config file specified?
Title: Re: How to restart Xvesa with different resolution
Post by: curaga on January 27, 2010, 08:18:21 AM
You can have a menu item, icon, or launch that script some other way. This is linux we're talking about :)

Actkbd isn't needed if you don't want a key/key-combo.
Title: Re: How to restart Xvesa with different resolution
Post by: saravanan on January 27, 2010, 08:27:14 AM
i opt for an icon rather, how do i do that if i don need actkbd otherwise?
Title: Re: How to restart Xvesa with different resolution
Post by: curaga on January 27, 2010, 12:37:11 PM
See http://tinycorelinux.com/wiki/tiki-index.php?page=iconmenuinfo
http://tinycorelinux.com/wiki/tiki-index.php?page=Creating+Extensions

The recommended way is to create an extension with the icon. Note that for the icon to show a menu item should also be there.
Title: Re: How to restart Xvesa with different resolution
Post by: saravanan on January 28, 2010, 04:24:16 AM
yes curaga, i learnt about editing the wbar config file, but what is the command that is required to be executed in case of clicking that icon.

ie. for tat icon info as in wbar conf :

i:/usr/local/tce.icons/something.png
t:restartX
c:/usr/local/bin/restartx.sh

In the above case, what should the restartx.sh contain,
if i add, killall Xvesa; wont this kill the child(restartx.sh) also??, so that it may fail to start X again???
If i am wrong, please guide me.
Title: Re: How to restart Xvesa with different resolution
Post by: curaga on January 28, 2010, 05:00:27 AM
I think that since it's not a X process itself, it should continue to run. If not, you can use "nohup" to protect it.
Title: Re: How to restart Xvesa with different resolution
Post by: saravanan on January 28, 2010, 07:04:00 AM
thanks curaga, with nohup it works fine :)