class Swm::MoveCommand

Attributes

options[R]

Public Class Methods

new(options) click to toggle source
# File lib/swm/commands/move_command.rb, line 27
def initialize(options)
  @options = options
end
print_help() click to toggle source
run(options) click to toggle source
# File lib/swm/commands/move_command.rb, line 6
def self.run(options)
  new(options).run
end

Public Instance Methods

run() click to toggle source
# File lib/swm/commands/move_command.rb, line 31
def run
  x_percent = options[:x]
  y_percent = options[:y]

  screen_dimensions = Screen.dimensions
  window = Swm::Window.current

  x = ((screen_dimensions[0] - window.width) * x_percent / 100.0).to_i
  y = ((screen_dimensions[1] - window.height) * y_percent / 100.0).to_i

  window.move x, y
end