URI: 
       dwm-flycolors-6.6.diff - sites - public wiki contents of suckless.org
  HTML git clone git://git.suckless.org/sites
   DIR Log
   DIR Files
   DIR Refs
       ---
       dwm-flycolors-6.6.diff (4874B)
       ---
            1 diff -up dwm-6.6-orig/config.def.h dwm-6.6-flycolors/config.def.h
            2 --- dwm-6.6-orig/config.def.h        2025-12-18 12:11:49.852471883 +0300
            3 +++ dwm-6.6-flycolors/config.def.h        2025-12-21 13:53:01.026979278 +0300
            4 @@ -11,11 +11,23 @@ static const char col_gray1[]       = "#
            5  static const char col_gray2[]       = "#444444";
            6  static const char col_gray3[]       = "#bbbbbb";
            7  static const char col_gray4[]       = "#eeeeee";
            8 -static const char col_cyan[]        = "#005577";
            9 -static const char *colors[][3]      = {
           10 +static const char default_flycolor[] = "#666666";
           11 +
           12 +static const char *flycolors[] = {
           13 +        "#666666", // gray
           14 +        "#005577", // blue
           15 +        "#117755", // green
           16 +        "#aa7711", // yellow
           17 +        "#771111", // red
           18 +        "#551177", // magenta
           19 +        "#aa1177", // pink
           20 +        NULL // used to count the array size
           21 +};
           22 +
           23 +static const char *colors[][3] = {
           24          /*               fg         bg         border   */
           25          [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
           26 -        [SchemeSel]  = { col_gray4, col_cyan,  col_cyan  },
           27 +        [SchemeSel]  = { col_gray4, default_flycolor, default_flycolor }, /* [1] and [2] are changed in cycle_flycolors */
           28  };
           29  
           30  /* tagging */
           31 @@ -57,13 +69,24 @@ static const Layout layouts[] = {
           32  
           33  /* commands */
           34  static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
           35 -static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
           36 +static const char *dmenucmd[] = {
           37 +        "dmenu_run",
           38 +        "-m", dmenumon,
           39 +        "-fn", dmenufont,
           40 +        "-nb", col_gray1,
           41 +        "-nf", col_gray3,
           42 +        "-sb", default_flycolor, /* changed as dmenucmd[10] in cycle_flycolors */
           43 +        "-sf", col_gray4,
           44 +        NULL
           45 +};
           46  static const char *termcmd[]  = { "st", NULL };
           47  
           48  static const Key keys[] = {
           49          /* modifier                     key        function        argument */
           50          { MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
           51          { MODKEY|ShiftMask,             XK_Return, spawn,          {.v = termcmd } },
           52 +        { MODKEY,                       XK_c,      cycle_flycolors, { .i = +1 } },
           53 +        { MODKEY|ShiftMask,             XK_c,      cycle_flycolors, { .i = -1 } },
           54          { MODKEY,                       XK_b,      togglebar,      {0} },
           55          { MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
           56          { MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
           57 @@ -73,7 +96,7 @@ static const Key keys[] = {
           58          { MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
           59          { MODKEY,                       XK_Return, zoom,           {0} },
           60          { MODKEY,                       XK_Tab,    view,           {0} },
           61 -        { MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
           62 +        { MODKEY|ShiftMask,             XK_x,      killclient,     {0} },
           63          { MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
           64          { MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
           65          { MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
           66 diff -up dwm-6.6-orig/dwm.1 dwm-6.6-flycolors/dwm.1
           67 --- dwm-6.6-orig/dwm.1        2025-12-18 12:11:49.852471883 +0300
           68 +++ dwm-6.6-flycolors/dwm.1        2025-12-21 13:53:01.026979278 +0300
           69 @@ -113,9 +113,15 @@ Decrease master area size.
           70  .B Mod1\-Return
           71  Zooms/cycles focused window to/from master area (tiled layouts only).
           72  .TP
           73 -.B Mod1\-Shift\-c
           74 +.B Mod1\-Shift\-x
           75  Close focused window.
           76  .TP
           77 +.B Mod1\-c
           78 +Cycle flycolors.
           79 +.TP
           80 +.B Mod1\-Shift\-c
           81 +Cycle flycolors back.
           82 +.TP
           83  .B Mod1\-Shift\-space
           84  Toggle focused window between tiled and floating state.
           85  .TP
           86 diff -up dwm-6.6-orig/dwm.c dwm-6.6-flycolors/dwm.c
           87 --- dwm-6.6-orig/dwm.c        2025-12-18 12:11:49.852471883 +0300
           88 +++ dwm-6.6-flycolors/dwm.c        2025-12-21 16:55:38.250530788 +0300
           89 @@ -141,6 +141,8 @@ typedef struct {
           90  } Rule;
           91  
           92  /* function declarations */
           93 +static void cycle_flycolors(const Arg *arg);
           94 +static void update_scheme();
           95  static void applyrules(Client *c);
           96  static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
           97  static void arrange(Monitor *m);
           98 @@ -234,6 +236,7 @@ static int xerrorstart(Display *dpy, XEr
           99  static void zoom(const Arg *arg);
          100  
          101  /* variables */
          102 +static unsigned int iflycol = 0;
          103  static const char broken[] = "broken";
          104  static char stext[256];
          105  static int screen;
          106 @@ -2139,6 +2142,30 @@ zoom(const Arg *arg)
          107          pop(c);
          108  }
          109  
          110 +void
          111 +update_scheme()
          112 +{
          113 +        Client *c = selmon->sel;
          114 +        for (int i = 0; i < LENGTH(colors); i++)
          115 +                scheme[i] = drw_scm_create(drw, colors[i], 3);
          116 +        focus(c);
          117 +}
          118 +
          119 +void
          120 +cycle_flycolors(const Arg *arg)
          121 +{
          122 +        int flycolors_limit = 256;
          123 +        int i;
          124 +        for(i = 0; flycolors[i] != NULL && i < flycolors_limit; i++)
          125 +                ;
          126 +        iflycol += i + arg->i;
          127 +        iflycol %= i;
          128 +        colors[SchemeSel][1] = flycolors[iflycol];
          129 +        colors[SchemeSel][2] = flycolors[iflycol];
          130 +        update_scheme();
          131 +        dmenucmd[10] = flycolors[iflycol];
          132 +}
          133 +
          134  int
          135  main(int argc, char *argv[])
          136  {