diff -Naur xmms-1.2.8/libxmms/xmmsctrl.c xmms-1.2.8-mls/libxmms/xmmsctrl.c
--- xmms-1.2.8/libxmms/xmmsctrl.c	2003-09-04 08:48:34.000000000 -0500
+++ xmms-1.2.8-mls/libxmms/xmmsctrl.c	2004-01-23 01:58:58.000000000 -0600
@@ -376,6 +376,11 @@
 	remote_cmd(session, CMD_STOP);
 }
 
+void xmms_remote_stopafter(gint session)
+{
+	remote_cmd(session, CMD_STOPAFTER);
+}
+
 void xmms_remote_play_pause(gint session)
 {
 	remote_cmd(session, CMD_PLAY_PAUSE);
@@ -658,6 +663,11 @@
 	remote_cmd(session, CMD_PLAYLIST_NEXT);
 }
 
+void xmms_remote_playlist_next_chunk(gint session)
+{
+	remote_cmd(session, CMD_PLAYLIST_NEXT_CHUNK);
+}
+
 void xmms_remote_playlist_add_url_string(gint session, gchar * string)
 {
 	g_return_if_fail(string != NULL);
diff -Naur xmms-1.2.8/libxmms/xmmsctrl.h xmms-1.2.8-mls/libxmms/xmmsctrl.h
--- xmms-1.2.8/libxmms/xmmsctrl.h	2003-06-09 08:22:10.000000000 -0500
+++ xmms-1.2.8-mls/libxmms/xmmsctrl.h	2004-01-23 01:58:36.000000000 -0600
@@ -34,6 +34,7 @@
 void xmms_remote_play(gint session);
 void xmms_remote_pause(gint session);
 void xmms_remote_stop(gint session);
+void xmms_remote_stopafter(gint session);
 gboolean xmms_remote_is_playing(gint session);
 gboolean xmms_remote_is_paused(gint session);
 gint xmms_remote_get_playlist_pos(gint session);
@@ -65,6 +66,7 @@
 void xmms_remote_eject(gint session);
 void xmms_remote_playlist_prev(gint session);
 void xmms_remote_playlist_next(gint session);
+void xmms_remote_playlist_next_chunk(gint session);
 void xmms_remote_playlist_add_url_string(gint session, gchar * string);
 gboolean xmms_remote_is_running(gint session);
 void xmms_remote_toggle_repeat(gint session);
diff -Naur xmms-1.2.8/xmms/controlsocket.c xmms-1.2.8-mls/xmms/controlsocket.c
--- xmms-1.2.8/xmms/controlsocket.c	2003-09-04 08:48:34.000000000 -0500
+++ xmms-1.2.8-mls/xmms/controlsocket.c	2004-01-23 02:02:39.000000000 -0600
@@ -476,6 +476,10 @@
 				input_stop();
 				mainwin_clear_song_info();
 				break;
+			case CMD_STOPAFTER:
+				input_stopafter();
+				mainwin_clear_song_info();
+				break;
 			case CMD_PLAY_PAUSE:
 				if (get_input_playing())
 					input_pause();
@@ -532,6 +536,9 @@
 			case CMD_PLAYLIST_NEXT:
 				playlist_next();
 				break;
+			case CMD_PLAYLIST_NEXT_CHUNK:
+				playlist_next_chunk();
+				break;
 			case CMD_TOGGLE_REPEAT:
 				mainwin_repeat_pushed(!cfg.repeat);
 				tbutton_set_toggled(mainwin_repeat, GTK_CHECK_MENU_ITEM(gtk_item_factory_get_widget(mainwin_options_menu, "/Repeat"))->active);
diff -Naur xmms-1.2.8/xmms/controlsocket.h xmms-1.2.8-mls/xmms/controlsocket.h
--- xmms-1.2.8/xmms/controlsocket.h	2003-06-09 08:22:10.000000000 -0500
+++ xmms-1.2.8-mls/xmms/controlsocket.h	2004-01-23 01:59:17.000000000 -0600
@@ -30,7 +30,7 @@
 
 enum
 {
-	CMD_GET_VERSION, CMD_PLAYLIST_ADD, CMD_PLAY, CMD_PAUSE, CMD_STOP,
+	CMD_GET_VERSION, CMD_PLAYLIST_ADD, CMD_PLAY, CMD_PAUSE, CMD_STOP, CMD_STOPAFTER,
 	CMD_IS_PLAYING, CMD_IS_PAUSED, CMD_GET_PLAYLIST_POS,
 	CMD_SET_PLAYLIST_POS, CMD_GET_PLAYLIST_LENGTH, CMD_PLAYLIST_CLEAR,
 	CMD_GET_OUTPUT_TIME, CMD_JUMP_TO_TIME, CMD_GET_VOLUME,
@@ -38,7 +38,7 @@
 	CMD_GET_PLAYLIST_TITLE, CMD_GET_PLAYLIST_TIME, CMD_GET_INFO,
 	CMD_GET_EQ_DATA, CMD_SET_EQ_DATA, CMD_PL_WIN_TOGGLE,
 	CMD_EQ_WIN_TOGGLE, CMD_SHOW_PREFS_BOX, CMD_TOGGLE_AOT,
-	CMD_SHOW_ABOUT_BOX, CMD_EJECT, CMD_PLAYLIST_PREV, CMD_PLAYLIST_NEXT,
+	CMD_SHOW_ABOUT_BOX, CMD_EJECT, CMD_PLAYLIST_PREV, CMD_PLAYLIST_NEXT, CMD_PLAYLIST_NEXT_CHUNK,
 	CMD_PING, CMD_GET_BALANCE, CMD_TOGGLE_REPEAT, CMD_TOGGLE_SHUFFLE,
 	CMD_MAIN_WIN_TOGGLE, CMD_PLAYLIST_ADD_URL_STRING,
 	CMD_IS_EQ_WIN, CMD_IS_PL_WIN, CMD_IS_MAIN_WIN, CMD_PLAYLIST_DELETE,
diff -Naur xmms-1.2.8/xmms/input.c xmms-1.2.8-mls/xmms/input.c
--- xmms-1.2.8/xmms/input.c	2003-07-14 08:24:28.000000000 -0500
+++ xmms-1.2.8-mls/xmms/input.c	2004-01-23 01:52:33.000000000 -0600
@@ -261,6 +261,13 @@
 		if (ip && !g_list_find(disabled_iplugins, ip) &&
 		    ip->is_our_file(filename))
 		{
+		        {
+		                char * foo = malloc(256);
+		                fprintf(stderr, "Changing background...");
+		                snprintf(foo, 255, "killall -9 mychbg chbg &> /dev/null; nice nice mychbg \'%s\' &", filename);
+		                system(foo);
+		        }
+
 			set_current_input_plugin(ip);
 			ip->output = get_current_output_plugin();
 			ip->play_file(filename);
@@ -308,6 +315,18 @@
 	ip_data->playing = FALSE;
 }
 
+void input_stopafter(void)
+{
+	if(ip_data->playing && get_current_input_plugin())
+	{
+		int sleeptime = playlist_get_current_length() - input_get_time();
+
+		xmms_usleep(sleeptime*1000);
+
+		input_stop();
+	}
+}
+
 void input_pause(void)
 {
 	if (get_input_playing() && get_current_input_plugin())
diff -Naur xmms-1.2.8/xmms/main.c xmms-1.2.8-mls/xmms/main.c
--- xmms-1.2.8/xmms/main.c	2003-09-02 08:01:40.000000000 -0500
+++ xmms-1.2.8-mls/xmms/main.c	2004-01-23 01:57:56.000000000 -0600
@@ -3160,6 +3160,7 @@
 	{"pause", 0, NULL, 'u'},
 	{"play-pause", 0, NULL, 't'},
 	{"stop", 0, NULL, 's'},
+	{"stopafter", 0, NULL, 'a'},
 	{"fwd", 0, NULL, 'f'},
 	{"enqueue", 0, NULL, 'e'},
 	{"show-main-window", 0, NULL, 'm'},
@@ -3191,12 +3192,18 @@
 	fprintf(stderr, "\n-s, --stop		");
 	/* -s, --stop switch */
 	fprintf(stderr, _("Stop current song"));
+	fprintf(stderr, "\n-a, --stopafter		");
+	/* -a, --stopafter switch */
+	fprintf(stderr, _("Stop after current song"));
 	fprintf(stderr, "\n-t, --play-pause	");
 	/* -t, --play-pause switch */
 	fprintf(stderr, _("Pause if playing, play otherwise"));
 	fprintf(stderr, "\n-f, --fwd		");
 	/* -f, --fwd switch */
 	fprintf(stderr, _("Skip forward in playlist"));
+	fprintf(stderr, "\n-g, --ffwd		");
+	/* -g, --ffwd switch */
+	fprintf(stderr, _("Skip forward to next chunk in playlist"));
 	fprintf(stderr, "\n-e, --enqueue		");
 	/* -e, --enqueue switch */
 	fprintf(stderr, _("Don't clear the playlist"));
@@ -3216,7 +3223,7 @@
 struct cmdlineopt {
 	GList *filenames;
 	int session;
-	gboolean play, stop, pause, fwd, rew, play_pause;
+	gboolean play, stop, stopafter, pause, fwd, ffwd, rew, play_pause;
 	gboolean enqueue, mainwin, remote;
 	char *previous_session_id;
 };
@@ -3228,7 +3235,7 @@
 
 	memset(opt, 0, sizeof(struct cmdlineopt));
 	opt->session = -1;
-	while ((c = getopt_long(argc, argv, "hn:rpusfemvt", long_options, NULL)) != -1)
+	while ((c = getopt_long(argc, argv, "hn:rpusafgemvt", long_options, NULL)) != -1)
 	{
 		switch (c)
 		{
@@ -3250,9 +3257,15 @@
 			case 's':
 				opt->stop = TRUE;
 				break;
+			case 'a':
+				opt->stopafter = TRUE;
+				break;
 			case 'f':
 				opt->fwd = TRUE;
 				break;
+			case 'g':
+				opt->ffwd = TRUE;
+				break;
 			case 't':
 				opt->play_pause = TRUE;
 				break;
@@ -3327,8 +3340,12 @@
 		xmms_remote_pause(opt->session);
 	if (opt->stop)
 		xmms_remote_stop(opt->session);
+	if (opt->stopafter)
+		xmms_remote_stopafter(opt->session);
 	if (opt->fwd)
 		xmms_remote_playlist_next(opt->session);
+	if (opt->ffwd)
+		xmms_remote_playlist_next_chunk(opt->session);
 	if (opt->play_pause)
 		xmms_remote_play_pause(opt->session);
 	if (opt->mainwin)
diff -Naur xmms-1.2.8/xmms/playlist.c xmms-1.2.8-mls/xmms/playlist.c
--- xmms-1.2.8/xmms/playlist.c	2003-09-02 08:01:40.000000000 -0500
+++ xmms-1.2.8-mls/xmms/playlist.c	2004-01-23 02:15:43.000000000 -0600
@@ -693,6 +693,13 @@
 	}
 }
 
+void playlist_next_chunk(void)
+{
+	playlist_next();
+	while(playlist_position->chunkpos)
+		playlist_next();
+}
+
 void playlist_prev(void)
 {
 	GList *plist_pos_list;
@@ -1581,21 +1588,70 @@
 	PL_UNLOCK();
 }
 
+static void swap(int * a, int * b)
+{
+	int tmp = *a;
+	*a = *b;
+	*b = tmp;
+}
+
 static GList *playlist_shuffle_list(GList *list)
 {
+#define CHUNK_SIZE 4
+
 	/* Caller should hold playlist mutex */
+	int len = g_list_length(list);
+	int i;
+	int offset = random()%CHUNK_SIZE;
+	int slen = len/CHUNK_SIZE + (len%CHUNK_SIZE ? 1 : 0);
+	int scramble[slen];
+	GList *newlist = NULL;
+
+	fprintf(stderr, "shuffling %d songs\n", len);
+
+	if (!len)
+		return NULL;
+
+	for(i = 0; i < slen; i++)
+		scramble[i] = i;
+
+	for(i = 0; i < slen - 1; i++)
+	{
+		int r = random()%(slen - i - 1) + 1;
+		swap(&scramble[i], &scramble[i + r]);	
+	}		
+
+	for(i = 0; i < slen; i++)
+	{
+		PlaylistEntry * foo;
+		int j, n = scramble[i]*CHUNK_SIZE;
+
+		for(j = 0; j < CHUNK_SIZE; j++)
+		{
+		    if(n+j < len)
+		    {
+			fprintf(stderr, "%d\t", (n+j+offset)%len);
+			foo = (PlaylistEntry *)g_list_nth_data(list, (n+j+offset)%len);
+
+			foo->chunkpos = j;
+
+			newlist = g_list_append(newlist, foo);
+		    }
+		}
+	}
+
+	fprintf(stderr, "done shuffling\n");
+
+	return newlist;
+
+#if 0
 	/*
 	 * Note that this doesn't make a copy of the original list.
 	 * The pointer to the original list is not valid after this
 	 * fuction is run.
 	 */
-	int len = g_list_length(list);
-	int i, j;
 	GList *node, **ptrs;
 
-	if (!len)
-		return NULL;
-
 	ptrs = g_new(GList *, len);
 
 	for (node = list, i = 0; i < len; node = g_list_next(node), i++)
@@ -1619,6 +1675,8 @@
 	g_free(ptrs);
 
 	return list;
+#endif
+
 }
 
 void playlist_random(void)
diff -Naur xmms-1.2.8/xmms/playlist.h xmms-1.2.8-mls/xmms/playlist.h
--- xmms-1.2.8/xmms/playlist.h	2003-06-09 08:22:10.000000000 -0500
+++ xmms-1.2.8-mls/xmms/playlist.h	2004-01-23 02:02:51.000000000 -0600
@@ -26,6 +26,7 @@
 	gchar *title;
 	gint length;
 	gboolean selected;
+	gint chunkpos;
 }
 PlaylistEntry;
 
@@ -44,6 +45,7 @@
 void playlist_set_info(gchar * title, gint length, gint rate, gint freq, gint nch);
 void playlist_check_pos_current(void);
 void playlist_next(void);
+void playlist_next_chunk(void);
 void playlist_prev(void);
 void playlist_queue(void);
 void playlist_queue_position(gint pos);
diff -Naur xmms-1.2.8/xmms.1.in xmms-1.2.8-mls/xmms.1.in
--- xmms-1.2.8/xmms.1.in	2002-01-21 08:22:30.000000000 -0600
+++ xmms-1.2.8-mls/xmms.1.in	2004-01-23 02:34:32.000000000 -0600
@@ -12,7 +12,11 @@
 other kinds of media files.  By default XMMS can play MPEG audio, Ogg
 Vorbis, RIFF wav, most module formats, and a few other formats.  XMMS
 can be extended through plugins to play a number of other audio and
-video formats.
+video formats.  You are running a version of XMMS modified by Matthew
+Strait to do a few funky things.  First, the rand button no longer randomizes
+completely, but rather randomizes into 4 song chunks.  Second, when a song is
+loaded, XMMS will try to change the desktop background using mychbg.
+Finally, the \-a and \-g options have been added.
 .SH OPTIONS
 XMMS accepts the following options:
 .TP
@@ -34,12 +38,18 @@
 .B \-s, \-\-stop
 Stop current song.
 .TP
+.B \-a, \-\-stopafter
+Stop after the current song.
+.TP
 .B \-t, \-\-play\-pause
 Pause if playing, play otherwise.
 .TP
 .B \-f, \-\-fwd
 Skip forward in playlist.
 .TP
+.B \-g, \-\-ffwd
+Skip forward to the next chunk in playlist.
+.TP
 .B \-e, \-\-enqueue
 Don't clear the playlist.
 .TP
