aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgtk3/wf-clock21
1 files changed, 13 insertions, 8 deletions
diff --git a/gtk3/wf-clock b/gtk3/wf-clock
index c4263ad..b63be33 100755
--- a/gtk3/wf-clock
+++ b/gtk3/wf-clock
@@ -106,8 +106,7 @@ Thread.start do
0, 65536, false, Xlib::AnyPropertyType,
type, format, nitems, after, data)
if status != 0
- warn "XGetWindowProperty(_NET_WM_STATE) failed for xwindow #{xwindow}"
- return false
+ raise "XGetWindowProperty(_NET_WM_STATE) failed for xwindow #{xwindow}"
end
nitems.read_ulong.times.any? { |i|
@@ -123,7 +122,7 @@ Thread.start do
walk_xwindows.call { |xwindow|
# Warframe's main window should have the following properties:
# - WM_ICON_NAME(STRING) = "Warframe"
- # - WM_NAME(STRING) = "Warframe"
+ # - _NET_WM_NAME(STRING) = "Warframe"
match = [
["_NET_WM_NAME", "Warframe"],
@@ -155,16 +154,22 @@ Thread.start do
nil
}
- while true
- xwin = wf_xwindow.()
- if !xwin || xwindow_is_hidden.(xwin)
+ xwin = nil
+ loop do
+ xwin ||= wf_xwindow.() or (sleep 10 and redo)
+
+ if xwindow_is_hidden.(xwin)
window.iconify
else
x, y, w, h = xwindow_bound.(xwin)
- margin = 20
window.deiconify
- window.move(x + margin, y + h - window.size[1] - margin)
+ window.move(x + 10, y + h - window.size[1] - 30)
end
+ rescue
+ warn $!
+ window.iconify
+ xwin = nil
+ ensure
sleep 3
end
end