lib/fusuma/plugin/wmctrl/workspace.rb in fusuma-plugin-wmctrl-1.3.0 vs lib/fusuma/plugin/wmctrl/workspace.rb in fusuma-plugin-wmctrl-1.3.1
- old
+ new
@@ -51,11 +51,11 @@
executors:
wmctrl_executor:
matrix-col-size: 2
```
ERRRORMESSAGE
- raise MissingMatrixOption, 'You need to set matrix option to config.yml'
+ raise MissingMatrixOption, "You need to set matrix option to config.yml"
end
# @return [Integer]
# @raise RuntimeError
def next_workspace_num_for_matrix(direction:)
@@ -63,35 +63,35 @@
current_workspace_num, total_workspace_num = workspace_values
row_size, col_size = matrix_size(total_workspace_num)
x = current_workspace_num % col_size
y = current_workspace_num / col_size
case direction
- when 'right'
+ when "right"
if x < col_size - 1
current_workspace_num + 1
elsif @wrap_navigation
current_workspace_num - (col_size - 1)
else
current_workspace_num
end
- when 'left'
+ when "left"
if x.positive?
current_workspace_num - 1
elsif @wrap_navigation
current_workspace_num + (col_size - 1)
else
current_workspace_num
end
- when 'down'
+ when "down"
if y < row_size - 1
current_workspace_num + col_size
elsif @wrap_navigation
(current_workspace_num + col_size) - total_workspace_num
else
current_workspace_num
end
- when 'up'
+ when "up"
if y.positive?
current_workspace_num - col_size
elsif @wrap_navigation
total_workspace_num + (current_workspace_num - col_size)
else
@@ -102,34 +102,34 @@
end
end
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
+ 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
def move_command_for_matrix(direction:)
workspace_num = next_workspace_num_for_matrix(direction: direction)
"wmctrl -s #{workspace_num}"
end
def move_window_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
+ when "next"
+ next_workspace_num(step: 1)
+ when "prev"
+ next_workspace_num(step: -1)
+ else
+ raise "#{direction} is invalid key"
+ end
"wmctrl -r :ACTIVE: -t #{workspace_num} ; wmctrl -s #{workspace_num}"
end
def move_window_command_for_matrix(direction:)
workspace_num = next_workspace_num_for_matrix(direction: direction)
@@ -147,10 +147,10 @@
# NOTE: stderror when failed to get desktop
# `Cannot get current desktop properties. \
# (_NET_CURRENT_DESKTOP or _WIN_WORKSPACE property)`
return [0, 1] if current_line.nil?
- current_workspace_num = current_line.chars.first.to_i
+ current_workspace_num = current_line[0].to_i
total_workspace_num = wmctrl_output.length
[current_workspace_num, total_workspace_num]
end
end