forked from speedie/spmenu
fix keybind for setprofile, fix mac support
This commit is contained in:
parent
f94f1ce9ab
commit
5b2cbc0c7e
19
Makefile
19
Makefile
|
@ -63,6 +63,22 @@ install: spmenu
|
|||
rm -f *.o
|
||||
rm -f spmenu
|
||||
|
||||
install_mac: spmenu
|
||||
rm -rf $(DESTDIR)$(PREFIX)/share/spmenu/
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/share/spmenu
|
||||
cp -r docs/* $(DESTDIR)$(PREFIX)/share/spmenu/
|
||||
echo "$(VERSION)" > $(DESTDIR)$(PREFIX)/share/spmenu/version
|
||||
echo "$(CC)" > $(DESTDIR)$(PREFIX)/share/spmenu/cc
|
||||
echo "$(CFLAGS)" > $(DESTDIR)$(PREFIX)/share/spmenu/cflags
|
||||
echo "$$(date "+%D %T")" > $(DESTDIR)$(PREFIX)/share/spmenu/compile-date
|
||||
cp -r spmenu scripts/spmenu* $(DESTDIR)$(PREFIX)/bin
|
||||
[ -f spmenu.1 ] && mkdir -p $(DESTDIR)$(MANPREFIX)/man1 || :
|
||||
[ -f spmenu.1 ] && cp spmenu.1 $(DESTDIR)$(MANPREFIX)/man1/spmenu.1 || :
|
||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/spmenu*
|
||||
rm -f *.o
|
||||
rm -f spmenu
|
||||
|
||||
compat:
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/dmenu
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/dmenu_run
|
||||
|
@ -77,6 +93,7 @@ help:
|
|||
@echo spmenu Makefile help
|
||||
@echo
|
||||
@echo install: Installs spmenu. You may need to run this as root.
|
||||
@echo install_mac: Installs spmenu on a Mac. You may need to run this as root.
|
||||
@echo uninstall: Uninstalls spmenu. You may need to run this as root.
|
||||
@echo install_arch: Uses the PKGBUILD to install spmenu using pacman.
|
||||
@echo dist: Creates a release for spmenu.
|
||||
|
@ -126,4 +143,4 @@ commit: docs
|
|||
git add *
|
||||
git commit -a || :
|
||||
|
||||
.PHONY: all options clean dist install install_arch uninstall pkg_arch help man docs commit
|
||||
.PHONY: all options clean dist install install_mac install_arch uninstall pkg_arch help man docs commit
|
||||
|
|
22
build.sh
22
build.sh
|
@ -2,6 +2,7 @@
|
|||
PREFIX="${PREFIX:-/usr}"
|
||||
DESTDIR="${DESTDIR:-}"
|
||||
INCDIR="${INCDIR:-/usr/include}"
|
||||
makebin="${makebin:-$(command -v make)}"
|
||||
cc="${cc:-${CC:-gcc}}"
|
||||
opt="${opt:-${OPT:--O2}}"
|
||||
warn="${warn:-true}"
|
||||
|
@ -13,6 +14,7 @@ check_dist() {
|
|||
}
|
||||
|
||||
check() {
|
||||
if [ "$mac" != "true" ]; then
|
||||
[ ! -x "$(command -v ldconfig)" ] && printf "ldconfig not found in %s. Please make sure your system is set up properly." "\$PATH" && exit 1
|
||||
[ ! -x "$(command -v make)" ] && printf "make not found in %s. Please make sure your system is set up properly." "\$PATH" && exit 1
|
||||
[ ! -x "$(command -v "$cc")" ] && printf "%s not found in %s. Please make sure your system is set up properly." "$cc" "\$PATH"
|
||||
|
@ -27,6 +29,10 @@ check() {
|
|||
[ -n "$(ldconfig -p | grep fribidi)" ] && printf "fribidi found\n" && fribidi=true || fribidi=false
|
||||
[ -n "$(ldconfig -p | grep freetype)" ] && printf "freetype found\n" && freetype=true || freetype=false
|
||||
[ -n "$(ldconfig -p | grep libconfig)" ] && printf "libconfig found\n" && libconfig=true || libconfig=false
|
||||
else
|
||||
makebin="gnumake"
|
||||
GEN_MANUAL="false"
|
||||
fi
|
||||
}
|
||||
|
||||
loadconf() {
|
||||
|
@ -101,10 +107,10 @@ build() {
|
|||
bdtoggle=""
|
||||
fi
|
||||
|
||||
make clean
|
||||
[ "$GEN_MANUAL" != "false" ] && make man
|
||||
$makebin clean
|
||||
[ "$GEN_MANUAL" != "false" ] && $makebin man
|
||||
|
||||
make \
|
||||
$makebin \
|
||||
CC="$cc" \
|
||||
PREFIX="$PREFIX" \
|
||||
DISTDIR="$DISTDIR" \
|
||||
|
@ -128,7 +134,13 @@ build() {
|
|||
}
|
||||
|
||||
install() {
|
||||
make install \
|
||||
if [ "$mac" = "true" ]; then
|
||||
RULE="install_mac"
|
||||
else
|
||||
RULE="install"
|
||||
fi
|
||||
|
||||
$makebin $RULE \
|
||||
CC="$cc" \
|
||||
PREFIX="$PREFIX" \
|
||||
OPT="$opt" \
|
||||
|
@ -150,7 +162,7 @@ install() {
|
|||
X11INC="$X11INC"
|
||||
}
|
||||
|
||||
[ "$1" = "--no-install" ] && INSTALL=false
|
||||
[ "$1" = "--no-install" ] && install=false
|
||||
|
||||
check_dist
|
||||
check
|
||||
|
|
|
@ -315,10 +315,10 @@ spmenu =
|
|||
argument = "+1";
|
||||
},
|
||||
{ mode = -1;
|
||||
modifier = "Control+Shift";
|
||||
modifier = "Ctrl+Shift";
|
||||
key = "p";
|
||||
function = "spawn";
|
||||
argument = "setprofile";
|
||||
function = "setprofile";
|
||||
argument = "0";
|
||||
},
|
||||
{ mode = 1;
|
||||
modifier = "None";
|
||||
|
|
|
@ -50,7 +50,7 @@ static Key keys[] = {
|
|||
{ -1, CONTROL, XK_Right, moveword, {.i = +1 } },
|
||||
{ -1, 0, XK_Left, movecursor, {.i = -1 } },
|
||||
{ -1, 0, XK_Right, movecursor, {.i = +1 } },
|
||||
{ -1, CONTROL|SHIFT, XK_p, spawn, {.c = "spmenu_profile --spmenu-set-profile" } },
|
||||
{ -1, CONTROL|SHIFT, XK_p, setprofile, {0} },
|
||||
|
||||
/* normal mode */
|
||||
{ 0, 0, XK_i, switchmode, {0} },
|
||||
|
|
|
@ -521,3 +521,12 @@ togglehighlight(Arg *arg)
|
|||
hidehighlight = !hidehighlight;
|
||||
drawmenu();
|
||||
}
|
||||
|
||||
void
|
||||
setprofile(Arg *arg)
|
||||
{
|
||||
if (!system("spmenu_profile --spmenu-set-profile"))
|
||||
die("spmenu: failed to run profile menu\n");
|
||||
else
|
||||
exit(0);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ static void backspace(Arg *arg);
|
|||
static void selectitem(Arg *arg);
|
||||
static void quit(Arg *arg);
|
||||
static void complete(Arg *arg);
|
||||
static void savehistory(char *input);
|
||||
static void setimgsize(Arg *arg);
|
||||
static void toggleimg(Arg *arg);
|
||||
static void defaultimg(Arg *arg);
|
||||
|
@ -40,3 +39,4 @@ static void setlines(Arg *arg);
|
|||
static void setcolumns(Arg *arg);
|
||||
static void spawn(Arg *arg);
|
||||
static void togglehighlight(Arg *arg);
|
||||
static void setprofile(Arg *arg);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
static char *histfile;
|
||||
static char **history;
|
||||
static size_t histsz, histpos;
|
||||
static void savehistory(char *input);
|
||||
|
|
|
@ -136,7 +136,6 @@ static ArgList al[] = {
|
|||
{ "98", {.i = 98 } },
|
||||
{ "99", {.i = 99 } },
|
||||
{ "100", {.i = 100 } },
|
||||
|
||||
{ "+0", {.i = +0 } },
|
||||
{ "+1", {.i = +1 } },
|
||||
{ "+2", {.i = +2 } },
|
||||
|
@ -238,7 +237,6 @@ static ArgList al[] = {
|
|||
{ "+98", {.i = +98 } },
|
||||
{ "+99", {.i = +99 } },
|
||||
{ "+100", {.i = +100 } },
|
||||
|
||||
{ "-0", {.i = -0 } },
|
||||
{ "-1", {.i = -1 } },
|
||||
{ "-2", {.i = -2 } },
|
||||
|
@ -340,7 +338,6 @@ static ArgList al[] = {
|
|||
{ "-98", {.i = -98 } },
|
||||
{ "-99", {.i = -99 } },
|
||||
{ "-100", {.i = -100 } },
|
||||
{ "setprofile", {.c = "spmenu_profile --spmenu-set-profile" } },
|
||||
};
|
||||
|
||||
static FuncList fl[] = {
|
||||
|
@ -383,8 +380,9 @@ static FuncList fl[] = {
|
|||
{ "setlines", setlines },
|
||||
{ "setcolumns", setcolumns },
|
||||
{ "togglehighlight",togglehighlight },
|
||||
{ "setprofile", spawn },
|
||||
{ "setprofile", setprofile },
|
||||
{ "switchmode", switchmode },
|
||||
{ "spawn", spawn },
|
||||
};
|
||||
|
||||
// list of modifiers that can be used in the config file
|
||||
|
|
Loading…
Reference in a new issue