Results 1 to 2 of 2
Thread: rxvt maximize on startup
Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
-
10-15-2013 #1Linux Enthusiast
- Join Date
- Dec 2011
- Location
- Turtle Island West
- Posts
- 591
rxvt maximize on startup
Have you ever wanted to fire up a terminal window and have it maximized right away? I do. For example, I run 'rxvt -e mc' and I like it to be as big as possible immediately. Xterm can do this with a fancy CSI sequence:
I like rxvt because it's so much smaller and simpler than xterm. The code is nice to read. It works with mc better.Code:# xterm seqs - don't work with rxvt :( #P s = 9 ; 0 ? Restore maximized window. #P s = 9 ; 1 ? Maximize window (i.e., resize to screen size). #P s = 9 ; 2 ? Maximize window vertically. #P s = 9 ; 3 ? Maximize window horizontally. #P s = 1 0 ; 0 ? Undo full-screen mode. #P s = 1 0 ; 1 ? Change to full-screen. #P s = 1 0 ; 2 ? Toggle full-screen. echo -e "\033[9;1t" # makes xterm maximized
Well, I got fed up with this situation and added the command line option -max or --maximize to rxvt-2.7.10.
It works beautifully.
rxvt-maximize-start.patch:
Peace and Cheer.Code:--- xdefaults.c 2003-02-27 17:03:18.000000000 -0800 +++ ../../rxvt-2.7.10-hack/src/xdefaults.c 2013-10-15 12:23:39.182180993 -0700 @@ -95,6 +95,7 @@ "reverse video"), BOOL(Rs_loginShell, "loginShell", "ls", Opt_loginShell, "login shell"), BOOL(Rs_jumpScroll, "jumpScroll", "j", Opt_jumpScroll, "jump scrolling"), + BOOL(Rs_maximize, "maximize", "max", Opt_maximize, "maximize window"), #ifdef HAVE_SCROLLBARS BOOL(Rs_scrollBar, "scrollBar", "sb", Opt_scrollBar, "scrollbar"), BOOL(Rs_scrollBar_right, "scrollBar_right", "sr", Opt_scrollBar_right, --- rxvt.h 2003-03-06 17:17:18.000000000 -0800 +++ ../../rxvt-2.7.10-hack/src/rxvt.h 2013-10-15 12:18:15.464626764 -0700 @@ -525,6 +525,7 @@ #endif Rs_loginShell, Rs_jumpScroll, + Rs_maximize, #ifdef HAVE_SCROLLBARS Rs_scrollBar, Rs_scrollBar_right, --- rxvtlib.h.in 2003-02-27 17:03:16.000000000 -0800 +++ ../../rxvt-2.7.10-hack/src/rxvtlib.h.in 2013-10-15 12:34:55.885174718 -0700 @@ -218,6 +218,7 @@ #define Opt_scrollWithBuffer (1LU<<17) #define Opt_jumpScroll (1LU<<18) #define Opt_mouseWheelScrollPage (1LU<<19) +#define Opt_maximize (1LU<<20) /* place holder used for parsing command-line options */ #define Opt_Reverse (1LU<<30) #define Opt_Boolean (1LU<<31) --- init.c 2002-12-03 21:21:39.000000000 -0800 +++ ../../rxvt-2.7.10-hack/src/init.c 2013-10-15 12:41:13.724271368 -0700 @@ -1126,6 +1126,15 @@ r->PixColors[Color_border], r->PixColors[Color_fg]); #endif + + /* Opt_maximize hack */ + if ( r->Options & Opt_maximize ) { + XMoveResizeWindow(r->Xdisplay, r->TermWin.parent[0], + 0, /* x */ 0, /* y */ + DisplayWidth(r->Xdisplay, Xscreen ), + DisplayHeight(r->Xdisplay, Xscreen ) ); + } + rxvt_xterm_seq(r, XTerm_title, r->h->rs[Rs_title], CHAR_ST); rxvt_xterm_seq(r, XTerm_iconName, r->h->rs[Rs_iconName], CHAR_ST);
-
10-17-2013 #2Linux Enthusiast
- Join Date
- Dec 2011
- Location
- Turtle Island West
- Posts
- 591
Actually, it works great if run locally. When run through ssh from another box, the SIGWINCH doesn't get caught properly on startup, so the command still thinks it's 80x25 or whatever, and the taskbar height doesn't get accounted for also.
So the approach needs to be a bit different. Instead of calling XMoveResizeWindow, we get in earlier and ignore and default or user specified geometry and use our own. Then, still, remote taskbar height is ignored, so it needs a bit of a hack to compensate.
What height is the average taskbar? 24 pixels? We subtract that from initial height and use it. The wm rounds the dimensions to the nearest character cell height, and it seems good.
The other option is waiting until way later after everything has been set, the command has been initialized, and then calling XMoveResizeWindow.


Reply With Quote
