diff --git a/docs/docs.md b/docs/docs.md index 45c47a5..429535b 100644 --- a/docs/docs.md +++ b/docs/docs.md @@ -612,6 +612,20 @@ All of these keybinds can be overriden in the configuration file. Should you unbind your switchmode key, you can always press `Ctrl+Alt+Delete` to exit spmenu, allowing you to fix your spmenu configuration. +## History buffer + +spmenu allows you to specify a history file using the `-H` argument. When this +argument is specified, the selected item(s) will be appended to the file. +In spmenu.conf, you can specify a max number of entries, and whether you +want duplicate entries or not. + +To access the history buffer, call `viewhist`. By default, the keybind for +that is Shift+h in normal mode. You can also access it by clicking the +match indicator. To hide the history buffer again, call `viewhist`. + +If `-H` is not specified, the history buffer will not be available, and +calling `viewhist` will do nothing. + ## -p option spmenu has a `-p` or `--prompt` option. It allows you to specify diff --git a/docs/example.Xresources b/docs/example.Xresources deleted file mode 100644 index 48af00f..0000000 --- a/docs/example.Xresources +++ /dev/null @@ -1,207 +0,0 @@ -! spmenu .Xresources file -! -! This is a .Xresources file with all possible .Xresources values defined, except global color values. -! Do note that it only works on X11, Wayland users cannot use it because .Xresources is X11 specific. -! To load it, run `xrdb /path/to/file` and then run spmenu as normal. - -!! Fonts -spmenu.font: Noto Sans Mono 8 -spmenu.textpadding: 0 -spmenu.normitempadding: 0 -spmenu.selitempadding: 0 -spmenu.priitempadding: 0 - -!! Colors -spmenu.col_itemnormfg: #bbbbbb -spmenu.col_itemnormbg: #110f1f -spmenu.col_itemnormfg2: #bbbbbb -spmenu.col_itemnormbg2: #110f1f -spmenu.col_itemselfg: #110f1f -spmenu.col_itemselbg: #8e93c2 -spmenu.col_itemmarkedfg: #110f1f -spmenu.col_itemmarkedbg: #8e93c2 -spmenu.col_itemnormprifg: #110f1f -spmenu.col_itemnormpribg: #110f1f -spmenu.col_itemselprifg: #110f1f -spmenu.col_itemselpribg: #8e93c2 -spmenu.col_menu: #110f1f -spmenu.col_promptfg: #110f1f -spmenu.col_promptbg: #c66e5b -spmenu.col_larrowfg: #bbbbbb -spmenu.col_rarrowfg: #bbbbbb -spmenu.col_larrowbg: #110f1f -spmenu.col_rarrowbg: #110f1f -spmenu.col_inputfg: #eeeeee -spmenu.col_inputbg: #110f1f -spmenu.col_numfg: #110f1f -spmenu.col_numbg: #2d3856 -spmenu.col_hlnormfg: #ffffff -spmenu.col_hlnormbg: #000000 -spmenu.col_hlselfg: #ffffff -spmenu.col_hlselbg: #000000 -spmenu.col_caretfg: #ffffff -spmenu.col_caretbg: #110f1f -spmenu.col_border: #8e93c2 -spmenu.col_modefg: #110f1f -spmenu.col_modebg: #92c94b -spmenu.col_capsfg: #110f1f -spmenu.col_capsbg: #f8d3e6 -spmenu.col_sgr0: #20201d -spmenu.col_sgr1: #d73737 -spmenu.col_sgr2: #60ac39 -spmenu.col_sgr3: #cfb017 -spmenu.col_sgr4: #6684e1 -spmenu.col_sgr5: #b854d4 -spmenu.col_sgr6: #1fad83 -spmenu.col_sgr7: #a6a28c -spmenu.col_sgr8: #7d7a68 -spmenu.col_sgr9: #d73737 -spmenu.col_sgr10: #60ac39 -spmenu.col_sgr11: #cfb017 -spmenu.col_sgr12: #6684e1 -spmenu.col_sgr13: #b854d4 -spmenu.col_sgr14: #1fad83 -spmenu.col_sgr15: #fefbec - -!! Alpha -spmenu.alpha_itemnormfg: 255 -spmenu.alpha_itemnormbg: 200 -spmenu.alpha_itemnormfg2: 255 -spmenu.alpha_itemnormbg2: 200 -spmenu.alpha_itemselfg: 255 -spmenu.alpha_itemselbg: 200 -spmenu.alpha_itemmarkedfg: 255 -spmenu.alpha_itemmarkedbg: 200 -spmenu.alpha_itemnormprifg: 255 -spmenu.alpha_itemnormpribg: 200 -spmenu.alpha_itemselprifg: 255 -spmenu.alpha_itemselpribg: 200 -spmenu.alpha_inputfg: 255 -spmenu.alpha_inputbg: 200 -spmenu.alpha_menu: 200 -spmenu.alpha_promptfg: 255 -spmenu.alpha_promptbg: 200 -spmenu.alpha_larrowfg: 255 -spmenu.alpha_larrowbg: 200 -spmenu.alpha_rarrowfg: 255 -spmenu.alpha_rarrowbg: 200 -spmenu.alpha_hlnormfg: 255 -spmenu.alpha_hlnormbg: 200 -spmenu.alpha_hlselfg: 255 -spmenu.alpha_hlselbg: 200 -spmenu.alpha_numfg: 255 -spmenu.alpha_numbg: 200 -spmenu.alpha_border: 255 -spmenu.alpha_caretfgfg: 255 -spmenu.alpha_caretfgbg: 200 -spmenu.alpha_modefg: 255 -spmenu.alpha_modebg: 200 -spmenu.alpha_capsfg: 255 -spmenu.alpha_capsbg: 200 - -!! Powerline -spmenu.powerlineprompt: 1 -spmenu.powerlinecount: 1 -spmenu.powerlinemode: 1 -spmenu.powerlinecaps: 1 -spmenu.powerlineitems: 1 -spmenu.promptpwlstyle: 2 -spmenu.matchcountpwlstyle: 2 -spmenu.modepwlstyle: 2 -spmenu.capspwlstyle: 2 -spmenu.itempwlstyle: 2 - -!! Misc color -spmenu.globalcolors: 1 -spmenu.alpha: 1 - -!! Lines and columns -spmenu.lineheight: 1 -spmenu.lines: 0 -spmenu.columns: 10 -spmenu.overridelines: 1 -spmenu.overridecolumns: 1 -spmenu.preselected: 0 -spmenu.indentitems: 0 - -!! History -spmenu.maxhist: 64 -spmenu.histdup: 0 - -!! Caret -spmenu.caretwidth: 0 -spmenu.caretheight: 0 -spmenu.caretpadding: 0 - -!! Matches -spmenu.type: 1 -spmenu.passwd: 0 -spmenu.fuzzy: 1 -spmenu.regex: 0 -spmenu.sortmatches: 1 -spmenu.mark: 1 -spmenu.casesensitive: 0 - -!! Menu -spmenu.menuposition: 2 -spmenu.menupaddingv: 0 -spmenu.menupaddingh: 0 -spmenu.menuwidth: 0 -spmenu.menumarginv: 0 -spmenu.menumarginh: 0 -spmenu.xpos: 0 -spmenu.ypos: 0 -spmenu.minwidth: 1000 -spmenu.borderwidth: 0 - -!! Properties -spmenu.dockproperty: 1 - -!! General -spmenu.fast: 0 -spmenu.managed: 0 -spmenu.mon: -1 -spmenu.printindex: 0 -spmenu.incremental: 0 -spmenu.requirematch: 0 -spmenu.coloritems: 1 -spmenu.sgr: 1 - -!! Image -spmenu.imagewidth: 200 -spmenu.imageheight: 200 -spmenu.imageresize: 1 -spmenu.imagegaps: 0 -spmenu.imageposition: 0 -spmenu.imagetype: 1 -spmenu.generatecache: 1 -spmenu.maxcache: 512 - -!! Mode options -spmenu.mode: 0 - -!! Hide options -spmenu.hidematchcount: 0 -spmenu.hidemode: 0 -spmenu.hidelarrow: 0 -spmenu.hiderarrow: 0 -spmenu.hideitem: 0 -spmenu.hideprompt: 0 -spmenu.hideinput: 0 -spmenu.hidepowerline: 0 -spmenu.hidecaps: 0 -spmenu.hidecaret: 0 -spmenu.hidehighlight: 0 -spmenu.hideimage: 0 - -!! Pango markup toggles -spmenu.pango_item: 1 -spmenu.pango_prompt: 1 -spmenu.pango_input: 1 -spmenu.pango_leftarrow: 0 -spmenu.pango_rightarrow: 0 -spmenu.pango_numbers: 0 -spmenu.pango_mode: 0 -spmenu.pango_caps: 0 -spmenu.pango_password: 0 -spmenu.pango_highlight: 1 diff --git a/docs/spmenu.conf b/docs/spmenu.conf index 9c12480..4ea9fc7 100644 --- a/docs/spmenu.conf +++ b/docs/spmenu.conf @@ -7,6 +7,7 @@ * * Example: @include "config.conf" */ + spmenu = { /* General window options */ window = ( { position = 2; // Menu position (0: Bottom, 1: Top, 2: Center) diff --git a/libs/x11/xrdb.c b/libs/x11/xrdb.c index c4377fd..083c0bb 100644 --- a/libs/x11/xrdb.c +++ b/libs/x11/xrdb.c @@ -41,9 +41,6 @@ void load_xresources(void) { return; db = XrmGetStringDatabase(resm); - for (p = resources; p < resources + LENGTH(resources); p++) - resource_load(db, p->name, p->type, p->dst); - // recognize global colors if (globalcolors) { for (p = cols; p < cols + LENGTH(cols); p++) diff --git a/libs/x11/xresources.h b/libs/x11/xresources.h index a72b391..bde81c7 100644 --- a/libs/x11/xresources.h +++ b/libs/x11/xresources.h @@ -2,188 +2,8 @@ // This .Xresources array is read and compared to the xrdb. Simply add to the array if you need to. #if USEXRESOURCES -ResourcePref resources[] = { - { "font", STRING, &font }, - { "col_caretfg", STRING, &col_caretfg }, - { "col_caretbg", STRING, &col_caretbg }, - { "col_larrowfg", STRING, &col_larrowfg }, - { "col_rarrowfg", STRING, &col_rarrowfg }, - { "col_larrowbg", STRING, &col_larrowbg }, - { "col_rarrowbg", STRING, &col_rarrowbg }, - { "col_itemnormfg", STRING, &col_itemnormfg }, - { "col_itemnormbg", STRING, &col_itemnormbg }, - { "col_itemnormfg2", STRING, &col_itemnormfg2 }, - { "col_itemnormbg2", STRING, &col_itemnormbg2 }, - { "col_itemselfg", STRING, &col_itemselfg }, - { "col_itemselbg", STRING, &col_itemselbg }, - { "col_itemmarkedfg", STRING, &col_itemmarkedfg }, - { "col_itemmarkedbg", STRING, &col_itemmarkedbg }, - { "col_itemnormprifg", STRING, &col_itemnormprifg }, - { "col_itemnormpribg", STRING, &col_itemnormpribg }, - { "col_itemselprifg", STRING, &col_itemselprifg }, - { "col_itemselpribg", STRING, &col_itemselpribg }, - { "col_inputbg", STRING, &col_inputbg }, - { "col_inputfg", STRING, &col_inputfg }, - { "col_menu", STRING, &col_menu }, - { "col_numfg", STRING, &col_numfg }, - { "col_numbg", STRING, &col_numbg }, - { "col_modefg", STRING, &col_modefg }, - { "col_modebg", STRING, &col_modebg }, - { "col_hlnormfg", STRING, &col_hlnormfg }, - { "col_hlnormbg", STRING, &col_hlnormbg }, - { "col_hlselfg", STRING, &col_hlselfg }, - { "col_hlselbg", STRING, &col_hlselbg }, - { "col_border", STRING, &col_border }, - { "col_promptfg", STRING, &col_promptfg }, - { "col_promptbg", STRING, &col_promptbg }, - { "col_capsfg", STRING, &col_capsfg }, - { "col_capsbg", STRING, &col_capsbg }, - - // Alpha - { "alpha_itemnormfg", INTEGER, &alpha_itemnormfg }, - { "alpha_itemnormbg", INTEGER, &alpha_itemnormbg }, - { "alpha_itemnormfg2", INTEGER, &alpha_itemnormfg2 }, - { "alpha_itemnormbg2", INTEGER, &alpha_itemnormbg2 }, - { "alpha_itemselfg", INTEGER, &alpha_itemselfg }, - { "alpha_itemselbg", INTEGER, &alpha_itemselbg }, - { "alpha_itemmarkedfg", INTEGER, &alpha_itemmarkedfg }, - { "alpha_itemmarkedbg", INTEGER, &alpha_itemmarkedbg }, - { "alpha_itemnormprifg", INTEGER, &alpha_itemnormprifg }, - { "alpha_itemnormpribg", INTEGER, &alpha_itemnormpribg }, - { "alpha_itemselprifg", INTEGER, &alpha_itemselprifg }, - { "alpha_itemselpribg", INTEGER, &alpha_itemselpribg }, - { "alpha_inputfg", INTEGER, &alpha_inputfg }, - { "alpha_inputbg", INTEGER, &alpha_inputbg }, - { "alpha_menu", INTEGER, &alpha_menu }, - { "alpha_promptfg", INTEGER, &alpha_promptfg }, - { "alpha_promptbg", INTEGER, &alpha_promptbg }, - { "alpha_larrowfg", INTEGER, &alpha_larrowfg }, - { "alpha_larrowbg", INTEGER, &alpha_larrowbg }, - { "alpha_rarrowfg", INTEGER, &alpha_rarrowfg }, - { "alpha_rarrowbg", INTEGER, &alpha_rarrowbg }, - { "alpha_hlnormfg", INTEGER, &alpha_hlnormfg }, - { "alpha_hlnormbg", INTEGER, &alpha_hlnormbg }, - { "alpha_hlselfg", INTEGER, &alpha_hlselfg }, - { "alpha_hlselbg", INTEGER, &alpha_hlselbg }, - { "alpha_numfg", INTEGER, &alpha_numfg }, - { "alpha_numbg", INTEGER, &alpha_numbg }, - { "alpha_border", INTEGER, &alpha_border }, - { "alpha_caretfg", INTEGER, &alpha_caretfg }, - { "alpha_caretbg", INTEGER, &alpha_caretbg }, - { "alpha_modefg", INTEGER, &alpha_modefg }, - { "alpha_modebg", INTEGER, &alpha_modebg }, - { "alpha_capsfg", INTEGER, &alpha_capsfg }, - { "alpha_capsbg", INTEGER, &alpha_capsbg }, - - // SGR sequence colors - { "col_sgr0", STRING, &col_sgr0 }, - { "col_sgr1", STRING, &col_sgr1 }, - { "col_sgr2", STRING, &col_sgr2 }, - { "col_sgr3", STRING, &col_sgr3 }, - { "col_sgr4", STRING, &col_sgr4 }, - { "col_sgr5", STRING, &col_sgr5 }, - { "col_sgr6", STRING, &col_sgr6 }, - { "col_sgr7", STRING, &col_sgr7 }, - { "col_sgr8", STRING, &col_sgr8 }, - { "col_sgr9", STRING, &col_sgr9 }, - { "col_sgr10", STRING, &col_sgr10 }, - { "col_sgr11", STRING, &col_sgr11 }, - { "col_sgr12", STRING, &col_sgr12 }, - { "col_sgr13", STRING, &col_sgr13 }, - { "col_sgr14", STRING, &col_sgr14 }, - { "col_sgr15", STRING, &col_sgr15 }, - - // General options - { "promptpwlstyle", INTEGER, &promptpwlstyle }, - { "matchcountpwlstyle", INTEGER, &matchcountpwlstyle }, - { "modepwlstyle", INTEGER, &modepwlstyle }, - { "capspwlstyle", INTEGER, &capspwlstyle }, - { "itempwlstyle", INTEGER, &itempwlstyle }, - { "powerlineprompt", INTEGER, &powerlineprompt }, - { "powerlinecount", INTEGER, &powerlinecount }, - { "powerlinemode", INTEGER, &powerlinemode }, - { "powerlinecaps", INTEGER, &powerlinecaps }, - { "powerlineitems", INTEGER, &powerlineitems }, - { "dockproperty", INTEGER, &dockproperty }, - { "globalcolors", INTEGER, &globalcolors }, - { "coloritems", INTEGER, &coloritems }, - { "sgr", INTEGER, &sgr }, - { "requirematch", INTEGER, &requirematch }, - { "menuposition", INTEGER, &menuposition }, - { "xpos", INTEGER, &xpos }, - { "ypos", INTEGER, &ypos }, - { "caretpadding", INTEGER, &caretpadding }, - { "caretwidth", INTEGER, &caretwidth }, - { "caretheight", INTEGER, &caretheight }, - { "menuwidth", INTEGER, &menuwidth }, - { "menupaddingv", INTEGER, &menupaddingv }, - { "menupaddingh", INTEGER, &menupaddingh }, - { "menumarginv", INTEGER, &menumarginv }, - { "menumarginh", INTEGER, &menumarginh }, - { "textpadding", INTEGER, &textpadding }, - { "normitempadding", INTEGER, &normitempadding }, - { "selitempadding", INTEGER, &selitempadding }, - { "priitempadding", INTEGER, &priitempadding }, - { "indentitems", INTEGER, &indentitems }, - { "alpha", INTEGER, &alpha }, - { "type", INTEGER, &type }, - { "passwd", INTEGER, &passwd }, - { "minwidth", INTEGER, &minwidth }, - { "preselected", INTEGER, &preselected }, - { "borderwidth", INTEGER, &borderwidth }, - { "lines", INTEGER, &lines }, - { "lineheight", INTEGER, &lineheight }, - { "columns", INTEGER, &columns }, - { "overridelines", INTEGER, &overridelines }, - { "overridecolumns", INTEGER, &overridecolumns }, - { "maxhist", INTEGER, &maxhist }, - { "hideitem", INTEGER, &hideitem }, - { "hidematchcount", INTEGER, &hidematchcount }, - { "hidehighlight", INTEGER, &hidehighlight }, - { "hidemode", INTEGER, &hidemode }, - { "hideimage", INTEGER, &hideimage }, - { "hidelarrow", INTEGER, &hidelarrow }, - { "hiderarrow", INTEGER, &hiderarrow }, - { "hideprompt", INTEGER, &hideprompt }, - { "hideinput", INTEGER, &hideinput }, - { "hidepowerline", INTEGER, &hidepowerline }, - { "hidecaret", INTEGER, &hidecaret }, - { "hidecursor", INTEGER, &hidecaret }, - { "hidecaps", INTEGER, &hidecaps }, - { "histdup", INTEGER, &histdup }, - { "casesensitive", INTEGER, &casesensitive }, - { "imagewidth", INTEGER, &imagewidth }, - { "imageheight", INTEGER, &imageheight }, - { "imagegaps", INTEGER, &imagegaps }, - { "imageposition", INTEGER, &imageposition }, - { "imageresize", INTEGER, &imageresize }, - { "imagetype", INTEGER, &imagetype }, - { "generatecache", INTEGER, &generatecache }, - { "maxcache", INTEGER, &maxcache }, - { "mode", INTEGER, &mode }, - { "fast", INTEGER, &fast }, - { "managed", INTEGER, &managed }, - { "mark", INTEGER, &mark }, - { "mon", INTEGER, &mon }, - { "sortmatches", INTEGER, &sortmatches }, - { "printindex", INTEGER, &printindex }, - { "incremental", INTEGER, &incremental }, - { "fuzzy", INTEGER, &fuzzy }, - { "regex", INTEGER, ®ex }, - { "pango_item", INTEGER, &pango_item }, - { "pango_prompt", INTEGER, &pango_prompt }, - { "pango_input", INTEGER, &pango_input }, - { "pango_leftarrow", INTEGER, &pango_leftarrow }, - { "pango_rightarrow", INTEGER, &pango_rightarrow }, - { "pango_numbers", INTEGER, &pango_numbers }, - { "pango_mode", INTEGER, &pango_mode }, - { "pango_caps", INTEGER, &pango_caps }, - { "pango_password", INTEGER, &pango_password }, - { "pango_highlight", INTEGER, &pango_highlight }, -}; - -// global colors ResourcePref cols[] = { + { "font", STRING, &font }, { "color10", STRING, &col_caretfg }, { "color0", STRING, &col_caretbg }, { "color4", STRING, &col_larrowfg }, diff --git a/meson.build b/meson.build index 147c127..aa3e3b3 100644 --- a/meson.build +++ b/meson.build @@ -97,8 +97,6 @@ project_target = executable( install_man('spmenu.1') install_man('spmenu_run.1') install_man('spmenu_test.1') -install_data(sources : 'docs/docs.md', install_dir : 'share/spmenu') -install_data(sources : 'docs/example.Xresources', install_dir : 'share/spmenu') install_data(sources : 'docs/spmenu.conf', install_dir : 'share/spmenu') install_data(sources : 'docs/spmenu_run.desktop', install_dir : 'share/applications') install_data(sources : 'docs/spmenu_desktop.desktop', install_dir : 'share/applications') diff --git a/scripts/spmenu_run b/scripts/spmenu_run index 96afbd2..e406db9 100755 --- a/scripts/spmenu_run +++ b/scripts/spmenu_run @@ -154,7 +154,7 @@ print_help() { cat << EOF | $RUNLAUNCHER "${rl_help[@]}" "${rl_ex[@]}" > /dev/null Start typing in keywords to list out entries. Press Enter to select an entry. The selected entry will be run through a shell. To set spmenu options, you pass arguments to 'spmenu_run' directly. See 'spmenu --help' for a list of valid arguments. -To configure spmenu, you may also copy ${DESTDIR}${PREFIX}/share/spmenu/example.Xresources to $CONFDIR/spmenu/spmenurc and edit that. +To configure spmenu, you may also copy ${DESTDIR}${PREFIX}/share/spmenu/spmenu.conf to $CONFDIR/spmenu/spmenu.conf and edit that. - Type in '?' to show this help screen at any time. - If the entry selected starts with 'www', it will instead be treated as a link and spawned in a web browser (\$BROWSER) diff --git a/spmenu.1 b/spmenu.1 index b9ed9b9..c766811 100644 --- a/spmenu.1 +++ b/spmenu.1 @@ -650,6 +650,22 @@ All of these keybinds can be overriden in the configuration file. Should you unbind your switchmode key, you can always press \f[V]Ctrl+Alt+Delete\f[R] to exit spmenu, allowing you to fix your spmenu configuration. +.SS History buffer +.PP +spmenu allows you to specify a history file using the \f[V]-H\f[R] +argument. +When this argument is specified, the selected item(s) will be appended +to the file. +In spmenu.conf, you can specify a max number of entries, and whether you +want duplicate entries or not. +.PP +To access the history buffer, call \f[V]viewhist\f[R]. +By default, the keybind for that is Shift+h in normal mode. +You can also access it by clicking the match indicator. +To hide the history buffer again, call \f[V]viewhist\f[R]. +.PP +If \f[V]-H\f[R] is not specified, the history buffer will not be +available, and calling \f[V]viewhist\f[R] will do nothing. .SS -p option .PP spmenu has a \f[V]-p\f[R] or \f[V]--prompt\f[R] option.