module Vigilem::X11::TerminalWindowUtils
Public Instance Methods
window_id()
click to toggle source
gets the id of the window that spawned this ruby process @return [Integer]
# File lib/vigilem/x11/terminal_window_utils.rb, line 16 def window_id return (env = to_i!(ENV['WINDOWID'])) if env curr_pid = Process.pid until curr_pid.to_i < 2 file = environ_file(curr_pid) if file and (xid = to_i!(file.read.scan(/(?<=WINDOWID=)\d+/)[0])) return xid else curr_pid = ppid_of(curr_pid) end end end