[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RP] [PATCH] max bar width
From: |
Rupert Levene |
Subject: |
[RP] [PATCH] max bar width |
Date: |
Sun Sep 21 04:01:02 2003 |
User-agent: |
Mutt/1.5.4i |
Fed up with ridiculously long website titles and buffer names making
your window list unusable? Here's a fix.
defbarmaxwidth -1 gives the current behaviour
defbarmaxwidth 0 makes the max bar width the screen width
defbarmaxwidth x makes the max bar width x
Index: actions.c
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/actions.c,v
retrieving revision 1.184
diff -u -r1.184 actions.c
--- actions.c 4 Sep 2003 09:55:08 -0000 1.184
+++ actions.c 21 Sep 2003 10:27:14 -0000
@@ -121,6 +121,7 @@
{"defmaxsizegravity", cmd_defmaxsizegravity, arg_STRING},
{"defpadding", cmd_defpadding, arg_STRING},
{"defbarborder", cmd_defbarborder, arg_STRING},
+ {"defbarmaxwidth", cmd_defbarmaxwidth, arg_STRING},
{"deftransgravity", cmd_deftransgravity, arg_STRING},
{"defwaitcursor", cmd_defwaitcursor, arg_STRING},
{"defwinfmt", cmd_defwinfmt, arg_STRING},
@@ -2895,6 +2896,21 @@
{
message (" defbarpadding: invalid argument ");
}
+ return NULL;
+}
+
+char *
+cmd_defbarmaxwidth (int interactive, char *data)
+{
+ int newwidth;
+
+ if (data == NULL
+ || sscanf (data, "%d", &newwidth) < 1 )
+ {
+ message (" defbarmaxwidth: one number required ");
+ return NULL;
+ }
+ defaults.bar_max_width = newwidth;
return NULL;
}
Index: actions.h
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/actions.h,v
retrieving revision 1.66
diff -u -r1.66 actions.h
--- actions.h 2 Sep 2003 17:33:58 -0000 1.66
+++ actions.h 21 Sep 2003 10:27:14 -0000
@@ -52,6 +52,7 @@
char *cmd_defbarborder (int interactive, char *data);
char *cmd_defbargravity (int interactive, char *data);
char *cmd_defbarpadding (int interactive, char *data);
+char *cmd_defbarmaxwidth (int interactive, char *data);
char *cmd_defbgcolor (int interactive, char *data);
char *cmd_defborder (int interactive, char *data);
char *cmd_deffgcolor (int interactive, char *data);
Index: bar.c
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/bar.c,v
retrieving revision 1.45
diff -u -r1.45 bar.c
--- bar.c 11 Aug 2003 00:02:36 -0000 1.45
+++ bar.c 21 Sep 2003 10:27:14 -0000
@@ -502,6 +502,7 @@
int num_lines;
int width;
int height;
+ int root_width;
PRINT_DEBUG (("msg = %s\n", msg));
PRINT_DEBUG (("mark_start = %d, mark_end = %d\n", mark_start, mark_end));
@@ -512,6 +513,14 @@
/* Calculate the width and height of the window. */
num_lines = count_lines (msg, strlen(msg));
width = defaults.bar_x_padding * 2 + max_line_length(msg);
+
+ root_width = current_screen()->root_attr.width;
+
+ if (defaults.bar_max_width > 0 && defaults.bar_max_width < width)
+ width = defaults.bar_max_width;
+ if (defaults.bar_max_width == 0 && root_width < width)
+ width = root_width;
+
height = FONT_HEIGHT (defaults.font) * num_lines + defaults.bar_y_padding *
2;
/* Display the string. */
Index: data.h
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/data.h,v
retrieving revision 1.57
diff -u -r1.57 data.h
--- data.h 2 Sep 2003 17:33:58 -0000 1.57
+++ data.h 21 Sep 2003 10:27:15 -0000
@@ -197,6 +197,7 @@
int bar_x_padding;
int bar_y_padding;
+ int bar_max_width;
int bar_location;
int bar_timeout;
int bar_border_width;
Index: main.c
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/main.c,v
retrieving revision 1.90
diff -u -r1.90 main.c
--- main.c 2 Sep 2003 17:33:58 -0000 1.90
+++ main.c 21 Sep 2003 10:27:15 -0000
@@ -443,6 +443,7 @@
defaults.window_border_width = 1;
defaults.bar_x_padding = 0;
defaults.bar_y_padding = 0;
+ defaults.bar_max_width = -1;
defaults.bar_location = NorthEastGravity;
defaults.bar_timeout = 5;
defaults.bar_border_width = 1;
- [RP] [PATCH] max bar width,
Rupert Levene <=