From f20804a5894f34729da202f0955362bc8732ee37 Mon Sep 17 00:00:00 2001 From: Venelin Dechkov Date: Fri, 13 Sep 2024 10:00:49 +0300 Subject: [PATCH] shift+ins paste --- config.h | 3 ++- vene.cpp | 16 +++++++++------- vene.h | 1 + 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/config.h b/config.h index 8c71a69..2f953a6 100644 --- a/config.h +++ b/config.h @@ -66,7 +66,7 @@ static const Layout layouts[] = { /* commands */ // static const char* dmenucmd[] = { "dmenu_run", "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; -static const char* dmenucmd[] = { "dmenu_run", NULL }; +static const char* dmenucmd[] = { "dmenu_run", "-fn", "monospace:size=14", NULL }; static const char* termcmd[] = { "st", NULL }; #if HAS_SW_BACKLIGHT static const char* bright_up[] = { "brightnessctl", "s", "-q", "3%+", NULL }; @@ -80,6 +80,7 @@ static void webbookmark(const Arg* unused){ static const Key keys[] = { /* modifier key function argument */ { MODKEY|ShiftMask, XK_s, vene_screenshot, {0} }, // Take a screenshot, located in ~/screenshots and in clipboard + { ShiftMask, XK_Insert, vene_paste_sel, {0} }, // Paste what the mouse selection { MODKEY|ShiftMask, XK_b, webbookmark, {0} }, // Open a web bookmark { 0, XF86XK_AudioRaiseVolume, vene_inc_vol, {0} }, { 0, XF86XK_AudioLowerVolume, vene_dec_vol, {0} }, diff --git a/vene.cpp b/vene.cpp index 1065d66..3fe2e0e 100644 --- a/vene.cpp +++ b/vene.cpp @@ -97,12 +97,6 @@ extern "C" // strcpy(BOOKMARK_DIR, HOME); // strcat(BOOKMARK_DIR, "/notes/bookmarks/web"); - - // sprintf(OPEN_BOOKMARK_CMD, "xdg-open $(dmenumap ~/notes/bookmarks/web/$(ls %s | dmenu "DMENU_OPTS") "DMENU_OPTS")", BOOKMARK_DIR); - // strcpy(OPEN_BOOKMARK_CMD, "xdg-open $(dmenumap "DMENU_OPTS" ~/notes/bookmarks/web/$(ls "); - // strcat(OPEN_BOOKMARK_CMD, BOOKMARK_DIR); - // strcat(OPEN_BOOKMARK_CMD, " | dmenu "DMENU_OPTS); - } void vene_updatestatus(char status[]) @@ -256,6 +250,14 @@ extern "C" scrot | tee | xclip; // todo: cppipe < string } + void vene_paste_sel(const Arg*) + { + Cmd xclip("xclip", "-selection", "primary", "-o"); + Cmd xdotool("xdotool", "click", "--delay", "0", "--clearmodifiers", "2"); + + xclip | xdotool; + } + void vene_browser(const Arg* browser_tag) { bool browser_tag_used = false; @@ -278,7 +280,7 @@ extern "C" void vene_webbookmark() // todo: cppipe exceptions { - Cmd dmenu( "dmenu", "-b", "-f", "-i", "-l", "30"); + Cmd dmenu( "dmenu", "-b", "-f", "-i", "-l", "30", "-fn", "monospace:size=14"); string bm_root (HOME); bm_root += "/sync/bookmarks/web/"; diff --git a/vene.h b/vene.h index 4912ed1..edb08f8 100644 --- a/vene.h +++ b/vene.h @@ -16,6 +16,7 @@ void vene_updatestatus(char status[]); void vene_run(); void vene_screenshot(const Arg*); +void vene_paste_sel(const Arg*); void vene_browser(const Arg*); void vene_webbookmark(); void vene_inc_vol(const Arg*);