Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
Choose a Base Repository
kernc/logkeys
1dal/logkeys
2625668714/logkeys
9kopb/logkeys
AdamProbert/logkeys
AfterLotus/logkeys
AlexanderAA/logkeys
Annatsu/logkeys
CodeMyAss/logkeys
Coroecram/logkeys
Double08/logkeys
Erosparrela/logkeys
Felipeasg/logkeys
GuardianRG/logkeys
Hritik14/logkeys
JoseFabianGomez/logkeys
Jrmbt/logkeys
Kanhavishva/logkeys
KbaHaxor/logkeys
LinuxComilla/logkeys
LinuxDevOpsGirl/logkeys
LinuxEntrepreneur/logkeys
LinuxSystemAdmin/logkeys
MG-Akbar/logkeys
Mumarda/logkeys
Philhiphop/logkeys
PhoenixFireLabs/logkeys
PlexPt/logkeys
QardenEden/logkeys
RobertoMalatesta/logkeys
STKeeper/logkeys
Solertis/logkeys
Sungguk/logkeys
WuYRV/logkeys
XCage15/logkeys
Ymil/logkeys
ZamirSadekinChowdhury/logkeys
a69/logkeys
abukauser/logkeys
achraf-jeday/logkeys
akibhightech/logkeys
alaminreaz/logkeys
aldemyr/logkeys
anasbalkhadir/logkeys
ankur09/logkeys
aponmart/logkeys
aszkid/logkeys
bdantas/logkeys
bigbael/logkeys
blackPantherOS/logkeys
bmr2018/logkeys
bramau1089/logkeys
buluma/logkeys
camura/logkeys
ccesara/logkeys
cfarley2/logkeys
charlycode/logkeys
chriad/logkeys
coffnix/logkeys
cryptobuks/logkeys
curiousTauseef/logkeys
cyberpollutionbd/logkeys
descent/logkeys
dmezquiam/logkeys
dot-Sean/logkeys
dothanthitiendiettiende/logkeys
dougray/logkeys
dtrybalski/logkeys
dvermd/logkeys
echodaemon/logkeys
eduardomatos66/logkeys
estevaofelipe/logkeys
falCOnID88/logkeys
fgarel/logkeys
flik/logkeys
foivosChristoulakis/logkeys
gharibehy/logkeys
gitqueue/logkeys
gnaomo/logkeys
godevop/logkeys
guilhemheinrich/logkeys
guppyfaced/logkeys
heikipikker/logkeys
henriquemeira/logkeys
iiwin/logkeys
inigocrespo/logkeys
isnuryusuf/logkeys
itbidhan/logkeys
itsns/logkeys
jack8412/logkeys
jaideraf/logkeys
jaiderlearning/logkeys
jchuang1977/logkeys
jeperez/logkeys
jisanB/logkeys
jkazuo55/logkeys
jsabari/logkeys
jzohrab/logkeys
kerscher/logkeys
kimusan/logkeys
knabe023/logkeys
kumar4k/logkeys
m4rm0k/logkeys
mahefaniaina/logkeys
malaniz/logkeys
manishmarahatta/logkeys
marcelo-tento/logkeys
marcostolosa/logkeys
mark201200/logkeys
marlluslustosa/logkeys
matteck/logkeys
megamindAT/logkeys
mestag-a/logkeys
mftom/logkeys
miguelpinia/logkeys
mrelx/logkeys
nesl/logkeys
nico202/logkeys
oduran18/logkeys
oidnus/logkeys
p4nj/logkeys
pablocordova/logkeys
patricmutwiri/logkeys
pavanyekabote/logkeys
petuniaderel/logkeys
pokkie/logkeys
psyKonetix/logkeys
realglobe-Inc/logkeys
robsonmobile/logkeys
rolfvreijdenberger/logkeys
rollschild/logkeys
sagardeyrakesh/logkeys
sangramz/logkeys
sarkartanzil/logkeys
sateler/logkeys
sawrus/logkeys
saydulk/logkeys
sergei-dyshel/logkeys
superbsix/logkeys
susmatthew/logkeys
swachalit/logkeys
t0mOURCSSn/logkeys
taficenio/logkeys
tatsuryu/logkeys
techgaun/logkeys
titosjosh/logkeys
tobed1995/logkeys
trevordavenport/logkeys
triclops200/logkeys
ttua/logkeys
ultrablast/logkeys
vishnukumarnekkanti/logkeys-1
waleadedeji/logkeys
webkul/logkeys
wgalvao/logkeys
wiltonlazary/logkeys
ycaihua/logkeys
ygemici/logkeys
ys7yoo/logkeys
zeus512/logkeys
zlgxzswjy/logkeys
Nothing to show
base: master
Choose a Head Repository
kernc/logkeys
1dal/logkeys
2625668714/logkeys
9kopb/logkeys
AdamProbert/logkeys
AfterLotus/logkeys
AlexanderAA/logkeys
Annatsu/logkeys
CodeMyAss/logkeys
Coroecram/logkeys
Double08/logkeys
Erosparrela/logkeys
Felipeasg/logkeys
GuardianRG/logkeys
Hritik14/logkeys
JoseFabianGomez/logkeys
Jrmbt/logkeys
Kanhavishva/logkeys
KbaHaxor/logkeys
LinuxComilla/logkeys
LinuxDevOpsGirl/logkeys
LinuxEntrepreneur/logkeys
LinuxSystemAdmin/logkeys
MG-Akbar/logkeys
Mumarda/logkeys
Philhiphop/logkeys
PhoenixFireLabs/logkeys
PlexPt/logkeys
QardenEden/logkeys
RobertoMalatesta/logkeys
STKeeper/logkeys
Solertis/logkeys
Sungguk/logkeys
WuYRV/logkeys
XCage15/logkeys
Ymil/logkeys
ZamirSadekinChowdhury/logkeys
a69/logkeys
abukauser/logkeys
achraf-jeday/logkeys
akibhightech/logkeys
alaminreaz/logkeys
aldemyr/logkeys
anasbalkhadir/logkeys
ankur09/logkeys
aponmart/logkeys
aszkid/logkeys
bdantas/logkeys
bigbael/logkeys
blackPantherOS/logkeys
bmr2018/logkeys
bramau1089/logkeys
buluma/logkeys
camura/logkeys
ccesara/logkeys
cfarley2/logkeys
charlycode/logkeys
chriad/logkeys
coffnix/logkeys
cryptobuks/logkeys
curiousTauseef/logkeys
cyberpollutionbd/logkeys
descent/logkeys
dmezquiam/logkeys
dot-Sean/logkeys
dothanthitiendiettiende/logkeys
dougray/logkeys
dtrybalski/logkeys
dvermd/logkeys
echodaemon/logkeys
eduardomatos66/logkeys
estevaofelipe/logkeys
falCOnID88/logkeys
fgarel/logkeys
flik/logkeys
foivosChristoulakis/logkeys
gharibehy/logkeys
gitqueue/logkeys
gnaomo/logkeys
godevop/logkeys
guilhemheinrich/logkeys
guppyfaced/logkeys
heikipikker/logkeys
henriquemeira/logkeys
iiwin/logkeys
inigocrespo/logkeys
isnuryusuf/logkeys
itbidhan/logkeys
itsns/logkeys
jack8412/logkeys
jaideraf/logkeys
jaiderlearning/logkeys
jchuang1977/logkeys
jeperez/logkeys
jisanB/logkeys
jkazuo55/logkeys
jsabari/logkeys
jzohrab/logkeys
kerscher/logkeys
kimusan/logkeys
knabe023/logkeys
kumar4k/logkeys
m4rm0k/logkeys
mahefaniaina/logkeys
malaniz/logkeys
manishmarahatta/logkeys
marcelo-tento/logkeys
marcostolosa/logkeys
mark201200/logkeys
marlluslustosa/logkeys
matteck/logkeys
megamindAT/logkeys
mestag-a/logkeys
mftom/logkeys
miguelpinia/logkeys
mrelx/logkeys
nesl/logkeys
nico202/logkeys
oduran18/logkeys
oidnus/logkeys
p4nj/logkeys
pablocordova/logkeys
patricmutwiri/logkeys
pavanyekabote/logkeys
petuniaderel/logkeys
pokkie/logkeys
psyKonetix/logkeys
realglobe-Inc/logkeys
robsonmobile/logkeys
rolfvreijdenberger/logkeys
rollschild/logkeys
sagardeyrakesh/logkeys
sangramz/logkeys
sarkartanzil/logkeys
sateler/logkeys
sawrus/logkeys
saydulk/logkeys
sergei-dyshel/logkeys
superbsix/logkeys
susmatthew/logkeys
swachalit/logkeys
t0mOURCSSn/logkeys
taficenio/logkeys
tatsuryu/logkeys
techgaun/logkeys
titosjosh/logkeys
tobed1995/logkeys
trevordavenport/logkeys
triclops200/logkeys
ttua/logkeys
ultrablast/logkeys
vishnukumarnekkanti/logkeys-1
waleadedeji/logkeys
webkul/logkeys
wgalvao/logkeys
wiltonlazary/logkeys
ycaihua/logkeys
ygemici/logkeys
ys7yoo/logkeys
zeus512/logkeys
zlgxzswjy/logkeys
Nothing to show
compare: master
Checking mergeability… Don’t worry, you can still create the pull request.
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 582 additions and 1 deletion.
  1. +37 −0 .vscode/settings.json
  2. +30 −1 src/logkeys.cc
  3. +515 −0 test.log
@@ -0,0 +1,37 @@
{
"files.associations": {
"array": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"csignal": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iosfwd": "cpp",
"istream": "cpp",
"limits": "cpp",
"new": "cpp",
"optional": "cpp",
"ostream": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"type_traits": "cpp",
"tuple": "cpp",
"typeinfo": "cpp",
"utility": "cpp",
"numeric": "cpp"
}
}
@@ -49,6 +49,8 @@
#define COMMAND_STR_DUMPKEYS ( EXE_DUMPKEYS " -n | " EXE_GREP " '^\\([[:space:]]shift[[:space:]]\\)*\\([[:space:]]altgr[[:space:]]\\)*keycode'" )
#define COMMAND_STR_GET_PID ( (std::string(EXE_PS " ax | " EXE_GREP " '") + program_invocation_name + "' | " EXE_GREP " -v grep").c_str() )
#define COMMAND_STR_CAPSLOCK_STATE ("{ { xset q 2>/dev/null | grep -q -E 'Caps Lock: +on'; } || { setleds 2>/dev/null | grep -q 'CapsLock on'; }; } && echo on")
#define COMMAND_GET_ACTIVE_WINDOW std::string("xprop -id $(xprop -root _NET_ACTIVE_WINDOW | cut -d ' ' -f 5) WM_NAME").c_str()
#define COMMAND_GET_ACTIVE_WINDOW_BIS "xprop -id $(xprop -root _NET_ACTIVE_WINDOW | cut -d ' ' -f 5) WM_NAME | sed -nr 's/.*= \"(.*)\"$/\1/p'"

#define INPUT_EVENT_PATH "/dev/input/" // standard path
#define DEFAULT_LOG_FILE "/var/log/logkeys.log"
@@ -76,6 +78,22 @@ std::string execute(const char* cmd)
return result;
}

std::string GetStdoutFromCommand(std::string cmd)
{
std::string data;
FILE * stream;
const int max_buffer = 256;
char buffer[max_buffer];
cmd.append(" 2>&1");

stream = popen(cmd.c_str(), "r");
if (stream) {
while (!feof(stream))
if (fgets(buffer, max_buffer, stream) != NULL) data.append(buffer);
pclose(stream);
}
return data;
}

int input_fd = -1; // input event device file descriptor; global so that signal_handler() can access it

@@ -577,12 +595,23 @@ int main(int argc, char **argv)
(ctrl_in_effect && (scan_code == KEY_C || scan_code == KEY_D))) {
if (ctrl_in_effect)
inc_size += fprintf(out, "%lc", char_keys[to_char_keys_index(scan_code)]); // log C or D
if (args.flags & FLAG_NO_TIMESTAMPS)
if (args.flags & FLAG_NO_TIMESTAMPS) {
// add current active window
std::string active_window = execute(COMMAND_GET_ACTIVE_WINDOW);
inc_size += fprintf(out, " [ %s ]", active_window.c_str());
inc_size += fprintf(out, "\n");
}
else {
// add current active window
std::string active_window = execute(COMMAND_GET_ACTIVE_WINDOW);
inc_size += fprintf(out, " [ %s ]", active_window.c_str());
strftime(timestamp, sizeof(timestamp), "\n" TIME_FORMAT, localtime(&event.time.tv_sec));
inc_size += fprintf(out, "%s", timestamp); // then newline and timestamp
}




if (inc_size > 0) file_size += inc_size;
continue; // but don't log "<Enter>"
}
Oops, something went wrong.

No commit comments for this range

You can’t perform that action at this time.