WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Getting X Windows resolution  (Read 398 times)

Offline binarydemon

  • WikiUser
  • *
  • Posts: 30
Getting X Windows resolution
« on: February 25, 2018, 07:56:59 PM »
Hi,

I was trying to have a script determine the resolution used by X Windows- most of the examples on the internet utilize xdpyinfo or xrandr but neither of these seem to be included in TinyCore x86 by default (I'm sure one of the tcz's in the repository include these, but I'd rather not keep adding bloat).  I see there is a -screen parameter in first line of .xsession, can I pretty much count on that being the working resolution or is there a chance when running that Xvesa command that it might fallback to something else or be overridden by a boot vga= parameter?

Is there another method I might be overlooking?

Check out DOSBox Distro - https://sites.google.com/site/dosboxdistro/

A tinycore LIVEUSB that makes playing your dos games anywhere very simple.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 10054
Re: Getting X Windows resolution
« Reply #1 on: February 25, 2018, 09:00:18 PM »
Xorg-7.7-bin contains xdpyinfo and xrandr - if you are concerned about the size, you could always hack the extension to only contain what you need.

Offline Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 5778
Re: Getting X Windows resolution
« Reply #2 on: February 25, 2018, 09:09:20 PM »
Hi binarydemon
If you go here:
http://forum.tinycorelinux.net/index.php/topic,13793.msg77139.html#msg77139
you'll find the C source code for a small desktop clock. You can lift the  GetScreenParams  routine to retrieve screen resolution.

Offline Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 5778
Re: Getting X Windows resolution
« Reply #3 on: February 26, 2018, 09:40:54 AM »
Hi binarydemon
Attached is a small C program for retrieving screen information. Install compiletc, xorg-7.x-dev and sstrip. Then run the
CompileScreenParams script to compile it. Compiled and stripped it's 1700 bytes and outputs the following:
Code: [Select]
tc@box:~/guilib/ScreenParams$ ./ScreenParams
Screen=1920 x 1080  DPIx=95 DPIy=94
tc@box:~/guilib/ScreenParams$