clip history
This commit is contained in:
@@ -72,6 +72,7 @@ static const Layout layouts[] = {
|
|||||||
// static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
// static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
||||||
static const char* dmenucmd[] = { "dmenu_run", "-fn", "monospace:size=14", NULL };
|
static const char* dmenucmd[] = { "dmenu_run", "-fn", "monospace:size=14", NULL };
|
||||||
static const char* termcmd[] = { "st", NULL };
|
static const char* termcmd[] = { "st", NULL };
|
||||||
|
static const char* simulate_mmb[] = { "xdotool", "click", "--delay", "0", "--clearmodifiers", "2", NULL };
|
||||||
#if HAS_SW_BACKLIGHT
|
#if HAS_SW_BACKLIGHT
|
||||||
static const char* bright_up[] = { "brightnessctl", "s", "-q", "1%+", NULL };
|
static const char* bright_up[] = { "brightnessctl", "s", "-q", "1%+", NULL };
|
||||||
static const char* bright_down[] = { "brightnessctl", "s", "-q", "1%-", NULL };
|
static const char* bright_down[] = { "brightnessctl", "s", "-q", "1%-", NULL };
|
||||||
@@ -83,9 +84,10 @@ static void webbookmark(const Arg* unused){
|
|||||||
|
|
||||||
static const Key keys[] = {
|
static const Key keys[] = {
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
{ MODKEY|ShiftMask, XK_s, vene_screenshot, {0} }, // Take a screenshot, located in ~/screenshots and in clipboard
|
{ 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, XK_v, vene_clip_history,{0} }, // Clip history
|
||||||
{ MODKEY|ShiftMask, XK_b, webbookmark, {0} }, // Open a web bookmark
|
{ ShiftMask, XK_Insert, spawn, { .v = simulate_mmb } }, // Paste what the mouse selection by simulating a MMB click
|
||||||
|
{ MODKEY|ShiftMask, XK_b, webbookmark, {0} }, // Open a web bookmark
|
||||||
{ 0, XF86XK_AudioRaiseVolume, vene_inc_vol, {0} },
|
{ 0, XF86XK_AudioRaiseVolume, vene_inc_vol, {0} },
|
||||||
{ 0, XF86XK_AudioLowerVolume, vene_dec_vol, {0} },
|
{ 0, XF86XK_AudioLowerVolume, vene_dec_vol, {0} },
|
||||||
{ 0, XF86XK_AudioMute, vene_toggle_vol, {0} },
|
{ 0, XF86XK_AudioMute, vene_toggle_vol, {0} },
|
||||||
|
|||||||
@@ -14,9 +14,11 @@ extern "C"
|
|||||||
#include "slstatus/slstatus.h"
|
#include "slstatus/slstatus.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DMENU_ARGS "-b", "-f", "-i", "-l", "30", "-fn", "monospace:size=14"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
using namespace std::chrono_literals;
|
using namespace std::literals;
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
char* HOME;
|
char* HOME;
|
||||||
@@ -234,7 +236,7 @@ extern "C"
|
|||||||
new_stat += (timeinfo->tm_min/10) + '0';
|
new_stat += (timeinfo->tm_min/10) + '0';
|
||||||
new_stat += (timeinfo->tm_min%10) + '0';
|
new_stat += (timeinfo->tm_min%10) + '0';
|
||||||
|
|
||||||
strcpy(status, new_stat.c_str());
|
strcpy(status, new_stat.c_str()); // todo: write directly to status
|
||||||
}
|
}
|
||||||
|
|
||||||
void vene_run() // update status bar every 5 sec
|
void vene_run() // update status bar every 5 sec
|
||||||
@@ -264,16 +266,21 @@ extern "C"
|
|||||||
{
|
{
|
||||||
Cmd scrot("scrot", "-s", "-");
|
Cmd scrot("scrot", "-s", "-");
|
||||||
Cmd tee("tee", SCREEN_CAPS_DIR);
|
Cmd tee("tee", SCREEN_CAPS_DIR);
|
||||||
Cmd xclip("xclip", "-selection", "clipboard", "-t", "image/png");
|
Cmd to_clip("xclip", "-selection", "clipboard", "-t", "image/png");
|
||||||
scrot | tee | xclip; // todo: cppipe < string
|
scrot | tee | to_clip; // todo: cppipe < string
|
||||||
}
|
}
|
||||||
|
|
||||||
void vene_paste_sel(const Arg*)
|
void vene_clip_history(const Arg*)
|
||||||
{
|
{
|
||||||
Cmd xclip("xclip", "-selection", "primary", "-o");
|
Cmd clipmenu("clipmenu", DMENU_ARGS);
|
||||||
Cmd xdotool("xdotool", "click", "--delay", "0", "--clearmodifiers", "2");
|
Cmd get_clip("xclip", "-o");
|
||||||
|
Cmd xdotool("xdotool", "type", "--delay", "0", "--clearmodifiers");
|
||||||
|
|
||||||
xclip | xdotool;
|
// Select a history entry and put to clip
|
||||||
|
clipmenu();
|
||||||
|
|
||||||
|
// Simulate keyboard input
|
||||||
|
run(xdotool + $(get_clip).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void vene_browser(const Arg* browser_tag)
|
void vene_browser(const Arg* browser_tag)
|
||||||
@@ -298,13 +305,11 @@ extern "C"
|
|||||||
|
|
||||||
void vene_webbookmark() // todo: cppipe exceptions
|
void vene_webbookmark() // todo: cppipe exceptions
|
||||||
{
|
{
|
||||||
Cmd dmenu( "dmenu", "-b", "-f", "-i", "-l", "30", "-fn", "monospace:size=14");
|
Cmd dmenu( "dmenu", DMENU_ARGS);
|
||||||
|
|
||||||
string bm_root (HOME);
|
string bm_root = HOME + "/sync/bookmarks/web/"s;
|
||||||
bm_root += "/sync/bookmarks/web/";
|
|
||||||
|
|
||||||
Cmd list_dirs ("ls");
|
Cmd list_dirs ("ls", bm_root.c_str());
|
||||||
list_dirs += bm_root.c_str();
|
|
||||||
|
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
@@ -315,17 +320,16 @@ extern "C"
|
|||||||
|
|
||||||
string bm_dir = bm_root + dir;
|
string bm_dir = bm_root + dir;
|
||||||
|
|
||||||
// Choose bookmark
|
// Read content of bookmarks file and choose
|
||||||
string link = $(dmenu < bm_dir.c_str());
|
string link = $(dmenu < bm_dir.c_str());
|
||||||
|
|
||||||
|
// Extract link
|
||||||
size_t link_begin = link.find('-');
|
size_t link_begin = link.find('-');
|
||||||
if(link_begin != string::npos)
|
if(link_begin != string::npos)
|
||||||
{
|
{
|
||||||
// Extract link
|
|
||||||
Cmd open_bookmark("apulse", BROWSER);
|
Cmd open_bookmark("apulse", BROWSER);
|
||||||
link = link.substr(link_begin+1);
|
detach(open_bookmark +
|
||||||
open_bookmark += link.c_str();
|
(link.c_str() + 1)); // skip -
|
||||||
detach(open_bookmark);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ void vene_updatestatus(char status[]);
|
|||||||
void vene_run();
|
void vene_run();
|
||||||
|
|
||||||
void vene_screenshot(const Arg*);
|
void vene_screenshot(const Arg*);
|
||||||
void vene_paste_sel(const Arg*);
|
void vene_clip_history(const Arg*);
|
||||||
void vene_browser(const Arg*);
|
void vene_browser(const Arg*);
|
||||||
void vene_webbookmark();
|
void vene_webbookmark();
|
||||||
void vene_inc_vol(const Arg*);
|
void vene_inc_vol(const Arg*);
|
||||||
|
|||||||
Reference in New Issue
Block a user