X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=x.c;h=12bc86b81cb03c663381965eddb664b3015884e6;hb=5345db3c9be1a22ca19202035b881b951c2f0f9e;hp=d43a52947aa61638c269194c1d2a7fa19d292c68;hpb=c5ba9c025b7ebc34979e839453528f6e4a18712d;p=st.git diff --git a/x.c b/x.c index d43a529..12bc86b 100644 --- a/x.c +++ b/x.c @@ -245,8 +245,8 @@ clipcopy(const Arg *dummy) { Atom clipboard; - if (xsel.clipboard != NULL) - free(xsel.clipboard); + free(xsel.clipboard); + xsel.clipboard = NULL; if (xsel.primary != NULL) { xsel.clipboard = xstrdup(xsel.primary); @@ -1492,7 +1492,7 @@ void xsettitle(char *p) { XTextProperty prop; - DEFAULT(p, "st"); + DEFAULT(p, opt_title); Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle, &prop); @@ -1929,12 +1929,12 @@ main(int argc, char *argv[]) } ARGEND; run: - if (argc > 0) { - /* eat all remaining arguments */ + if (argc > 0) /* eat all remaining arguments */ opt_cmd = argv; - if (!opt_title && !opt_line) - opt_title = basename(xstrdup(argv[0])); - } + + if (!opt_title) + opt_title = (opt_line || !opt_cmd) ? "st" : opt_cmd[0]; + setlocale(LC_CTYPE, ""); XSetLocaleModifiers(""); cols = MAX(cols, 1);