Skip to content

Commit 1bf4bef

Browse files
committed
Correct logging of username minecraft is being played as.
1 parent 4678b28 commit 1bf4bef

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

activitylog

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,21 @@ export XAUTHORITY=$HOME/.Xauthority
1111
#Check status of screensaver - if it's running, do nothing.
1212
if gnome-screensaver-command -q | grep inactive > /dev/null; then
1313
#If the screensaver isn't running, log the title of the active window
14-
xwininfo -id `xdotool getactivewindow` | grep Window\ id | logger
15-
#This command lists the tabs that have been opened in the current firefox session.
16-
#grep -Eo '"entries":\[{"url":"[^"]*"' /home/jgilmore/.mozilla/firefox/*.default/sessionstore.js | sed 's/^.*:"//; s/"$//'
17-
#Saved here for possible future reference
14+
ACTIVE=`xdotool getactivewindow`
15+
TITLE=`xwininfo -id $ACTIVE | grep 'xwininfo:' | cut -c 32-`
16+
if echo "$TITLE" | grep '"Minecraft"'; then
17+
#If minecraft is being played via my launch script (which displays the usename in the titlebar of the shell)
18+
#Log that instead of the active window's title
19+
MINE=`xdotool search --title 'minecraft being played by\:'`
20+
if [ -n "$MINE" ]; then
21+
#If we can't figure out which user, just log "Minecraft"
22+
TITLE=`xwininfo -id $MINE | grep 'xwininfo:' | cut -c 32-`
23+
fi
24+
#This command lists the tabs that have been opened in the current firefox session.
25+
#grep -Eo '"entries":\[{"url":"[^"]*"' /home/jgilmore/.mozilla/firefox/*.default/sessionstore.js | sed 's/^.*:"//; s/"$//'
26+
#Saved here for possible future reference
27+
fi
28+
logger -t activitylog -p local4.info -- "$TITLE"
1829
fi
1930

2031

0 commit comments

Comments
 (0)