Class: Fusuma::Plugin::Executors::WmctrlExecutor
- Inherits:
-
Executor
- Object
- Executor
- Fusuma::Plugin::Executors::WmctrlExecutor
- Defined in:
- lib/fusuma/plugin/executors/wmctrl_executor.rb
Overview
Control Window or Workspaces by executing wctrl
Defined Under Namespace
Instance Method Summary collapse
-
#executable?(event) ⇒ TrueClass, FalseClass
check executable.
-
#execute(event) ⇒ nil
execute wmctrl command.
- #search_command(event) ⇒ String, NilClass
Instance Method Details
#executable?(event) ⇒ TrueClass, FalseClass
check executable
26 27 28 29 30 |
# File 'lib/fusuma/plugin/executors/wmctrl_executor.rb', line 26 def executable?(event) event.tag.end_with?('_detector') && event.record.type == :index && search_command(event) end |
#execute(event) ⇒ nil
execute wmctrl command
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fusuma/plugin/executors/wmctrl_executor.rb', line 11 def execute(event) return if search_command(event).nil? MultiLogger.info(wmctrl: search_command(event)) pid = fork do Process.daemon(true) exec(search_command(event)) end Process.detach(pid) end |
#search_command(event) ⇒ String, NilClass
35 36 37 |
# File 'lib/fusuma/plugin/executors/wmctrl_executor.rb', line 35 def search_command(event) search_workspace_command(event) || search_window_command(event) end |