The Navigatrix has been updated. The new website can be found at navigatrix.net.




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: A little bigger screen for netbooks

Joined: 04 Nov 2010, 20:51
Posts: 1062
Sometimes software doesn't know our screens are 'only' 600 pixels high...minus a toolbar. This script allows us to change resolution, beyond capabilities, stressing only our eyes, not the video chips.

Open a terminal; enter:
Code:
mkdir .local/bin
to create a directory for a local script.

Open a text editor for the two files:
Code:
medit ~/.local/bin/nxrez ~/Desktop/alilbigger.desktop
When the text editor opens; paste into ~/.local/bin/nxrez the following
Code:
#!/bin/bash

# Marc Brumlik, Tailored Software Inc, [email protected]
# Wed Jan  2 05:23:54 CST 2013

# newrez v 1.0
# use xrandr to scale the display to a new resolution
# rewriten to handle mouse boundaries when scaled
# this requires setting a new resolution to the unused VGA1 device
# then scaling that for B display on the LVDS1 device
# modified by Moe because he's lazy and doesn't like to type.

umask 000

# resolution can optionally be specified on command line
newrez=$1

# we MUST be running xrandr 1.3 or higher
if xrandr -v | grep "RandR version 1.[012]"
   then   zenity --info --title="XRandR version is too old" --text="You must be running Xrandr
version 1.3 or newer!
Time to upgrade your system  :-)"
      exit 0
fi

# find the currently connected devices, make a list
devices=`xrandr -q | grep connected | grep -v disconnected | cut -d"(" -f1`

# there MUST be a "connected" LVDS1 and a "disconnected" VGA1
current=`xrandr -q`

if echo "$current" | grep "LVDS1 connected" >/dev/null
   then   : OK
   else   zenity --info --title="PROBLEM" --text="Current display must be LVDS1"; exit 0
fi
if echo "$current" | grep "VGA1 disconnected" >/dev/null
   then   : OK
   else   zenity --info --title="IMPORTANT" --text="The VGA1 display resolution may be affected by this change"
fi

default=`echo "$current" | grep -A 1 "^LVDS1" | tail -1 | awk '{print $1}'`
H=`echo $default | cut -d'x' -f1`
V=`echo $default | cut -d'x' -f2`
HZ=`echo $default | awk '{print $2}' | tr -d '[*+]'`

# echo DEFAULT: $default $H $V

  title="Resolutions"
  text="Default Resolution: $default"


if [ -z "$newrez" ]
   then   while true
      do
         newrez=$(zenity --title="$title" --list \
            --height=250 --width 250 --text="$text" \
            --radiolist --column="X" --hide-column=2 --column="Resolution" --column="Screen Size" \
            TRUE    default     Default \
            FALSE   1280x800    "1280 X 800 -- 125%" \
            FALSE   1440x900    "1440 X 900 -- 140%" )
#           additional settings can be added here
#           changing the above ")" to a "\"
#           with the last one in the list ending with ")"
#           For example:
#           FALSE   1440x900    "1440 X 900 -- 140%" \
#           FALSE   4096x2400   "4096 X 2400 Maximum" )
         case $newrez in
            default|[0-9]*x[0-9]*)   break ;;
         esac
            exit 0
      done
fi

case $newrez in
   default)   xrandr --output VGA1 --auto --output LVDS1 --auto
         xrandr --output LVDS1 --mode $default --scale 1x1
         exit 0 ;;
esac

newH=`echo $newrez | cut -d'x' -f1`
newV=`echo $newrez | cut -d'x' -f2`
modeline=`cvt $newH $newV $HZ | grep Modeline`
newmode=`echo "$modeline" | sed 's/^.*"//'`
cvtrez=`echo "$modeline" | sed -e 's/_.*//' -e 's/^.*"//'`

if [ "$newrez" != "$cvtrez" ]
   then   newrez=$cvtrez
      newH=`echo $newrez | cut -d'x' -f1`
      newV=`echo $newrez | cut -d'x' -f2`
fi

scaleH=`echo -e "scale=10\n$newH / $H\nquit" | bc`
scaleV=`echo -e "scale=10\n$newV / $V\nquit" | bc`

if echo "$current" | grep -A 100 "^VGA1" | grep $newrez >/dev/null
   then   : already there
   else   xrandr --newmode "$newrez" $newmode
      xrandr --addmode VGA1 $newrez
fi

if xrandr --output VGA1 --mode $newrez --output LVDS1 --fb $newrez --scale $scaleH"x"$scaleV 2>&1 | tee -a /tmp/xrandr.err
   then   : success
   else   zenity --info --title="Xrandr produced this error" --text="`cat /tmp/xrandr.err`"

The problem could be that Your video driver
does not support xrandr version 1.3
      rm -f /tmp/xrandr.err
fi
Save the file and paste the following into ~/Desktop/alilbigger.desktop (the other text file):
Code:
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=A lil bigger screen
Comment=Change screen resolution for a large/smaller desktop
Exec= .local/bin/nxrez
Icon=preferences-desktop-theme.png
Terminal=false
Type=Application
Categories=Settings;
Save and exit the text editor.

Activate the new script with
Code:
chmod +x ~/.local/bin/nxrez
Test it out with the Desktop icon.
If you want a menu entry:
Code:
sudo cp ~/Desktop/alilbigger.desktop /usr/share/applications/alilbigger.desktop
It will show under "Preferences"


Top
   
 
 Post subject: Re: A little bigger screen for netbooks

Joined: 11 Oct 2014, 03:27
Posts: 13
Hi Moe
I'd like to run this very usefull script but I've never done that, so I 'm a bit lost:
if I enter in a terminal:mkdir .local/bin
the response is :
zelda@zelda-AOA150:~$ mkdir .local/bin
mkdir: impossible de créer le répertoire «.local/bin»: Le fichier existe

I go on , I open text editor medit, I see two files already there:lightdm.conf and libclearkey.so (I remember that I've tried to run a script about password some months ago but didnt succeed).
Then when you say:
When the text editor opens; paste into ~/.local/bin/nxrez the following
I don't know how to find : ~/.local/bin/nxrez from the text editor.

Finally, when you say:save , ok but save under what or where ?
I'm sorry, I 'm really beginner and most of the time, everything in NX is working so perfectly, then I don't really have to learn how to improve or repair, compare to ...another OS


Top
   
 
 Post subject: Re: A little bigger screen for netbooks

Joined: 04 Nov 2010, 20:51
Posts: 1062
Sorry Zelda, "paste into ~/.local/bin/nxrez" is a poor way of saying "create an empty file and put in the following text"

Since mkdir: impossible de créer le répertoire «.local/bin»: Le fichier existe (mkdir is the command to make the directory, which you already have. This is ok, and since you tried that password script, it's expected. )

If you enter
Code:
medit ~/.local/bin/nxrez
If the file exists it will open it. If it doesn't exist, it will create the empty file with that name and location (~/.local/bin/nxrez).

You can then write, or in this case, paste into that empty file. This is the file you save.

After it is saved it can be tested.


Top
   
 
 Post subject: Re: A little bigger screen for netbooks

Joined: 11 Oct 2014, 03:27
Posts: 13
Moe wrote:
After it is saved it can be tested.

Thank you , I've done it !


Top
   
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 


Search for:
cron

Credits © 2010 - 2024