Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
TheScoutPro

Changing screen resolution with a script

Question

So, my actual computer has an odd resolution, so I need to use tier 2 screens because of the resolutions, but I want more colourscolors.  I need to know how to change resolution in the autorun script. Any help is appreciated.

 

 

       

                                                                                                                                                                                               -TheScoutPro

 

Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

What you want to do is use the gpu component. it would look something like this:

 

*inside your autorun.lua*

component=require("component")

gpu = component.gpu

 

gpu.setResolution(10,10)

 

You can of course change the two tens in the method to whatever you require.

 

Or, a second method:

 

*inside your autorun.lua*

os.execute("resolution 10 10")

Link to post
Share on other sites
  • 0

Isn't autorun.lua reserved to when a disk is mounted?

You could also use RC, you just have to take the aforementionned code, and throw it in a start function, then save the thing as /etc/rc.d/filename.lua.

-- /etc/rc.d/filename.lua

local gpu = require("component").gpu

function start(config)
  gpu.setResolution(10, 10)
end

And you could then enable this that way (just add the filename in "enabled", you don't have to touch anything else) :

-- /etc/rc.conf

enabled = {"filename"}
Link to post
Share on other sites
  • 0

@Negi: If you/he do something wrong in /etc/rc.d/script.lua or in /etc/rc.cfg than the system will not boot anymore. So i guess its better to do it over /autorun.lua ;)

Making your system unbootable is always an issue with things that run on boot, no matter where you put them. Writing a rc script is the "proper" way to make something run on boot though - init.lua is the OpenOS "kernel", and the scripts in /boot set up the OpenOS environment. If you put your custom code there, you might be unable to use some of OpenOS' custom libraries and functionality. autorun.lua is an even worse place - it is run everytime the filesystem is mounted on any computer (not just if it's the boot filesystem) meaning that if you do bad things in your autorun you won't even be able to fix it by booting from another filesystem. Unless you disable autorun in /etc/filesystem.cfg, which you really should do. ;)

Link to post
Share on other sites
  • 0

Making your system unbootable is always an issue with things that run on boot, no matter where you put them. Writing a rc script is the "proper" way to make something run on boot though - init.lua is the OpenOS "kernel", and the scripts in /boot set up the OpenOS environment. If you put your custom code there, you might be unable to use some of OpenOS' custom libraries and functionality. autorun.lua is an even worse place - it is run everytime the filesystem is mounted on any computer (not just if it's the boot filesystem) meaning that if you do bad things in your autorun you won't even be able to fix it by booting from another filesystem. Unless you disable autorun in /etc/filesystem.cfg, which you really should do. ;)

I'll add that ALL rc.d services aren't started on boot, only those in the enabled table. You wouldn't enable a service which you aren't sure works as expected, right ?

Well that's why you should test the state of things with rc <service> start before enabling it for automatic starting at boot.

 

What I've wrote here is only a quick solution, so I didn't bother with details.

Link to post
Share on other sites
  • 0

If you have autorun.lua enabled by default in OpenOs, which I believe it is by default, the easiest way is create a new file in / dir named 'autorun.lua' and save this text...

<CODE>

os.execute("resolution Xwidth Yheight")

xwidth and height are strings of the number width and height you want

<\CODE>

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.