You are not logged in.

#1 2010-11-22 14:30:49

Rob
Member
Registered: 2010-11-22
Posts: 4

Easy Switch between xorg.conf files enable disable tvout

Hello,

This is my first post on this forum, so i'am not sure were to put my post, but i think here is the best place

summary:
Easy Switch between xorg.conf files, and enable/disable startup applications. Script does this:
detect which xorg.conf file is used and then depending on which one is used do 1 or 2:
1. copy tvout.conf to xorg.conf and disable all startup applications + enable one or more startup application(s) defined in the script startupappsoff
2. copy xorg.conf.backup to xorg.conf and enable all startup applications + disable one or more startup application(s) defined in the script startupappson

I thought it would be nice to share the script i created for an easy switch between two xorg.conf files. Myself preferred to switch between two xorg files for personal need.

Beside only switching between two xorg.conf files i would like to enable/disable some startup apps, therefor i created the scripts startupappsoff and startupappson.

If you want to use these scripts, look in this code for comments, and custimize at the points A. to I. Further read the comments on top of each script.

If something is not clear or is not correct, your free to ask! cool

have fun!

The script to be run to switch:
tvout

#!/bin/sh

#summary: This programm switches xorg.conf file with an other and back. Also it calls the programms startupappsoff and startupappson.

#in order to get this as a command, copy this program to: /usr/bin/
#to execute without password, add: <username> ALL=NOPASSWD: /usr/bin/tvout (replace <username> with your own)

#A. this script needs to recorgnize the different xorg.conf files you want to use. So put on top of your xorg.conf files in the first line: #tvout or #original
var1=$(head -1 /etc/X11/xorg.conf)

if [ $var1 == "#original" ]
then
#B. put here the path to your own custimized xorg.conf
sudo cp /mnt/data1/Arch\ Files/xorg.conf.tvout /etc/X11/xorg.conf
zenity --info --text 'tv-out enabled, to switch press CTRL+ALT+BACKSPACE'
#C. put here the path to startupappsoff and change username
su rob /mnt/data1/Arch\ Files/startupappsoff
fi

if [ $var1 == "#tvout" ]
then
#D. put here the path to your backuped xorg.conf or second custimized xorg.conf
sudo cp /mnt/data1/Arch\ Files/xorg.conf.backup /etc/X11/xorg.conf
zenity --info --text 'tft-out enabled, to switch press CTRL+ALT+BACKSPACE'
#E. put here the path to startupappson and change username
su rob /mnt/data1/Arch\ Files/startupappson
fi

startupappsoff

#!/bin/sh

#this programm turns startup programms off and turns only the startup programms defined here on

for file in $(ls ~/.config/autostart/);
do
#switch all startup apps off
#G. change rob to your own username
sed -i 's/X-GNOME-Autostart-enabled=true/X-GNOME-Autostart-enabled=false/g' /home/rob/.config/autostart/$file

#H. switch only these startup apps on, change rob to your own username
sed -i 's/X-GNOME-Autostart-enabled=false/X-GNOME-Autostart-enabled=true/g' /home/rob/.config/autostart/appchk.desktop
sed -i 's/X-GNOME-Autostart-enabled=false/X-GNOME-Autostart-enabled=true/g' /home/rob/.config/autostart/yakuake.desktop
done

startupappson

#!/bin/sh

#this script turns all startup programms of, and only turns on the startup programms defined here:

for file in $(ls ~/.config/autostart/);
do

#switch all startup apps on
#I. change rob to your own username
sed -i 's/X-GNOME-Autostart-enabled=false/X-GNOME-Autostart-enabled=true/g' /home/rob/.config/autostart/$file

#J. switch only these startup apps off, change rob to your own username
sed -i 's/X-GNOME-Autostart-enabled=true/X-GNOME-Autostart-enabled=false/g' /home/rob/.config/autostart/xbmc.desktop
done

Last edited by Rob (2010-11-24 14:10:58)

Offline

#2 2010-11-24 14:14:07

Rob
Member
Registered: 2010-11-22
Posts: 4

Re: Easy Switch between xorg.conf files enable disable tvout

i changed two lines at point C. and E.:
"/mnt/data1/Arch\ Files/startupappsoff" to "su rob /mnt/data1/Arch\ Files/startupappsoff
and
"/mnt/data1/Arch\ Files/startupappson" to "su rob /mnt/data1/Arch\ Files/startupappson"

because it seems that as root the for loop in both startupappsoff and startupappson does not work properly

Offline

#3 2011-07-13 14:30:20

sweetthdevil
Member
Registered: 2009-10-20
Posts: 417

Re: Easy Switch between xorg.conf files enable disable tvout

Many thanks, I am actually using your script minus the app changing script - to change my xorg from my dual screen display to a single screen display and my s-video tvout.

Now I need to tune my xorg to work, but I am trying to add the <username> ALL=NOPASSWD for the script to work without password but I do not know where to add the line and the format of the line?

Again many thanks for your script,

looking forward for your reply,

Regards

Offline

Board footer

Powered by FluxBB