summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/dmenu/dmenu.c24
-rw-r--r--core/dwm/config.def.h4
-rw-r--r--core/dwm/config.h5
3 files changed, 23 insertions, 10 deletions
diff --git a/core/dmenu/dmenu.c b/core/dmenu/dmenu.c
index b009179..6ca6db6 100644
--- a/core/dmenu/dmenu.c
+++ b/core/dmenu/dmenu.c
@@ -41,6 +41,7 @@ struct item {
static char text[BUFSIZ] = "";
static char *embed;
static int bh, mw, mh;
+static int ih;
static int promptw;
static int lrpad; /* sum of left and right padding */
static size_t cursor;
@@ -169,26 +170,30 @@ drawmenu(void)
if (prompt && *prompt) {
drw_setscheme(drw, scheme[SchemeSel]);
- x = drw_text(drw, x, 0, promptw, bh, lrpad / 2, prompt, 0);
+ x = drw_text(drw, x, 0, promptw, ih, lrpad / 2, prompt, 0);
}
/* draw input field */
w = mw - x;
drw_setscheme(drw, scheme[SchemeNorm]);
- drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
+ drw_text(drw, x, 0, w, ih, lrpad / 2, text, 0);
curpos = TEXTW(text) - TEXTW(&text[cursor]);
if ((curpos += lrpad / 2 - 1) < w) {
+ int cy = (ih - bh) / 2 + 2;
drw_setscheme(drw, scheme[SchemeNorm]);
- drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0);
+ drw_rect(drw, x + curpos, cy, 2, bh - 4, 1, 0);
}
+ drw_setscheme(drw, accent);
+ drw_rect(drw, 0, ih - 1, mw, 1, 1, 1);
+
+ y = ih;
for (item = curr; item != next; item = item->right) {
- y += bh;
drawitem(item, x, y, mw - x);
drw_setscheme(drw, accent);
drw_rect(drw, x, y + bh - 1, mw - x, 1, 1, 1);
+ y += bh;
}
-
drw_map(drw, win, 0, 0, mw, mh);
}
@@ -637,6 +642,7 @@ setup(void)
/* calculate menu geometry */
bh = drw->fonts->h + 2;
+ ih = (bh * 3) / 2;
#ifdef XINERAMA
i = 0;
if (parentwin == root && (info = XineramaQueryScreens(dpy, &n))) {
@@ -661,9 +667,9 @@ setup(void)
break;
mw = info[i].width / 2;
- int max_lines = info[i].height / bh - 1;
+ int max_lines = (info[i].height - ih) / bh;
lines = lines ? MIN(lines, max_lines) : MIN(20, max_lines);
- mh = (lines + 1) * bh;
+ mh = ih + lines * bh;
x = info[i].x_org + (info[i].width - mw) / 2;
y = info[i].y_org + (info[i].height - mh) / 2;
XFree(info);
@@ -674,9 +680,9 @@ setup(void)
die("could not get embedding window attributes: 0x%lx",
parentwin);
mw = wa.width / 2;
- int max_lines = wa.height / bh - 1;
+ int max_lines = (wa.height - ih) / bh;
lines = lines ? MIN(lines, max_lines) : MIN(20, max_lines);
- mh = (lines + 1) * bh;
+ mh = ih + lines * bh;
x = (wa.width - mw) / 2;
y = (wa.height - mh) / 2;
}
diff --git a/core/dwm/config.def.h b/core/dwm/config.def.h
index c94f430..394937d 100644
--- a/core/dwm/config.def.h
+++ b/core/dwm/config.def.h
@@ -71,6 +71,8 @@ static const char *screenshotcmd[] = { "flameshot", "gui", NULL };
static const char *mediaplaypause[] = { "playerctl", "play-pause", NULL };
static const char *medianext[] = { "playerctl", "next", NULL };
static const char *mediaprev[] = { "playerctl", "previous", NULL };
+static const char *powermenucmd[] = { "/bin/sh", "-c", "power-menu.sh", NULL };
+static const char *steamcmd[] = { "/bin/sh", "-c", "steam-dmenu.sh", NULL };
static const Key keys[] = {
/* modifier key function argument */
@@ -79,6 +81,8 @@ static const Key keys[] = {
{ MODKEY, XK_F1, spawn, {.v = browsercmd } },
{ 0, XK_Print, spawn, {.v = screenshotcmd } },
{ MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } },
+ { MODKEY|ShiftMask, XK_p, spawn, {.v = powermenucmd } },
+ { MODKEY|ControlMask, XK_p, spawn, {.v = steamcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
diff --git a/core/dwm/config.h b/core/dwm/config.h
index c89c80d..9525e86 100644
--- a/core/dwm/config.h
+++ b/core/dwm/config.h
@@ -73,7 +73,8 @@ static const char *medianext[] = { "playerctl", "next", NULL };
static const char *mediaprev[] = { "playerctl", "previous", NULL };
static const char *calendarcmd[] = { "/bin/sh", "-c", "st -e sh -c 'cal -3 | less'", NULL };
static const char *dunstlogcmd[] = { "/bin/sh", "-c", "st -e sh -c 'less -+F \"$HOME/.cache/dunst/dunst.log\"'", NULL };
-static const char *powermenucmd[] = { "/bin/sh", "-c", "printf '%s\n' lock reboot shutdown | dmenu | xargs -r -I{} sh -c 'case \"{}\" in lock) slock ;; reboot) loginctl reboot ;; shutdown) loginctl poweroff ;; esac'", NULL };
+static const char *powermenucmd[] = { "/bin/sh", "-c", "power-menu.sh", NULL };
+static const char *steamcmd[] = { "/bin/sh", "-c", "steam-dmenu.sh", NULL };
static const Key keys[] = {
/* modifier key function argument */
@@ -82,6 +83,8 @@ static const Key keys[] = {
{ MODKEY, XK_F1, spawn, {.v = browsercmd } },
{ 0, XK_Print, spawn, {.v = screenshotcmd } },
{ MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } },
+ { MODKEY|ShiftMask, XK_p, spawn, {.v = powermenucmd } },
+ { MODKEY|ControlMask, XK_p, spawn, {.v = steamcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },