Browse Source

Dots backup before switching to gentoo

main
Yigit Colakoglu 4 years ago
parent
commit
276ac4d4b7
24 changed files with 1099 additions and 35 deletions
  1. +1
    -1
      .config/mutt/accounts/2-yigit@yigitcolakoglu.com.muttrc
  2. +1
    -0
      .config/vim/plugin/plugins.vim
  3. +1
    -1
      .local/bin/mpd-notif
  4. +9
    -13
      .local/bin/password_manager
  5. +1
    -1
      .local/src/dwm/Makefile
  6. +70
    -0
      .local/src/dwm/config.def.h
  7. +4
    -0
      .local/src/dwm/config.h
  8. +149
    -14
      .local/src/dwm/dwm.c
  9. +40
    -0
      .local/src/dwm/dwmc
  10. +2
    -2
      .local/src/dwm/keybinds.h
  11. +240
    -0
      .local/src/dwm/patches/dwm-dwmc-6.2.diff
  12. +177
    -0
      .local/src/dwm/patches/dwm-pertag-20200914-61bb8b2.diff
  13. +2
    -1
      .local/src/dwm/rules.h
  14. +9
    -0
      .local/src/sent/config.def.h
  15. +9
    -0
      .local/src/sent/config.h
  16. +69
    -0
      .local/src/sent/example
  17. BIN
      .local/src/sent/nyan.png
  18. +73
    -0
      .local/src/sent/patches/sent-invertedcolors-72d33d4.diff
  19. +72
    -0
      .local/src/sent/patches/sent-options-20190213-72d33d4.diff
  20. +31
    -0
      .local/src/sent/patches/sent-progress-bar-1.0.diff
  21. +79
    -0
      .local/src/sent/patches/sent-toggle-scm-20210119-2be4210.diff
  22. BIN
      .local/src/sent/sent
  23. +17
    -0
      .local/src/sent/sent.1
  24. +43
    -2
      .local/src/sent/sent.c

+ 1
- 1
.config/mutt/accounts/2-yigit@yigitcolakoglu.com.muttrc View File

@ -1,6 +1,6 @@
# vim: filetype=neomuttrc # vim: filetype=neomuttrc
# muttrc file for account yigit@yigitcolakoglu.com # muttrc file for account yigit@yigitcolakoglu.com
set realname = "yigit"
set realname = "Yigit Colakoglu"
set from = "yigit@yigitcolakoglu.com" set from = "yigit@yigitcolakoglu.com"
set sendmail = "msmtp -a yigit@yigitcolakoglu.com" set sendmail = "msmtp -a yigit@yigitcolakoglu.com"
alias me yigit <yigit@yigitcolakoglu.com> alias me yigit <yigit@yigitcolakoglu.com>


+ 1
- 0
.config/vim/plugin/plugins.vim View File

@ -25,6 +25,7 @@ Plug 'jlanzarotta/bufexplorer'
Plug 'jeffkreeftmeijer/vim-numbertoggle' Plug 'jeffkreeftmeijer/vim-numbertoggle'
Plug 'rhysd/vim-grammarous' Plug 'rhysd/vim-grammarous'
Plug 'chrisbra/NrrwRgn' Plug 'chrisbra/NrrwRgn'
Plug 'robertbasic/vim-hugo-helper'
"Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } "Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'sheerun/vim-polyglot' Plug 'sheerun/vim-polyglot'
Plug 'M4R7iNP/vim-inky' Plug 'M4R7iNP/vim-inky'


+ 1
- 1
.local/bin/mpd-notif View File

@ -3,4 +3,4 @@
title=$(mpc -f "%title%" 2> /dev/null | head -n 1 | xargs) title=$(mpc -f "%title%" 2> /dev/null | head -n 1 | xargs)
artist=$(mpc -f "%artist%" 2> /dev/null | head -n 1 | xargs) artist=$(mpc -f "%artist%" 2> /dev/null | head -n 1 | xargs)
notify-send -r 120 -a " $artist" -t 1500 "~ $title ~ "
notify-send -a " $artist" -t 1500 "~ $title ~ "

+ 9
- 13
.local/bin/password_manager View File

@ -2,7 +2,7 @@
shopt -s nullglob globstar shopt -s nullglob globstar
typeit=0
typeit=1
if [[ $1 == "--type" ]]; then if [[ $1 == "--type" ]]; then
typeit=1 typeit=1
shift shift
@ -24,20 +24,16 @@ case "$action" in
echo "$username" | xclip -selection clipboard echo "$username" | xclip -selection clipboard
notify-send -a " Password Manager" "Username copied to clipboard";; notify-send -a " Password Manager" "Username copied to clipboard";;
Password) Password)
if [[ $typeit -eq 0 ]]; then
pass show -c "$entry" 2>/dev/null
else
pass show "$entry" | { IFS= read -r pass; printf %s "$pass"; } |
xdotool type --clearmodifiers --file -
fi
password=$(pass show "$entry")
echo "$password" | xclip -selection clipboard
echo "$password" | { IFS= read -r pass; printf %s "$pass"; } |
xdotool type --clearmodifiers --file -
notify-send -a " Password Manager" "Password copied to clipboard";; notify-send -a " Password Manager" "Password copied to clipboard";;
TOTP) TOTP)
if [[ $typeit -eq 0 ]]; then
pass otp -c "$entry" 2>/dev/null
else
pass otp "$entry" | { IFS= read -r pass; printf %s "$pass"; } |
xdotool type --clearmodifiers --file -
fi
otp=$(pass otp "$entry")
echo "$otp" | xclip -selection clipboard
echo "$otp" | { IFS= read -r pass; printf %s "$pass"; } |
xdotool type --clearmodifiers --file -
notify-send -a " Password Manager" "TOTP copied to clipboard";; notify-send -a " Password Manager" "TOTP copied to clipboard";;
esac esac

+ 1
- 1
.local/src/dwm/Makefile View File

@ -38,7 +38,7 @@ dist: clean
install: all install: all
mkdir -p ${DESTDIR}${PREFIX}/bin mkdir -p ${DESTDIR}${PREFIX}/bin
cp -f dwm ${DESTDIR}${PREFIX}/bin
cp -f dwm dwmc ${DESTDIR}${PREFIX}/bin
chmod 755 ${DESTDIR}${PREFIX}/bin/dwm chmod 755 ${DESTDIR}${PREFIX}/bin/dwm
mkdir -p ${DESTDIR}${MANPREFIX}/man1 mkdir -p ${DESTDIR}${MANPREFIX}/man1
sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1 sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1


+ 70
- 0
.local/src/dwm/config.def.h View File

@ -231,3 +231,73 @@ static Button buttons[] = {
{ ClkTagBar, MODKEY, Button3, toggletag, {0} }, { ClkTagBar, MODKEY, Button3, toggletag, {0} },
}; };
void
setlayoutex(const Arg *arg)
{
setlayout(&((Arg) { .v = &layouts[arg->i] }));
}
void
viewex(const Arg *arg)
{
view(&((Arg) { .ui = 1 << arg->ui }));
}
void
viewall(const Arg *arg)
{
view(&((Arg){.ui = ~0}));
}
void
toggleviewex(const Arg *arg)
{
toggleview(&((Arg) { .ui = 1 << arg->ui }));
}
void
tagex(const Arg *arg)
{
tag(&((Arg) { .ui = 1 << arg->ui }));
}
void
toggletagex(const Arg *arg)
{
toggletag(&((Arg) { .ui = 1 << arg->ui }));
}
void
tagall(const Arg *arg)
{
tag(&((Arg){.ui = ~0}));
}
/* signal definitions */
/* signum must be greater than 0 */
/* trigger signals using `xsetroot -name "fsignal:<signame> [<type> <value>]"` */
static Signal signals[] = {
/* signum function */
{ "focusstack", focusstack },
{ "setmfact", setmfact },
{ "togglebar", togglebar },
{ "incnmaster", incnmaster },
{ "togglefloating", togglefloating },
{ "focusmon", focusmon },
{ "tagmon", tagmon },
{ "zoom", zoom },
{ "view", view },
{ "viewall", viewall },
{ "viewex", viewex },
{ "toggleview", view },
{ "toggleviewex", toggleviewex },
{ "tag", tag },
{ "tagall", tagall },
{ "tagex", tagex },
{ "toggletag", tag },
{ "toggletagex", toggletagex },
{ "killclient", killclient },
{ "quit", quit },
{ "setlayout", setlayout },
{ "setlayoutex", setlayoutex },
};

+ 4
- 0
.local/src/dwm/config.h View File

@ -76,3 +76,7 @@ static Button buttons[] = {
{ ClkTagBar, MODKEY, Button3, toggletag, {0} }, { ClkTagBar, MODKEY, Button3, toggletag, {0} },
}; };
static Signal signals[] = {
/* signum function */
{ "focusstack", focusstack },
};

+ 149
- 14
.local/src/dwm/dwm.c View File

@ -118,11 +118,17 @@ typedef struct {
const Arg arg; const Arg arg;
} Key; } Key;
typedef struct {
const char * sig;
void (*func)(const Arg *);
} Signal;
typedef struct { typedef struct {
const char *symbol; const char *symbol;
void (*arrange)(Monitor *); void (*arrange)(Monitor *);
} Layout; } Layout;
typedef struct Pertag Pertag;
struct Monitor { struct Monitor {
char ltsymbol[16]; char ltsymbol[16];
float mfact; float mfact;
@ -147,6 +153,7 @@ struct Monitor {
Monitor *next; Monitor *next;
Window barwin; Window barwin;
const Layout *lt[2]; const Layout *lt[2];
Pertag *pertag;
}; };
typedef struct { typedef struct {
@ -169,6 +176,7 @@ static void arrangemon(Monitor *m);
static void attach(Client *c); static void attach(Client *c);
static void attachaside(Client *c); static void attachaside(Client *c);
static void attachstack(Client *c); static void attachstack(Client *c);
static int fake_signal(void);
static void buttonpress(XEvent *e); static void buttonpress(XEvent *e);
static void checkotherwm(void); static void checkotherwm(void);
static void cleanup(void); static void cleanup(void);
@ -326,6 +334,15 @@ static xcb_connection_t *xcon;
#include "keybinds.h" #include "keybinds.h"
#include "rules.h" #include "rules.h"
struct Pertag {
unsigned int curtag, prevtag; /* current and previous tag */
int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */
float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */
unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */
const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */
int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
};
/* compile-time check if all tags fit into an unsigned int bit array. */ /* compile-time check if all tags fit into an unsigned int bit array. */
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
@ -555,15 +572,16 @@ buttonpress(XEvent *e)
unsigned int xc; unsigned int xc;
int padding = - sp * 3; /* I don't know why 3 works better than two, but it does */ int padding = - sp * 3; /* I don't know why 3 works better than two, but it does */
Arg arg = {0}; Arg arg = {0};
Client *c;
Client *c, *sel;
Monitor *m; Monitor *m;
XButtonPressedEvent *ev = &e->xbutton; XButtonPressedEvent *ev = &e->xbutton;
click = ClkRootWin; click = ClkRootWin;
/* focus monitor if necessary */ /* focus monitor if necessary */
if ((m = wintomon(ev->window)) && m != selmon) { if ((m = wintomon(ev->window)) && m != selmon) {
unfocus(selmon->sel, 1);
sel = selmon->sel;
selmon = m; selmon = m;
unfocus(sel, 1);
focus(NULL); focus(NULL);
} }
if (ev->window == selmon->barwin) { if (ev->window == selmon->barwin) {
@ -842,6 +860,7 @@ Monitor *
createmon(void) createmon(void)
{ {
Monitor *m; Monitor *m;
unsigned int i;
m = ecalloc(1, sizeof(Monitor)); m = ecalloc(1, sizeof(Monitor));
m->tagset[0] = m->tagset[1] = 1; m->tagset[0] = m->tagset[1] = 1;
@ -856,6 +875,20 @@ createmon(void)
m->lt[0] = &layouts[0]; m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % LENGTH(layouts)]; m->lt[1] = &layouts[1 % LENGTH(layouts)];
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
m->pertag = ecalloc(1, sizeof(Pertag));
m->pertag->curtag = m->pertag->prevtag = 1;
for (i = 0; i <= LENGTH(tags); i++) {
m->pertag->nmasters[i] = m->nmaster;
m->pertag->mfacts[i] = m->mfact;
m->pertag->ltidxs[i][0] = m->lt[0];
m->pertag->ltidxs[i][1] = m->lt[1];
m->pertag->sellts[i] = m->sellt;
m->pertag->showbars[i] = m->showbar;
}
return m; return m;
} }
@ -1164,7 +1197,7 @@ floatpos(const Arg *arg)
void void
enternotify(XEvent *e) enternotify(XEvent *e)
{ {
Client *c;
Client *c, *sel;
Monitor *m; Monitor *m;
XCrossingEvent *ev = &e->xcrossing; XCrossingEvent *ev = &e->xcrossing;
@ -1173,8 +1206,9 @@ enternotify(XEvent *e)
c = wintoclient(ev->window); c = wintoclient(ev->window);
m = c ? c->mon : wintomon(ev->window); m = c ? c->mon : wintomon(ev->window);
if (m != selmon) { if (m != selmon) {
unfocus(selmon->sel, 1);
sel = selmon->sel;
selmon = m; selmon = m;
unfocus(sel, 1);
} else if (!c || c == selmon->sel) } else if (!c || c == selmon->sel)
return; return;
focus(c); focus(c);
@ -1229,13 +1263,15 @@ void
focusmon(const Arg *arg) focusmon(const Arg *arg)
{ {
Monitor *m; Monitor *m;
Client *sel;
if (!mons->next) if (!mons->next)
return; return;
if ((m = dirtomon(arg->i)) == selmon) if ((m = dirtomon(arg->i)) == selmon)
return; return;
unfocus(selmon->sel, 0);
sel = selmon->sel;
selmon = m; selmon = m;
unfocus(sel, 0);
focus(NULL); focus(NULL);
} }
@ -1504,7 +1540,7 @@ grabkeys(void)
void void
incnmaster(const Arg *arg) incnmaster(const Arg *arg)
{ {
selmon->nmaster = MAX(selmon->nmaster + arg->i, 0);
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = MAX(selmon->nmaster + arg->i, 0);
arrange(selmon); arrange(selmon);
} }
@ -1536,6 +1572,49 @@ keypress(XEvent *e)
keys[i].func(&(keys[i].arg)); keys[i].func(&(keys[i].arg));
} }
int
fake_signal(void)
{
char fsignal[256];
char indicator[9] = "fsignal:";
char str_sig[50];
char param[16];
int i, len_str_sig, n, paramn;
size_t len_fsignal, len_indicator = strlen(indicator);
Arg arg;
// Get root name property
if (gettextprop(root, XA_WM_NAME, fsignal, sizeof(fsignal))) {
len_fsignal = strlen(fsignal);
// Check if this is indeed a fake signal
if (len_indicator > len_fsignal ? 0 : strncmp(indicator, fsignal, len_indicator) == 0) {
paramn = sscanf(fsignal+len_indicator, "%s%n%s%n", str_sig, &len_str_sig, param, &n);
if (paramn == 1) arg = (Arg) {0};
else if (paramn > 2) return 1;
else if (strncmp(param, "i", n - len_str_sig) == 0)
sscanf(fsignal + len_indicator + n, "%i", &(arg.i));
else if (strncmp(param, "ui", n - len_str_sig) == 0)
sscanf(fsignal + len_indicator + n, "%u", &(arg.ui));
else if (strncmp(param, "f", n - len_str_sig) == 0)
sscanf(fsignal + len_indicator + n, "%f", &(arg.f));
else return 1;
// Check if a signal was found, and if so handle it
for (i = 0; i < LENGTH(signals); i++)
if (strncmp(str_sig, signals[i].sig, len_str_sig) == 0 && signals[i].func)
signals[i].func(&(arg));
// A fake signal was sent
return 1;
}
}
// No fake signal was sent, so proceed with update
return 0;
}
void void
killclient(const Arg *arg) killclient(const Arg *arg)
{ {
@ -1666,13 +1745,15 @@ motionnotify(XEvent *e)
{ {
static Monitor *mon = NULL; static Monitor *mon = NULL;
Monitor *m; Monitor *m;
Client *sel;
XMotionEvent *ev = &e->xmotion; XMotionEvent *ev = &e->xmotion;
if (ev->window != root) if (ev->window != root)
return; return;
if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) { if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
unfocus(selmon->sel, 1);
sel = selmon->sel;
selmon = m; selmon = m;
unfocus(sel, 1);
focus(NULL); focus(NULL);
} }
mon = m; mon = m;
@ -1771,8 +1852,10 @@ propertynotify(XEvent *e)
Window trans; Window trans;
XPropertyEvent *ev = &e->xproperty; XPropertyEvent *ev = &e->xproperty;
if ((ev->window == root) && (ev->atom == XA_WM_NAME))
updatestatus();
if ((ev->window == root) && (ev->atom == XA_WM_NAME)) {
if (!fake_signal())
updatestatus();
}
else if (ev->state == PropertyDelete) else if (ev->state == PropertyDelete)
return; /* ignore */ return; /* ignore */
else if ((c = wintoclient(ev->window))) { else if ((c = wintoclient(ev->window))) {
@ -2101,9 +2184,9 @@ void
setlayout(const Arg *arg) setlayout(const Arg *arg)
{ {
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
selmon->sellt ^= 1;
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag] ^= 1;
if (arg && arg->v) if (arg && arg->v)
selmon->lt[selmon->sellt] = (Layout *)arg->v;
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v;
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol); strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
if (selmon->sel) if (selmon->sel)
arrange(selmon); arrange(selmon);
@ -2122,7 +2205,7 @@ setmfact(const Arg *arg)
f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0; f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
if (f < 0.05 || f > 0.95) if (f < 0.05 || f > 0.95)
return; return;
selmon->mfact = f;
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f;
arrange(selmon); arrange(selmon);
} }
@ -2319,7 +2402,7 @@ tagmon(const Arg *arg)
void void
togglebar(const Arg *arg) togglebar(const Arg *arg)
{ {
selmon->showbar = !selmon->showbar;
selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar;
updatebarpos(selmon); updatebarpos(selmon);
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by + vp, selmon->ww - 2 * sp, bh); XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + sp, selmon->by + vp, selmon->ww - 2 * sp, bh);
arrange(selmon); arrange(selmon);
@ -2384,9 +2467,33 @@ void
toggleview(const Arg *arg) toggleview(const Arg *arg)
{ {
unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK); unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
int i;
if (newtagset) { if (newtagset) {
selmon->tagset[selmon->seltags] = newtagset; selmon->tagset[selmon->seltags] = newtagset;
if (newtagset == ~0) {
selmon->pertag->prevtag = selmon->pertag->curtag;
selmon->pertag->curtag = 0;
}
/* test if the user did not select the same tag */
if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) {
selmon->pertag->prevtag = selmon->pertag->curtag;
for (i = 0; !(newtagset & 1 << i); i++) ;
selmon->pertag->curtag = i + 1;
}
/* apply settings for this view */
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
togglebar(NULL);
focus(NULL); focus(NULL);
arrange(selmon); arrange(selmon);
} }
@ -2397,6 +2504,8 @@ unfocus(Client *c, int setfocus)
{ {
if (!c) if (!c)
return; return;
if (c->isfullscreen && ISVISIBLE(c) && c->mon == selmon)
setfullscreen(c, 0);
grabbuttons(c, 0); grabbuttons(c, 0);
XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel); XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel);
if (setfocus) { if (setfocus) {
@ -2700,11 +2809,37 @@ updatewmhints(Client *c)
void void
view(const Arg *arg) view(const Arg *arg)
{ {
int i;
unsigned int tmptag;
if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
return; return;
selmon->seltags ^= 1; /* toggle sel tagset */ selmon->seltags ^= 1; /* toggle sel tagset */
if (arg->ui & TAGMASK)
if (arg->ui & TAGMASK) {
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
selmon->pertag->prevtag = selmon->pertag->curtag;
if (arg->ui == ~0)
selmon->pertag->curtag = 0;
else {
for (i = 0; !(arg->ui & 1 << i); i++) ;
selmon->pertag->curtag = i + 1;
}
} else {
tmptag = selmon->pertag->prevtag;
selmon->pertag->prevtag = selmon->pertag->curtag;
selmon->pertag->curtag = tmptag;
}
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
togglebar(NULL);
focus(NULL); focus(NULL);
arrange(selmon); arrange(selmon);
} }


+ 40
- 0
.local/src/dwm/dwmc View File

@ -0,0 +1,40 @@
#!/usr/bin/env sh
signal() {
xsetroot -name "fsignal:$*"
}
case $# in
1)
case $1 in
setlayout | view | viewall | togglebar | togglefloating | zoom | killclient | quit)
signal $1
;;
*)
echo "Unknown command or missing one argument."
exit 1
;;
esac
;;
2)
case $1 in
view)
signal $1 ui $2
;;
viewex | toggleviewex | tagex | toggletagex | setlayoutex | focusstack | incnmaster | focusmon | tagmon)
signal $1 i $2
;;
setmfact)
signal $1 f $2
;;
*)
echo "Unknown command or one too many arguments."
exit 1
;;
esac
;;
*)
echo "Too many arguments."
exit 1
;;
esac

+ 2
- 2
.local/src/dwm/keybinds.h View File

@ -37,8 +37,8 @@ static const char *outmenu[] = {"/home/yigit/.local/bin/dmenu-logout", NULL};
static const char *refresh[] = {"/home/yigit/.local/bin/dmenu-refresh", NULL}; static const char *refresh[] = {"/home/yigit/.local/bin/dmenu-refresh", NULL};
static const char *keyboard[] = {"/home/yigit/.local/bin/kbmap_toggle", NULL}; static const char *keyboard[] = {"/home/yigit/.local/bin/kbmap_toggle", NULL};
static const char *screenshot[] = { "scrot", "/tmp/%Y-%m-%d-%s_$wx$h.png", "-e","xclip -selection clipboard -target image/png -i $f; cp $f ~/Pictures/Screenshots;notify-send \"SNAP\" \"$f\"", NULL };
static const char *windowshot[] = { "scrot", "-u", "/tmp/%Y-%m-%d-%s_$wx$h.png", "-e","xclip -selection clipboard -target image/png -i $f; cp $f ~/Pictures/Screenshots;notify-send \"SNAP\" \"$f\"", NULL };
static const char *screenshot[] = { "scrot", "/tmp/%Y-%m-%d-%s_$wx$h.png", "-e","xclip -selection clipboard -target image/png -i $f; cp $f ~/Pictures/Screenshots;notify-send -a \"SNAP\" \"$f\"", NULL };
static const char *windowshot[] = { "scrot", "-u", "/tmp/%Y-%m-%d-%s_$wx$h.png", "-e","xclip -selection clipboard -target image/png -i $f; cp $f ~/Pictures/Screenshots;notify-send -a \"SNAP\" \"$f\"", NULL };
static const char *simcrop[] = {"simcrop","-fc","-sc", "-g", "900x500",NULL}; static const char *simcrop[] = {"simcrop","-fc","-sc", "-g", "900x500",NULL};
static const char *notification[] = {"/home/yigit/.local/bin/dunst_toggle.sh", "-t",NULL}; static const char *notification[] = {"/home/yigit/.local/bin/dunst_toggle.sh", "-t",NULL};


+ 240
- 0
.local/src/dwm/patches/dwm-dwmc-6.2.diff View File

@ -0,0 +1,240 @@
From d94cb6f1a553d19127f44dbdc96e8bb5041956c2 Mon Sep 17 00:00:00 2001
From: Nihal Jere <noocsharp@gmail.com>
Date: Sat, 21 Mar 2020 15:16:49 -0500
Subject: [PATCH] dwm-client
---
Makefile | 2 +-
config.def.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++
dwm.c | 55 +++++++++++++++++++++++++++++++++++++++--
dwmc | 40 ++++++++++++++++++++++++++++++
4 files changed, 164 insertions(+), 3 deletions(-)
create mode 100755 dwmc
diff --git a/Makefile b/Makefile
index 77bcbc0..f837f5c 100644
--- a/Makefile
+++ b/Makefile
@@ -38,7 +38,7 @@ dist: clean
install: all
mkdir -p ${DESTDIR}${PREFIX}/bin
- cp -f dwm ${DESTDIR}${PREFIX}/bin
+ cp -f dwm dwmc ${DESTDIR}${PREFIX}/bin
chmod 755 ${DESTDIR}${PREFIX}/bin/dwm
mkdir -p ${DESTDIR}${MANPREFIX}/man1
sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1
diff --git a/config.def.h b/config.def.h
index 1c0b587..efbae79 100644
--- a/config.def.h
+++ b/config.def.h
@@ -113,3 +113,73 @@ static Button buttons[] = {
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};
+void
+setlayoutex(const Arg *arg)
+{
+ setlayout(&((Arg) { .v = &layouts[arg->i] }));
+}
+
+void
+viewex(const Arg *arg)
+{
+ view(&((Arg) { .ui = 1 << arg->ui }));
+}
+
+void
+viewall(const Arg *arg)
+{
+ view(&((Arg){.ui = ~0}));
+}
+
+void
+toggleviewex(const Arg *arg)
+{
+ toggleview(&((Arg) { .ui = 1 << arg->ui }));
+}
+
+void
+tagex(const Arg *arg)
+{
+ tag(&((Arg) { .ui = 1 << arg->ui }));
+}
+
+void
+toggletagex(const Arg *arg)
+{
+ toggletag(&((Arg) { .ui = 1 << arg->ui }));
+}
+
+void
+tagall(const Arg *arg)
+{
+ tag(&((Arg){.ui = ~0}));
+}
+
+/* signal definitions */
+/* signum must be greater than 0 */
+/* trigger signals using `xsetroot -name "fsignal:<signame> [<type> <value>]"` */
+static Signal signals[] = {
+ /* signum function */
+ { "focusstack", focusstack },
+ { "setmfact", setmfact },
+ { "togglebar", togglebar },
+ { "incnmaster", incnmaster },
+ { "togglefloating", togglefloating },
+ { "focusmon", focusmon },
+ { "tagmon", tagmon },
+ { "zoom", zoom },
+ { "view", view },
+ { "viewall", viewall },
+ { "viewex", viewex },
+ { "toggleview", view },
+ { "toggleviewex", toggleviewex },
+ { "tag", tag },
+ { "tagall", tagall },
+ { "tagex", tagex },
+ { "toggletag", tag },
+ { "toggletagex", toggletagex },
+ { "killclient", killclient },
+ { "quit", quit },
+ { "setlayout", setlayout },
+ { "setlayoutex", setlayoutex },
+};
diff --git a/dwm.c b/dwm.c
index 4465af1..aa53706 100644
--- a/dwm.c
+++ b/dwm.c
@@ -106,6 +106,11 @@ typedef struct {
const Arg arg;
} Key;
+typedef struct {
+ const char * sig;
+ void (*func)(const Arg *);
+} Signal;
+
typedef struct {
const char *symbol;
void (*arrange)(Monitor *);
@@ -148,6 +153,7 @@ static void arrange(Monitor *m);
static void arrangemon(Monitor *m);
static void attach(Client *c);
static void attachstack(Client *c);
+static int fake_signal(void);
static void buttonpress(XEvent *e);
static void checkotherwm(void);
static void cleanup(void);
@@ -998,6 +1004,49 @@ keypress(XEvent *e)
keys[i].func(&(keys[i].arg));
}
+int
+fake_signal(void)
+{
+ char fsignal[256];
+ char indicator[9] = "fsignal:";
+ char str_sig[50];
+ char param[16];
+ int i, len_str_sig, n, paramn;
+ size_t len_fsignal, len_indicator = strlen(indicator);
+ Arg arg;
+
+ // Get root name property
+ if (gettextprop(root, XA_WM_NAME, fsignal, sizeof(fsignal))) {
+ len_fsignal = strlen(fsignal);
+
+ // Check if this is indeed a fake signal
+ if (len_indicator > len_fsignal ? 0 : strncmp(indicator, fsignal, len_indicator) == 0) {
+ paramn = sscanf(fsignal+len_indicator, "%s%n%s%n", str_sig, &len_str_sig, param, &n);
+
+ if (paramn == 1) arg = (Arg) {0};
+ else if (paramn > 2) return 1;
+ else if (strncmp(param, "i", n - len_str_sig) == 0)
+ sscanf(fsignal + len_indicator + n, "%i", &(arg.i));
+ else if (strncmp(param, "ui", n - len_str_sig) == 0)
+ sscanf(fsignal + len_indicator + n, "%u", &(arg.ui));
+ else if (strncmp(param, "f", n - len_str_sig) == 0)
+ sscanf(fsignal + len_indicator + n, "%f", &(arg.f));
+ else return 1;
+
+ // Check if a signal was found, and if so handle it
+ for (i = 0; i < LENGTH(signals); i++)
+ if (strncmp(str_sig, signals[i].sig, len_str_sig) == 0 && signals[i].func)
+ signals[i].func(&(arg));
+
+ // A fake signal was sent
+ return 1;
+ }
+ }
+
+ // No fake signal was sent, so proceed with update
+ return 0;
+}
+
void
killclient(const Arg *arg)
{
@@ -1215,8 +1264,10 @@ propertynotify(XEvent *e)
Window trans;
XPropertyEvent *ev = &e->xproperty;
- if ((ev->window == root) && (ev->atom == XA_WM_NAME))
- updatestatus();
+ if ((ev->window == root) && (ev->atom == XA_WM_NAME)) {
+ if (!fake_signal())
+ updatestatus();
+ }
else if (ev->state == PropertyDelete)
return; /* ignore */
else if ((c = wintoclient(ev->window))) {
diff --git a/dwmc b/dwmc
new file mode 100755
index 0000000..5ff8dbc
--- /dev/null
+++ b/dwmc
@@ -0,0 +1,40 @@
+#!/usr/bin/env sh
+
+signal() {
+ xsetroot -name "fsignal:$*"
+}
+
+case $# in
+1)
+ case $1 in
+ setlayout | view | viewall | togglebar | togglefloating | zoom | killclient | quit)
+ signal $1
+ ;;
+ *)
+ echo "Unknown command or missing one argument."
+ exit 1
+ ;;
+ esac
+ ;;
+2)
+ case $1 in
+ view)
+ signal $1 ui $2
+ ;;
+ viewex | toggleviewex | tagex | toggletagex | setlayoutex | focusstack | incnmaster | focusmon | tagmon)
+ signal $1 i $2
+ ;;
+ setmfact)
+ signal $1 f $2
+ ;;
+ *)
+ echo "Unknown command or one too many arguments."
+ exit 1
+ ;;
+ esac
+ ;;
+*)
+ echo "Too many arguments."
+ exit 1
+ ;;
+esac
--
2.25.1

+ 177
- 0
.local/src/dwm/patches/dwm-pertag-20200914-61bb8b2.diff View File

@ -0,0 +1,177 @@
diff --git a/dwm.c b/dwm.c
index 664c527..ac8e4ec 100644
--- a/dwm.c
+++ b/dwm.c
@@ -111,6 +111,7 @@ typedef struct {
void (*arrange)(Monitor *);
} Layout;
+typedef struct Pertag Pertag;
struct Monitor {
char ltsymbol[16];
float mfact;
@@ -130,6 +131,7 @@ struct Monitor {
Monitor *next;
Window barwin;
const Layout *lt[2];
+ Pertag *pertag;
};
typedef struct {
@@ -272,6 +274,15 @@ static Window root, wmcheckwin;
/* configuration, allows nested code to access above variables */
#include "config.h"
+struct Pertag {
+ unsigned int curtag, prevtag; /* current and previous tag */
+ int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */
+ float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */
+ unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */
+ const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */
+ int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
+};
+
/* compile-time check if all tags fit into an unsigned int bit array. */
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
@@ -632,6 +643,7 @@ Monitor *
createmon(void)
{
Monitor *m;
+ unsigned int i;
m = ecalloc(1, sizeof(Monitor));
m->tagset[0] = m->tagset[1] = 1;
@@ -642,6 +654,20 @@ createmon(void)
m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % LENGTH(layouts)];
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
+ m->pertag = ecalloc(1, sizeof(Pertag));
+ m->pertag->curtag = m->pertag->prevtag = 1;
+
+ for (i = 0; i <= LENGTH(tags); i++) {
+ m->pertag->nmasters[i] = m->nmaster;
+ m->pertag->mfacts[i] = m->mfact;
+
+ m->pertag->ltidxs[i][0] = m->lt[0];
+ m->pertag->ltidxs[i][1] = m->lt[1];
+ m->pertag->sellts[i] = m->sellt;
+
+ m->pertag->showbars[i] = m->showbar;
+ }
+
return m;
}
@@ -967,7 +993,7 @@ grabkeys(void)
void
incnmaster(const Arg *arg)
{
- selmon->nmaster = MAX(selmon->nmaster + arg->i, 0);
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = MAX(selmon->nmaster + arg->i, 0);
arrange(selmon);
}
@@ -1502,9 +1528,9 @@ void
setlayout(const Arg *arg)
{
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
- selmon->sellt ^= 1;
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag] ^= 1;
if (arg && arg->v)
- selmon->lt[selmon->sellt] = (Layout *)arg->v;
+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v;
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
if (selmon->sel)
arrange(selmon);
@@ -1523,7 +1549,7 @@ setmfact(const Arg *arg)
f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
if (f < 0.05 || f > 0.95)
return;
- selmon->mfact = f;
+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f;
arrange(selmon);
}
@@ -1702,7 +1728,7 @@ tile(Monitor *m)
void
togglebar(const Arg *arg)
{
- selmon->showbar = !selmon->showbar;
+ selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar;
updatebarpos(selmon);
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
arrange(selmon);
@@ -1741,9 +1767,33 @@ void
toggleview(const Arg *arg)
{
unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
+ int i;
if (newtagset) {
selmon->tagset[selmon->seltags] = newtagset;
+
+ if (newtagset == ~0) {
+ selmon->pertag->prevtag = selmon->pertag->curtag;
+ selmon->pertag->curtag = 0;
+ }
+
+ /* test if the user did not select the same tag */
+ if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) {
+ selmon->pertag->prevtag = selmon->pertag->curtag;
+ for (i = 0; !(newtagset & 1 << i); i++) ;
+ selmon->pertag->curtag = i + 1;
+ }
+
+ /* apply settings for this view */
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
+ selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
+
+ if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
+ togglebar(NULL);
+
focus(NULL);
arrange(selmon);
}
@@ -2038,11 +2088,37 @@ updatewmhints(Client *c)
void
view(const Arg *arg)
{
+ int i;
+ unsigned int tmptag;
+
if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
return;
selmon->seltags ^= 1; /* toggle sel tagset */
- if (arg->ui & TAGMASK)
+ if (arg->ui & TAGMASK) {
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
+ selmon->pertag->prevtag = selmon->pertag->curtag;
+
+ if (arg->ui == ~0)
+ selmon->pertag->curtag = 0;
+ else {
+ for (i = 0; !(arg->ui & 1 << i); i++) ;
+ selmon->pertag->curtag = i + 1;
+ }
+ } else {
+ tmptag = selmon->pertag->prevtag;
+ selmon->pertag->prevtag = selmon->pertag->curtag;
+ selmon->pertag->curtag = tmptag;
+ }
+
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
+ selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
+
+ if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
+ togglebar(NULL);
+
focus(NULL);
arrange(selmon);
}

+ 2
- 1
.local/src/dwm/rules.h View File

@ -17,7 +17,7 @@
*/ */
static const Rule rules[] = { static const Rule rules[] = {
/* class instance title tags mask isfloating floatpos isterminal noswallow monitor */
/* class instance title tags mask isfloating floatpos isterminal noswallow monitor */
{ "discord" , NULL , NULL , 1 << 8 , NULL , NULL , 0 , 0 , -1 }, { "discord" , NULL , NULL , 1 << 8 , NULL , NULL , 0 , 0 , -1 },
{ "Brave-browser" , NULL , NULL , 1 << 1 , NULL , NULL , 0 , 0 , -1 }, { "Brave-browser" , NULL , NULL , 1 << 1 , NULL , NULL , 0 , 0 , -1 },
{ "firefox" , NULL , NULL , 1 << 1 , NULL , NULL , 0 , 0 , -1 }, { "firefox" , NULL , NULL , 1 << 1 , NULL , NULL , 0 , 0 , -1 },
@ -37,6 +37,7 @@ static const Rule rules[] = {
{ "weather" , NULL , NULL , 0 , 1 , "50% 50% 1200W 800H" , 0 , 0 , -1 }, { "weather" , NULL , NULL , 0 , 1 , "50% 50% 1200W 800H" , 0 , 0 , -1 },
{ "center" , NULL , NULL , 0 , 1 , "50% 50% 1000W 600H" , 0 , 0 , -1 }, { "center" , NULL , NULL , 0 , 1 , "50% 50% 1000W 600H" , 0 , 0 , -1 },
{ "htop" , NULL , NULL , 0 , 1 , "50% 50% 1200W 600H" , 0 , 0 , -1 }, { "htop" , NULL , NULL , 0 , 1 , "50% 50% 1200W 600H" , 0 , 0 , -1 },
{ "Zathura" , NULL , NULL , 0 , 0 , NULL , 0 , 1 , -1 },
{ "spfeh" , NULL , NULL , SPTAG(1) , 1 , NULL , 0 , 0 , -1 }, { "spfeh" , NULL , NULL , SPTAG(1) , 1 , NULL , 0 , 0 , -1 },
{ NULL , "spterm" , NULL , SPTAG(0) , 1 , NULL , 0 , 0 , -1 }, { NULL , "spterm" , NULL , SPTAG(0) , 1 , NULL , 0 , 0 , -1 },
{ NULL , "spmutt" , NULL , SPTAG(2) , 1 , NULL , 0 , 0 , -1 }, { NULL , "spmutt" , NULL , SPTAG(2) , 1 , NULL , 0 , 0 , -1 },


+ 9
- 0
.local/src/sent/config.def.h View File

@ -13,12 +13,20 @@ static const char *colors[] = {
"#FFFFFF", /* background color */ "#FFFFFF", /* background color */
}; };
static const char *inverted_colors[] = {
"#FFFFFF", /* foreground color */
"#000000", /* background color */
};
static const float linespacing = 1.4; static const float linespacing = 1.4;
/* how much screen estate is to be used at max for the content */ /* how much screen estate is to be used at max for the content */
static const float usablewidth = 0.75; static const float usablewidth = 0.75;
static const float usableheight = 0.75; static const float usableheight = 0.75;
/* height of the presentation progress bar */
static const int progressheight = 5;
static Mousekey mshortcuts[] = { static Mousekey mshortcuts[] = {
/* button function argument */ /* button function argument */
{ Button1, advance, {.i = +1} }, { Button1, advance, {.i = +1} },
@ -47,6 +55,7 @@ static Shortcut shortcuts[] = {
{ XK_n, advance, {.i = +1} }, { XK_n, advance, {.i = +1} },
{ XK_p, advance, {.i = -1} }, { XK_p, advance, {.i = -1} },
{ XK_r, reload, {0} }, { XK_r, reload, {0} },
{ XK_i, togglescm, {0} },
}; };
static Filter filters[] = { static Filter filters[] = {


+ 9
- 0
.local/src/sent/config.h View File

@ -9,6 +9,11 @@ static char *fontfallbacks[] = {
#define FONTSZ(x) ((int)(10.0 * powf(1.1288, (x)))) /* x in [0, NUMFONTSCALES-1] */ #define FONTSZ(x) ((int)(10.0 * powf(1.1288, (x)))) /* x in [0, NUMFONTSCALES-1] */
static const char *colors[] = { static const char *colors[] = {
"#000000", /* foreground color */
"#FFFFFF", /* background color */
};
static const char *inverted_colors[] = {
"#FFFFFF", /* foreground color */ "#FFFFFF", /* foreground color */
"#000000", /* background color */ "#000000", /* background color */
}; };
@ -19,6 +24,9 @@ static const float linespacing = 1.4;
static const float usablewidth = 0.75; static const float usablewidth = 0.75;
static const float usableheight = 0.75; static const float usableheight = 0.75;
/* height of the presentation progress bar */
static const int progressheight = 5;
static Mousekey mshortcuts[] = { static Mousekey mshortcuts[] = {
/* button function argument */ /* button function argument */
{ Button1, advance, {.i = +1} }, { Button1, advance, {.i = +1} },
@ -47,6 +55,7 @@ static Shortcut shortcuts[] = {
{ XK_n, advance, {.i = +1} }, { XK_n, advance, {.i = +1} },
{ XK_p, advance, {.i = -1} }, { XK_p, advance, {.i = -1} },
{ XK_r, reload, {0} }, { XK_r, reload, {0} },
{ XK_i, togglescm, {0} },
}; };
static Filter filters[] = { static Filter filters[] = {


+ 69
- 0
.local/src/sent/example View File

@ -0,0 +1,69 @@
sent
Origin:
Takahashi
Why?
• PPTX sucks
• LATEX sucks
• PDF sucks
also:
terminal presentations
don't support images…
@nyan.png
this text will not be displayed, since the @ at the start of the first line
makes this paragraph an image slide.
easy to use
depends on
♽ Xlib
☢ Xft
☃ farbfeld
~1000 lines of code
usage:
$ sent FILE1 [FILE2 …]
▸ one slide per paragraph
▸ lines starting with # are ignored
▸ image slide: paragraph containing @FILENAME
▸ empty slide: just use a \ as a paragraph
# This is a comment and will not be part of the presentation
# multiple empty lines between paragraphs are also ignored
# The following lines should produce
# one empty slide
\
\
\@this_line_actually_started_with_a_\.png
\#This line as well
⇒ Prepend a backslash to kill behaviour of special characters
Images are handled in the
http://tools.suckless.org/farbfeld/
format internally.
sent also supports transparent images.
Try changing the background in config.h
and rebuild.
@transparent_test.ff
😀😁😂😃😄😅😆😇😈😉😊😋😌😍😎😏
😐😑😒😓😔😕😖😗😘😙😚😛😜😝😞😟
😠😡😢😣😥😦😧😨😩😪😫😭😮😯😰😱
😲😳😴😵😶😷😸😹😺😻😼😽😾😿🙀☠
thanks.
questions?

BIN
.local/src/sent/nyan.png View File

Before After
Width: 470  |  Height: 285  |  Size: 901 B

+ 73
- 0
.local/src/sent/patches/sent-invertedcolors-72d33d4.diff View File

@ -0,0 +1,73 @@
diff --git a/config.def.h b/config.def.h
index 60eb376..ccea9a6 100644
--- a/config.def.h
+++ b/config.def.h
@@ -13,6 +13,11 @@ static const char *colors[] = {
"#FFFFFF", /* background color */
};
+static const char *inverted_colors[] = {
+ "#FFFFFF", /* foreground color */
+ "#000000", /* background color */
+};
+
static const float linespacing = 1.4;
/* how much screen estate is to be used at max for the content */
diff --git a/sent.1 b/sent.1
index fabc614..f74d583 100644
--- a/sent.1
+++ b/sent.1
@@ -6,6 +6,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl v
+.Op Fl i
.Op Ar file
.Sh DESCRIPTION
.Nm
@@ -21,6 +22,8 @@ few minutes.
.Bl -tag -width Ds
.It Fl v
Print version information to stdout and exit.
+.It Fl i
+Use the colors from the inverted color array.
.El
.Sh USAGE
.Bl -tag -width Ds
diff --git a/sent.c b/sent.c
index c50a572..c31f772 100644
--- a/sent.c
+++ b/sent.c
@@ -25,6 +25,8 @@
char *argv0;
+int use_inverted_colors = 0;
+
/* macros */
#define LEN(a) (sizeof(a) / sizeof(a)[0])
#define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x)
@@ -586,7 +588,11 @@ xinit()
if (!(d = drw_create(xw.dpy, xw.scr, xw.win, xw.w, xw.h)))
die("sent: Unable to create drawing context");
- sc = drw_scm_create(d, colors, 2);
+ if (use_inverted_colors) {
+ sc = drw_scm_create(d, inverted_colors, 2);
+ } else {
+ sc = drw_scm_create(d, colors, 2);
+ }
drw_setscheme(d, sc);
XSetWindowBackground(xw.dpy, xw.win, sc[ColBg].pixel);
@@ -687,6 +693,9 @@ main(int argc, char *argv[])
case 'v':
fprintf(stderr, "sent-"VERSION"\n");
return 0;
+ case 'i':
+ use_inverted_colors = 1;
+ break;
default:
usage();
} ARGEND

+ 72
- 0
.local/src/sent/patches/sent-options-20190213-72d33d4.diff View File

@ -0,0 +1,72 @@
From 3a348cc15a97df8e8784b129800293dcfba28f3f Mon Sep 17 00:00:00 2001
From: Sunur Efe Vural <efe@efe.kim>
Date: Wed, 13 Feb 2019 14:28:17 -0500
Subject: [PATCH] Commandline Options
A simple patch that adds extra commandline options to sent.
---
sent.1 | 11 +++++++++++
sent.c | 11 ++++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/sent.1 b/sent.1
index fabc614..5d55bf4 100644
--- a/sent.1
+++ b/sent.1
@@ -5,6 +5,9 @@
.Nd simple plaintext presentation tool
.Sh SYNOPSIS
.Nm
+.Op Fl f Ar font
+.Op Fl c Ar fgcolor
+.Op Fl b Ar bgcolor
.Op Fl v
.Op Ar file
.Sh DESCRIPTION
@@ -21,6 +24,14 @@ few minutes.
.Bl -tag -width Ds
.It Fl v
Print version information to stdout and exit.
+.It Fl f Ar font
+Defines the
+.Ar font
+when sent is run.
+.It Fl c Ar fgcolor
+Defines the foreground color when sent is run.
+.It Fl b Ar bgcolor
+Defines the background color when sent is run.
.El
.Sh USAGE
.Bl -tag -width Ds
diff --git a/sent.c b/sent.c
index c50a572..0b36e32 100644
--- a/sent.c
+++ b/sent.c
@@ -675,7 +675,7 @@ configure(XEvent *e)
void
usage()
{
- die("usage: %s [file]", argv0);
+ die("usage: %s [-c fgcolor] [-b bgcolor] [-f font] [file]", argv0);
}
int
@@ -687,6 +687,15 @@ main(int argc, char *argv[])
case 'v':
fprintf(stderr, "sent-"VERSION"\n");
return 0;
+ case 'f':
+ fontfallbacks[0] = EARGF(usage());
+ break;
+ case 'c':
+ colors[0] = EARGF(usage());
+ break;
+ case 'b':
+ colors[1] = EARGF(usage());
+ break;
default:
usage();
} ARGEND
--
2.20.1

+ 31
- 0
.local/src/sent/patches/sent-progress-bar-1.0.diff View File

@ -0,0 +1,31 @@
diff --git a/config.def.h b/config.def.h
index 60eb376..25d89e0 100644
--- a/config.def.h
+++ b/config.def.h
@@ -19,6 +19,9 @@ static const float linespacing = 1.4;
static const float usablewidth = 0.75;
static const float usableheight = 0.75;
+/* height of the presentation progress bar */
+static const int progressheight = 5;
+
static Mousekey mshortcuts[] = {
/* button function argument */
{ Button1, advance, {.i = +1} },
diff --git a/sent.c b/sent.c
index c50a572..046466e 100644
--- a/sent.c
+++ b/sent.c
@@ -533,6 +533,12 @@ xdraw()
0,
slides[idx].lines[i],
0);
+ if (idx != 0 && progressheight != 0) {
+ drw_rect(d,
+ 0, xw.h - progressheight,
+ (xw.w * idx)/(slidecount - 1), progressheight,
+ 1, 0);
+ }
drw_map(d, xw.win, 0, 0, xw.w, xw.h);
} else {
if (!(im->state & SCALED))

+ 79
- 0
.local/src/sent/patches/sent-toggle-scm-20210119-2be4210.diff View File

@ -0,0 +1,79 @@
From 2be4210944d97ddb158feee601ec85c016de0872 Mon Sep 17 00:00:00 2001
From: Randoragon <randoragongamedev@gmail.com>
Date: Tue, 19 Jan 2021 10:17:47 +0100
Subject: [PATCH] Add toggle colorscheme functionality
This patch is meant to be applied on top of the "inverted colors" patch
(https://tools.suckless.org/sent/patches/inverted-colors/). It creates a
new binding, "i", that lets you toggle between two colorschemes during
presentation.
---
config.def.h | 1 +
sent.1 | 2 ++
sent.c | 18 ++++++++++++++++++
3 files changed, 21 insertions(+)
diff --git a/config.def.h b/config.def.h
index ccea9a6..c72afc5 100644
--- a/config.def.h
+++ b/config.def.h
@@ -52,6 +52,7 @@ static Shortcut shortcuts[] = {
{ XK_n, advance, {.i = +1} },
{ XK_p, advance, {.i = -1} },
{ XK_r, reload, {0} },
+ { XK_i, togglescm, {0} },
};
static Filter filters[] = {
diff --git a/sent.1 b/sent.1
index f74d583..a7564a8 100644
--- a/sent.1
+++ b/sent.1
@@ -44,6 +44,8 @@ Reload the slides. Only works on file input.
Go to next slide, if existent.
.It Sy Left | Backspace | h | k | Up | Prior | p
Go to previous slide, if existent.
+.It Sy i
+Toggle colorschemes.
.El
.El
.Sh FORMAT
diff --git a/sent.c b/sent.c
index 7053ab3..d29fc35 100644
--- a/sent.c
+++ b/sent.c
@@ -107,6 +107,7 @@ static void xdraw();
static void xhints();
static void xinit();
static void xloadfonts();
+static void togglescm();
static void bpress(XEvent *);
static void cmessage(XEvent *);
@@ -613,6 +614,23 @@ xinit()
XSync(xw.dpy, False);
}
+void
+togglescm()
+{
+ if (use_inverted_colors) {
+ free(sc);
+ sc = drw_scm_create(d, colors, 2);
+ use_inverted_colors = 0;
+ } else {
+ sc = drw_scm_create(d, inverted_colors, 2);
+ use_inverted_colors = 1;
+ }
+ drw_setscheme(d, sc);
+ XSetWindowBackground(xw.dpy, xw.win, sc[ColBg].pixel);
+ xdraw();
+}
+
+
void
xloadfonts()
{
--
2.30.0

BIN
.local/src/sent/sent View File


+ 17
- 0
.local/src/sent/sent.1 View File

@ -5,7 +5,11 @@
.Nd simple plaintext presentation tool .Nd simple plaintext presentation tool
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl f Ar font
.Op Fl c Ar fgcolor
.Op Fl b Ar bgcolor
.Op Fl v .Op Fl v
.Op Fl i
.Op Ar file .Op Ar file
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm .Nm
@ -21,6 +25,17 @@ few minutes.
.Bl -tag -width Ds .Bl -tag -width Ds
.It Fl v .It Fl v
Print version information to stdout and exit. Print version information to stdout and exit.
.It Fl i
Use the colors from the inverted color array.
.It Fl f Ar font
Defines the
.Ar font
when sent is run.
.It Fl c Ar fgcolor
Defines the foreground color when sent is run.
.It Fl b Ar bgcolor
Defines the background color when sent is run.
>>>>>>>
.El .El
.Sh USAGE .Sh USAGE
.Bl -tag -width Ds .Bl -tag -width Ds
@ -41,6 +56,8 @@ Reload the slides. Only works on file input.
Go to next slide, if existent. Go to next slide, if existent.
.It Sy Left | Backspace | h | k | Up | Prior | p .It Sy Left | Backspace | h | k | Up | Prior | p
Go to previous slide, if existent. Go to previous slide, if existent.
.It Sy i
Toggle colorschemes.
.El .El
.El .El
.Sh FORMAT .Sh FORMAT


+ 43
- 2
.local/src/sent/sent.c View File

@ -25,6 +25,8 @@
char *argv0; char *argv0;
int use_inverted_colors = 0;
/* macros */ /* macros */
#define LEN(a) (sizeof(a) / sizeof(a)[0]) #define LEN(a) (sizeof(a) / sizeof(a)[0])
#define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x) #define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x)
@ -105,6 +107,7 @@ static void xdraw();
static void xhints(); static void xhints();
static void xinit(); static void xinit();
static void xloadfonts(); static void xloadfonts();
static void togglescm();
static void bpress(XEvent *); static void bpress(XEvent *);
static void cmessage(XEvent *); static void cmessage(XEvent *);
@ -537,6 +540,12 @@ xdraw()
0, 0,
slides[idx].lines[i], slides[idx].lines[i],
0); 0);
if (idx != 0 && progressheight != 0) {
drw_rect(d,
0, xw.h - progressheight,
(xw.w * idx)/(slidecount - 1), progressheight,
1, 0);
}
drw_map(d, xw.win, 0, 0, xw.w, xw.h); drw_map(d, xw.win, 0, 0, xw.w, xw.h);
} else { } else {
if (!(im->state & SCALED)) if (!(im->state & SCALED))
@ -590,7 +599,11 @@ xinit()
if (!(d = drw_create(xw.dpy, xw.scr, xw.win, xw.w, xw.h))) if (!(d = drw_create(xw.dpy, xw.scr, xw.win, xw.w, xw.h)))
die("sent: Unable to create drawing context"); die("sent: Unable to create drawing context");
sc = drw_scm_create(d, colors, 2);
if (use_inverted_colors) {
sc = drw_scm_create(d, inverted_colors, 2);
} else {
sc = drw_scm_create(d, colors, 2);
}
drw_setscheme(d, sc); drw_setscheme(d, sc);
XSetWindowBackground(xw.dpy, xw.win, sc[ColBg].pixel); XSetWindowBackground(xw.dpy, xw.win, sc[ColBg].pixel);
@ -607,6 +620,23 @@ xinit()
XSync(xw.dpy, False); XSync(xw.dpy, False);
} }
void
togglescm()
{
if (use_inverted_colors) {
free(sc);
sc = drw_scm_create(d, colors, 2);
use_inverted_colors = 0;
} else {
sc = drw_scm_create(d, inverted_colors, 2);
use_inverted_colors = 1;
}
drw_setscheme(d, sc);
XSetWindowBackground(xw.dpy, xw.win, sc[ColBg].pixel);
xdraw();
}
void void
xloadfonts() xloadfonts()
{ {
@ -679,7 +709,7 @@ configure(XEvent *e)
void void
usage() usage()
{ {
die("usage: %s [file]", argv0);
die("usage: %s [-c fgcolor] [-b bgcolor] [-f font] [file]", argv0);
} }
int int
@ -691,6 +721,17 @@ main(int argc, char *argv[])
case 'v': case 'v':
fprintf(stderr, "sent-"VERSION"\n"); fprintf(stderr, "sent-"VERSION"\n");
return 0; return 0;
case 'i':
use_inverted_colors = 1;
case 'f':
fontfallbacks[0] = EARGF(usage());
break;
case 'c':
colors[0] = EARGF(usage());
break;
case 'b':
colors[1] = EARGF(usage());
break;
default: default:
usage(); usage();
} ARGEND } ARGEND


Loading…
Cancel
Save