update time every min
This commit is contained in:
@@ -44,6 +44,7 @@ static const float mfact = 0.55; /* factor of master area size [0.05..0.95]
|
||||
static const int nmaster = 1; /* number of clients in master area */
|
||||
static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
|
||||
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||
static const int refreshrate = 60; /* refresh rate (per second) for client move/resize */
|
||||
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
@@ -88,6 +89,7 @@ static const Key keys[] = {
|
||||
{ MODKEY, XK_v, vene_clip_history,{0} }, // Clip history
|
||||
{ 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
|
||||
{ MODKEY, XK_z, vene_zzz, {0} }, // Sleep
|
||||
{ 0, XF86XK_AudioRaiseVolume, vene_inc_vol, {0} },
|
||||
{ 0, XF86XK_AudioLowerVolume, vene_dec_vol, {0} },
|
||||
{ 0, XF86XK_AudioMute, vene_toggle_vol, {0} },
|
||||
|
||||
@@ -1384,10 +1384,41 @@ run(void)
|
||||
XEvent ev;
|
||||
/* main event loop */
|
||||
XSync(dpy, False);
|
||||
while (!XNextEvent(dpy, &ev))
|
||||
|
||||
int display_fd = ConnectionNumber(dpy);
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (handler[ev.type])
|
||||
handler[ev.type](&ev); /* call handler */
|
||||
// Wait until there is an XEvent
|
||||
fd_set waited_read_fds;
|
||||
FD_ZERO(&waited_read_fds);
|
||||
FD_SET(display_fd, &waited_read_fds);
|
||||
|
||||
struct timeval tv;
|
||||
tv.tv_sec = 60;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
int fds_ready_count = select(display_fd + 1, &waited_read_fds, NULL, NULL, &tv);
|
||||
|
||||
if(fds_ready_count > 0)
|
||||
{
|
||||
// Event pending
|
||||
while(XPending(dpy))
|
||||
{
|
||||
XNextEvent(dpy, &ev);
|
||||
|
||||
if (handler[ev.type])
|
||||
handler[ev.type](&ev); /* call handler */
|
||||
}
|
||||
}
|
||||
else if(fds_ready_count == 0)
|
||||
{
|
||||
// timeout
|
||||
}
|
||||
else
|
||||
{
|
||||
// error
|
||||
}
|
||||
|
||||
vene_run();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <cppipe/commands.hpp>
|
||||
#include <X11/X.h>
|
||||
// #include "vene.h"
|
||||
#include "vene_env.h"
|
||||
#include <vene_env.h>
|
||||
extern "C"
|
||||
{
|
||||
#include "slstatus/slstatus.h"
|
||||
@@ -272,15 +272,13 @@ extern "C"
|
||||
|
||||
void vene_clip_history(const Arg*)
|
||||
{
|
||||
Cmd clipmenu("clipmenu", DMENU_ARGS);
|
||||
Cmd get_clip("xclip", "-o");
|
||||
Cmd xdotool("xdotool", "type", "--delay", "0", "--clearmodifiers");
|
||||
|
||||
// Select a history entry and put to clip
|
||||
clipmenu();
|
||||
Cmd clipmenu("clipmenu", DMENU_ARGS);
|
||||
|
||||
// Simulate keyboard input
|
||||
run(xdotool + $(get_clip).c_str());
|
||||
// Paste
|
||||
Cmd xdotool("xdotool", "key", "--delay", "0", "--clearmodifiers", "shift+Insert");
|
||||
|
||||
clipmenu && xdotool;
|
||||
}
|
||||
|
||||
void vene_browser(const Arg* browser_tag)
|
||||
@@ -362,4 +360,9 @@ extern "C"
|
||||
child = detach(toggle_mic);
|
||||
has_child = true;
|
||||
}
|
||||
|
||||
void vene_zzz(const Arg*)
|
||||
{
|
||||
ofstream("/sys/power/state") << "mem";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user