diff -Nurp /sys/src/cmd/rio/README ../grio/README --- /sys/src/cmd/rio/README Wed Dec 31 18:00:00 1969 +++ ../grio/README Fri Dec 7 23:24:27 2018 @@ -0,0 +1,12 @@ +grio is a modified rio that adds hubfs integration, an extra user +selectable command in the menu, and appearance options. grio expects +hubfs to be installed. If an available hubfs is not mounted at +/n/hubfs, it starts one. It uses /srv/riohubfs.username for the new +hubfs. Additional options: the -x argument sets a command (default +/bin/acme), -a provides an argument to it. Colors are defined by 8 +digit hexidecimal numbers. -c sets background color, -t the text +color, -u the window color, -y the border color of active windows, -z +the border color of backgrounded windows. The width of borders can be +set with an integer parameter for -w. -e removes the 'exit' option from the menu. + +Example: grio -x /bin/stats -a -elm -c 0xaabbccff -y 0x11111111 -w 2 diff -Nurp /sys/src/cmd/rio/dat.h ../grio/dat.h --- /sys/src/cmd/rio/dat.h Fri Dec 7 22:53:55 2018 +++ ../grio/dat.h Fri Dec 7 23:24:27 2018 @@ -43,7 +43,7 @@ typedef struct Xfid Xfid; enum { - Selborder = 4, /* border of selected window */ +// Selborder = 4, /* border of selected window */ Unselborder = 1, /* border of unselected window */ Scrollwid = 12, /* width of scroll bar */ Scrollgap = 4, /* gap right of scroll bar */ @@ -173,6 +173,13 @@ struct Window char *dir; }; +int Selborder; +ulong bgtrans; +ulong borderactivecolor; +ulong borderbgcolor; +ulong textcolor; +ulong winbgcolor; +ulong scrollbarcolor; void winctl(void*); void winshell(void*); Window* wlookid(int); @@ -309,6 +316,7 @@ Screen *wscreen; Cursor boxcursor; Cursor crosscursor; Cursor sightcursor; +Cursor deletecursor; Cursor whitearrow; Cursor query; Cursor *corners[9]; @@ -348,6 +356,7 @@ char srvpipe[]; char srvwctl[]; int errorshouldabort; int menuing; /* menu action is pending; waiting for window to be indicated */ +int deleting; /* for changing cursor in pointto() */ int snarfversion; /* updated each time it is written */ int messagesize; /* negotiated in 9P version setup */ int shiftdown; diff -Nurp /sys/src/cmd/rio/data.c ../grio/data.c --- /sys/src/cmd/rio/data.c Sat Nov 23 15:21:19 2013 +++ ../grio/data.c Fri Dec 7 23:24:27 2018 @@ -46,6 +46,18 @@ Cursor sightcursor = { 0x21, 0x84, 0x31, 0x8C, 0x0F, 0xF0, 0x00, 0x00, } }; +Cursor deletecursor = { + 0, 0, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + + 0x00, 0x0E, 0x07, 0x1F, 0x03, 0x17, 0x73, 0x6F, + 0xFB, 0xCE, 0xDB, 0x8C, 0xDB, 0xC0, 0xFB, 0x6C, + 0x77, 0xFC, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, + 0x94, 0xA6, 0x63, 0x3C, 0x63, 0x18, 0x94, 0x90, +}; Cursor whitearrow = { {0, 0}, {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFC, @@ -173,23 +185,38 @@ Cursor *corners[9] = { }; void -iconinit(void) +iconinit(char *bf) { - background = allocimage(display, Rect(0,0,1,1), RGB24, 1, 0x777777FF); + int fd; + Image *bimg = nil; + + background = allocimage(display, Rect(0,0,1,1), RGB24, 1, bgtrans); /* greys are multiples of 0x11111100+0xFF, 14* being palest */ - cols[BACK] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0xFFFFFFFF^reverse); - cols[BORD] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x999999FF^reverse); - cols[TEXT] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x000000FF^reverse); + cols[BACK] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, winbgcolor^reverse); + cols[BORD] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, scrollbarcolor^reverse); + cols[TEXT] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, textcolor^reverse); cols[HTEXT] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x000000FF); if(!reverse) { cols[HIGH] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0xCCCCCCFF); - titlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DGreygreen); - lighttitlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPalegreygreen); + titlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, borderactivecolor); + lighttitlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, borderbgcolor); } else { cols[HIGH] = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPurpleblue); - titlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DPurpleblue); - lighttitlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, 0x222222FF); + titlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, borderactivecolor); + lighttitlecol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, borderbgcolor); + } + if(bf != nil){ + fd = open(bf, OREAD); + if(fd >= 0){ + bimg = readimage(display, fd, 0); + close(fd); + } else + fprint(2, "iconinit: %r\n"); + } + if(bimg){ + background = allocimage(display, Rect(0, 0, Dx(bimg->r), Dy(bimg->r)), RGB24, 1, 0xFFFFFFFF); + draw(background, background->r, bimg, 0, bimg->r.min); } dholdcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DMedblue); lightholdcol = allocimage(display, Rect(0,0,1,1), CMAP8, 1, DGreyblue); diff -Nurp /sys/src/cmd/rio/fns.h ../grio/fns.h --- /sys/src/cmd/rio/fns.h Thu May 19 11:48:54 2016 +++ ../grio/fns.h Fri Dec 7 23:24:27 2018 @@ -15,7 +15,7 @@ Timer* timerstart(int); void error(char*); void killprocs(void); int shutdown(void*, char*); -void iconinit(void); +void iconinit(char*); void *erealloc(void*, uint); void *emalloc(uint); char *estrdup(char*); diff -Nurp /sys/src/cmd/rio/grio.man ../grio/grio.man --- /sys/src/cmd/rio/grio.man Wed Dec 31 18:00:00 1969 +++ ../grio/grio.man Fri Dec 7 23:24:27 2018 @@ -0,0 +1,157 @@ +.TH GRIO 1 +.SH NAME +grio \- customizable rio +.SH SYNOPSIS +.B grio +[ +.B -x +.BI ' menu_cmd ' +] +[ +.B -a +.BI ' cmd_argument ' +] +[ +.B -e +] +[ +.B -c +.I background color +] +[ +.B -t +.I text color +] +[ +.B -u +.I window color +] +[ +.B -y +.I active bordercolor +] +[ +.B -z +.I bkground bordercolor +] +[ +.B -l +.I scrollbar color +] +[ +.B -B +.I bkground image +] +[ +.B -w +.I border width +] +.SH DESCRIPTION +Rio with hubfs integration, command menu customization, selectable colors. +.I Grio +is a modified version of +.IR rio (1) +All rio options are supported. Integration with +.IR hubfs (4) +and a user-selectable command is provided via the right mouse button menu. This manpage describes only the new features. +.SS Menu Options +.I Grio +provides an 'exit' command in the right button menu, because it is often run nested. The +.B -e +option removes the 'exit' command from the menu. A user-selected command (or +.B /bin/acme +by default) is added to the menu via the +.B -x +option. The command must include the full path, for instance +.B /bin/stats +rather than simply 'stats'. A single argument containing no spaces may be passed with the +.B -a +argument option. If the argument is a set of flags, the - needs to be included. For instance, +.B -lems +as an argument to stats. The argument may not contain any spaces, and quoting does not enable the use of multi-part arguments. +.SS Color Selection +Most of the colors used by +.I grio +are now user-selectable via 8 digit hex codes. See +.IR colors (1) +to inspect sample colors and their codes. +.B -c +.I colorcode +sets the background color. +.B -t +.I textcolor +sets the color of text in windows. +.B -u +.I windowcolor +sets the color the windows themselves. +.B -y +.I bordercolor +sets the color of the border of the currently active window, and +.B -z +.I bordercolor +sets the color of the border of the unselected windows. The width of borders is set with an integer parameter to +.B -w +.I borderpixels +with 2 as the minimum for visible window borders. If no theming parameters are provided, the appearance defaults to standard. +.SS Background Image +.B -B +.I backimg +sets an image for use as the background. The image must be in Plan 9 Image format. You can use the tools such as +.IR jpg(1) +or +.IR png(1) +with the +.B -c +option to convert other images to Plan 9 format. The image will be tiled to fill the available background space. +.SS Hubfs integration +Another menu option, +.B Hub +is present in the right mouse button menu. This provides integration with +.IR Hubfs (4) +such that after this command is selected, the window swept out will automatically be connected to the hubfs mounted at +.B /n/hubfs. +On startup, if there is not already a mounted hubfs at /n/hubfs, +.I grio +will launch a new instance of +.I hubfs +with the srv file posted at +.B /srv/riohubfs.username. +It is often useful to import the /srv of a remote machine and mount a hubfs from it to /n/hubfs prior to starting +.I grio +. +.SH EXAMPLES +Start with no exit command in the menu, and the ability to create a subgrio with its windows set to scroll mode. (Windows of hosting grio will not be in scroll mode because the -s option is "consumed" by the -a argument.) +.IP +.EX +grio -e -x /bin/grio -a -s +.EE +.PP +Start with a tasteful light purple theme and thin black borders +.IP +.EX +grio -c 0xffaaffff -y 0 -w 2 +.EE +.PP +Import and mount a hubfs already running on a remote machine for easy use from the menu +.IP +.EX +rimport kremvax /srv +mount -c /srv/kremhub /n/hubfs +grio +.EE +.PP +Start with a theme of bold and breathtaking beauty +.IP +.EX +grio -c 0xff0000ff -u 0x00ccff -y 0x00ff00ff -t 0xffff00ff -z 0xffaa00ff +.EE +.EX +-w 10 -x /bin/games/catclock -f /lib/font/bit/times/latin1.bold.10.font +.EE +.PP +.SH SOURCE +.B /sys/src/ants/frontmods/grio +.SH BUGS +It would be nice if the +.B -a +argument option could parse and separate multipart arguments. diff -Nurp /sys/src/cmd/rio/mkfile ../grio/mkfile --- /sys/src/cmd/rio/mkfile Tue Jan 17 18:12:54 2012 +++ ../grio/mkfile Fri Dec 7 23:24:27 2018 @@ -1,7 +1,7 @@ r, background, nil, ZP); +// draw(view, view->r, background, nil, ZP); + draw(view, view->r, background, nil, view->r.min); o = subpt(viewr.max, viewr.min); n = subpt(view->clipr.max, view->clipr.min); qsort(window, nwindow, sizeof(window[0]), wtopcmp); @@ -710,6 +807,7 @@ button3menu(void) free(menu3str[i]); menu3str[i] = nil; } + menu3str[Altc] = altargv[0]; sweeping = TRUE; switch(i = menuhit(3, mousectl, &menu3, wscreen)){ case -1: @@ -717,6 +815,12 @@ button3menu(void) case New: new(sweep(), FALSE, scrolling, 0, nil, "/bin/rc", nil); break; + case Hub: + new(sweep(), FALSE, scrolling, 0, nil, "/bin/hubshell", hubargv); + break; + case Altc: + new(sweep(), FALSE, scrolling, 0, nil, altcmd, altargv); + break; case Reshape: resize(); break; @@ -981,7 +1085,11 @@ pointto(int wait) Window *w; menuing = TRUE; - riosetcursor(&sightcursor); + if(deleting == TRUE){ + riosetcursor(&deletecursor); + deleting = FALSE; + } else + riosetcursor(&sightcursor); while(mouse->buttons == 0) readmouse(mousectl); if(mouse->buttons == 4) @@ -1009,6 +1117,7 @@ delete(void) { Window *w; + deleting = TRUE; w = pointto(TRUE); if(w) wsendctlmesg(w, Deleted, ZR, nil);