summaryrefslogtreecommitdiff
path: root/src/actions.c
diff options
context:
space:
mode:
authorKipling Inscore <k@bijna.net>2008-08-03 11:40:42 -0700
committerShawn <sabetts@juicebox.(none)>2008-10-10 13:07:47 -0700
commit497fb323835bbb3cceb39874e7555b565863c7e8 (patch)
tree5d2e5495b879cd1e4dfbbbd0b8913685adf86d55 /src/actions.c
parentb47008536843fe9dfa5790581228f42d5c83ee80 (diff)
downloadratpoison-497fb323835bbb3cceb39874e7555b565863c7e8.zip
allow window border color to be set seperately for focused and unfocused windows
Diffstat (limited to 'src/actions.c')
-rw-r--r--src/actions.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/actions.c b/src/actions.c
index 4365679..0a1f4f1 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -64,6 +64,8 @@ static cmdret * set_winname (struct cmdarg **args);
static cmdret * set_framefmt (struct cmdarg **args);
static cmdret * set_fgcolor (struct cmdarg **args);
static cmdret * set_bgcolor (struct cmdarg **args);
+static cmdret * set_fwcolor (struct cmdarg **args);
+static cmdret * set_bwcolor (struct cmdarg **args);
static cmdret * set_barpadding (struct cmdarg **args);
static cmdret * set_winliststyle (struct cmdarg **args);
static cmdret * set_framesels (struct cmdarg **args);
@@ -129,6 +131,8 @@ init_set_vars(void)
add_set_var ("framefmt", set_framefmt, 1, "", arg_REST);
add_set_var ("fgcolor", set_fgcolor, 1, "", arg_STRING);
add_set_var ("bgcolor", set_bgcolor, 1, "", arg_STRING);
+ add_set_var ("fwcolor", set_fwcolor, 1, "", arg_STRING);
+ add_set_var ("bwcolor", set_bwcolor, 1, "", arg_STRING);
add_set_var ("barpadding", set_barpadding, 2, "", arg_NUMBER, "", arg_NUMBER);
add_set_var ("winliststyle", set_winliststyle, 1, "", arg_STRING);
add_set_var ("framesels", set_framesels, 1, "", arg_STRING);
@@ -3894,6 +3898,68 @@ set_bgcolor (struct cmdarg **args)
return cmdret_new (RET_SUCCESS, NULL);
}
+static cmdret *
+set_fwcolor (struct cmdarg **args)
+{
+ int i;
+ XColor color, junk;
+ rp_window *win = current_window();
+
+ if (args[0] == NULL)
+ return cmdret_new (RET_SUCCESS, "%s", defaults.fwcolor_string);
+
+ for (i=0; i<num_screens; i++)
+ {
+ if (!XAllocNamedColor (dpy, screens[i].def_cmap, ARG_STRING(0), &color, &junk))
+ return cmdret_new (RET_FAILURE, "deffwcolor: unknown color");
+
+ screens[i].fw_color = color.pixel;
+ update_gc (&screens[i]);
+
+ free (defaults.fwcolor_string);
+ defaults.fwcolor_string = xstrdup (ARG_STRING(0));
+ }
+
+ /* Update current window. */
+ if (win != NULL)
+ XSetWindowBorder (dpy, win->w, win->scr->fw_color);
+
+ return cmdret_new (RET_SUCCESS, NULL);
+}
+
+static cmdret *
+set_bwcolor (struct cmdarg **args)
+{
+ int i;
+ XColor color, junk;
+ rp_window *win, *cur = current_window();
+
+ if (args[0] == NULL)
+ return cmdret_new (RET_SUCCESS, "%s", defaults.bwcolor_string);
+
+ for (i=0; i<num_screens; i++)
+ {
+ if (!XAllocNamedColor (dpy, screens[i].def_cmap, ARG_STRING(0), &color, &junk))
+ return cmdret_new (RET_FAILURE, "defbwcolor: unknown color");
+
+ screens[i].bw_color = color.pixel;
+ update_gc (&screens[i]);
+
+ free (defaults.bwcolor_string);
+ defaults.bwcolor_string = xstrdup (ARG_STRING(0));
+ }
+
+ /* Update all the visible windows. */
+ list_for_each_entry (win,&rp_mapped_window,node)
+ {
+ if (win != cur)
+ XSetWindowBorder (dpy, win->w, win->scr->bw_color);
+ }
+
+
+ return cmdret_new (RET_SUCCESS, NULL);
+}
+
cmdret *
cmd_setenv (int interactive, struct cmdarg **args)
{