Last active
June 12, 2019 18:41
-
-
Save anthonyheckmann/617842b2fa6b5c4d59347b88e86a1ec4 to your computer and use it in GitHub Desktop.
Revisions
-
anthonyheckmann revised this gist
Jun 12, 2019 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,6 +7,8 @@ like `track >> window.log` #include <time.h> #include <X11/Xlib.h> /*This grabs XEvents, gets the window title and prints it with timestamp*/ int main() { Display *dpy = XOpenDisplay(0x0); XSelectInput(dpy, DefaultRootWindow(dpy), FocusChangeMask); -
anthonyheckmann created this gist
Jun 12, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ /* Found here https://bbs.archlinux.org/viewtopic.php?pid=1551884#p1551884 By user Trilby Compile with `gcc -o track track.c -lX11`, and consider putting into .xinitrc like `track >> window.log` */ #include <stdio.h> #include <time.h> #include <X11/Xlib.h> int main() { Display *dpy = XOpenDisplay(0x0); XSelectInput(dpy, DefaultRootWindow(dpy), FocusChangeMask); Window win; int ignore; char *title; XEvent ev; while (!XNextEvent(dpy,&ev)) { XGetInputFocus(dpy, &win, &ignore); if (XFetchName(dpy, win, &title)) { printf("%d\t%s\n", time(NULL), title); XFree(title); } } return 0; }