Class: Fusuma::Plugin::Executors::WmctrlExecutor::Workspace
- Inherits:
-
Object
- Object
- Fusuma::Plugin::Executors::WmctrlExecutor::Workspace
- Includes:
- Singleton
- Defined in:
- lib/fusuma/plugin/executors/wmctrl_executor.rb
Overview
Manage workspace
Instance Attribute Summary collapse
-
#wrap_navigation ⇒ Object
Returns the value of attribute wrap_navigation.
Class Method Summary collapse
-
.configure(wrap_navigation:) ⇒ NilClass
configure properties of the workspace switcher.
- .move_command(direction:) ⇒ Object
-
.next_workspace_num(step:) ⇒ Integer
get next workspace number.
Instance Attribute Details
#wrap_navigation ⇒ Object
Returns the value of attribute wrap_navigation.
97 98 99 |
# File 'lib/fusuma/plugin/executors/wmctrl_executor.rb', line 97 def @wrap_navigation end |
Class Method Details
.configure(wrap_navigation:) ⇒ NilClass
configure properties of the workspace switcher
102 103 104 |
# File 'lib/fusuma/plugin/executors/wmctrl_executor.rb', line 102 def configure(wrap_navigation:) instance. = end |
.move_command(direction:) ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/fusuma/plugin/executors/wmctrl_executor.rb', line 124 def move_command(direction:) workspace_num = case direction when 'next' next_workspace_num(step: 1) when 'prev' next_workspace_num(step: -1) else raise "#{direction} is invalid key" end "wmctrl -s #{workspace_num}" end |
.next_workspace_num(step:) ⇒ Integer
get next workspace number
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/fusuma/plugin/executors/wmctrl_executor.rb', line 108 def next_workspace_num(step:) current_workspace_num, total_workspace_num = workspace_values next_workspace_num = current_workspace_num + step return next_workspace_num unless instance. if next_workspace_num.negative? next_workspace_num = total_workspace_num - 1 elsif next_workspace_num >= total_workspace_num next_workspace_num = 0 else next_workspace_num end end |