mirror of
https://github.com/k0kubun/xremap
synced 2024-11-08 01:10:28 +00:00
26 lines
509 B
Ruby
26 lines
509 B
Ruby
module Xkremap
|
|
class ActiveWindow
|
|
# @param [Fixnum] current_window
|
|
attr_reader :current_window
|
|
|
|
# @param [Xkremap::Display] display
|
|
def initialize(display)
|
|
@display = display
|
|
@current_window = fetch_active_window
|
|
end
|
|
|
|
def changed?
|
|
next_window = fetch_active_window
|
|
@current_window != next_window
|
|
ensure
|
|
@current_window = next_window
|
|
end
|
|
|
|
private
|
|
|
|
def fetch_active_window
|
|
XlibWrapper.fetch_active_window(@display)
|
|
end
|
|
end
|
|
end
|