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.
  • 4 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on Oct 09, 2017
log uppercase letters when capslock is on
This is tested and working. Only caveat is that it is a simple toggle that assumes CapsLock is off when logkeys starts. If CapsLock happens to be on when logkeys starts, log file will show reverse capitalization.
Showing with 16 additions and 0 deletions.
  1. +16 −0 src/logkeys.cc
@@ -19,6 +19,7 @@
#include <netdb.h>
#include <unistd.h>
#include <getopt.h>
#include <wctype.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/socket.h>
@@ -47,6 +48,7 @@

#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 INPUT_EVENT_PATH "/dev/input/" // standard path
#define DEFAULT_LOG_FILE "/var/log/logkeys.log"
@@ -472,6 +474,7 @@ int main(int argc, char **argv)
unsigned int scan_code, prev_code = 0; // the key code of the pressed key (some codes are from "scan code set 1", some are different (see <linux/input.h>)
struct input_event event;
char timestamp[32]; // timestamp string, long enough to hold format "\n%F %T%z > "
bool capslock_in_effect = execute(COMMAND_STR_CAPSLOCK_STATE).size() >= 2;
bool shift_in_effect = false;
bool altgr_in_effect = false;
bool ctrl_in_effect = false; // used for identifying Ctrl+C / Ctrl+D
@@ -583,6 +586,9 @@ int main(int argc, char **argv)
continue; // but don't log "<Enter>"
}

if (scan_code == KEY_CAPSLOCK)
capslock_in_effect = !capslock_in_effect;

if (scan_code == KEY_LEFTSHIFT || scan_code == KEY_RIGHTSHIFT)
shift_in_effect = true;
if (scan_code == KEY_RIGHTALT)
@@ -602,6 +608,16 @@ int main(int argc, char **argv)
wch = char_keys[to_char_keys_index(scan_code)];
}
}

else if (capslock_in_effect && iswalpha(char_keys[to_char_keys_index(scan_code)])) { // only bother with capslock if alpha
if (shift_in_effect) // capslock and shift cancel each other
wch = char_keys[to_char_keys_index(scan_code)];
else
wch = shift_keys[to_char_keys_index(scan_code)];
if (wch == L'\0')
wch = char_keys[to_char_keys_index(scan_code)];
}

else if (shift_in_effect) {
wch = shift_keys[to_char_keys_index(scan_code)];
if (wch == L'\0')

No commit comments for this range

You can’t perform that action at this time.