Compare commits

..

13 Commits

Author SHA1 Message Date
Ryan 5eb745581e
cleanup config.def.h
Few small tweaks to variable naming and such.
2024-12-03 11:11:04 -05:00
Ryan fec6ec3257
make the zoomrate configurable
This commit makes the rate that st zooms configurable.
2024-12-03 11:11:04 -05:00
Ryan 057ec62950
apply external-pipe-eternal patch
Makes it work with scrollback.
2024-12-03 11:11:04 -05:00
Ryan ed7be6b51b
apply externalpipe patch 2024-12-03 11:11:04 -05:00
Ryan bd6d10b904
apply blinking_cursor patch
Tweak the Xresources loading to use the new variable.
2024-12-03 11:11:04 -05:00
Ryan c5eb9851a9
apply xclearwin patch 2024-12-03 11:11:04 -05:00
Ryan c0bdced263
apply scrollback-mouse-increment patch
Tweak the config to be a bit better organized.
2024-12-03 11:11:04 -05:00
Ryan 2cd815077c
apply scrollback-mouse-altscreen patch
This makes the mouse wheel work for both normal scrolling and
altscreens such as less or vim.
2024-12-03 11:11:04 -05:00
Ryan 04f516b05e
apply scrollback-mouse patch
Just updates the config, kinda unnecessary.
2024-12-03 11:11:04 -05:00
Ryan 660100a961
apply scrollback-reflow patch
This patch makes text reflow like a real terminal.
2024-12-03 11:11:00 -05:00
Ryan 33885fc9d1
apply scrollback patch 2024-12-03 11:09:21 -05:00
Ryan 04e9641e17
apply dynamic-cursor-color patch
Makes the cursor match the underlying text. Very pretty.
2024-12-03 11:09:21 -05:00
Ryan 0a8ec7d442
apply anysize patch
This patch causes the terminal to fill its window manager slot versus
snapping to a multiple of the character width/height.
2024-12-03 11:09:21 -05:00
2 changed files with 4 additions and 110 deletions

View File

@ -177,42 +177,6 @@ static unsigned int defaultattr = 11;
*/
static uint forcemousemod = ShiftMask;
/*
* Xresources preferences to load at startup
*/
ResourcePref resources[] = {
{ "font", STRING, &font },
{ "color0", STRING, &colorname[0] },
{ "color1", STRING, &colorname[1] },
{ "color2", STRING, &colorname[2] },
{ "color3", STRING, &colorname[3] },
{ "color4", STRING, &colorname[4] },
{ "color5", STRING, &colorname[5] },
{ "color6", STRING, &colorname[6] },
{ "color7", STRING, &colorname[7] },
{ "color8", STRING, &colorname[8] },
{ "color9", STRING, &colorname[9] },
{ "color10", STRING, &colorname[10] },
{ "color11", STRING, &colorname[11] },
{ "color12", STRING, &colorname[12] },
{ "color13", STRING, &colorname[13] },
{ "color14", STRING, &colorname[14] },
{ "color15", STRING, &colorname[15] },
{ "background", STRING, &colorname[256] },
{ "foreground", STRING, &colorname[257] },
{ "cursorColor", STRING, &colorname[258] },
{ "termname", STRING, &termname },
{ "shell", STRING, &shell },
{ "minlatency", INTEGER, &minlatency },
{ "maxlatency", INTEGER, &maxlatency },
{ "blinktimeout", INTEGER, &blinktimeout },
{ "bellvolume", INTEGER, &bellvolume },
{ "tabspaces", INTEGER, &tabspaces },
{ "borderpx", INTEGER, &borderpx },
{ "cwscale", FLOAT, &cwscale },
{ "chscale", FLOAT, &chscale },
};
/*
* The number of lines to scroll by.
*/

78
x.c
View File

@ -14,7 +14,6 @@
#include <X11/keysym.h>
#include <X11/Xft/Xft.h>
#include <X11/XKBlib.h>
#include <X11/Xresource.h>
char *argv0;
#include "arg.h"
@ -47,19 +46,6 @@ typedef struct {
signed char appcursor; /* application cursor */
} Key;
/* Xresources preferences */
enum resource_type {
STRING = 0,
INTEGER = 1,
FLOAT = 2
};
typedef struct {
char *name;
enum resource_type type;
void *dst;
} ResourcePref;
/* X modifiers */
#define XK_ANY_MOD UINT_MAX
#define XK_NO_MOD 0
@ -886,8 +872,8 @@ xclearwin(void)
void
xhints(void)
{
XClassHint class = {opt_name ? opt_name : "st",
opt_class ? opt_class : "St"};
XClassHint class = {opt_name ? opt_name : termname,
opt_class ? opt_class : termname};
XWMHints wm = {.flags = InputHint, .input = 1};
XSizeHints *sizeh;
@ -1162,6 +1148,8 @@ xinit(int cols, int rows)
pid_t thispid = getpid();
XColor xmousefg, xmousebg;
if (!(xw.dpy = XOpenDisplay(NULL)))
die("can't open display\n");
xw.scr = XDefaultScreen(xw.dpy);
xw.vis = XDefaultVisual(xw.dpy, xw.scr);
@ -2081,59 +2069,6 @@ run(void)
}
}
int
resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst)
{
char **sdst = dst;
int *idst = dst;
float *fdst = dst;
char fullname[256];
char fullclass[256];
char *type;
XrmValue ret;
snprintf(fullname, sizeof(fullname), "%s.%s",
opt_name ? opt_name : "st", name);
snprintf(fullclass, sizeof(fullclass), "%s.%s",
opt_class ? opt_class : "St", name);
fullname[sizeof(fullname) - 1] = fullclass[sizeof(fullclass) - 1] = '\0';
XrmGetResource(db, fullname, fullclass, &type, &ret);
if (ret.addr == NULL || strncmp("String", type, 64))
return 1;
switch (rtype) {
case STRING:
*sdst = ret.addr;
break;
case INTEGER:
*idst = strtoul(ret.addr, NULL, 10);
break;
case FLOAT:
*fdst = strtof(ret.addr, NULL);
break;
}
return 0;
}
void
config_init(void)
{
char *resm;
XrmDatabase db;
ResourcePref *p;
XrmInitialize();
resm = XResourceManagerString(xw.dpy);
if (!resm)
return;
db = XrmGetStringDatabase(resm);
for (p = resources; p < resources + LEN(resources); p++)
resource_load(db, p->name, p->type, p->dst);
}
void
usage(void)
{
@ -2207,11 +2142,6 @@ run:
setlocale(LC_CTYPE, "");
XSetLocaleModifiers("");
if(!(xw.dpy = XOpenDisplay(NULL)))
die("Can't open display\n");
config_init();
cols = MAX(cols, 1);
rows = MAX(rows, 1);
tnew(cols, rows);