John Floren avatar John Floren committed 3090bf8

Now, you can cycle forward and backward through the apps. Default Alt+n
and Alt+p keybindings. This has been a major source of annoyance for me
so it was the first order of business.

Comments (0)

Files changed (6)

 *.swp
 anduin
 keyview
+*.core
 		case CMD_DEBUG:
 			printDebug();
 			break;
+		case CMD_NEXT_APP:
+			shiftNext();
+			break;
+		case CMD_PREV_APP:
+			shiftPrev();
+			break;
 		case CMD_NONE:
 			break;
 		default:
 CMD_STD_SIZE=s,Alt
 CMD_MAKE_APPLET=a,Alt
 
-CMD_MAIN_APP=n,Alt|1
+CMD_PREV_APP=p,Alt
+CMD_NEXT_APP=n,Alt
 
 CMD_MAIN_APP=z,Alt|1
 CMD_MAIN_APP=x,Alt|2
 CMD_APPLET=period,Alt|2
 CMD_APPLET=slash,Alt|3
 
-CMD_CHATTER=p,Alt|Test
+# CMD_CHATTER=p,Alt|Test
 # CMD_DEBUG=d,Alt
 
 # CMD_START_APP=m,Ctrl|mozilla
 
 #define MAX_BUF_SIZE 128
 
-int numCmds = 13;
+int numCmds = 15;
 Command commandList[] = {
 { XK_q, ControlMask | Mod1Mask, CMD_SHUTDOWN, "CMD_SHUTDOWN" },
 { XK_Alt_L, 0, CMD_MODE, "CMD_MODE" },
 { XK_f, 0, CMD_FULL_SIZE, "CMD_FULL_SIZE" },
 { XK_s, 0, CMD_STD_SIZE, "CMD_STD_SIZE" },
 { XK_a, 0, CMD_MAKE_APPLET, "CMD_MAKE_APPLET" },
-{ XK_p, 0, CMD_CHATTER, "CMD_CHATTER" },
+{ XK_c, 0, CMD_CHATTER, "CMD_CHATTER" },
 { XK_l, 0, CMD_START_APP, "CMD_START_APP" },
 { XK_z, 0, CMD_MAIN_APP, "CMD_MAIN_APP" },
 { XK_m, 0, CMD_APPLET, "CMD_APPLET" },
 { XK_d, 0, CMD_DEBUG, "CMD_DEBUG" },
+{ XK_p, 0, CMD_PREV_APP, "CMD_PREV_APP" },
+{ XK_n, 0, CMD_NEXT_APP, "CMD_NEXT_APP" },
 { XK_VoidSymbol, 0, CMD_END_MODE, "CMD_MODE" },
 };
 
 }
 
 KeyBind* findKeyEntry(KeySym keySym, unsigned int mask) {
-    KeyBind *ptr;
+	KeyBind *ptr;
 
 	if(cmdMode == NULL) {
 printf("Empty cmdMode\n");
 		return cmdMode;
 	}
 
-    ptr = cmdMode->keys;
+	ptr = cmdMode->keys;
 
 	// printf("findKey - Keysym 0x%lx Char %s\n", keySym, XKeysymToString(keySym));
-    while(ptr != NULL) {
+	while(ptr != NULL) {
 		// printf("Looking for %s search %s\n", XKeysymToString(keySym), XKeysymToString(ptr->keySym));
 		// printf("Mask: 0x%x search 0x%x\n", mask, ptr->mask);
 
 			return ptr;
 		}
 
-        ptr = ptr->next;
-    }
+		ptr = ptr->next;
+	}
 	
 	return NULL;
 }
 
 	removeFromAppList(list, appWin);
 	appWin->next = *list;
+
 	*list = appWin;
 }
 
+// Shift ahead to the next app in the line
+void shiftNext() {
+	AppWin *ptr, *p;
+
+	ptr = mainAppList;
+	removeFromAppList(&mainAppList, ptr);
+
+	for (p = mainAppList; p->next != NULL;)  {
+		p = p->next;
+	}
+
+	p->next = ptr;
+	if(! mainAppList->isMapped) {
+		XMapWindow(display, mainAppList->win);
+		XMapWindow(display, mainAppList->parent);
+	}
+	XRaiseWindow(display, mainAppList->parent);
+
+	showAppList();
+	reFocus();
+}
+
+// Make the last app the current app, i.e. go from:
+// app1 app2 app3 app4
+// to:
+// app4 app1 app2 app3
+void shiftPrev() {
+	AppWin *p;
+
+	for (p = mainAppList; p->next != NULL;) {
+		p = p->next;
+	}
+	addToAppList(&mainAppList, p);
+	if(! mainAppList->isMapped) {
+		XMapWindow(display, mainAppList->win);
+		XMapWindow(display, mainAppList->parent);
+	}
+	XRaiseWindow(display, mainAppList->parent);
+
+	showAppList();
+	reFocus();
+}
+
 //---------------------------------------------------------
 
 void showAppList() {
 #define CMD_MAIN_APP 10
 #define CMD_APPLET 11
 #define CMD_DEBUG 12
+#define CMD_PREV_APP 13
+#define CMD_NEXT_APP 14
 
 // Resources
 extern int rSINGLE_TASK; // limits windows to 1 main app and applets as opposed to overlapping windows
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.