sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 32847555f7fb536bebfa03a80145e06e2c582863
parent 124c74e9d5e871afb9eb9b1f21b9d69433597890
Author: Randoragon <randoragongamedev@gmail.com>
Date:   Tue, 19 Jan 2021 10:34:30 +0100

[sent][patch][toggle-scm] new patch that toggles colorschemes

Diffstat:
Atools.suckless.org/sent/patches/toggle-scm/index.md | 16++++++++++++++++
Atools.suckless.org/sent/patches/toggle-scm/sent-toggle-scm-20210119-2be4210.diff | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 95 insertions(+), 0 deletions(-)

diff --git a/tools.suckless.org/sent/patches/toggle-scm/index.md b/tools.suckless.org/sent/patches/toggle-scm/index.md @@ -0,0 +1,16 @@ +Toggle Colorscheme +================== + +Description +----------- +This patch is meant to be applied on top of [inverted colors](https://tools.suckless.org/sent/patches/inverted-colors/). +It adds a new binding, "i", which lets you toggle between the two colorschemes +during presentation. + +Download +-------- +* [sent-toggle-scm-20210119-2be4210.diff](sent-toggle-scm-20210119-2be4210.diff) + +Author +------ +* Randoragon <randoragongamedev@gmail.com> diff --git a/tools.suckless.org/sent/patches/toggle-scm/sent-toggle-scm-20210119-2be4210.diff b/tools.suckless.org/sent/patches/toggle-scm/sent-toggle-scm-20210119-2be4210.diff @@ -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 +