Compare commits
3 commits
Author | SHA1 | Date | |
---|---|---|---|
Alexis Jhon Gaspar | d7f7b42a5e | ||
Alexis Jhon Gaspar | b0dc1707cd | ||
Alexis Jhon Gaspar | 53c75b4a2e |
14
.gitignore
vendored
14
.gitignore
vendored
|
@ -7,12 +7,12 @@ spmenu
|
||||||
spmenu-*[.]PKGBUILD
|
spmenu-*[.]PKGBUILD
|
||||||
buildconf*
|
buildconf*
|
||||||
build
|
build
|
||||||
./*.ebuild*
|
*.ebuild*
|
||||||
PKGBUILD
|
PKGBUILD
|
||||||
|
|
||||||
src/wl/wlr-layer-shell-unstable-v1-client-protocol.h
|
libs/wl/wlr-layer-shell-unstable-v1-client-protocol.h
|
||||||
src/wl/wlr-layer-shell-unstable-v1-protocol.c
|
libs/wl/wlr-layer-shell-unstable-v1-protocol.c
|
||||||
src/wl/xdg-output-unstable-v1-protocol.c
|
libs/wl/xdg-output-unstable-v1-protocol.c
|
||||||
src/wl/xdg-output-unstable-v1-client-protocol.h
|
libs/wl/xdg-output-unstable-v1-client-protocol.h
|
||||||
src/wl/xdg-shell-client-protocol.h
|
libs/wl/xdg-shell-client-protocol.h
|
||||||
src/wl/xdg-shell-protocol.c
|
libs/wl/xdg-shell-protocol.c
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -11,7 +11,7 @@ MIT/X Consortium License
|
||||||
© 2013 Jari Vetoniemi <mailroxas@gmail.com>
|
© 2013 Jari Vetoniemi <mailroxas@gmail.com>
|
||||||
© 2014-2022 Hiltjo Posthuma <hiltjo@codemadness.org>
|
© 2014-2022 Hiltjo Posthuma <hiltjo@codemadness.org>
|
||||||
© 2015-2019 Quentin Rameau <quinq@fifth.space>
|
© 2015-2019 Quentin Rameau <quinq@fifth.space>
|
||||||
© 2021-2024 speedie <speedie@speedie.site>
|
© 2021-2023 speedie <speedie@speedie.site>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
|
@ -102,9 +102,8 @@ Configure the build by running these commands:
|
||||||
`mkdir -p build/ # Create a build/ directory, Meson will use this as the working
|
`mkdir -p build/ # Create a build/ directory, Meson will use this as the working
|
||||||
directory`
|
directory`
|
||||||
|
|
||||||
`meson setup build --prefix=/usr # This will check to make sure all
|
`meson setup build # This will check to make sure all dependencies are found.
|
||||||
dependencies are found. If you're recompiling you may want to pass
|
If you're recompiling you may want to pass --reconfigure as an argument`
|
||||||
--reconfigure as an argument`
|
|
||||||
|
|
||||||
This is where you can enable/disable certain features, as well as set
|
This is where you can enable/disable certain features, as well as set
|
||||||
compiler options.
|
compiler options.
|
||||||
|
@ -142,7 +141,7 @@ directory**. If you want to generate a pacman package, run
|
||||||
|
|
||||||
When creating a release, do the following:
|
When creating a release, do the following:
|
||||||
|
|
||||||
1. Bump version in meson.build and src/libspmenu/meson.build (optional)
|
1. Bump version in meson.build (optional)
|
||||||
2. Run `scripts/spmenu_make docs`. This will generate new documentation.
|
2. Run `scripts/spmenu_make docs`. This will generate new documentation.
|
||||||
3. `git commit -a` to bump version
|
3. `git commit -a` to bump version
|
||||||
4. Run `scripts/spmenu_make dist`. This will generate a tarball, along
|
4. Run `scripts/spmenu_make dist`. This will generate a tarball, along
|
||||||
|
|
|
@ -1,92 +0,0 @@
|
||||||
/* binds-vim.conf
|
|
||||||
*
|
|
||||||
* This is a binds.conf file which replaces the spmenu dmenu like bindings with Vim inspired keybinds/
|
|
||||||
* It is included as an option for more advanced users, or those who like Vim style bindings, because it reenables normal mode.
|
|
||||||
*/
|
|
||||||
|
|
||||||
bind = {
|
|
||||||
/* Mouse bindings
|
|
||||||
*
|
|
||||||
* See https://spmenu.speedie.site/Configurable+keybindings for a list of valid options.
|
|
||||||
*/
|
|
||||||
mouse = (
|
|
||||||
/* Click Button Function Argument */
|
|
||||||
{ click = "ClickInput"; button = "Left Click"; function = "clear"; argument = "0"; }, // Left click on input: Clear the input
|
|
||||||
{ click = "ClickPrompt"; button = "Left Click"; function = "clear"; argument = "0"; }, // Left click on prompt: Clear the input
|
|
||||||
{ click = "ClickMode"; button = "Left Click"; function = "switchmode"; argument = "0"; }, // Left click on the mode indicator: Toggle mode
|
|
||||||
{ click = "ClickNumber"; button = "Left Click"; function = "viewhist"; argument = "0"; }, // Click on the match count: Toggle viewing history buffer
|
|
||||||
{ click = "ClickItem"; button = "Left Click"; function = "selecthover"; argument = "0"; }, // Left click on an item: Select it
|
|
||||||
{ click = "ClickItem"; button = "Right Click"; function = "markhover"; argument = "0"; }, // Right click on an item: Mark it
|
|
||||||
{ click = "None"; button = "Scroll Up"; function = "moveprev"; argument = "0"; }, // Scroll Up: Move to the previous page
|
|
||||||
{ click = "None"; button = "Scroll Down"; function = "movenext"; argument = "0"; }, // Scroll Down: Move to the next page
|
|
||||||
|
|
||||||
{
|
|
||||||
scrolldistance = 512; // Distance to scroll for a scroll action to count. Wayland only (num)
|
|
||||||
ignoreglobalmouse = 1; // Ignore hardcoded mouse binds (0/1)
|
|
||||||
} );
|
|
||||||
|
|
||||||
/* Keys
|
|
||||||
*
|
|
||||||
* It is strongly recommended that you do NOT unbind any switchmode or quit
|
|
||||||
* function keybinds unless you know exactly what you're doing.
|
|
||||||
* If you ignore this warning and find that you can't exit spmenu,
|
|
||||||
* press Ctrl+Alt+Delete. Doing so will exit spmenu, even if no key is bound.
|
|
||||||
*
|
|
||||||
* Please note that at least on the US standard keyboard layout,
|
|
||||||
* `key` will differ if Shift is held down and the key is a number or symbol.
|
|
||||||
*
|
|
||||||
* See https://spmenu.speedie.site/Configurable+keybindings for a list of valid options.
|
|
||||||
*/
|
|
||||||
keys = (
|
|
||||||
/* Mode Modifier Key Function Argument */
|
|
||||||
{ mode = -1; modifier = "None"; key = "Enter"; function = "selectitem"; argument = "+1"; }, // Enter: Select item
|
|
||||||
{ mode = -1; modifier = "Shift"; key = "Enter"; function = "selectitem"; argument = "0"; }, // Shift+Enter: Select input
|
|
||||||
{ mode = -1; modifier = "Ctrl"; key = "Enter"; function = "markitem"; argument = "0"; }, // Ctrl+Enter: Mark input
|
|
||||||
{ mode = -1; modifier = "None"; key = "Tab"; function = "complete"; argument = "0"; }, // Tab: Tab complete
|
|
||||||
{ mode = -1; modifier = "Ctrl"; key = "v"; function = "paste"; argument = "2"; }, // Ctrl+v: Paste from clipboard
|
|
||||||
{ mode = -1; modifier = "Ctrl+Shift"; key = "v"; function = "paste"; argument = "1"; }, // Ctrl+Shift+v: Paste from selection
|
|
||||||
{ mode = -1; modifier = "None"; key = "Backspace"; function = "backspace"; argument = "0"; }, // Backspace: Backspace
|
|
||||||
{ mode = -1; modifier = "Ctrl"; key = "Backspace"; function = "deleteword"; argument = "0"; }, // Ctrl+Backspace: Delete word
|
|
||||||
{ mode = -1; modifier = "Ctrl"; key = "Left"; function = "moveword"; argument = "-1"; }, // Ctrl+Left: Move caret (cursor) one word to the left
|
|
||||||
{ mode = -1; modifier = "Ctrl"; key = "Right"; function = "moveword"; argument = "+1"; }, // Ctrl+Right: Move caret (cursor) one word to the right
|
|
||||||
{ mode = -1; modifier = "None"; key = "Left"; function = "movecursor"; argument = "-1"; }, // Left: Move caret (cursor) one character to the left
|
|
||||||
{ mode = -1; modifier = "None"; key = "Right"; function = "movecursor"; argument = "+1"; }, // Right: Move caret (cursor) one character to the right
|
|
||||||
{ mode = -1; modifier = "Ctrl"; key = "k"; function = "setlines"; argument = "+1"; }, // Ctrl+k: Increase lines by 1
|
|
||||||
{ mode = -1; modifier = "Ctrl"; key = "j"; function = "setlines"; argument = "-1"; }, // Ctrl+j: Decrease lines by 1
|
|
||||||
{ mode = -1; modifier = "Ctrl"; key = "l"; function = "setcolumns"; argument = "+1"; }, // Ctrl+l: Increase columns by 1
|
|
||||||
{ mode = -1; modifier = "Ctrl"; key = "h"; function = "setcolumns"; argument = "-1"; }, // Ctrl+h: Decrease columns by 1
|
|
||||||
{ mode = -1; modifier = "Ctrl+Shift"; key = "p"; function = "setprofile"; argument = "0"; }, // Ctrl+Shift+p: Open profile menu
|
|
||||||
{ mode = -1; modifier = "None"; key = "PrintScr"; function = "screenshot"; argument = "0"; }, // Print Screen: Screenshot spmenu
|
|
||||||
{ mode = 1; modifier = "None"; key = "Esc"; function = "switchmode"; argument = "0"; }, // Escape: Switch mode
|
|
||||||
{ mode = 1; modifier = "Ctrl"; key = "r"; function = "toggleregex"; argument = "0"; }, // Ctrl+r: Toggle regex matching
|
|
||||||
{ mode = 0; modifier = "None"; key = "i"; function = "switchmode"; argument = "0"; }, // i: Switch mode
|
|
||||||
{ mode = 0; modifier = "Ctrl"; key = "="; function = "setimgsize"; argument = "+10"; }, // Ctrl+=: Increase image size by 10
|
|
||||||
{ mode = 0; modifier = "Ctrl"; key = "-"; function = "setimgsize"; argument = "-10"; }, // Ctrl+-: Decrease image size by 10
|
|
||||||
{ mode = 0; modifier = "Shift"; key = ")"; function = "defaultimg"; argument = "0"; }, // Shift+0: Set image size to the default
|
|
||||||
{ mode = 0; modifier = "None"; key = "o"; function = "setimgpos"; argument = "+1"; }, // o: Toggle image position
|
|
||||||
{ mode = 0; modifier = "None"; key = "p"; function = "paste"; argument = "2"; }, // p: Paste from clipboard
|
|
||||||
{ mode = 0; modifier = "Ctrl"; key = "1"; function = "setimggaps"; argument = "-10"; }, // Ctrl+1: Decrease image gaps by 10
|
|
||||||
{ mode = 0; modifier = "Ctrl"; key = "2"; function = "setimggaps"; argument = "+10"; }, // Ctrl+2: Increase image gaps by 10
|
|
||||||
{ mode = 0; modifier = "None"; key = "t"; function = "toggleimg"; argument = "0"; }, // t: Toggle image
|
|
||||||
{ mode = 0; modifier = "None"; key = "q"; function = "flipimg"; argument = "1"; }, // q: Flip image horizontally
|
|
||||||
{ mode = 0; modifier = "None"; key = "w"; function = "flipimg"; argument = "0"; }, // w: Flip image vertically
|
|
||||||
{ mode = 0; modifier = "None"; key = "k"; function = "moveup"; argument = "0"; }, // k: Move up 1 item
|
|
||||||
{ mode = 0; modifier = "None"; key = "j"; function = "movedown"; argument = "0"; }, // j: Move down 1 item
|
|
||||||
{ mode = 0; modifier = "None"; key = "h"; function = "moveleft"; argument = "0"; }, // h: Move left 1 item
|
|
||||||
{ mode = 0; modifier = "None"; key = "l"; function = "moveright"; argument = "0"; }, // l: Move right 1 item
|
|
||||||
{ mode = 0; modifier = "Ctrl"; key = "u"; function = "moveup"; argument = "5"; }, // Ctrl+u: Move up 5 items
|
|
||||||
{ mode = 0; modifier = "Ctrl"; key = "d"; function = "movedown"; argument = "5"; }, // Ctrl+d: Move down 5 items
|
|
||||||
{ mode = 0; modifier = "None"; key = "u"; function = "togglehighlight"; argument = "0"; }, // u: Toggle highlighting
|
|
||||||
{ mode = 0; modifier = "Shift"; key = "h"; function = "viewhist"; argument = "0"; }, // Shift+h: Toggle viewing history buffer
|
|
||||||
{ mode = 0; modifier = "None"; key = "d"; function = "clear"; argument = "0"; }, // d: Clear the input
|
|
||||||
{ mode = 0; modifier = "Shift"; key = "d"; function = "clearins"; argument = "0"; }, // Shift+d: Clear the input and enter insert mode
|
|
||||||
{ mode = 0; modifier = "None"; key = "Esc"; function = "quit"; argument = "0"; }, // Esc: Exit
|
|
||||||
{ mode = 0; modifier = "None"; key = "g"; function = "movestart"; argument = "0"; }, // g: Move to the start
|
|
||||||
{ mode = 0; modifier = "Shift"; key = "g"; function = "moveend"; argument = "0"; }, // Shift+g: Move to the end
|
|
||||||
{ mode = 0; modifier = "Ctrl"; key = "p"; function = "navhistory"; argument = "-1"; }, // Ctrl+p: Navigate to the previous entry in the history buffer
|
|
||||||
{ mode = 0; modifier = "Ctrl"; key = "n"; function = "navhistory"; argument = "+1"; }, // Ctrl+n: Navigate to the next entry in the history buffer
|
|
||||||
|
|
||||||
{ ignoreglobalkeys = 1; // Ignore hardcoded keybinds (0/1)
|
|
||||||
forceinsertmode = 0; // Force insert mode, disabling normal mode (0/1)
|
|
||||||
} ),
|
|
||||||
};
|
|
13
docs/docs.md
13
docs/docs.md
|
@ -283,9 +283,6 @@ in the config files.
|
||||||
`-sin, --show-input`
|
`-sin, --show-input`
|
||||||
: Show input
|
: Show input
|
||||||
|
|
||||||
`-spt, --show-pretext`
|
|
||||||
: Show pretext
|
|
||||||
|
|
||||||
`-spl, --show-powerline`
|
`-spl, --show-powerline`
|
||||||
: Show powerline
|
: Show powerline
|
||||||
|
|
||||||
|
@ -376,12 +373,6 @@ in the config files.
|
||||||
`-nwm, --unmanaged`
|
`-nwm, --unmanaged`
|
||||||
: Don't spawn spmenu as a window manager controlled client/window (X11 only)
|
: Don't spawn spmenu as a window manager controlled client/window (X11 only)
|
||||||
|
|
||||||
`-gk, --grab-keyboard`
|
|
||||||
: Grab keyboard on runtime
|
|
||||||
|
|
||||||
`-ngk, --no-grab-keyboard`
|
|
||||||
: Grab keyboard on runtime
|
|
||||||
|
|
||||||
`-cf, --config-file file`
|
`-cf, --config-file file`
|
||||||
: Set config file to load to file
|
: Set config file to load to file
|
||||||
|
|
||||||
|
@ -614,7 +605,9 @@ regex can be used as well.
|
||||||
## Modes
|
## Modes
|
||||||
|
|
||||||
There are two modes. Normal mode and Insert mode. These modes are of
|
There are two modes. Normal mode and Insert mode. These modes are of
|
||||||
course similar to Vim.
|
course similar to Vim. While modes are used by default, it is possible
|
||||||
|
to move all keybinds to Insert mode, restoring the original dmenu
|
||||||
|
behavior.
|
||||||
|
|
||||||
Normal mode is the mode spmenu starts in unless a mode argument is specified
|
Normal mode is the mode spmenu starts in unless a mode argument is specified
|
||||||
or another mode is set in the configuration file. Note that if `forceinsertmode`
|
or another mode is set in the configuration file. Note that if `forceinsertmode`
|
||||||
|
|
|
@ -21,7 +21,6 @@ spmenu = {
|
||||||
padding-horizontal = 0; // Outer horizontal padding (px)
|
padding-horizontal = 0; // Outer horizontal padding (px)
|
||||||
width = 0; // Width when X and/or Y offset is set, 0 is the default (px)
|
width = 0; // Width when X and/or Y offset is set, 0 is the default (px)
|
||||||
managed = 0; // Allow your window manager to manage spmenu as a window (0/1)
|
managed = 0; // Allow your window manager to manage spmenu as a window (0/1)
|
||||||
grabkeyboard = 1; // Grab keyboard on runtime (0/1)
|
|
||||||
alpha = 1; // Enable alpha/transparency (0/1)
|
alpha = 1; // Enable alpha/transparency (0/1)
|
||||||
x = 0; // X position offset (px)
|
x = 0; // X position offset (px)
|
||||||
y = 0; // Y position offset (px)
|
y = 0; // Y position offset (px)
|
||||||
|
@ -384,10 +383,10 @@ spmenu = {
|
||||||
{ mode = -1; modifier = "Ctrl+Shift"; key = "p"; function = "setprofile"; argument = "0"; }, // Ctrl+Shift+p: Open profile menu
|
{ mode = -1; modifier = "Ctrl+Shift"; key = "p"; function = "setprofile"; argument = "0"; }, // Ctrl+Shift+p: Open profile menu
|
||||||
{ mode = -1; modifier = "Ctrl"; key = "="; function = "setimgsize"; argument = "+10"; }, // Ctrl+=: Increase image size by 10
|
{ mode = -1; modifier = "Ctrl"; key = "="; function = "setimgsize"; argument = "+10"; }, // Ctrl+=: Increase image size by 10
|
||||||
{ mode = -1; modifier = "Ctrl"; key = "-"; function = "setimgsize"; argument = "-10"; }, // Ctrl+-: Decrease image size by 10
|
{ mode = -1; modifier = "Ctrl"; key = "-"; function = "setimgsize"; argument = "-10"; }, // Ctrl+-: Decrease image size by 10
|
||||||
{ mode = -1; modifier = "None"; key = "Up"; function = "moveup"; argument = "0"; }, // Up: Move up 1 item
|
{ mode = -1; modifier = "None"; key = "Up"; function = "moveup"; argument = "0"; }, // k: Move up 1 item
|
||||||
{ mode = -1; modifier = "None"; key = "Down"; function = "movedown"; argument = "0"; }, // Down: Move down 1 item
|
{ mode = -1; modifier = "None"; key = "Down"; function = "movedown"; argument = "0"; }, // j: Move down 1 item
|
||||||
{ mode = -1; modifier = "None"; key = "Left"; function = "moveleft"; argument = "0"; }, // Left: Move left 1 item
|
{ mode = -1; modifier = "None"; key = "Left"; function = "moveleft"; argument = "0"; }, // h: Move left 1 item
|
||||||
{ mode = -1; modifier = "None"; key = "Right"; function = "moveright"; argument = "0"; }, // Right: Move right 1 item
|
{ mode = -1; modifier = "None"; key = "Right"; function = "moveright"; argument = "0"; }, // l: Move right 1 item
|
||||||
{ mode = -1; modifier = "Ctrl"; key = "u"; function = "moveup"; argument = "5"; }, // Ctrl+u: Move up 5 items
|
{ mode = -1; modifier = "Ctrl"; key = "u"; function = "moveup"; argument = "5"; }, // Ctrl+u: Move up 5 items
|
||||||
{ mode = -1; modifier = "Ctrl"; key = "d"; function = "movedown"; argument = "5"; }, // Ctrl+d: Move down 5 items
|
{ mode = -1; modifier = "Ctrl"; key = "d"; function = "movedown"; argument = "5"; }, // Ctrl+d: Move down 5 items
|
||||||
{ mode = -1; modifier = "Ctrl"; key = "h"; function = "viewhist"; argument = "0"; }, // Ctrl+h: Toggle viewing history buffer
|
{ mode = -1; modifier = "Ctrl"; key = "h"; function = "viewhist"; argument = "0"; }, // Ctrl+h: Toggle viewing history buffer
|
||||||
|
|
|
@ -564,7 +564,7 @@ void defaultimg(Arg *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setlines(Arg *arg) {
|
void setlines(Arg *arg) {
|
||||||
if (!overridelines || (hideprompt && hideinput && hidemode && hidematchcount && hidecaps)) return;
|
if (!overridelines) return;
|
||||||
|
|
||||||
insert(NULL, 0 - sp.cursor);
|
insert(NULL, 0 - sp.cursor);
|
||||||
selecteditem = currentitem = matches;
|
selecteditem = currentitem = matches;
|
||||||
|
@ -587,7 +587,7 @@ void setlines(Arg *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setcolumns(Arg *arg) {
|
void setcolumns(Arg *arg) {
|
||||||
if (!overridecolumns || (hideprompt && hideinput && hidemode && hidematchcount && hidecaps)) return;
|
if (!overridecolumns) return;
|
||||||
|
|
||||||
columns += arg->i;
|
columns += arg->i;
|
||||||
|
|
|
@ -181,10 +181,6 @@ void readargs(int argc, char *argv[]) {
|
||||||
managed = 1;
|
managed = 1;
|
||||||
} else if (!strcmp(argv[i], "-nwm") || (!strcmp(argv[i], "--unmanaged"))) { // don't display as managed wm window
|
} else if (!strcmp(argv[i], "-nwm") || (!strcmp(argv[i], "--unmanaged"))) { // don't display as managed wm window
|
||||||
managed = 0;
|
managed = 0;
|
||||||
} else if (!strcmp(argv[i], "-gk") || (!strcmp(argv[i], "--grab-keyboard"))) { // grab keyboard
|
|
||||||
grabkeyboard = 1;
|
|
||||||
} else if (!strcmp(argv[i], "-ngk") || (!strcmp(argv[i], "--no-grab-keyboard"))) { // don't grab keyboard
|
|
||||||
grabkeyboard = 0;
|
|
||||||
} else if (!strcmp(argv[i], "-na") || (!strcmp(argv[i], "--no-alpha"))) { // disable alpha
|
} else if (!strcmp(argv[i], "-na") || (!strcmp(argv[i], "--no-alpha"))) { // disable alpha
|
||||||
alpha = 0;
|
alpha = 0;
|
||||||
} else if (!strcmp(argv[i], "-a") || (!strcmp(argv[i], "--alpha"))) { // alpha
|
} else if (!strcmp(argv[i], "-a") || (!strcmp(argv[i], "--alpha"))) { // alpha
|
||||||
|
@ -228,15 +224,13 @@ void readargs(int argc, char *argv[]) {
|
||||||
} else if (!strcmp(argv[i], "-hpr") || (!strcmp(argv[i], "--hide-prompt"))) { // hide prompt
|
} else if (!strcmp(argv[i], "-hpr") || (!strcmp(argv[i], "--hide-prompt"))) { // hide prompt
|
||||||
hideprompt = 1;
|
hideprompt = 1;
|
||||||
} else if (!strcmp(argv[i], "-hpt") || (!strcmp(argv[i], "--hide-pretext"))) { // hide pretext
|
} else if (!strcmp(argv[i], "-hpt") || (!strcmp(argv[i], "--hide-pretext"))) { // hide pretext
|
||||||
hidepretext = 1;
|
hideprompt = 1;
|
||||||
} else if (!strcmp(argv[i], "-hpl") || (!strcmp(argv[i], "--hide-powerline"))) { // hide powerline
|
} else if (!strcmp(argv[i], "-hpl") || (!strcmp(argv[i], "--hide-powerline"))) { // hide powerline
|
||||||
hidepowerline = 1;
|
hidepowerline = 1;
|
||||||
} else if (!strcmp(argv[i], "-hip") || (!strcmp(argv[i], "--hide-input"))) { // hide input
|
} else if (!strcmp(argv[i], "-hin") || (!strcmp(argv[i], "--hide-input"))) { // hide input
|
||||||
hideinput = 1;
|
hideinput = 1;
|
||||||
} else if (!strcmp(argv[i], "-spr") || (!strcmp(argv[i], "--show-prompt"))) { // show prompt
|
} else if (!strcmp(argv[i], "-spr") || (!strcmp(argv[i], "--show-prompt"))) { // show prompt
|
||||||
hideprompt = 0;
|
hideprompt = 0;
|
||||||
} else if (!strcmp(argv[i], "-spt") || (!strcmp(argv[i], "--show-pretext"))) { // show pretext
|
|
||||||
hidepretext = 0;
|
|
||||||
} else if (!strcmp(argv[i], "-spl") || (!strcmp(argv[i], "--show-powerline"))) { // show prompt
|
} else if (!strcmp(argv[i], "-spl") || (!strcmp(argv[i], "--show-powerline"))) { // show prompt
|
||||||
hidepowerline = 0;
|
hidepowerline = 0;
|
||||||
} else if (!strcmp(argv[i], "-sin") || (!strcmp(argv[i], "--show-input"))) { // show input
|
} else if (!strcmp(argv[i], "-sin") || (!strcmp(argv[i], "--show-input"))) { // show input
|
||||||
|
@ -708,7 +702,6 @@ void usage(int status) {
|
||||||
"spmenu -sra, --show-right-arrow Show right arrow\n"
|
"spmenu -sra, --show-right-arrow Show right arrow\n"
|
||||||
"spmenu -sit, --show-item Show items\n"
|
"spmenu -sit, --show-item Show items\n"
|
||||||
"spmenu -spr, --show-prompt Show prompt\n"
|
"spmenu -spr, --show-prompt Show prompt\n"
|
||||||
"spmenu -spt, --show-pretext Show pretext\n"
|
|
||||||
"spmenu -sin, --show-input Show input\n"
|
"spmenu -sin, --show-input Show input\n"
|
||||||
"spmenu -spl, --show-powerline Show powerline\n"
|
"spmenu -spl, --show-powerline Show powerline\n"
|
||||||
"spmenu -sc, --show-caret, --show-cursor Show caret\n"
|
"spmenu -sc, --show-caret, --show-cursor Show caret\n"
|
||||||
|
@ -748,19 +741,6 @@ void usage(int status) {
|
||||||
fputs(
|
fputs(
|
||||||
"spmenu -wm, --managed, --x11-client Spawn spmenu as a window manager controlled client/window (X11 only)\n"
|
"spmenu -wm, --managed, --x11-client Spawn spmenu as a window manager controlled client/window (X11 only)\n"
|
||||||
"spmenu -nwm, --unmanaged Don't spawn spmenu as a window manager controlled client/window (X11 only)\n"
|
"spmenu -nwm, --unmanaged Don't spawn spmenu as a window manager controlled client/window (X11 only)\n"
|
||||||
"spmenu -gk, --grab-keyboard Grab keyboard on runtime\n"
|
|
||||||
"spmenu -ngk, --no-grab-keyboard Don't grab keyboard on runtime\n"
|
|
||||||
"spmenu -cf, --config-file <file> Set config file to load to <file>\n"
|
|
||||||
"spmenu -lcfg, --load-config Load spmenu configuration (~/.config/spmenu/spmenu.conf)\n"
|
|
||||||
"spmenu -ncfg, --no-load-config Don't load spmenu configuration (~/.config/spmenu/spmenu.conf)\n"
|
|
||||||
"spmenu -bf, --bind-file <file> Exclusively load binds from <file>\n"
|
|
||||||
"spmenu -lbi, --load-binds Load spmenu binds (~/.config/spmenu/binds.conf)\n"
|
|
||||||
"spmenu -nlbi, --no-load-binds Don't load spmenu binds (~/.config/spmenu/binds.conf)\n"
|
|
||||||
"spmenu -tm, --theme <theme> Load theme <theme>\n"
|
|
||||||
"spmenu -ltm, --load-theme Load theme\n"
|
|
||||||
"spmenu -nltm, --no-load-theme Don't load theme\n"
|
|
||||||
"spmenu -x11, --x11 Run spmenu in X11 mode\n"
|
|
||||||
"spmenu -wl, --wayland Run spmenu in Wayland mode\n"
|
|
||||||
"spmenu -cf, --config-file <file> Set config file to load to <file>\n"
|
"spmenu -cf, --config-file <file> Set config file to load to <file>\n"
|
||||||
"spmenu -lcfg, --load-config Load spmenu configuration (~/.config/spmenu/spmenu.conf)\n"
|
"spmenu -lcfg, --load-config Load spmenu configuration (~/.config/spmenu/spmenu.conf)\n"
|
||||||
"spmenu -ncfg, --no-load-config Don't load spmenu configuration (~/.config/spmenu/spmenu.conf)\n"
|
"spmenu -ncfg, --no-load-config Don't load spmenu configuration (~/.config/spmenu/spmenu.conf)\n"
|
|
@ -286,7 +286,6 @@ void conf_init(void) {
|
||||||
config_setting_lookup_int(conf, "width", &menuwidth); // spmenu.window.width
|
config_setting_lookup_int(conf, "width", &menuwidth); // spmenu.window.width
|
||||||
config_setting_lookup_int(conf, "border", &borderwidth); // spmenu.window.border
|
config_setting_lookup_int(conf, "border", &borderwidth); // spmenu.window.border
|
||||||
config_setting_lookup_int(conf, "managed", &managed); // spmenu.window.managed
|
config_setting_lookup_int(conf, "managed", &managed); // spmenu.window.managed
|
||||||
config_setting_lookup_int(conf, "grabkeyboard", &grabkeyboard); // spmenu.window.grabkeyboard
|
|
||||||
config_setting_lookup_int(conf, "monitor", &mon); // spmenu.window.monitor
|
config_setting_lookup_int(conf, "monitor", &mon); // spmenu.window.monitor
|
||||||
config_setting_lookup_int(conf, "alpha", &alpha); // spmenu.window.alpha
|
config_setting_lookup_int(conf, "alpha", &alpha); // spmenu.window.alpha
|
||||||
|
|
|
@ -468,7 +468,7 @@ int drawinput(int x, int y, int w) {
|
||||||
fh = sp.bh - sp.lrpad / 4;
|
fh = sp.bh - sp.lrpad / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (passwd && !hideinput) {
|
if (passwd) {
|
||||||
censort = ecalloc(1, sizeof(tx.text));
|
censort = ecalloc(1, sizeof(tx.text));
|
||||||
|
|
||||||
for (int i = 0; i < strlen(tx.text); i++)
|
for (int i = 0; i < strlen(tx.text); i++)
|
||||||
|
@ -481,7 +481,7 @@ int drawinput(int x, int y, int w) {
|
||||||
|
|
||||||
free(censort);
|
free(censort);
|
||||||
} else if (!passwd) {
|
} else if (!passwd) {
|
||||||
if (strlen(tx.text) && !hideinput) {
|
if (strlen(tx.text)) {
|
||||||
char ptext[BUFSIZ];
|
char ptext[BUFSIZ];
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
@ -500,16 +500,16 @@ int drawinput(int x, int y, int w) {
|
||||||
|
|
||||||
curpos = TEXTW(ptext) - TEXTW(&ptext[sp.cursor]);
|
curpos = TEXTW(ptext) - TEXTW(&ptext[sp.cursor]);
|
||||||
} else if (pretext != NULL) {
|
} else if (pretext != NULL) {
|
||||||
if (hidepretext) {
|
if (hidepretext) {
|
||||||
pretext = "";
|
pretext = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
apply_fribidi(pretext);
|
apply_fribidi(pretext);
|
||||||
draw_text(draw, x + fw, y, w, sp.bh, sp.lrpad / 2, isrtl ? fribidi_text : pretext, 0, pango_pretext ? True : False, col_pretextfg, col_pretextbg, alpha_pretextfg, alpha_pretextbg);
|
draw_text(draw, x + fw, y, w, sp.bh, sp.lrpad / 2, isrtl ? fribidi_text : pretext, 0, pango_pretext ? True : False, col_pretextfg, col_pretextbg, alpha_pretextfg, alpha_pretextbg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((curpos += sp.lrpad / 2 - 1) < w && !hidecaret && !hideinput) {
|
if ((curpos += sp.lrpad / 2 - 1) < w && !hidecaret) {
|
||||||
curpos += fp;
|
curpos += fp;
|
||||||
draw_rect(draw, x + curpos, 2 + (sp.bh - fh) / 2 + y, fw, fh - 4, 1, 0, col_caretfg, col_caretbg, alpha_caretfg, alpha_caretbg);
|
draw_rect(draw, x + curpos, 2 + (sp.bh - fh) / 2 + y, fw, fh - 4, 1, 0, col_caretfg, col_caretbg, alpha_caretfg, alpha_caretbg);
|
||||||
}
|
}
|
||||||
|
@ -736,8 +736,10 @@ void drawmenu_layer(void) {
|
||||||
x = drawprompt(x, y + (nh ? lines ? itemposition ? (sp.mh - sp.bh) : 0 : 0 : 0), w);
|
x = drawprompt(x, y + (nh ? lines ? itemposition ? (sp.mh - sp.bh) : 0 : 0 : 0), w);
|
||||||
}
|
}
|
||||||
|
|
||||||
w = (lines > 0 || !matches) ? sp.mw - x : sp.inputw;
|
if (!hideinput) {
|
||||||
x = drawinput(x, y + (nh ? lines ? itemposition ? (sp.mh - sp.bh) : 0 : 0 : 0), w);
|
w = (lines > 0 || !matches) ? sp.mw - x : sp.inputw;
|
||||||
|
x = drawinput(x, y + (nh ? lines ? itemposition ? (sp.mh - sp.bh) : 0 : 0 : 0), w);
|
||||||
|
}
|
||||||
|
|
||||||
// draw the items, this function also calls drawrarrow() and drawlarrow()
|
// draw the items, this function also calls drawrarrow() and drawlarrow()
|
||||||
if (!hideitem) {
|
if (!hideitem) {
|
|
@ -404,7 +404,7 @@ void draw_set_img(Draw_t *draw, void *data, int w, int h) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_img(Draw_t *draw, int x, int y) {
|
void draw_img(Draw_t *draw, int x, int y) {
|
||||||
if (!draw || !draw->img_surface) {
|
if (!draw) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -362,11 +362,11 @@ void resizetoimageheight_x11(int imageheight) {
|
||||||
|
|
||||||
if (menuposition == 2) { // centered
|
if (menuposition == 2) { // centered
|
||||||
sp.mw = MIN(MAX(max_textw() + sp.promptw, centerwidth), mo.output_width);
|
sp.mw = MIN(MAX(max_textw() + sp.promptw, centerwidth), mo.output_width);
|
||||||
x = mo.output_xpos + ((mo.output_width - sp.mw) / 2 + xpos);
|
x = (mo.output_width - sp.mw) / 2 + xpos;
|
||||||
y = mo.output_ypos + ((mo.output_height - sp.mh) / 2 - ypos);
|
y = (mo.output_height - sp.mh) / 2 - ypos;
|
||||||
} else { // top or bottom
|
} else { // top or bottom
|
||||||
x = mo.output_xpos + xpos;
|
x = xpos;
|
||||||
y = mo.output_ypos + menuposition ? (-ypos) : (mo.output_height - sp.mh - ypos);
|
y = menuposition ? (-ypos) : (mo.output_height - sp.mh - ypos);
|
||||||
sp.mw = (menuwidth > 0 ? menuwidth : mo.output_width);
|
sp.mw = (menuwidth > 0 ? menuwidth : mo.output_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,9 +437,9 @@ void resizetoimageheight_wl(int imageheight) {
|
||||||
drawmenu();
|
drawmenu();
|
||||||
|
|
||||||
wl_surface_set_buffer_scale(state.surface, 1);
|
wl_surface_set_buffer_scale(state.surface, 1);
|
||||||
wl_surface_attach(state.surface, state.buffer, 0, 0);
|
wl_surface_attach(state.surface, state.buffer, 0, 0);
|
||||||
wl_surface_damage(state.surface, 0, 0, state.width, state.height);
|
wl_surface_damage(state.surface, 0, 0, state.width, state.height);
|
||||||
wl_surface_commit(state.surface);
|
wl_surface_commit(state.surface);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -12,7 +12,6 @@ static int loadtheme = 1; /* Load theme (~/.config/spmenu/them
|
||||||
static int loadbinds = 1; /* Load keybind file (~/.config/spmenu/binds.conf) on runtime */
|
static int loadbinds = 1; /* Load keybind file (~/.config/spmenu/binds.conf) on runtime */
|
||||||
static int mon = -1; /* Monitor to run spmenu on */
|
static int mon = -1; /* Monitor to run spmenu on */
|
||||||
static int managed = 0; /* Let your window manager manage spmenu? */
|
static int managed = 0; /* Let your window manager manage spmenu? */
|
||||||
static int grabkeyboard = 1; /* Grab keyboard/general input */
|
|
||||||
|
|
||||||
/* Wayland options */
|
/* Wayland options */
|
||||||
static int scrolldistance = 512; /* Distance to scroll for a scroll action to count */
|
static int scrolldistance = 512; /* Distance to scroll for a scroll action to count */
|
|
@ -51,7 +51,7 @@ void handle_wl(void) {
|
||||||
|
|
||||||
anchor_layer(&state, menuposition);
|
anchor_layer(&state, menuposition);
|
||||||
set_exclusive_zone(&state, -1);
|
set_exclusive_zone(&state, -1);
|
||||||
set_keyboard(&state, grabkeyboard ? 1 : 0);
|
set_keyboard(&state, 1);
|
||||||
add_layer_listener(&state);
|
add_layer_listener(&state);
|
||||||
set_visible_layer(&state);
|
set_visible_layer(&state);
|
||||||
|
|
|
@ -20,7 +20,7 @@ void create_window_x11(int x, int y, int w, int h) {
|
||||||
ExposureMask | // mapping the drawing
|
ExposureMask | // mapping the drawing
|
||||||
KeyPressMask | // keypresses
|
KeyPressMask | // keypresses
|
||||||
VisibilityChangeMask | // whether or not client is visible
|
VisibilityChangeMask | // whether or not client is visible
|
||||||
ButtonPressMask | // see buttonpress in mouse.c for usage
|
ButtonPressMask | // see buttonpress in libs/mouse.c for usage
|
||||||
PointerMotionMask; // we need pointer for selecting entries using the mouse
|
PointerMotionMask; // we need pointer for selecting entries using the mouse
|
||||||
|
|
||||||
// create client
|
// create client
|
||||||
|
@ -94,11 +94,11 @@ void resizeclient_x11(void) {
|
||||||
|
|
||||||
if (menuposition == 2) { // centered
|
if (menuposition == 2) { // centered
|
||||||
sp.mw = MIN(MAX(max_textw() + sp.promptw, centerwidth), mo.output_width);
|
sp.mw = MIN(MAX(max_textw() + sp.promptw, centerwidth), mo.output_width);
|
||||||
x = mo.output_xpos + ((mo.output_width - sp.mw) / 2 + xpos);
|
x = (mo.output_width - sp.mw) / 2 + xpos;
|
||||||
y = mo.output_ypos + ((mo.output_height - sp.mh) / 2 - ypos);
|
y = (mo.output_height - sp.mh) / 2 - ypos;
|
||||||
} else { // top or bottom
|
} else { // top or bottom
|
||||||
x = mo.output_xpos + xpos;
|
x = xpos;
|
||||||
y = mo.output_ypos + menuposition ? (-ypos) : (mo.output_height - sp.mh - ypos);
|
y = menuposition ? (-ypos) : (mo.output_height - sp.mh - ypos);
|
||||||
sp.mw = (menuwidth > 0 ? menuwidth : mo.output_width);
|
sp.mw = (menuwidth > 0 ? menuwidth : mo.output_width);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,8 +51,6 @@ void setupdisplay_x11(void) {
|
||||||
|
|
||||||
mo.output_width = info[i].width;
|
mo.output_width = info[i].width;
|
||||||
mo.output_height = info[i].height;
|
mo.output_height = info[i].height;
|
||||||
mo.output_xpos = info[i].x_org;
|
|
||||||
mo.output_ypos = info[i].y_org;
|
|
||||||
|
|
||||||
XFree(info);
|
XFree(info);
|
||||||
} else
|
} else
|
||||||
|
@ -70,15 +68,14 @@ void setupdisplay_x11(void) {
|
||||||
|
|
||||||
if (menuposition == 2) { // centered
|
if (menuposition == 2) { // centered
|
||||||
sp.mw = MIN(MAX(max_textw() + sp.promptw, centerwidth), mo.output_width);
|
sp.mw = MIN(MAX(max_textw() + sp.promptw, centerwidth), mo.output_width);
|
||||||
x = mo.output_xpos + ((mo.output_width - sp.mw) / 2 + xpos);
|
x = (mo.output_width - sp.mw) / 2 + xpos;
|
||||||
y = mo.output_ypos + ((mo.output_height - sp.mh) / 2 - ypos);
|
y = (mo.output_height - sp.mh) / 2 - ypos;
|
||||||
} else { // top or bottom
|
} else { // top or bottom
|
||||||
x = mo.output_xpos + xpos;
|
x = xpos;
|
||||||
y = mo.output_ypos + menuposition ? (-ypos) : (mo.output_height - sp.mh - ypos);
|
y = menuposition ? (-ypos) : (mo.output_height - sp.mh - ypos);
|
||||||
sp.mw = (menuwidth > 0 ? menuwidth : mo.output_width);
|
sp.mw = (menuwidth > 0 ? menuwidth : mo.output_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// create menu window and set properties for it
|
// create menu window and set properties for it
|
||||||
create_window_x11(
|
create_window_x11(
|
||||||
x + sp.sp,
|
x + sp.sp,
|
19
meson.build
19
meson.build
|
@ -1,15 +1,15 @@
|
||||||
project(
|
project(
|
||||||
'spmenu',
|
'spmenu',
|
||||||
'c',
|
'c',
|
||||||
version : '"3.5.0"',
|
version : '"3.4"',
|
||||||
default_options : ['warning_level=3']
|
default_options : ['warning_level=3']
|
||||||
)
|
)
|
||||||
|
|
||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
|
|
||||||
project_source_files = [
|
project_source_files = [
|
||||||
'src/draw/draw.c',
|
'libs/draw/draw.c',
|
||||||
'src/spmenu.c',
|
'spmenu.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
project_dependencies = [
|
project_dependencies = [
|
||||||
|
@ -40,12 +40,12 @@ if get_option('wayland')
|
||||||
|
|
||||||
run_command('protocols/generate.sh', check : true)
|
run_command('protocols/generate.sh', check : true)
|
||||||
|
|
||||||
project_source_files += [ 'src/wl/wlr-layer-shell-unstable-v1-client-protocol.h' ]
|
project_source_files += [ 'libs/wl/wlr-layer-shell-unstable-v1-client-protocol.h' ]
|
||||||
project_source_files += [ 'src/wl/wlr-layer-shell-unstable-v1-protocol.c' ]
|
project_source_files += [ 'libs/wl/wlr-layer-shell-unstable-v1-protocol.c' ]
|
||||||
project_source_files += [ 'src/wl/xdg-output-unstable-v1-client-protocol.h' ]
|
project_source_files += [ 'libs/wl/xdg-output-unstable-v1-client-protocol.h' ]
|
||||||
project_source_files += [ 'src/wl/xdg-output-unstable-v1-protocol.c' ]
|
project_source_files += [ 'libs/wl/xdg-output-unstable-v1-protocol.c' ]
|
||||||
project_source_files += [ 'src/wl/xdg-shell-client-protocol.h' ]
|
project_source_files += [ 'libs/wl/xdg-shell-client-protocol.h' ]
|
||||||
project_source_files += [ 'src/wl/xdg-shell-protocol.c' ]
|
project_source_files += [ 'libs/wl/xdg-shell-protocol.c' ]
|
||||||
build_args += [ '-DWAYLAND' ]
|
build_args += [ '-DWAYLAND' ]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -100,6 +100,7 @@ endif
|
||||||
|
|
||||||
if get_option('docs')
|
if get_option('docs')
|
||||||
install_data(sources : 'docs/spmenu.conf', install_dir : 'share/spmenu')
|
install_data(sources : 'docs/spmenu.conf', install_dir : 'share/spmenu')
|
||||||
|
install_data(sources : 'docs/binds-vim.conf', install_dir : 'share/spmenu')
|
||||||
install_data(sources : 'docs/spmenu_run.desktop', install_dir : 'share/applications')
|
install_data(sources : 'docs/spmenu_run.desktop', install_dir : 'share/applications')
|
||||||
install_data(sources : 'docs/spmenu_desktop.desktop', install_dir : 'share/applications')
|
install_data(sources : 'docs/spmenu_desktop.desktop', install_dir : 'share/applications')
|
||||||
install_data(sources : 'docs/spmenu_filemanager.desktop', install_dir : 'share/applications')
|
install_data(sources : 'docs/spmenu_filemanager.desktop', install_dir : 'share/applications')
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
# Copyright 1999-2022 Gentoo Authors
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
|
|
||||||
EAPI=8
|
|
||||||
inherit toolchain-funcs meson
|
|
||||||
|
|
||||||
DESCRIPTION="C++ library for spmenu"
|
|
||||||
HOMEPAGE="https://spmenu.speedie.site"
|
|
||||||
|
|
||||||
if [[ ${PV} == 9999 ]]; then
|
|
||||||
inherit git-r3
|
|
||||||
EGIT_REPO_URI="https://git.speedie.site/speedie/spmenu"
|
|
||||||
else
|
|
||||||
KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~x86"
|
|
||||||
SRC_URI="https://ls.speedie.site/spmenu-${PV}.tar.gz -> ${P}.tar.gz"
|
|
||||||
S="${WORKDIR}/spmenu-${PV}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
EMESON_SOURCE="${S}/src/libspmenu"
|
|
||||||
|
|
||||||
LICENSE="MIT"
|
|
||||||
SLOT="0"
|
|
||||||
IUSE=""
|
|
||||||
|
|
||||||
RDEPEND="x11-misc/spmenu"
|
|
||||||
|
|
||||||
DEPEND="${RDEPEND}"
|
|
||||||
BDEPEND="virtual/pkgconfig"
|
|
||||||
|
|
||||||
src_prepare() {
|
|
||||||
default
|
|
||||||
}
|
|
||||||
|
|
||||||
src_configure() {
|
|
||||||
meson_src_configure
|
|
||||||
}
|
|
||||||
|
|
||||||
src_compile() {
|
|
||||||
meson_src_compile
|
|
||||||
}
|
|
||||||
|
|
||||||
src_install() {
|
|
||||||
meson_install
|
|
||||||
}
|
|
|
@ -1,7 +1,6 @@
|
||||||
# Maintainer: speedie <speedie@speedie.site>
|
# Maintainer: speedie <speedie@speedie.site>
|
||||||
|
|
||||||
pkgname=('spmenu' 'libspmenu')
|
pkgname=spmenu
|
||||||
pkgbase="spmenu"
|
|
||||||
pkgver=VERSION
|
pkgver=VERSION
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Fancy dynamic menu for X11 and Wayland, compatible with dmenu!"
|
pkgdesc="Fancy dynamic menu for X11 and Wayland, compatible with dmenu!"
|
||||||
|
@ -30,13 +29,15 @@ makedepends=(
|
||||||
|
|
||||||
optdepends=(
|
optdepends=(
|
||||||
'wl-clipboard: Clipboard support on Wayland'
|
'wl-clipboard: Clipboard support on Wayland'
|
||||||
'libspmenu: C++ library for spmenu'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
provides=($pkgname)
|
provides=($pkgname)
|
||||||
|
conflicts=($pkgname)
|
||||||
source=(
|
source=(
|
||||||
"$pkgbase-$pkgver.tar.gz"
|
"$pkgname-$pkgver.tar.gz"
|
||||||
"$pkgbase-$pkgver.tar.gz.sig"
|
"$pkgname-$pkgver.tar.gz.sig"
|
||||||
|
#"https://ls.speedie.site/releases/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz"
|
||||||
|
#"https://ls.speedie.site/releases/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz.sig"
|
||||||
)
|
)
|
||||||
|
|
||||||
md5sums=(
|
md5sums=(
|
||||||
|
@ -49,19 +50,15 @@ sha256sums=(
|
||||||
'SKIP'
|
'SKIP'
|
||||||
)
|
)
|
||||||
|
|
||||||
package_spmenu() {
|
build(){
|
||||||
cd "$pkgbase-$pkgver"
|
cd $pkgname-$pkgver
|
||||||
|
mkdir -p build/
|
||||||
meson setup --reconfigure --prefix=${pkgdir}/usr build
|
meson setup --reconfigure --prefix=${pkgdir}/usr build
|
||||||
cd build/
|
ninja -C build
|
||||||
meson install
|
|
||||||
}
|
}
|
||||||
|
|
||||||
package_libspmenu() {
|
package() {
|
||||||
pkgdesc="C++ library for spmenu"
|
cd "$pkgname-$pkgver"
|
||||||
optdepends=()
|
|
||||||
|
|
||||||
cd "$pkgbase-$pkgver/src/libspmenu"
|
meson install -C build
|
||||||
meson setup --reconfigure --prefix=${pkgdir}/usr build
|
|
||||||
cd build/
|
|
||||||
meson install
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@ RDEPEND="
|
||||||
imlib2? ( media-libs/imlib2 )
|
imlib2? ( media-libs/imlib2 )
|
||||||
ssl? ( dev-libs/openssl )
|
ssl? ( dev-libs/openssl )
|
||||||
fribidi? ( dev-libs/fribidi )
|
fribidi? ( dev-libs/fribidi )
|
||||||
config? ( dev-libs/libconfig )
|
|
||||||
x11-libs/pango
|
x11-libs/pango
|
||||||
x11-libs/cairo
|
x11-libs/cairo
|
||||||
"
|
"
|
||||||
|
|
|
@ -142,9 +142,9 @@ print_desktop_list() {
|
||||||
mapfile -t it_display < "$DISPLAYFILE"
|
mapfile -t it_display < "$DISPLAYFILE"
|
||||||
mapfile -t it_only < "$ONLYFILE"
|
mapfile -t it_only < "$ONLYFILE"
|
||||||
mapfile -t it_comment < "$COMMENTFILE"
|
mapfile -t it_comment < "$COMMENTFILE"
|
||||||
|
# TODO test this code if it mimic old sorting behavior
|
||||||
d_print_array | \
|
d_print_array | \
|
||||||
sort -k 2 "${sort_args[@]}" | \
|
sort "${sort_args[@]}" | \
|
||||||
uniq "${uniq_args[@]}" | \
|
uniq "${uniq_args[@]}" | \
|
||||||
grep -vE "$HIDDEN_ENTRY_KEYWORDS" | \
|
grep -vE "$HIDDEN_ENTRY_KEYWORDS" | \
|
||||||
grep -E "$ENTRY_KEYWORDS"
|
grep -E "$ENTRY_KEYWORDS"
|
||||||
|
|
|
@ -11,20 +11,19 @@ wayland=${wayland:-true}
|
||||||
x11=${x11:-true}
|
x11=${x11:-true}
|
||||||
regex=${regex:-true}
|
regex=${regex:-true}
|
||||||
fifo=${fifo:-true}
|
fifo=${fifo:-true}
|
||||||
library=${library:-true}
|
|
||||||
|
|
||||||
prefix="${prefix:-/usr}"
|
prefix="${prefix:-/usr}"
|
||||||
|
|
||||||
reconfigure=${reconfigure:-true}
|
reconfigure=${reconfigure:-false}
|
||||||
static=${static:-false}
|
static=${static:-false}
|
||||||
|
|
||||||
clean() {
|
clean() {
|
||||||
clean_headers
|
clean_headers
|
||||||
rm -rf ./*.zst* ./*.tar* ./*.sig* *.PKGBUILD *.ebuild *.ebuild* build/ PKGBUILD
|
rm -rf ./*.zst* ./*.tar* ./*.sig* *.PKGBUILD *.ebuild *.ebuild* build/
|
||||||
}
|
}
|
||||||
|
|
||||||
check_correct_dir() {
|
check_correct_dir() {
|
||||||
[ ! -f "src/spmenu.c" ] && printf "Incorrect directory.\n" && exit 1
|
[ ! -f "spmenu.c" ] && printf "Incorrect directory.\n" && exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
gen_arg_list() {
|
gen_arg_list() {
|
||||||
|
@ -66,42 +65,42 @@ headers() {
|
||||||
wayland-scanner \
|
wayland-scanner \
|
||||||
client-header \
|
client-header \
|
||||||
protocols/wlr-layer-shell-unstable-v1.xml \
|
protocols/wlr-layer-shell-unstable-v1.xml \
|
||||||
src/wl/wlr-layer-shell-unstable-v1-client-protocol.h
|
libs/wl/wlr-layer-shell-unstable-v1-client-protocol.h
|
||||||
|
|
||||||
wayland-scanner \
|
wayland-scanner \
|
||||||
client-header \
|
client-header \
|
||||||
protocols/xdg-shell.xml \
|
protocols/xdg-shell.xml \
|
||||||
src/wl/xdg-shell-client-protocol.h
|
libs/wl/xdg-shell-client-protocol.h
|
||||||
|
|
||||||
wayland-scanner \
|
wayland-scanner \
|
||||||
client-header \
|
client-header \
|
||||||
protocols/xdg-output-unstable-v1.xml \
|
protocols/xdg-output-unstable-v1.xml \
|
||||||
src/wl/xdg-output-unstable-v1-client-protocol.h
|
libs/wl/xdg-output-unstable-v1-client-protocol.h
|
||||||
|
|
||||||
wayland-scanner \
|
wayland-scanner \
|
||||||
public-code \
|
public-code \
|
||||||
protocols/wlr-layer-shell-unstable-v1.xml \
|
protocols/wlr-layer-shell-unstable-v1.xml \
|
||||||
src/wl/wlr-layer-shell-unstable-v1-protocol.c
|
libs/wl/wlr-layer-shell-unstable-v1-protocol.c
|
||||||
|
|
||||||
wayland-scanner \
|
wayland-scanner \
|
||||||
public-code \
|
public-code \
|
||||||
protocols/xdg-shell.xml \
|
protocols/xdg-shell.xml \
|
||||||
src/wl/xdg-shell-protocol.c
|
libs/wl/xdg-shell-protocol.c
|
||||||
|
|
||||||
wayland-scanner \
|
wayland-scanner \
|
||||||
public-code \
|
public-code \
|
||||||
protocols/xdg-output-unstable-v1.xml \
|
protocols/xdg-output-unstable-v1.xml \
|
||||||
src/wl/xdg-output-unstable-v1-protocol.c
|
libs/wl/xdg-output-unstable-v1-protocol.c
|
||||||
}
|
}
|
||||||
|
|
||||||
clean_headers() {
|
clean_headers() {
|
||||||
rm -f \
|
rm -f \
|
||||||
src/wl/xdg-output-unstable-v1-protocol.c \
|
libs/wl/xdg-output-unstable-v1-protocol.c \
|
||||||
src/wl/xdg-shell-protocol.c \
|
libs/wl/xdg-shell-protocol.c \
|
||||||
src/wl/wlr-layer-shell-unstable-v1-protocol.c \
|
libs/wl/wlr-layer-shell-unstable-v1-protocol.c \
|
||||||
src/wl/xdg-output-unstable-v1-client-protocol.h \
|
libs/wl/xdg-output-unstable-v1-client-protocol.h \
|
||||||
src/wl/xdg-shell-client-protocol.h \
|
libs/wl/xdg-shell-client-protocol.h \
|
||||||
src/wl/wlr-layer-shell-unstable-v1-client-protocol.h
|
libs/wl/wlr-layer-shell-unstable-v1-client-protocol.h
|
||||||
}
|
}
|
||||||
|
|
||||||
gen_pkg() {
|
gen_pkg() {
|
||||||
|
@ -111,33 +110,25 @@ gen_pkg() {
|
||||||
rm -f spmenu spmenu-${version}.tar.gz spmenu-${version}.PKGBUILD *.o *zst*
|
rm -f spmenu spmenu-${version}.tar.gz spmenu-${version}.PKGBUILD *.o *zst*
|
||||||
mkdir -p spmenu-${version}
|
mkdir -p spmenu-${version}
|
||||||
cp -rf \
|
cp -rf \
|
||||||
LICENSE \
|
LICENSE \
|
||||||
meson.build \
|
meson.build \
|
||||||
meson_options.txt \
|
meson_options.txt \
|
||||||
spmenu.1 \
|
*.c \
|
||||||
spmenu_run.1 \
|
spmenu.1 \
|
||||||
spmenu_test.1 \
|
spmenu_run.1 \
|
||||||
scripts/ \
|
spmenu_test.1 \
|
||||||
docs/ \
|
scripts/ \
|
||||||
src/ \
|
docs/ \
|
||||||
protocols/ \
|
libs/ \
|
||||||
packaging \
|
protocols/ \
|
||||||
"spmenu-${version}"
|
packaging \
|
||||||
|
"spmenu-${version}"
|
||||||
tar -cf spmenu-${version}.tar spmenu-${version}
|
tar -cf spmenu-${version}.tar spmenu-${version}
|
||||||
gzip spmenu-${version}.tar
|
gzip spmenu-${version}.tar
|
||||||
rm -rf spmenu-${version}
|
rm -rf spmenu-${version}
|
||||||
|
|
||||||
USER="$(whoami)"
|
|
||||||
printf "Is your GPG key '$(whoami)'?\n"
|
|
||||||
select yn in "Yes" "No"; do
|
|
||||||
case $yn in
|
|
||||||
Yes) USER="$(whoami)"; break ;;
|
|
||||||
No) printf "\n> "; read -r USER; break ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -x "$(command -v gpg)" ]; then
|
if [ -x "$(command -v gpg)" ]; then
|
||||||
gpg --detach-sign --yes --local-user "${USER}" spmenu-${version}.tar.gz
|
gpg --detach-sign --yes --local-user $(whoami) spmenu-${version}.tar.gz
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -x "$(command -v md5sum)" ]; then
|
if [ -x "$(command -v md5sum)" ]; then
|
||||||
|
@ -153,20 +144,11 @@ gen_gentoo_pkg() {
|
||||||
[ "$(id -u)" = "0" ] && printf "Do not run as root.\n" && exit 1
|
[ "$(id -u)" = "0" ] && printf "Do not run as root.\n" && exit 1
|
||||||
version="$(grep "version : '" meson.build | awk '{ print $3 }' | sed "s/'\"//g; s/\"',//g")"
|
version="$(grep "version : '" meson.build | awk '{ print $3 }' | sed "s/'\"//g; s/\"',//g")"
|
||||||
|
|
||||||
USER="$(whoami)"
|
|
||||||
printf "Is your GPG key '$(whoami)'?\n"
|
|
||||||
select yn in "Yes" "No"; do
|
|
||||||
case $yn in
|
|
||||||
Yes) USER="$(whoami)"; break ;;
|
|
||||||
No) printf "\n> "; read -r USER; break ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -f "packaging/spmenu.ebuild" ]; then
|
if [ -f "packaging/spmenu.ebuild" ]; then
|
||||||
cp packaging/spmenu.ebuild spmenu-${version}.ebuild
|
cp packaging/spmenu.ebuild spmenu-${version}.ebuild
|
||||||
|
|
||||||
if [ -x "$(command -v gpg)" ]; then
|
if [ -x "$(command -v gpg)" ]; then
|
||||||
gpg --detach-sign --yes --local-user "${USER}" spmenu-${version}.ebuild
|
gpg --detach-sign --yes --local-user $(whoami) spmenu-${version}.ebuild
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -x "$(command -v md5sum)" ]; then
|
if [ -x "$(command -v md5sum)" ]; then
|
||||||
|
@ -177,27 +159,12 @@ gen_gentoo_pkg() {
|
||||||
sha256sum spmenu-${version}.ebuild | cut -d ' ' -f 1 > spmenu-${version}.ebuild.sha256
|
sha256sum spmenu-${version}.ebuild | cut -d ' ' -f 1 > spmenu-${version}.ebuild.sha256
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "packaging/libspmenu.ebuild" ] && [ "$library" != "false" ]; then
|
|
||||||
cp packaging/libspmenu.ebuild libspmenu-${version}.ebuild
|
|
||||||
|
|
||||||
if [ -x "$(command -v gpg)" ]; then
|
|
||||||
gpg --detach-sign --yes --local-user "${USER}" libspmenu-${version}.ebuild
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -x "$(command -v md5sum)" ]; then
|
|
||||||
md5sum libspmenu-${version}.ebuild | cut -d ' ' -f 1 > libspmenu-${version}.ebuild.md5
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -x "$(command -v sha256sum)" ]; then
|
|
||||||
sha256sum libspmenu-${version}.ebuild | cut -d ' ' -f 1 > libspmenu-${version}.ebuild.sha256
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gen_arch_pkg() {
|
gen_arch_pkg() {
|
||||||
[ "$(id -u)" = "0" ] && printf "Do not run as root.\n" && exit 1
|
[ "$(id -u)" = "0" ] && printf "Do not run as root.\n" && exit 1
|
||||||
[ ! -x "$(command -v makepkg)" ] && printf "makepkg required for this action.\n" && exit 1
|
[ ! -x "$(command -v makepkg)" ] && printf "makepkg required for this action.\n" && exit 1
|
||||||
|
[ -f "packaging/spmenu.PKGBUILD" ] || exit 1
|
||||||
|
|
||||||
rm -f PKGBUILD
|
rm -f PKGBUILD
|
||||||
|
|
||||||
|
@ -215,42 +182,36 @@ gen_arch_pkg() {
|
||||||
|
|
||||||
makepkg -sfr --sign || exit 1
|
makepkg -sfr --sign || exit 1
|
||||||
|
|
||||||
rm -rf pkg/ src/spmenu-${version}.tar.gz src/spmenu-${version}.tar.gz.sig src/spmenu-${version}
|
rm -rf src/ pkg/
|
||||||
|
|
||||||
mv PKGBUILD spmenu-${version}.PKGBUILD
|
mv PKGBUILD spmenu-${version}.PKGBUILD
|
||||||
|
|
||||||
# generate MD5 checksum
|
if [ -x "$(command -v md5sum)" ]; then
|
||||||
[ -x "$(command -v md5sum)" ] && \
|
|
||||||
md5sum spmenu-${version}-1-x86_64.pkg.tar.zst | cut -d ' ' -f 1 > spmenu-${version}-1-x86_64.pkg.tar.zst.md5
|
md5sum spmenu-${version}-1-x86_64.pkg.tar.zst | cut -d ' ' -f 1 > spmenu-${version}-1-x86_64.pkg.tar.zst.md5
|
||||||
[ -x "$(command -v md5sum)" ] && \
|
fi
|
||||||
md5sum libspmenu-${version}-1-x86_64.pkg.tar.zst | cut -d ' ' -f 1 > libspmenu-${version}-1-x86_64.pkg.tar.zst.md5
|
|
||||||
|
|
||||||
# generate SHA256 checksum
|
if [ -x "$(command -v sha256sum)" ]; then
|
||||||
[ -x "$(command -v sha256sum)" ] && \
|
|
||||||
sha256sum spmenu-${version}-1-x86_64.pkg.tar.zst | cut -d ' ' -f 1 > spmenu-${version}-1-x86_64.pkg.tar.zst.sha256
|
sha256sum spmenu-${version}-1-x86_64.pkg.tar.zst | cut -d ' ' -f 1 > spmenu-${version}-1-x86_64.pkg.tar.zst.sha256
|
||||||
[ -x "$(command -v sha256sum)" ] && \
|
fi
|
||||||
sha256sum libspmenu-${version}-1-x86_64.pkg.tar.zst | cut -d ' ' -f 1 > libspmenu-${version}-1-x86_64.pkg.tar.zst.sha256
|
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_theme() {
|
generate_theme() {
|
||||||
declare -a color
|
declare -a color
|
||||||
color=()
|
|
||||||
|
read_colors() {
|
||||||
i=1
|
i=1
|
||||||
|
color=()
|
||||||
|
|
||||||
[ ! -f "$1" ] && printf "File does not exist.\n" && exit 1
|
|
||||||
[ "$(grep -c "" "$1")" != "18" ] && printf "Color list is not 18 lines long.\n" && exit 1
|
|
||||||
|
|
||||||
# assign colors to variables
|
|
||||||
while true; do
|
while true; do
|
||||||
color[i]="$(sed -n ${i},${i}p $1)"
|
color[i]="$(sed -n ${i},${i}p $1)"
|
||||||
ccol="${color[i]}"
|
ccol="${color[i]}"
|
||||||
|
|
||||||
[ "${#ccol}" != "7" ] || [ "${ccol:0:1}" != "#" ] && color[i]="#000000"
|
[ "${#ccol}" != "7" ] || [ "${ccol:0:1}" != "#" ] && color[i]="#000000"
|
||||||
[ "$i" = "18" ] && break
|
[ "$i" = "18" ] && break
|
||||||
|
|
||||||
i=$((i+1))
|
i=$((i+1))
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
write_array() {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
/* spmenu colorscheme generated from ${1:-None} */
|
/* spmenu colorscheme generated from ${1:-None} */
|
||||||
theme = {
|
theme = {
|
||||||
|
@ -313,6 +274,13 @@ theme = {
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ ! -f "$1" ] && printf "File does not exist.\n" && exit 1
|
||||||
|
[ "$(grep -c "" "$1")" != "18" ] && printf "Color list is not 18 lines long.\n" && exit 1
|
||||||
|
|
||||||
|
read_colors "$1"
|
||||||
|
write_array "$1"
|
||||||
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
[ -x "buildconf" ] && [ ! -x "buildconf_dev" ] && source buildconf
|
[ -x "buildconf" ] && [ ! -x "buildconf_dev" ] && source buildconf
|
||||||
[ -x "buildconf_dev" ] && source buildconf_dev
|
[ -x "buildconf_dev" ] && source buildconf_dev
|
||||||
|
@ -325,6 +293,8 @@ build() {
|
||||||
|
|
||||||
mkdir -p build/
|
mkdir -p build/
|
||||||
|
|
||||||
|
chown -R $(whoami) build/ || exit 1
|
||||||
|
|
||||||
[ "$static" = "true" ] && STATIC="--prefer-static"
|
[ "$static" = "true" ] && STATIC="--prefer-static"
|
||||||
|
|
||||||
if [ "$reconfigure" = "true" ]; then
|
if [ "$reconfigure" = "true" ]; then
|
||||||
|
@ -361,13 +331,6 @@ build() {
|
||||||
|
|
||||||
[ "$cp_build" = "true" ] && cp meson.build meson.build.used
|
[ "$cp_build" = "true" ] && cp meson.build meson.build.used
|
||||||
mv -f meson.build.orig meson.build
|
mv -f meson.build.orig meson.build
|
||||||
|
|
||||||
if [ "$library" != "false" ]; then
|
|
||||||
cd src/libspmenu/ || exit 1
|
|
||||||
meson setup --prefix "$prefix" build || exit 1
|
|
||||||
ninja -C build
|
|
||||||
cd ../../ || exit 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install() {
|
install() {
|
||||||
|
@ -378,14 +341,6 @@ install() {
|
||||||
cd .. || exit 1
|
cd .. || exit 1
|
||||||
[ "$reconfigure" = "true" ] && rm -rf build/
|
[ "$reconfigure" = "true" ] && rm -rf build/
|
||||||
[ "$reconfigure" = "true" ] && clean_headers
|
[ "$reconfigure" = "true" ] && clean_headers
|
||||||
|
|
||||||
if [ "$library" != "false" ]; then
|
|
||||||
cd src/libspmenu/build/ || exit 1
|
|
||||||
meson install
|
|
||||||
cd ..
|
|
||||||
[ "$reconfigure" = "true" ] && rm -rf build/
|
|
||||||
cd ../../
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
help() {
|
help() {
|
||||||
|
@ -413,7 +368,7 @@ main() {
|
||||||
"dist") action="dist" ;;
|
"dist") action="dist" ;;
|
||||||
"arglist") action="arglist" ;;
|
"arglist") action="arglist" ;;
|
||||||
"pkg_arch") action="arch" ;;
|
"pkg_arch") action="arch" ;;
|
||||||
"pkg_gentoo") action="gentoo" ;;
|
"pkg_gentoo") action="gentoo" ;;
|
||||||
"help") action="help" ;;
|
"help") action="help" ;;
|
||||||
"install") action="install" ;;
|
"install") action="install" ;;
|
||||||
"theme") action="theme" ;;
|
"theme") action="theme" ;;
|
||||||
|
@ -435,7 +390,7 @@ main() {
|
||||||
"build") build ;;
|
"build") build ;;
|
||||||
"install") install ;;
|
"install") install ;;
|
||||||
"arch") gen_arch_pkg ;;
|
"arch") gen_arch_pkg ;;
|
||||||
"gentoo") gen_gentoo_pkg ;;
|
"gentoo") gen_gentoo_pkg ;;
|
||||||
"theme") generate_theme "$2" ;;
|
"theme") generate_theme "$2" ;;
|
||||||
"help") help ;;
|
"help") help ;;
|
||||||
"arglist") gen_arg_list ;;
|
"arglist") gen_arg_list ;;
|
||||||
|
|
17
spmenu.1
17
spmenu.1
|
@ -1,5 +1,5 @@
|
||||||
'\" t
|
'\" t
|
||||||
.\" Automatically generated by Pandoc 2.17.1.1
|
.\" Automatically generated by Pandoc 3.1.2
|
||||||
.\"
|
.\"
|
||||||
.\" Define V font for inline verbatim, using C font in formats
|
.\" Define V font for inline verbatim, using C font in formats
|
||||||
.\" that render this, and otherwise B font.
|
.\" that render this, and otherwise B font.
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
. ftr VB CB
|
. ftr VB CB
|
||||||
. ftr VBI CBI
|
. ftr VBI CBI
|
||||||
.\}
|
.\}
|
||||||
.TH "spmenu" "1" "" "3.5.0" "fancy dynamic menu"
|
.TH "spmenu" "1" "" "3.4" "fancy dynamic menu"
|
||||||
.hy
|
.hy
|
||||||
.SH spmenu
|
.SH spmenu
|
||||||
.PP
|
.PP
|
||||||
|
@ -311,9 +311,6 @@ Show prompt
|
||||||
\f[V]-sin, --show-input\f[R]
|
\f[V]-sin, --show-input\f[R]
|
||||||
Show input
|
Show input
|
||||||
.TP
|
.TP
|
||||||
\f[V]-spt, --show-pretext\f[R]
|
|
||||||
Show pretext
|
|
||||||
.TP
|
|
||||||
\f[V]-spl, --show-powerline\f[R]
|
\f[V]-spl, --show-powerline\f[R]
|
||||||
Show powerline
|
Show powerline
|
||||||
.TP
|
.TP
|
||||||
|
@ -405,12 +402,6 @@ Spawn spmenu as a window manager controlled client/window (X11 only)
|
||||||
Don\[cq]t spawn spmenu as a window manager controlled client/window (X11
|
Don\[cq]t spawn spmenu as a window manager controlled client/window (X11
|
||||||
only)
|
only)
|
||||||
.TP
|
.TP
|
||||||
\f[V]-gk, --grab-keyboard\f[R]
|
|
||||||
Grab keyboard on runtime
|
|
||||||
.TP
|
|
||||||
\f[V]-ngk, --no-grab-keyboard\f[R]
|
|
||||||
Grab keyboard on runtime
|
|
||||||
.TP
|
|
||||||
\f[V]-cf, --config-file file\f[R]
|
\f[V]-cf, --config-file file\f[R]
|
||||||
Set config file to load to file
|
Set config file to load to file
|
||||||
.TP
|
.TP
|
||||||
|
@ -650,6 +641,8 @@ Of course, more advanced regex can be used as well.
|
||||||
There are two modes.
|
There are two modes.
|
||||||
Normal mode and Insert mode.
|
Normal mode and Insert mode.
|
||||||
These modes are of course similar to Vim.
|
These modes are of course similar to Vim.
|
||||||
|
While modes are used by default, it is possible to move all keybinds to
|
||||||
|
Insert mode, restoring the original dmenu behavior.
|
||||||
.PP
|
.PP
|
||||||
Normal mode is the mode spmenu starts in unless a mode argument is
|
Normal mode is the mode spmenu starts in unless a mode argument is
|
||||||
specified or another mode is set in the configuration file.
|
specified or another mode is set in the configuration file.
|
||||||
|
@ -745,7 +738,7 @@ This allows something similar to the emoji highlight patch on the
|
||||||
suckless website, except even more useful.
|
suckless website, except even more useful.
|
||||||
.PP
|
.PP
|
||||||
Example:
|
Example:
|
||||||
\f[V]printf \[dq]\[rs]033[0;44m\[u1F600]\[rs]033[0m Emoji highlighting\[rs]n\[dq] | spmenu --columns 1\f[R]
|
\f[V]printf \[dq]\[rs]033[0;44m😀\[rs]033[0m Emoji highlighting\[rs]n\[dq] | spmenu --columns 1\f[R]
|
||||||
.PP
|
.PP
|
||||||
It should be noted that font sequences are not yet supported.
|
It should be noted that font sequences are not yet supported.
|
||||||
See `SGR sequences' for more information.
|
See `SGR sequences' for more information.
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "main.c"
|
#include "libs/main.c"
|
||||||
|
|
||||||
#include "draw/draw.h"
|
#include "libs/draw/draw.h"
|
||||||
|
|
||||||
#ifndef VERSION
|
#ifndef VERSION
|
||||||
#define VERSION "unknown"
|
#define VERSION "unknown"
|
||||||
|
@ -76,8 +76,6 @@ struct sp {
|
||||||
struct mo {
|
struct mo {
|
||||||
int output_width; // output width
|
int output_width; // output width
|
||||||
int output_height; // output height
|
int output_height; // output height
|
||||||
int output_xpos; // output x position
|
|
||||||
int output_ypos; // output y position
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if IMAGE
|
#if IMAGE
|
||||||
|
@ -174,28 +172,28 @@ static char **list;
|
||||||
static size_t listsize;
|
static size_t listsize;
|
||||||
|
|
||||||
// various headers
|
// various headers
|
||||||
#include "options.h"
|
#include "libs/options.h"
|
||||||
#include "draw.h"
|
#include "libs/draw.h"
|
||||||
#include "arg.h"
|
#include "libs/arg.h"
|
||||||
|
|
||||||
#include "x11/inc.h"
|
#include "libs/x11/inc.h"
|
||||||
#include "wl/inc.h"
|
#include "libs/wl/inc.h"
|
||||||
|
|
||||||
static char *fonts[] = { font };
|
static char *fonts[] = { font };
|
||||||
|
|
||||||
#include "img.c"
|
#include "libs/img.c"
|
||||||
#include "icon.c"
|
#include "libs/icon.c"
|
||||||
#include "rtl.c"
|
#include "libs/rtl.c"
|
||||||
#include "sort.c"
|
#include "libs/sort.c"
|
||||||
#include "match.c"
|
#include "libs/match.c"
|
||||||
#include "schemes.c"
|
#include "libs/schemes.c"
|
||||||
#include "stream.c"
|
#include "libs/stream.c"
|
||||||
#include "draw.c"
|
#include "libs/draw.c"
|
||||||
#include "conf/config.c"
|
#include "libs/conf/config.c"
|
||||||
#include "argv.c"
|
#include "libs/argv.c"
|
||||||
#include "history.c"
|
#include "libs/history.c"
|
||||||
#include "arg.c"
|
#include "libs/arg.c"
|
||||||
#include "fifo.c"
|
#include "libs/fifo.c"
|
||||||
|
|
||||||
#if X11
|
#if X11
|
||||||
static Key keys[] = {
|
static Key keys[] = {
|
||||||
|
@ -273,8 +271,8 @@ static WlMouse wl_buttons[] = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "x11/inc.c"
|
#include "libs/x11/inc.c"
|
||||||
#include "wl/inc.c"
|
#include "libs/wl/inc.c"
|
||||||
|
|
||||||
int is_selected(size_t index) {
|
int is_selected(size_t index) {
|
||||||
for (int i = 0; i < sel_size; i++) {
|
for (int i = 0; i < sel_size; i++) {
|
||||||
|
@ -550,17 +548,11 @@ void handle(void) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (fast && !isatty(0)) {
|
if (fast && !isatty(0)) {
|
||||||
if (grabkeyboard) {
|
grabkeyboard_x11();
|
||||||
grabkeyboard_x11();
|
|
||||||
}
|
|
||||||
|
|
||||||
readstdin();
|
readstdin();
|
||||||
} else {
|
} else {
|
||||||
readstdin();
|
readstdin();
|
||||||
|
grabkeyboard_x11();
|
||||||
if (grabkeyboard) {
|
|
||||||
grabkeyboard_x11();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_mode();
|
set_mode();
|
|
@ -1,4 +1,4 @@
|
||||||
.\" Automatically generated by Pandoc 2.17.1.1
|
.\" Automatically generated by Pandoc 3.1.2
|
||||||
.\"
|
.\"
|
||||||
.\" Define V font for inline verbatim, using C font in formats
|
.\" Define V font for inline verbatim, using C font in formats
|
||||||
.\" that render this, and otherwise B font.
|
.\" that render this, and otherwise B font.
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
. ftr VB CB
|
. ftr VB CB
|
||||||
. ftr VBI CBI
|
. ftr VBI CBI
|
||||||
.\}
|
.\}
|
||||||
.TH "spmenu_run" "1" "" "3.5.0" "$PATH/.desktop launcher and file manager"
|
.TH "spmenu_run" "1" "" "3.4" "$PATH/.desktop launcher and file manager"
|
||||||
.hy
|
.hy
|
||||||
.SH spmenu_run
|
.SH spmenu_run
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.\" Automatically generated by Pandoc 2.17.1.1
|
.\" Automatically generated by Pandoc 3.1.2
|
||||||
.\"
|
.\"
|
||||||
.\" Define V font for inline verbatim, using C font in formats
|
.\" Define V font for inline verbatim, using C font in formats
|
||||||
.\" that render this, and otherwise B font.
|
.\" that render this, and otherwise B font.
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
. ftr VB CB
|
. ftr VB CB
|
||||||
. ftr VBI CBI
|
. ftr VBI CBI
|
||||||
.\}
|
.\}
|
||||||
.TH "spmenu_test" "1" "" "3.5.0" "spmenu test script"
|
.TH "spmenu_test" "1" "" "3.4" "spmenu test script"
|
||||||
.hy
|
.hy
|
||||||
.SH spmenu_test
|
.SH spmenu_test
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -1,231 +0,0 @@
|
||||||
/* libspmenu
|
|
||||||
* spmenu C++ library
|
|
||||||
*
|
|
||||||
* See LICENSE file for copyright and license details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <sstream>
|
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
#include <array>
|
|
||||||
#include <cstring>
|
|
||||||
#include "libspmenu.h"
|
|
||||||
|
|
||||||
std::string spmenu::addArgument(std::string Argument, std::string Value) {
|
|
||||||
return " " + Argument + " \"" + Value + "\"";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string spmenu::addArgument(std::string enabledArgument, std::string disabledArgument, std::string Value) {
|
|
||||||
if (disabledArgument.empty() || enabledArgument.empty()) {
|
|
||||||
return "";
|
|
||||||
} else if (Value.compare("True") && Value.compare("true") && Value.compare("False") && Value.compare("false") && Value.compare("0") && Value.compare("1")) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return " " + ((!Value.compare("True") || !Value.compare("true") || !Value.compare("1")) ? enabledArgument : disabledArgument);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string spmenu::generateArguments(spmenu::spmenuSettings *settings) {
|
|
||||||
std::string argList;
|
|
||||||
|
|
||||||
argList += (settings->promptText.empty()) ? "" : (spmenu::addArgument("--prompt", settings->promptText));
|
|
||||||
argList += (settings->preText.empty()) ? "" : (spmenu::addArgument("--pretext", settings->preText));
|
|
||||||
argList += (settings->inputText.empty()) ? "" : (spmenu::addArgument("--input", settings->inputText));
|
|
||||||
argList += (settings->normalModeText.empty()) ? "" : (spmenu::addArgument("--normal-mode-text", settings->normalModeText));
|
|
||||||
argList += (settings->insertModeText.empty()) ? "" : (spmenu::addArgument("--insert-mode-text", settings->insertModeText));
|
|
||||||
argList += (settings->capsLockOnText.empty()) ? "" : (spmenu::addArgument("--caps-lock-on-text", settings->capsLockOnText));
|
|
||||||
argList += (settings->capsLockOffText.empty()) ? "" : (spmenu::addArgument("--caps-lock-off-text", settings->capsLockOffText));
|
|
||||||
argList += (settings->leftArrowText.empty()) ? "" : (spmenu::addArgument("--left-arrow-symbol", settings->leftArrowText));
|
|
||||||
argList += (settings->rightArrowText.empty()) ? "" : (spmenu::addArgument("--right-arrow-symbol", settings->rightArrowText));
|
|
||||||
argList += (settings->lineHeight.empty()) ? "" : (spmenu::addArgument("--line-height", settings->lineHeight));
|
|
||||||
argList += (settings->centerWidth.empty()) ? "" : (spmenu::addArgument("--center-width", settings->centerWidth));
|
|
||||||
argList += (settings->Lines.empty()) ? "" : (spmenu::addArgument("--lines", settings->Lines));
|
|
||||||
argList += (settings->Columns.empty()) ? "" : (spmenu::addArgument("--columns", settings->Columns));
|
|
||||||
argList += (settings->minLines.empty()) ? "" : (spmenu::addArgument("--min-lines", settings->minLines));
|
|
||||||
argList += spmenu::addArgument("--generate-cache", "--no-generate-cache", settings->generateCache);
|
|
||||||
argList += (settings->maxCache.empty()) ? "" : (spmenu::addArgument("--max-cache", settings->maxCache));
|
|
||||||
argList += (settings->cacheDir.empty()) ? "" : (spmenu::addArgument("--cache-dir", settings->cacheDir));
|
|
||||||
argList += spmenu::addArgument("--print-index", "--no-print-index", settings->printIndex);
|
|
||||||
argList += spmenu::addArgument("--fast", "", settings->Fast);
|
|
||||||
argList += spmenu::addArgument("--incremental", "--no-incremental", settings->Incremental);
|
|
||||||
argList += spmenu::addArgument("--require-match", "--no-require-match", settings->requireMatch);
|
|
||||||
argList += spmenu::addArgument("--mark-items", "--no-mark-items", settings->markItems);
|
|
||||||
argList += spmenu::addArgument("--fuzzy", "--no-fuzzy", settings->Fuzzy);
|
|
||||||
argList += spmenu::addArgument("--regex", "--no-regex", settings->Regex);
|
|
||||||
argList += spmenu::addArgument("--password", "--no-password", settings->Password);
|
|
||||||
argList += spmenu::addArgument("--indent", "--no-indent", settings->Indent);
|
|
||||||
argList += spmenu::addArgument("--color-items", "--no-color-items", settings->colorItems);
|
|
||||||
argList += spmenu::addArgument("--sgr", "--no-sgr", settings->Sgr);
|
|
||||||
argList += spmenu::addArgument("--alpha", "--no-alpha", settings->Alpha);
|
|
||||||
argList += spmenu::addArgument("--allow-typing", "--no-allow-typing", settings->allowTyping);
|
|
||||||
argList += spmenu::addArgument("--override-lines", "--no-override-lines", settings->allowOverrideLines);
|
|
||||||
argList += spmenu::addArgument("--override-columns", "--no-override-columns", settings->allowOverrideColumns);
|
|
||||||
argList += (settings->X.empty()) ? "" : (spmenu::addArgument("--x-position", settings->X));
|
|
||||||
argList += (settings->Y.empty()) ? "" : (spmenu::addArgument("--y-position", settings->Y));
|
|
||||||
argList += (settings->W.empty()) ? "" : (spmenu::addArgument("--width", settings->W));
|
|
||||||
argList += (settings->H.empty()) ? "" : (spmenu::addArgument("--min-lines", settings->H));
|
|
||||||
argList += (settings->Preselect.empty()) ? "" : (spmenu::addArgument("--preselect", settings->Preselect));
|
|
||||||
argList += (settings->borderWidth.empty()) ? "" : (spmenu::addArgument("--border-width", settings->borderWidth));
|
|
||||||
argList += spmenu::addArgument("--sort", "--no-sort", settings->Sort);
|
|
||||||
argList += (settings->Priority.empty()) ? "" : (spmenu::addArgument("--priority", settings->Priority));
|
|
||||||
argList += spmenu::addArgument("--case-sensitive", "--case-insensitive", settings->caseSensitive);
|
|
||||||
argList += spmenu::addArgument("--normal", "--insert", settings->defaultMode);
|
|
||||||
argList += spmenu::addArgument("--hide-mode", "--show-mode", settings->hideMode);
|
|
||||||
argList += spmenu::addArgument("--hide-match-count", "--show-match-count", settings->hideMatchCount);
|
|
||||||
argList += spmenu::addArgument("--hide-left-arrow", "--show-left-arrow", settings->hideLeftArrow);
|
|
||||||
argList += spmenu::addArgument("--hide-right-arrow", "--show-right-arrow", settings->hideRightArrow);
|
|
||||||
argList += spmenu::addArgument("--hide-item", "--show-item", settings->hideItem);
|
|
||||||
argList += spmenu::addArgument("--hide-prompt", "--show-prompt", settings->hidePrompt);
|
|
||||||
argList += spmenu::addArgument("--hide-pretext", "--show-pretext", settings->hidePretext);
|
|
||||||
argList += spmenu::addArgument("--hide-input", "--show-input", settings->hideInput);
|
|
||||||
argList += spmenu::addArgument("--hide-powerline", "--show-powerline", settings->hidePowerline);
|
|
||||||
argList += spmenu::addArgument("--hide-caret", "--show-caret", settings->hideCaret);
|
|
||||||
argList += spmenu::addArgument("--hide-highlighting", "--show-highlighting", settings->hideHighlighting);
|
|
||||||
argList += spmenu::addArgument("--hide-image", "--show-image", settings->hideImage);
|
|
||||||
argList += spmenu::addArgument("--hide-caps", "--show-caps", settings->hideCaps);
|
|
||||||
argList += spmenu::addArgument("--xrdb", "--no-xrdb", settings->Xrdb);
|
|
||||||
argList += (settings->Monitor.empty()) ? "" : (spmenu::addArgument("--monitor", settings->Monitor));
|
|
||||||
argList += (settings->Embed.empty()) ? "" : (spmenu::addArgument("--embed", settings->Embed));
|
|
||||||
argList += (settings->histFile.empty()) ? "" : (spmenu::addArgument("--hist-file", settings->histFile));
|
|
||||||
argList += (settings->listFile.empty()) ? "" : (spmenu::addArgument("--list-file", settings->listFile));
|
|
||||||
argList += (settings->configFile.empty()) ? "" : (spmenu::addArgument("--config-file", settings->configFile));
|
|
||||||
argList += (settings->bindsFile.empty()) ? "" : (spmenu::addArgument("--bind-file", settings->bindsFile));
|
|
||||||
argList += (settings->themeFile.empty()) ? "" : (spmenu::addArgument("--theme-file", settings->themeFile));
|
|
||||||
argList += (settings->imageGaps.empty()) ? "" : (spmenu::addArgument("--image-gaps", settings->imageGaps));
|
|
||||||
argList += (settings->imageSize.empty()) ? "" : (spmenu::addArgument("--image-size", settings->imageSize));
|
|
||||||
argList += spmenu::addArgument("--display-image", "--display-icons", settings->imageType);
|
|
||||||
argList += spmenu::addArgument("--image-resize", "--no-image-resize", settings->imageResize);
|
|
||||||
argList += (settings->textPadding.empty()) ? "" : (spmenu::addArgument("--text-padding", settings->textPadding));
|
|
||||||
argList += (settings->verticalPadding.empty()) ? "" : (spmenu::addArgument("--vertical-padding", settings->verticalPadding));
|
|
||||||
argList += (settings->horizontalPadding.empty()) ? "" : (spmenu::addArgument("--horizontal-padding", settings->horizontalPadding));
|
|
||||||
argList += (settings->verticalMargin.empty()) ? "" : (spmenu::addArgument("--vertical-margin", settings->verticalMargin));
|
|
||||||
argList += (settings->horizontalMargin.empty()) ? "" : (spmenu::addArgument("--horizontal-margin", settings->horizontalMargin));
|
|
||||||
argList += spmenu::addArgument("--managed", "--unmanaged", settings->Managed);
|
|
||||||
argList += spmenu::addArgument("--wayland", "-x11", settings->displayProtocol);
|
|
||||||
argList += spmenu::addArgument("--load-config", "--no-load-config", settings->loadConfig);
|
|
||||||
argList += spmenu::addArgument("--load-binds", "--no-load-binds", settings->loadBinds);
|
|
||||||
argList += spmenu::addArgument("--load-theme", "--no-load-theme", settings->loadTheme);
|
|
||||||
argList += (settings->Font.empty()) ? "" : (spmenu::addArgument("--font", settings->Font));
|
|
||||||
argList += (settings->normalItemForegroundColor.empty()) ? "" : (spmenu::addArgument("--normal-item-foreground", settings->normalItemForegroundColor));
|
|
||||||
argList += (settings->normalItemBackgroundColor.empty()) ? "" : (spmenu::addArgument("--normal-item-background", settings->normalItemBackgroundColor));
|
|
||||||
argList += (settings->selectedItemForegroundColor.empty()) ? "" : (spmenu::addArgument("--selected-item-foreground", settings->selectedItemForegroundColor));
|
|
||||||
argList += (settings->selectedItemBackgroundColor.empty()) ? "" : (spmenu::addArgument("--selected-item-background", settings->selectedItemBackgroundColor));
|
|
||||||
argList += (settings->normalNextItemForegroundColor.empty()) ? "" : (spmenu::addArgument("--normal-next-item-foreground", settings->normalNextItemForegroundColor));
|
|
||||||
argList += (settings->normalNextItemBackgroundColor.empty()) ? "" : (spmenu::addArgument("--normal-next-item-background", settings->normalNextItemBackgroundColor));
|
|
||||||
argList += (settings->normalItemPriorityForegroundColor.empty()) ? "" : (spmenu::addArgument("--normal-item-priority-foreground", settings->normalItemPriorityForegroundColor));
|
|
||||||
argList += (settings->normalItemPriorityBackgroundColor.empty()) ? "" : (spmenu::addArgument("--normal-item-priority-background", settings->normalItemPriorityBackgroundColor));
|
|
||||||
argList += (settings->selectedItemPriorityForegroundColor.empty()) ? "" : (spmenu::addArgument("--selected-item-priority-foreground", settings->selectedItemPriorityForegroundColor));
|
|
||||||
argList += (settings->selectedItemPriorityBackgroundColor.empty()) ? "" : (spmenu::addArgument("--selected-item-priority-background", settings->selectedItemPriorityBackgroundColor));
|
|
||||||
argList += (settings->promptForegroundColor.empty()) ? "" : (spmenu::addArgument("--prompt-foreground", settings->promptForegroundColor));
|
|
||||||
argList += (settings->promptBackgroundColor.empty()) ? "" : (spmenu::addArgument("--prompt-background", settings->promptBackgroundColor));
|
|
||||||
argList += (settings->inputForegroundColor.empty()) ? "" : (spmenu::addArgument("--input-foreground", settings->inputForegroundColor));
|
|
||||||
argList += (settings->inputBackgroundColor.empty()) ? "" : (spmenu::addArgument("--input-background", settings->inputBackgroundColor));
|
|
||||||
argList += (settings->preTextForegroundColor.empty()) ? "" : (spmenu::addArgument("--preText-foreground", settings->preTextForegroundColor));
|
|
||||||
argList += (settings->preTextBackgroundColor.empty()) ? "" : (spmenu::addArgument("--preText-background", settings->preTextBackgroundColor));
|
|
||||||
argList += (settings->windowColor.empty()) ? "" : (spmenu::addArgument("--menu-background", settings->windowColor));
|
|
||||||
argList += (settings->normalHighlightForegroundColor.empty()) ? "" : (spmenu::addArgument("--normal-highlight-foreground", settings->normalHighlightForegroundColor));
|
|
||||||
argList += (settings->normalHighlightBackgroundColor.empty()) ? "" : (spmenu::addArgument("--normal-highlight-background", settings->normalHighlightBackgroundColor));
|
|
||||||
argList += (settings->selectedHighlightForegroundColor.empty()) ? "" : (spmenu::addArgument("--selected-highlight-foreground", settings->selectedHighlightForegroundColor));
|
|
||||||
argList += (settings->selectedHighlightBackgroundColor.empty()) ? "" : (spmenu::addArgument("--selected-highlight-background", settings->selectedHighlightBackgroundColor));
|
|
||||||
argList += (settings->numberForegroundColor.empty()) ? "" : (spmenu::addArgument("--number-foreground", settings->numberForegroundColor));
|
|
||||||
argList += (settings->numberBackgroundColor.empty()) ? "" : (spmenu::addArgument("--number-background", settings->numberBackgroundColor));
|
|
||||||
argList += (settings->modeForegroundColor.empty()) ? "" : (spmenu::addArgument("--mode-foreground", settings->modeForegroundColor));
|
|
||||||
argList += (settings->modeBackgroundColor.empty()) ? "" : (spmenu::addArgument("--mode-background", settings->modeBackgroundColor));
|
|
||||||
argList += (settings->leftArrowForegroundColor.empty()) ? "" : (spmenu::addArgument("--left-arrow-foreground", settings->leftArrowForegroundColor));
|
|
||||||
argList += (settings->leftArrowBackgroundColor.empty()) ? "" : (spmenu::addArgument("--left-arrow-background", settings->leftArrowBackgroundColor));
|
|
||||||
argList += (settings->rightArrowForegroundColor.empty()) ? "" : (spmenu::addArgument("--right-arrow-foreground", settings->rightArrowForegroundColor));
|
|
||||||
argList += (settings->rightArrowBackgroundColor.empty()) ? "" : (spmenu::addArgument("--right-arrow-background", settings->rightArrowBackgroundColor));
|
|
||||||
argList += (settings->caretForegroundColor.empty()) ? "" : (spmenu::addArgument("--caret-foreground", settings->caretForegroundColor));
|
|
||||||
argList += (settings->caretBackgroundColor.empty()) ? "" : (spmenu::addArgument("--caret-background", settings->caretBackgroundColor));
|
|
||||||
argList += (settings->borderColor.empty()) ? "" : (spmenu::addArgument("--border-background", settings->borderColor));
|
|
||||||
argList += (settings->sgr0Color.empty()) ? "" : (spmenu::addArgument("--sgr0", settings->sgr0Color));
|
|
||||||
argList += (settings->sgr1Color.empty()) ? "" : (spmenu::addArgument("--sgr1", settings->sgr1Color));
|
|
||||||
argList += (settings->sgr2Color.empty()) ? "" : (spmenu::addArgument("--sgr2", settings->sgr2Color));
|
|
||||||
argList += (settings->sgr3Color.empty()) ? "" : (spmenu::addArgument("--sgr3", settings->sgr3Color));
|
|
||||||
argList += (settings->sgr4Color.empty()) ? "" : (spmenu::addArgument("--sgr4", settings->sgr4Color));
|
|
||||||
argList += (settings->sgr5Color.empty()) ? "" : (spmenu::addArgument("--sgr5", settings->sgr5Color));
|
|
||||||
argList += (settings->sgr6Color.empty()) ? "" : (spmenu::addArgument("--sgr6", settings->sgr6Color));
|
|
||||||
argList += (settings->sgr7Color.empty()) ? "" : (spmenu::addArgument("--sgr7", settings->sgr7Color));
|
|
||||||
argList += (settings->sgr8Color.empty()) ? "" : (spmenu::addArgument("--sgr8", settings->sgr8Color));
|
|
||||||
argList += (settings->sgr9Color.empty()) ? "" : (spmenu::addArgument("--sgr9", settings->sgr9Color));
|
|
||||||
argList += (settings->sgr10Color.empty()) ? "" : (spmenu::addArgument("--sgr10", settings->sgr10Color));
|
|
||||||
argList += (settings->sgr11Color.empty()) ? "" : (spmenu::addArgument("--sgr11", settings->sgr11Color));
|
|
||||||
argList += (settings->sgr12Color.empty()) ? "" : (spmenu::addArgument("--sgr12", settings->sgr12Color));
|
|
||||||
argList += (settings->sgr13Color.empty()) ? "" : (spmenu::addArgument("--sgr13", settings->sgr13Color));
|
|
||||||
argList += (settings->sgr14Color.empty()) ? "" : (spmenu::addArgument("--sgr14", settings->sgr14Color));
|
|
||||||
argList += (settings->sgr15Color.empty()) ? "" : (spmenu::addArgument("--sgr15", settings->sgr15Color));
|
|
||||||
|
|
||||||
if (!settings->windowPosition.empty()) {
|
|
||||||
std::string argument = "";
|
|
||||||
if (!settings->windowPosition.compare("Top")) {
|
|
||||||
argument = "--top";
|
|
||||||
} else if (!settings->windowPosition.compare("Bottom")) {
|
|
||||||
argument = "--bottom";
|
|
||||||
} else if (!settings->windowPosition.compare("Center")) {
|
|
||||||
argument = "--center";
|
|
||||||
}
|
|
||||||
|
|
||||||
argList += " " + argument;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!settings->itemPosition.empty()) {
|
|
||||||
std::string argument = "";
|
|
||||||
if (!settings->itemPosition.compare("Top")) {
|
|
||||||
argument = "--item-top";
|
|
||||||
} else if (!settings->itemPosition.compare("Bottom")) {
|
|
||||||
argument = "--item-bottom";
|
|
||||||
}
|
|
||||||
|
|
||||||
argList += " " + argument;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!settings->imagePosition.empty()) {
|
|
||||||
std::string argument = "";
|
|
||||||
if (!settings->imagePosition.compare("Top")) {
|
|
||||||
argument = "--image-top";
|
|
||||||
} else if (!settings->imagePosition.compare("Bottom")) {
|
|
||||||
argument = "--image-bottom";
|
|
||||||
} else if (!settings->imagePosition.compare("Center")) {
|
|
||||||
argument = "--image-center";
|
|
||||||
} else if (!settings->imagePosition.compare("Top Center")) {
|
|
||||||
argument = "--image-topcenter";
|
|
||||||
}
|
|
||||||
|
|
||||||
argList += " " + argument;
|
|
||||||
}
|
|
||||||
|
|
||||||
return argList;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string spmenu::Run(spmenu::spmenuSettings *settings) {
|
|
||||||
const int bufferSize{ sizeof(settings->standardInput) };
|
|
||||||
std::ostringstream command;
|
|
||||||
std::string ret;
|
|
||||||
std::array<char, bufferSize> buf;
|
|
||||||
|
|
||||||
std::string Arguments;
|
|
||||||
|
|
||||||
Arguments = spmenu::generateArguments(settings);
|
|
||||||
|
|
||||||
command << "printf \"" << settings->standardInput << "\" | spmenu " << Arguments << " " << settings->userArguments;
|
|
||||||
|
|
||||||
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(command.str().c_str(), "r"), pclose);
|
|
||||||
|
|
||||||
if (!pipe) {
|
|
||||||
std::cerr << "Failed to popen()\n";
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (fgets(buf.data(), buf.size(), pipe.get()) != NULL) {
|
|
||||||
size_t len = strlen(buf.data());
|
|
||||||
|
|
||||||
if (len > 0 && buf[len - 1] == '\n') {
|
|
||||||
ret += std::string(buf.data(), len - 1);
|
|
||||||
} else {
|
|
||||||
ret += buf.data();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
|
@ -1,152 +0,0 @@
|
||||||
#ifndef LIBSPMENU_HPP
|
|
||||||
#define LIBSPMENU_HPP
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
namespace spmenu {
|
|
||||||
using Integer = std::string;
|
|
||||||
using String = std::string;
|
|
||||||
using Bool = std::string;
|
|
||||||
class spmenuSettings {
|
|
||||||
public:
|
|
||||||
String userArguments{};
|
|
||||||
String standardInput{};
|
|
||||||
|
|
||||||
String promptText{}; // -p
|
|
||||||
String preText{}; // -pt
|
|
||||||
String inputText{}; // -It
|
|
||||||
String normalModeText{}; // -nmt
|
|
||||||
String insertModeText{}; // -imt
|
|
||||||
String capsLockOnText{}; // -clon
|
|
||||||
String capsLockOffText{}; // -clof
|
|
||||||
String leftArrowText{}; // -la
|
|
||||||
String rightArrowText{}; // -ra
|
|
||||||
Integer lineHeight; // -mh
|
|
||||||
Integer centerWidth; // -cw
|
|
||||||
Integer Lines; // -l
|
|
||||||
Integer Columns; // -g
|
|
||||||
Integer minLines; // -ml
|
|
||||||
Bool generateCache; // -gc, -ngc
|
|
||||||
Integer maxCache; // -mc
|
|
||||||
String cacheDir{}; // -cd
|
|
||||||
Bool printIndex; // -ix, -nix
|
|
||||||
Bool Fast; // -f
|
|
||||||
Bool Incremental; // -r, -nr
|
|
||||||
Bool requireMatch; // -rm, -nrm
|
|
||||||
Bool markItems; // -ma, -nma
|
|
||||||
Bool Fuzzy; // -F, -NF
|
|
||||||
Bool Regex; // -R, -NR
|
|
||||||
Bool Password; // -P, -nP
|
|
||||||
Bool Indent; // -ip, -nip
|
|
||||||
Bool colorItems; // -ci, -nci
|
|
||||||
Bool Sgr; // -sgr, -nsgr
|
|
||||||
Bool Alpha; // -a, -na
|
|
||||||
Bool allowTyping; // -tp, -nt
|
|
||||||
Bool allowOverrideLines; // -ol, -nol
|
|
||||||
Bool allowOverrideColumns; // -oc, -noc
|
|
||||||
Integer X; // -x
|
|
||||||
Integer Y; // -y
|
|
||||||
Integer W; // -z
|
|
||||||
Integer H; // -ml
|
|
||||||
Integer Preselect; // -n
|
|
||||||
Integer borderWidth; // -bw
|
|
||||||
Bool Sort; // -so, -nso
|
|
||||||
String Priority{}; // -pri
|
|
||||||
Bool caseSensitive; // -s, -ns
|
|
||||||
Bool defaultMode; // -nm, -im
|
|
||||||
Integer windowPosition; // -t, -b, -c
|
|
||||||
Integer itemPosition; // -itt, -itb
|
|
||||||
Integer imagePosition; // -it, -ib, -ic, -itc
|
|
||||||
Bool hideMode; // -hm
|
|
||||||
Bool hideMatchCount; // -hmc
|
|
||||||
Bool hideLeftArrow; // -hla
|
|
||||||
Bool hideRightArrow; // -hra
|
|
||||||
Bool hideItem; // -hit
|
|
||||||
Bool hidePrompt; // -hpr
|
|
||||||
Bool hidePretext; // -hpt
|
|
||||||
Bool hideInput; // -hip
|
|
||||||
Bool hidePowerline; // -hpl
|
|
||||||
Bool hideCaret; // -hc
|
|
||||||
Bool hideHighlighting; // -hhl
|
|
||||||
Bool hideImage; // -hi
|
|
||||||
Bool hideCaps; // -hcl
|
|
||||||
Bool Xrdb; // -xrdb, -nxrdb
|
|
||||||
Integer Monitor; // -m
|
|
||||||
Integer Embed; // -w
|
|
||||||
String histFile{}; // -H
|
|
||||||
String listFile{}; // -lf
|
|
||||||
String configFile{}; // -cf
|
|
||||||
String bindsFile{}; // -bf
|
|
||||||
String themeFile{}; // -tm
|
|
||||||
Integer imageGaps; // -ig
|
|
||||||
Integer imageSize; // -is
|
|
||||||
Bool imageType; // -di, -df
|
|
||||||
Bool imageResize; // -ir, -nir
|
|
||||||
Integer textPadding; // -txp
|
|
||||||
Integer verticalPadding; // -lp
|
|
||||||
Integer horizontalPadding; // -hp
|
|
||||||
Integer verticalMargin; // -vem
|
|
||||||
Integer horizontalMargin; // -hom
|
|
||||||
Bool Managed; // -wm, -nwm
|
|
||||||
Bool displayProtocol; // -x11, -wl
|
|
||||||
Bool loadConfig; // -lcfg, -ncfg
|
|
||||||
Bool loadBinds; // -lbi, -nlbi
|
|
||||||
Bool loadTheme; // -ltm, -nltm
|
|
||||||
String Font; // -fn
|
|
||||||
String normalItemForegroundColor{}; // -nif
|
|
||||||
String normalItemBackgroundColor{}; // -nib
|
|
||||||
String normalNextItemForegroundColor{}; // -nnif
|
|
||||||
String normalNextItemBackgroundColor{}; // -nnib
|
|
||||||
String selectedItemForegroundColor{}; // -sif
|
|
||||||
String selectedItemBackgroundColor{}; // -sib
|
|
||||||
String normalItemPriorityForegroundColor{}; // -npf
|
|
||||||
String normalItemPriorityBackgroundColor{}; // -npb
|
|
||||||
String selectedItemPriorityForegroundColor{}; // -spf
|
|
||||||
String selectedItemPriorityBackgroundColor{}; // -spb
|
|
||||||
String promptForegroundColor{}; // -pfg
|
|
||||||
String promptBackgroundColor{}; // -pbg
|
|
||||||
String inputForegroundColor{}; // -ifg
|
|
||||||
String inputBackgroundColor{}; // -ibg
|
|
||||||
String preTextForegroundColor{}; // -ptfg
|
|
||||||
String preTextBackgroundColor{}; // -ptbg
|
|
||||||
String windowColor{}; // -mnbg
|
|
||||||
String normalHighlightForegroundColor{}; // -nhf
|
|
||||||
String normalHighlightBackgroundColor{}; // -nhb
|
|
||||||
String selectedHighlightForegroundColor{}; // -shf
|
|
||||||
String selectedHighlightBackgroundColor{}; // -shb
|
|
||||||
String numberForegroundColor{}; // -nfg
|
|
||||||
String numberBackgroundColor{}; // -nbg
|
|
||||||
String modeForegroundColor{}; // -mfg
|
|
||||||
String modeBackgroundColor{}; // -mbg
|
|
||||||
String leftArrowForegroundColor{}; // -laf
|
|
||||||
String leftArrowBackgroundColor{}; // -lab
|
|
||||||
String rightArrowForegroundColor{}; // -raf
|
|
||||||
String rightArrowBackgroundColor{}; // -rab
|
|
||||||
String caretForegroundColor{}; // -cfc
|
|
||||||
String caretBackgroundColor{}; // -cbg
|
|
||||||
String borderColor{}; // -bc
|
|
||||||
String sgr0Color{}; // -sgr0
|
|
||||||
String sgr1Color{}; // -sgr1
|
|
||||||
String sgr2Color{}; // -sgr2
|
|
||||||
String sgr3Color{}; // -sgr3
|
|
||||||
String sgr4Color{}; // -sgr4
|
|
||||||
String sgr5Color{}; // -sgr5
|
|
||||||
String sgr6Color{}; // -sgr6
|
|
||||||
String sgr7Color{}; // -sgr7
|
|
||||||
String sgr8Color{}; // -sgr8
|
|
||||||
String sgr9Color{}; // -sgr9
|
|
||||||
String sgr10Color{}; // -sgr10
|
|
||||||
String sgr11Color{}; // -sgr11
|
|
||||||
String sgr12Color{}; // -sgr12
|
|
||||||
String sgr13Color{}; // -sgr13
|
|
||||||
String sgr14Color{}; // -sgr14
|
|
||||||
String sgr15Color{}; // -sgr15
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string Run(spmenuSettings *settings);
|
|
||||||
std::string generateArguments(spmenuSettings *settings);
|
|
||||||
std::string addArgument(std::string Argument, std::string Value);
|
|
||||||
std::string addArgument(std::string enabledArgument, std::string disabledArgument, std::string Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,19 +0,0 @@
|
||||||
# libspmenu
|
|
||||||
project('spmenu', 'cpp', version : '3.4')
|
|
||||||
cc = meson.get_compiler('cpp')
|
|
||||||
|
|
||||||
project_source_files = [
|
|
||||||
'libspmenu.cpp',
|
|
||||||
]
|
|
||||||
|
|
||||||
project_dependencies = [
|
|
||||||
]
|
|
||||||
|
|
||||||
build_args = [
|
|
||||||
'-DVERSION=' + meson.project_version(),
|
|
||||||
]
|
|
||||||
|
|
||||||
so_version = meson.project_version()
|
|
||||||
|
|
||||||
install_headers('libspmenu.h', subdir : 'libspmenu')
|
|
||||||
lib_shared = shared_library('spmenu', project_source_files, version : so_version, install : true)
|
|
|
@ -1,14 +0,0 @@
|
||||||
/* g++ test.cpp -o test -lspmenu */
|
|
||||||
#include <iostream>
|
|
||||||
#include <libspmenu/libspmenu.h>
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
spmenu::spmenuSettings settings;
|
|
||||||
|
|
||||||
settings.promptText = "libspmenu test";
|
|
||||||
settings.windowPosition = "Bottom";
|
|
||||||
settings.itemPosition = "Top";
|
|
||||||
settings.standardInput = "Item1\nItem2\nItem3\n";
|
|
||||||
|
|
||||||
std::cout << spmenu::Run(&settings);
|
|
||||||
}
|
|
Loading…
Reference in a new issue