LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-03-2018, 11:10 AM   #1
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Rep: Reputation: 51
xev output -> meaninful information


I made this human script for something I need to do:

Code:
END key
press and hold LEFT SHIFT
PAGE UP key
release  LEFT SHIFT
CONTEXT-MENU key
'm' key
'm' key
ENTER key
The final aim is to make a shell script to this script above.

I used 'xev' to show what its window received when I did the script in its window, with added comments in red. But most of this output is very strange to me. And I still need to learn how to convert "these xev happened" to "make these xev happen"

May you help me?

Below I have a xev session with the human script given inside it. There is no mouse noise in it - its cursor never passed above XEV window, and the only "mouse" action I did was to click "close" for that window.

Code:
Outer window is 0x5200001, inner window is 0x5200002

PropertyNotify event, serial 8, synthetic NO, window 0x5200001,
    atom 0x27 (WM_NAME), time 1575197383, state PropertyNewValue

PropertyNotify event, serial 9, synthetic NO, window 0x5200001,
    atom 0x22 (WM_COMMAND), time 1575197383, state PropertyNewValue

PropertyNotify event, serial 10, synthetic NO, window 0x5200001,
    atom 0x28 (WM_NORMAL_HINTS), time 1575197383, state PropertyNewValue

CreateNotify event, serial 11, synthetic NO, window 0x5200001,
    parent 0x5200001, window 0x5200002, (10,10), width 50, height 50
border_width 4, override NO

PropertyNotify event, serial 14, synthetic NO, window 0x5200001,
    atom 0x127 (WM_PROTOCOLS), time 1575197383, state PropertyNewValue

MapNotify event, serial 15, synthetic NO, window 0x5200001,
    event 0x5200001, window 0x5200002, override NO

ConfigureNotify event, serial 18, synthetic NO, window 0x5200001,
    event 0x5200001, window 0x5200001, (0,0), width 178, height 178,
    border_width 0, above 0x3244e39, override NO

PropertyNotify event, serial 18, synthetic NO, window 0x5200001,
    atom 0x195 (_NET_WM_ALLOWED_ACTIONS), time 1575197384, state PropertyNewValue

PropertyNotify event, serial 18, synthetic NO, window 0x5200001,
    atom 0x195 (_NET_WM_ALLOWED_ACTIONS), time 1575197384, state PropertyNewValue

ReparentNotify event, serial 18, synthetic NO, window 0x5200001,
    event 0x5200001, window 0x5200001, parent 0xd4a80f,
    (0,0), override NO

PropertyNotify event, serial 18, synthetic NO, window 0x5200001,
    atom 0x12f (_NET_WM_DESKTOP), time 1575197384, state PropertyNewValue

PropertyNotify event, serial 18, synthetic NO, window 0x5200001,
    atom 0x12f (_NET_WM_DESKTOP), time 1575197384, state PropertyNewValue

PropertyNotify event, serial 18, synthetic NO, window 0x5200001,
    atom 0x12c (_NET_FRAME_EXTENTS), time 1575197384, state PropertyNewValue

ConfigureNotify event, serial 18, synthetic NO, window 0x5200001,
    event 0x5200001, window 0x5200001, (1,23), width 178, height 178,
    border_width 0, above 0x0, override NO

PropertyNotify event, serial 18, synthetic NO, window 0x5200001,
    atom 0x158 (WM_STATE), time 1575197384, state PropertyNewValue

PropertyNotify event, serial 18, synthetic NO, window 0x5200001,
    atom 0x135 (_NET_WM_STATE), time 1575197384, state PropertyNewValue

ConfigureNotify event, serial 24, synthetic YES, window 0x5200001,
    event 0x5200001, window 0x5200001, (592,302), width 178, height 178,
    border_width 2, above 0x0, override NO

MapNotify event, serial 24, synthetic NO, window 0x5200001,
    event 0x5200001, window 0x5200001, override NO

VisibilityNotify event, serial 24, synthetic NO, window 0x5200001,
    state VisibilityUnobscured

Expose event, serial 24, synthetic NO, window 0x5200001,
    (0,0), width 178, height 10, count 3

Expose event, serial 24, synthetic NO, window 0x5200001,
    (0,10), width 10, height 58, count 2

Expose event, serial 24, synthetic NO, window 0x5200001,
    (68,10), width 110, height 58, count 1

Expose event, serial 24, synthetic NO, window 0x5200001,
    (0,68), width 178, height 110, count 0

PropertyNotify event, serial 24, synthetic NO, window 0x5200001,
    atom 0x135 (_NET_WM_STATE), time 1575197386, state PropertyNewValue

FocusIn event, serial 24, synthetic NO, window 0x5200001,
    mode NotifyNormal, detail NotifyNonlinear

KeymapNotify event, serial 24, synthetic NO, window 0x0,
    keys:  4294967197 0   0   0   16  0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

PropertyNotify event, serial 24, synthetic NO, window 0x5200001,
    atom 0x135 (_NET_WM_STATE), time 1575197386, state PropertyNewValue

ColormapNotify event, serial 33, synthetic NO, window 0x5200001,
    colormap 0x20, new NO, state ColormapInstalled

PropertyNotify event, serial 33, synthetic NO, window 0x5200001,
    atom 0x18d (_NET_WM_ICON_GEOMETRY), time 1575197406, state PropertyNewValue

PropertyNotify event, serial 34, synthetic NO, window 0x5200001,
    atom 0x18d (_NET_WM_ICON_GEOMETRY), time 1575197430, state PropertyNewValue

KeyRelease event, serial 34, synthetic NO, window 0x5200001,
    root 0xc9, subw 0x0, time 1575197449, (-40,384), root:(554,688),
    state 0x10, keycode 36 (keysym 0xff0d, Return), same_screen YES,
    XLookupString gives 1 bytes: (0d) "
"
    XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x5200001,
    root 0xc9, subw 0x0, time 1575201162, (-40,384), root:(554,688),
    state 0x10, keycode 115 (keysym 0xff57, End), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x5200001,
    root 0xc9, subw 0x0, time 1575201258, (-40,384), root:(554,688),
    state 0x10, keycode 115 (keysym 0xff57, End), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x5200001,
    root 0xc9, subw 0x0, time 1575203578, (-40,385), root:(554,689),
    state 0x10, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x5200001,
    root 0xc9, subw 0x0, time 1575216681, (-40,385), root:(554,689),
    state 0x11, keycode 112 (keysym 0xff55, Prior), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x5200001,
    root 0xc9, subw 0x0, time 1575216777, (-40,385), root:(554,689),
    state 0x11, keycode 112 (keysym 0xff55, Prior), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x5200001,
    root 0xc9, subw 0x0, time 1575218641, (-40,385), root:(554,689),
    state 0x11, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x5200001,
    root 0xc9, subw 0x0, time 1575222753, (-40,385), root:(554,689),
    state 0x10, keycode 135 (keysym 0xff67, Menu), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x5200001,
    root 0xc9, subw 0x0, time 1575222857, (-40,385), root:(554,689),
    state 0x10, keycode 135 (keysym 0xff67, Menu), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x5200001,
    root 0xc9, subw 0x0, time 1575226305, (-40,385), root:(554,689),
    state 0x10, keycode 58 (keysym 0x6d, m), same_screen YES,
    XLookupString gives 1 bytes: (6d) "m"
    XmbLookupString gives 1 bytes: (6d) "m"
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x5200001,
    root 0xc9, subw 0x0, time 1575226385, (-40,385), root:(554,689),
    state 0x10, keycode 58 (keysym 0x6d, m), same_screen YES,
    XLookupString gives 1 bytes: (6d) "m"
    XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x5200001,
    root 0xc9, subw 0x0, time 1575227545, (-40,385), root:(554,689),
    state 0x10, keycode 58 (keysym 0x6d, m), same_screen YES,
    XLookupString gives 1 bytes: (6d) "m"
    XmbLookupString gives 1 bytes: (6d) "m"
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x5200001,
    root 0xc9, subw 0x0, time 1575227625, (-40,385), root:(554,689),
    state 0x10, keycode 58 (keysym 0x6d, m), same_screen YES,
    XLookupString gives 1 bytes: (6d) "m"
    XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x5200001,
    root 0xc9, subw 0x0, time 1575230833, (-40,385), root:(554,689),
    state 0x10, keycode 36 (keysym 0xff0d, Return), same_screen YES,
    XLookupString gives 1 bytes: (0d) "
"
    XmbLookupString gives 1 bytes: (0d) "
"
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x5200001,
    root 0xc9, subw 0x0, time 1575230937, (-40,385), root:(554,689),
    state 0x10, keycode 36 (keysym 0xff0d, Return), same_screen YES,
    XLookupString gives 1 bytes: (0d) "
"
    XFilterEvent returns: False

ClientMessage event, serial 37, synthetic YES, window 0x5200001,
    message_type 0x127 (WM_PROTOCOLS), format 32, message 0x125 (WM_DELETE_WINDOW)
(editing to add comments in the xev output above)
 
Old 09-03-2018, 04:12 PM   #2
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by dedec0 View Post
I made this human script for something I need to do:
That's not much to go on. Caveat: I've really only used xev for finding key codes in cases where I needed to use xmodmap(1) to interface with some oddball keyboard. Take the following with a grain of salt:

I would think that using xev as a means of detecting a keystroke would be one of the harder ways if you're looking to making an interactive graphical script. My first move would be to look at xmessage(1) or, maybe, gxmessage(1). (The latter may not be on your preferred distribution, though. I had to download it separately and compile from source.) Especially if all you need to do is pop up a window to ask for user input---like "which of these options do you want?" [click here, here, or here].

Simple(-minded) example using xmessage:
Code:
#!/bin/bash

xmessage -buttons "Brief list?":1,"Long list?":2 "View files..."
case $? in
   1) ls ;;
   2) ls -l ;;
   *) echo "Oops! Something odd occurred (rc=$?)."
esac
There's also wish(1) but, if memory serves, you might need to be writing Tcl scripts to use that.

Hope this helps.

Last edited by rnturn; 09-03-2018 at 04:16 PM.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
keyboard issue: no xev output on keypress... masavini Linux - Hardware 4 05-30-2012 02:21 AM
no output from xev, can I still remap? Asido Linux - Newbie 4 01-11-2012 11:04 AM
detailed information about mdadm output bertl1982 Linux - General 3 01-11-2010 05:00 AM
Redirecting output from XEV 3saul Linux - Software 1 02-26-2006 01:14 PM
A very small but meaninful success....... slightcrazed LinuxQuestions.org Member Success Stories 3 11-18-2003 09:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration