📄 xdefaults.c
字号:
/*--------------------------------*-C-*---------------------------------* * File: xdefaults.c *----------------------------------------------------------------------* * $Id: xdefaults.c,v 1.108 2003/02/28 00:58:43 gcw Exp $ * * All portions of code are copyright by their respective author/s. * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> * - original version * Copyright (c) 1997,1998 mj olesen <olesen@me.queensu.ca> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*//*----------------------------------------------------------------------* * get resources from ~/.Xdefaults or ~/.Xresources with the memory-saving * default or with XGetDefault() (#define USE_XGETDEFAULT) *----------------------------------------------------------------------*/#include "../config.h" /* NECESSARY */#include "rxvt.h" /* NECESSARY */#include "version.h"#include "xdefaults.intpro" /* PROTOS for internal routines *//* #define DEBUG_RESOURCES */static const char *const xnames[2] = { ".Xdefaults", ".Xresources" };/*{{{ monolithic option/resource structure: *//* * `string' options MUST have a usage argument * `switch' and `boolean' options have no argument * if there's no desc(ription), it won't appear in rxvt_usage() *//* INFO() - descriptive information only */#define INFO(opt, arg, desc) \ {0, -1, NULL, (opt), (arg), (desc)}/* STRG() - command-line option, with/without resource */#define STRG(rsp, kw, opt, arg, desc) \ {0, (rsp), (kw), (opt), (arg), (desc)}/* RSTRG() - resource/long-option */#define RSTRG(rsp, kw, arg) \ {0, (rsp), (kw), NULL, (arg), NULL}/* BOOL() - regular boolean `-/+' flag */#define BOOL(rsp, kw, opt, flag, desc) \ {(Opt_Boolean|(flag)), (rsp), (kw), (opt), NULL, (desc)}/* SWCH() - `-' flag */#define SWCH(opt, flag, desc) \ {(flag), -1, NULL, (opt), NULL, (desc)}/* convenient macros */#define optList_strlen(i) \ (optList[i].flag ? 0 : (optList[i].arg ? STRLEN(optList[i].arg) : 1))#define optList_isBool(i) \ (optList[i].flag & Opt_Boolean)#define optList_isReverse(i) \ (optList[i].flag & Opt_Reverse)#define optList_size() \ (sizeof(optList) / sizeof(optList[0]))static const struct { const unsigned long flag; /* Option flag */ const int doff; /* data offset */ const char *kw; /* keyword */ const char *opt; /* option */ const char *arg; /* argument */ const char *desc; /* description */} optList[] = { STRG(Rs_display_name, NULL, "d", NULL, NULL), /* short form */ STRG(Rs_display_name, NULL, "display", "string", "X server to contact"), STRG(Rs_term_name, "termName", "tn", "string", "value of the TERM environment variable"), STRG(Rs_geometry, NULL, "g", NULL, NULL), /* short form */ STRG(Rs_geometry, "geometry", "geometry", "geometry", "size (in characters) and position"), SWCH("C", Opt_console, "intercept console messages"), SWCH("iconic", Opt_iconic, "start iconic"), SWCH("ic", Opt_iconic, NULL), /* short form */ BOOL(Rs_reverseVideo, "reverseVideo", "rv", Opt_reverseVideo, "reverse video"), BOOL(Rs_loginShell, "loginShell", "ls", Opt_loginShell, "login shell"), BOOL(Rs_jumpScroll, "jumpScroll", "j", Opt_jumpScroll, "jump scrolling"),#ifdef HAVE_SCROLLBARS BOOL(Rs_scrollBar, "scrollBar", "sb", Opt_scrollBar, "scrollbar"), BOOL(Rs_scrollBar_right, "scrollBar_right", "sr", Opt_scrollBar_right, "scrollbar right"), BOOL(Rs_scrollBar_floating, "scrollBar_floating", "st", Opt_scrollBar_floating, "scrollbar without a trough"),#endif BOOL(Rs_scrollTtyOutput, "scrollTtyOutput", NULL, Opt_scrollTtyOutput, NULL), BOOL(Rs_scrollTtyOutput, NULL, "si", Opt_Reverse | Opt_scrollTtyOutput, "scroll-on-tty-output inhibit"), BOOL(Rs_scrollTtyKeypress, "scrollTtyKeypress", "sk", Opt_scrollTtyKeypress, "scroll-on-keypress"), BOOL(Rs_scrollWithBuffer, "scrollWithBuffer", "sw", Opt_scrollWithBuffer, "scroll-with-buffer"),#ifdef TRANSPARENT BOOL(Rs_transparent, "inheritPixmap", "ip", Opt_transparent, "inherit parent pixmap"), BOOL(Rs_transparent_all, "inheritPixmapforce", "ipf", Opt_transparent_all, "forcefully inherit root pixmap"), SWCH("tr", Opt_transparent, NULL),#endif BOOL(Rs_utmpInhibit, "utmpInhibit", "ut", Opt_utmpInhibit, "utmp inhibit"),#ifndef NO_BELL BOOL(Rs_visualBell, "visualBell", "vb", Opt_visualBell, "visual bell"),# if ! defined(NO_MAPALERT) && defined(MAPALERT_OPTION) BOOL(Rs_mapAlert, "mapAlert", NULL, Opt_mapAlert, NULL),# endif#endif#ifdef META8_OPTION BOOL(Rs_meta8, "meta8", NULL, Opt_meta8, NULL),#endif#ifdef MOUSE_WHEEL BOOL(Rs_mouseWheelScrollPage, "mouseWheelScrollPage", NULL, Opt_mouseWheelScrollPage, NULL),#endif#ifdef MULTICHAR_SET BOOL(Rs_mc_hack, "multibyte_cursor", "mcc", Opt_mc_hack, "Multibyte character cursor movement"),#endif#ifndef NO_FRILLS BOOL(Rs_tripleclickwords, "tripleclickwords", "tcw", Opt_tripleclickwords, "triple click word selection"),#endif STRG(Rs_color + Color_bg, "background", "bg", "color", "background color"), STRG(Rs_color + Color_fg, "foreground", "fg", "color", "foreground color"), RSTRG(Rs_color + minCOLOR + 0, "color0", "color"), RSTRG(Rs_color + minCOLOR + 1, "color1", "color"), RSTRG(Rs_color + minCOLOR + 2, "color2", "color"), RSTRG(Rs_color + minCOLOR + 3, "color3", "color"), RSTRG(Rs_color + minCOLOR + 4, "color4", "color"), RSTRG(Rs_color + minCOLOR + 5, "color5", "color"), RSTRG(Rs_color + minCOLOR + 6, "color6", "color"), RSTRG(Rs_color + minCOLOR + 7, "color7", "color"),#ifndef NO_BRIGHTCOLOR RSTRG(Rs_color + minBrightCOLOR + 0, "color8", "color"), RSTRG(Rs_color + minBrightCOLOR + 1, "color9", "color"), RSTRG(Rs_color + minBrightCOLOR + 2, "color10", "color"), RSTRG(Rs_color + minBrightCOLOR + 3, "color11", "color"), RSTRG(Rs_color + minBrightCOLOR + 4, "color12", "color"), RSTRG(Rs_color + minBrightCOLOR + 5, "color13", "color"), RSTRG(Rs_color + minBrightCOLOR + 6, "color14", "color"), RSTRG(Rs_color + minBrightCOLOR + 7, "color15", "color"),#endif /* NO_BRIGHTCOLOR */#ifndef NO_BOLD_UNDERLINE_REVERSE RSTRG(Rs_color + Color_BD, "colorBD", "color"), RSTRG(Rs_color + Color_UL, "colorUL", "color"), RSTRG(Rs_color + Color_RV, "colorRV", "color"),#endif /* ! NO_BOLD_UNDERLINE_REVERSE */#ifdef KEEP_SCROLLCOLOR RSTRG(Rs_color + Color_scroll, "scrollColor", "color"), RSTRG(Rs_color + Color_trough, "troughColor", "color"),#endif /* KEEP_SCROLLCOLOR */#ifdef OPTION_HC STRG(Rs_color + Color_HC, "highlightColor", "hc", "color", "highlight color"),#endif#if defined (XPM_BACKGROUND) || (MENUBAR_MAX) RSTRG(Rs_path, "path", "search path"),#endif /* defined (XPM_BACKGROUND) || (MENUBAR_MAX) */#ifdef XPM_BACKGROUND STRG(Rs_backgroundPixmap, "backgroundPixmap", "pixmap", "file[;geom]", "background pixmap"),#endif /* XPM_BACKGROUND */#if (MENUBAR_MAX) RSTRG(Rs_menu, "menu", "name[;tag]"),#endif#ifndef NO_BOLDFONT STRG(Rs_boldFont, "boldFont", "fb", "fontname", "bold text font"),#endif STRG(Rs_font + 0, "font", "fn", "fontname", "normal text font"),/* fonts: command-line option = resource name */#if MAX_NFONTS > 1 RSTRG(Rs_font + 1, "font1", "fontname"),#endif#if MAX_NFONTS > 2 RSTRG(Rs_font + 2, "font2", "fontname"),#endif#if MAX_NFONTS > 3 RSTRG(Rs_font + 3, "font3", "fontname"),#endif#if MAX_NFONTS > 4 RSTRG(Rs_font + 4, "font4", "fontname"),#endif#if MAX_NFONTS > 5 RSTRG(Rs_font + 5, "font5", "fontname"),#endif#if MAX_NFONTS > 6 RSTRG(Rs_font + 6, "font6", "fontname"),#endif#if MAX_NFONTS > 7 RSTRG(Rs_font + 7, "font7", "fontname"),#endif#ifdef MULTICHAR_SET STRG(Rs_mfont + 0, "mfont", "fm", "fontname", "multichar font"),/* fonts: command-line option = resource name */# if MAX_NFONTS > 1 RSTRG(Rs_mfont + 1, "mfont1", "fontname"),# endif# if MAX_NFONTS > 2 RSTRG(Rs_mfont + 2, "mfont2", "fontname"),# endif# if MAX_NFONTS > 3 RSTRG(Rs_mfont + 3, "mfont3", "fontname"),# endif# if MAX_NFONTS > 4 RSTRG(Rs_mfont + 4, "mfont4", "fontname"),# endif# if MAX_NFONTS > 5 RSTRG(Rs_mfont + 5, "mfont5", "fontname"),# endif# if MAX_NFONTS > 6 RSTRG(Rs_mfont + 6, "mfont6", "fontname"),# endif# if MAX_NFONTS > 7 RSTRG(Rs_mfont + 7, "mfont7", "fontname"),# endif#endif /* MULTICHAR_SET */#ifdef MULTICHAR_SET STRG(Rs_multichar_encoding, "multichar_encoding", "km", "mode", "multichar encoding; mode = eucj|sjis|big5|gb|kr|noenc"),#endif /* MULTICHAR_SET */#ifdef USE_XIM STRG(Rs_inputMethod, "inputMethod", "im", "name", "name of input method"), STRG(Rs_preeditType, "preeditType", "pt", "style", "input style: style = OverTheSpot|OffTheSpot|Root"),#endif /* USE_XIM */#ifdef GREEK_SUPPORT STRG(Rs_greek_keyboard, "greek_keyboard", "grk", "mode", "greek keyboard mapping; mode = iso | ibm"), RSTRG(Rs_greektoggle_key, "greektoggle_key", "keysym"),#endif STRG(Rs_name, NULL, "name", "string", "client instance, icon, and title strings"), STRG(Rs_title, "title", "title", "string", "title name for window"), STRG(Rs_title, NULL, "T", NULL, NULL), /* short form */ STRG(Rs_iconName, "iconName", "n", "string", "icon name for window"),#ifndef NO_CURSORCOLOR STRG(Rs_color + Color_cursor, "cursorColor", "cr", "color", "cursor color"),/* command-line option = resource name */ RSTRG(Rs_color + Color_cursor2, "cursorColor2", "color"),#endif /* NO_CURSORCOLOR */ STRG(Rs_color + Color_pointer, "pointerColor", "pr", "color", "pointer color"), STRG(Rs_color + Color_border, "borderColor", "bd", "color", "border color"), STRG(Rs_saveLines, "saveLines", "sl", "number", "number of scrolled lines to save"),#ifndef NO_FRILLS STRG(Rs_ext_bwidth, "externalBorder", "w", "number", "external border in pixels"), STRG(Rs_ext_bwidth, NULL, "bw", NULL, NULL), STRG(Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL), STRG(Rs_int_bwidth, "internalBorder", "b", "number", "internal border in pixels"),#endif#ifndef NO_LINESPACE STRG(Rs_lineSpace, "lineSpace", "lsp", "number", "number of extra pixels between rows"),#endif STRG(Rs_scrollBar_thickness, "thickness", "sbt", "number", "scrollbar thickness/width in pixels"),#ifndef NO_BACKSPACE_KEY RSTRG(Rs_backspace_key, "backspacekey", "string"),#endif#ifndef NO_DELETE_KEY RSTRG(Rs_delete_key, "deletekey", "string"),#endif RSTRG(Rs_selectstyle, "selectstyle", "mode"), RSTRG(Rs_scrollstyle, "scrollstyle", "mode"),#ifdef HAVE_SCROLLBARS RSTRG(Rs_scrollBar_align, "scrollBar_align", "mode"),#endif#ifdef PRINTPIPE RSTRG(Rs_print_pipe, "print-pipe", "string"),#endif#if defined (HOTKEY_CTRL) || defined (HOTKEY_META) RSTRG(Rs_bigfont_key, "bigfont_key", "keysym"), RSTRG(Rs_smallfont_key, "smallfont_key", "keysym"),#endif STRG(Rs_modifier, "modifier", "mod", "modifier", "meta modifier = alt|meta|hyper|super|mod1|...|mod5"), INFO("xrm", "string", "X resource"),#ifdef CUTCHAR_RESOURCE RSTRG(Rs_cutchars, "cutchars", "string"),#endif /* CUTCHAR_RESOURCE */ RSTRG(Rs_answerbackstring, "answerbackString", "string"), INFO("e", "command arg ...", "command to execute")};#undef INFO#undef STRG#undef RSTRG#undef SWCH#undef BOOL/*}}} */static const char releasestring[] = "Rxvt v" VERSION " - released: " DATE "\n";static const char optionsstring[] = "Options: "#if defined(XPM_BACKGROUND) "XPM,"#endif#if defined(TRANSPARENT) "transparent,"#endif#if defined(UTMP_SUPPORT) "utmp,"#endif#if defined(MENUBAR) "menubar,"#endif#if !defined(NO_FRILLS) "frills,"#endif#if !defined(NO_LINESPACE) "linespace,"#endif#if defined(PREFER_24BIT) "24bit,"#endif#if defined(USE_XIM) "XIM,"#endif#if defined(MULTICHAR_SET) "multichar_languages,"#endif "scrollbars="#if !defined(HAVE_SCROLLBARS) "NONE"#else# if defined(RXVT_SCROLLBAR) "rxvt"# if defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR) "+"# endif# endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -