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
Instance Method Summary collapse
- #config_param_types ⇒ Object
-
#executable?(event) ⇒ TrueClass, FalseClass
check executable.
-
#execute(event) ⇒ nil
execute wmctrl command.
-
#execute_keys ⇒ Array<Symbol>
executor properties on config.yml.
-
#initialize ⇒ WmctrlExecutor
constructor
A new instance of WmctrlExecutor.
- #search_command(event) ⇒ String, NilClass
Constructor Details
#initialize ⇒ WmctrlExecutor
Returns a new instance of WmctrlExecutor.
24 25 26 27 28 29 30 31 |
# File 'lib/fusuma/plugin/executors/wmctrl_executor.rb', line 24 def initialize super() @workspace = Wmctrl::Workspace.new( wrap_navigation: config_params(:'wrap-navigation'), matrix_col_size: config_params(:'matrix-col-size') ) @window = Wmctrl::Window.new end |
Instance Method Details
#config_param_types ⇒ Object
17 18 19 20 21 22 |
# File 'lib/fusuma/plugin/executors/wmctrl_executor.rb', line 17 def config_param_types { 'wrap-navigation': [TrueClass, FalseClass], 'matrix-col-size': [Integer] } end |
#executable?(event) ⇒ TrueClass, FalseClass
check executable
47 48 49 50 51 |
# File 'lib/fusuma/plugin/executors/wmctrl_executor.rb', line 47 def executable?(event) event.tag.end_with?('_detector') && event.record.type == :index && search_command(event) end |
#execute(event) ⇒ nil
execute wmctrl command
36 37 38 39 40 41 42 |
# File 'lib/fusuma/plugin/executors/wmctrl_executor.rb', line 36 def execute(event) return if search_command(event).nil? MultiLogger.info(wmctrl: search_command(event)) pid = Process.spawn(search_command(event)) Process.detach(pid) end |
#execute_keys ⇒ Array<Symbol>
executor properties on config.yml
13 14 15 |
# File 'lib/fusuma/plugin/executors/wmctrl_executor.rb', line 13 def execute_keys %i[workspace window] end |
#search_command(event) ⇒ String, NilClass
56 57 58 59 60 61 |
# File 'lib/fusuma/plugin/executors/wmctrl_executor.rb', line 56 def search_command(event) search_workspace_command(event) || search_window_command(event) rescue Workspace::InvalidOption => e MultiLogger.error(e.) exit 1 end |