Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 25th October 2008
Gabe_G23 Gabe_G23 is offline
New User
Join Date: Oct 2008
Posts: 5
Default Handy X11 script

Hello everyone,

New here.. but I'll jump right in..

If you have multiple X11 environments with *BSD, this script is very handy. Instead of having a log-in manager (which in some cases takes up a considerable amount of RAM) like XDM, KDM, GDM, etc.

I have tested this on FreeBSD only for now.

It can even play music if you want it to!

Here ya go (tell me what you think please):

--This script currently works with the GNOME and WindowMaker environments.

# You can also modify #!/usr/local/bin/bash to /bin/bash depending on your
# system. This script will allow you to start an environment without 
# having to go through a (RAM hogging) log-in manager like XDM, GDM,
# KDM, etc. Enjoy!

echo Choose the environment to start:
OPTIONS="Gnome WindowMaker"
select opt in $OPTIONS; do
	if [ "$opt" = "Gnome" ]; then
	 echo "/usr/local/bin/gnome-session" > ~/.xinitrc && startx
	elif [ "$opt" = "WindowMaker" ]; then
	 echo "exec wmaker" > ~/.xinitrc && startx
	 echo Bad Option
If you were to want to play music (MUST HAVE mpg123 installed - /usr/ports/audio/mpg123 on FreeBSD):

if [ "$opt" = "Gnome" ]; then
	 echo "/usr/local/bin/gnome-session" > ~/.xinitrc && startx && sleep 5 && mpg123 /usr/home/gabe/Gabe_Folders/music/System/startup.mp3
Adjust the sleep <variable> to tell the system how long to wait until playing the music. Also adjust the mpg123 <DIR> to the location of your start up music.

Should be easy enough to follow along. If you have any questions, feel free to ask!


Standard sh script (thanks to vermaden):

#! /bin/sh

echo Choose the environment to start:
echo "1. gnome"
echo "2. wmaker"
echo -n "choice: "
read OPT

case $OPT in
    echo "/usr/local/bin/gnome-session" > ~/.xinitrc && startx
    exit 0
    echo "exec wmaker" > ~/.xinitrc && startx
    exit 0
    echo "ERROR: wrong option"
    exit 1

Last edited by Gabe_G23; 25th October 2008 at 04:12 PM.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Crontab won't run script Petrocelli08 FreeBSD General 4 7th March 2009 04:19 AM
Backup script(s)? giddyupman General software and network 2 3rd January 2009 02:06 PM
Automation Script ninjatux FreeBSD General 2 24th October 2008 04:16 PM
my 1st sh script graudeejs Programming 12 18th August 2008 10:25 PM
Shell Script. bsdnewbie999 Programming 21 15th July 2008 07:54 AM

All times are GMT. The time now is 11:06 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick