shithub: zuke

Download patch

ref: 9a9b8477a8dec9fd05b97ddfda316f86dae8fb20
parent: 8952c92c316b6d97f2306f7f35583631cfca74d2
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Thu Jun 18 06:51:43 EDT 2020

add -s option to start in shuffled mode

--- a/README.md
+++ b/README.md
@@ -48,6 +48,8 @@
 p  file path
 ```
 
+With `-s` zuke will start in shuffled mode.
+
 ## Hot keys
 
 ```
--- a/zuke.c
+++ b/zuke.c
@@ -850,7 +850,7 @@
 static void
 usage(void)
 {
-	fprint(2, "usage: %s [-c aAdDtTp]\n", argv0);
+	fprint(2, "usage: %s [-s] [-c aAdDtTp]\n", argv0);
 	sysfatal("usage");
 }
 
@@ -867,9 +867,13 @@
 		{ nil, &key, CHANRCV },
 		{ nil, nil, CHANEND },
 	};
-	int fd, n, scrolling, oldpcur, oldbuttons, pnew;
+	int fd, n, scrolling, oldpcur, oldbuttons, pnew, shuffled;
 
+	shuffled = 0;
 	ARGBEGIN{
+	case 's':
+		shuffled = 1;
+		break;
 	case 'c':
 		cols = EARGF(usage());
 		if(strlen(cols) >= nelem(colwidth))
@@ -912,6 +916,11 @@
 	if((fd = open(tmp, OWRITE)) >= 0){
 		fprint(fd, "pri 13\n");
 		close(fd);
+	}
+
+	if(shuffled){
+		pcur = nrand(plnum);
+		toggleshuffle();
 	}
 
 	themeinit();