-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathxpop
executable file
·70 lines (62 loc) · 2.13 KB
/
xpop
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
# A wrapper around xprop to easily get class, name and other useful properties
# of windows. Has support for awesomeWM, if awesome-client is installed.
# First get the window id. That's not so easy with xprop.
# (also available through ./get-xwindow-pid).
windowid=$(xwininfo -int | sed -n '/^xwininfo: Window id: / { s/xwininfo: Window id: //; s/ .*//p }')
# Get interesting props from xprop.
xprop=$(xprop -id $windowid _NET_WM_PID WM_CLASS WM_NAME WM_WINDOW_ROLE \
WM_TRANSIENT_FOR _NET_WM_WINDOW_TYPE _NET_WM_STATE)
windowpid="$(get-xwindow-pid "$windowid")"
set -x
# Get interesting props from awesome-client.
if hash awesome-client 2>/dev/null; then
awesome_info=$(cat <<EOF |
local get_tag_names = function(c)
local names={}, t
for _,t in ipairs(c:tags()) do
table.insert(names, t.name)
end
return table.concat(names, ", ")
end
for idx,c in ipairs(client.get()) do
if c.window == $windowid then
local r = ""
for _,p in pairs({"class", "name", "instance", "border_width",
"type", "sticky", "ontop", "screen.index", "screen.outputs", "tags",
"type", "border_color", "urgent", "window", "floating",
"_implicitly_floating", "maximized", "fullscreen", "fixed",
"transient_for", "x", "y", "height", "width"}) do
local v
if p == "tags" then
v = get_tag_names(c)
elseif p == "screen.index" then
v = c.screen.index
elseif p == "screen.outputs" then
v = table.concat(c.screen.outputs, ', ')
-- elseif type(c[p]) == "function" then
-- v = c[p](c)
else
v = c[p]
end
r = r .. p .. ": " .. tostring(v) .. "\n"
end
r = r .. "client.get idx: " .. tostring(idx) .. "\n"
return "\n" .. r .. "\n"
end
end
EOF
awesome-client | sed '1d; $d')
fi
text="winid: $windowid
---
$xprop
---
$awesome_info"
if [ -n "$windowpid" ]; then
text="$text
---
pstree: $(pstree -apus "$windowpid")"
fi
# zenity --info --no-markup --text "$text"
zenity --width=800 --info --text "<span font=\"8\">$text</span>"