Tiny Core Linux

Tiny Core Base => TCB Tips & Tricks => Topic started by: netnomad on November 14, 2011, 09:45:28 AM

Title: xvesa - how can i read the current resolution to use it as a variable?
Post by: netnomad on November 14, 2011, 09:45:28 AM
hi friends, hi roberts,

i want to make my desktop flexible for different resolutions in xvesa.
for that goal i want to read or get the current resolution.
in my examples i looked just for the y-value,
because i want to place my desktop pager in the left bottom corner.
would you tell me a  way to place something in the left bottom corner?
f.e. like the concept of positioning wbar or a panel!?
another goal is to position mnttool on the right up corner...:)


first i tried to use

Code: [Select]
awk ' BEGIN{FS=",";} { $1= "";} {sub(/^[ \t]+/, ""); print}' /sys/devices/platform/vesafb.0/graphics/fb0/virtual_size

although it stores a suitable value,
i guess that this virtual_size has not too much to do with my current resolution...


later i tried

Code: [Select]
Xvesa -listmodes 2>&1 | grep ^0x | awk '{ printf "%s\n",$2 }' | sort -n > /tmp/xvesamodes
awk ' BEGIN{FS="x";} { $1= "";} { $3= "";} {sub(/[ \t]+$/, "")} {sub(/^[ \t]+/, ""); print}' /tmp/xvesamodes | sed '$!d'

but  Xvesa -listmodes offers so many resolutions that someones display cannot support,
so the highest resolution is not always the suitable one.


i guess that this one-liners are looking ugly for experienced coders, so please, don't mind...:)

so do you know a way, every hint is welcomed!
thank you
Title: Re: xvesa - how can i read the current resolution to use it as a variable?
Post by: curaga on November 14, 2011, 11:01:33 AM
Please read the watcher info file,
http://ftp.nluug.nl/pub/metalab/distributions/tinycorelinux/4.x/x86/tcz/watcher.tcz.info (http://ftp.nluug.nl/pub/metalab/distributions/tinycorelinux/4.x/x86/tcz/watcher.tcz.info)

It has a quick howto on using the X standard -g (-geometry) option that most apps accept. With it you can position apps easily with no knowledge of the screen size.


--

For getting the screen resolution, if you can't read .xsession, xdpyinfo and xwininfo can tell you.
Title: Re: xvesa - how can i read the current resolution to use it as a variable?
Post by: netnomad on November 14, 2011, 01:25:26 PM
hi curaga,

thank you for your reply.
ipager doesn't have such an -g option, but it's good that you've mentioned it, i guess that i will need it later.

i had success with xwininfo, it works without dependencies, so i don't need to install the heavy xorg-package...

Code: [Select]
#!/bin/sh
MYY="$(xwininfo -root | awk '/Height:/,/Height:/' | sed 's/Height: / /g' | sed 's/ //g')"
sleep 1
ipager -c ~/.ipager/ipager$MYY.conf 2>/dev/null &

thank you for your hints!
Title: Re: xvesa - how can i read the current resolution to use it as a variable?
Post by: curaga on November 15, 2011, 05:22:08 AM
Many apps support the -g option via their toolkit (and so not listed in their --help etc).

Just curious, do you launch xvesa some different way, that the resolution is not in .xsession?
Title: Re: xvesa - how can i read the current resolution to use it as a variable?
Post by: netnomad on November 15, 2011, 06:07:12 AM
yes, you are right!

1. in my .xsession i control the 1280x1024x24-resolution of my mainly used systems.

2. when i use my netbook then i use over syslinux the command-line "xvesa=1024x600x32" and my .xsession-entry stays untouched.

Though i really love and heavily use my ipager in the left bottom corner, i read the resolution of xwininfo and choose the compatible ipager-config-file f.e. ipager1024.conf.

by the way, ipager doesn't know a -g option:
tc@box:~$ ipager -g +88+88
ipager: invalid option -- 'g'
Title: Re: xvesa - how can i read the current resolution to use it as a variable?
Post by: curaga on November 15, 2011, 06:33:23 AM
The bootcode does change .xsession, but if you don't do a backup, it's not persistent.