Class: Swm::ResizeCommand
- Inherits:
-
Object
- Object
- Swm::ResizeCommand
- Defined in:
- lib/swm/commands/resize_command.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ ResizeCommand
constructor
A new instance of ResizeCommand.
- #run ⇒ Object
Constructor Details
#initialize(options) ⇒ ResizeCommand
Returns a new instance of ResizeCommand.
30 31 32 |
# File 'lib/swm/commands/resize_command.rb', line 30 def initialize() @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
28 29 30 |
# File 'lib/swm/commands/resize_command.rb', line 28 def @options end |
Class Method Details
.print_help ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/swm/commands/resize_command.rb', line 10 def self.print_help puts <<-EOF Usage: swm resize <options> Options: --x: X-coord of top-left corner in percent of screen --y: Y-ccord of top-left corner in percent of screen --width: Width in percent of screen --height: Height in percent of screen --left: (Optional) Sets a left margin of the screen --right: (Optional) Sets a right margin of the screen --top: (Optional) Sets a top margin of the screen --bottom: (Optional) Sets a bottom margin of the screen Examples: Make window fill 80 percent of screen in each dimension with a 10 percent margin: swm resize --x 10 --y 10 --width 80 --height 80 EOF end |
.run(options) ⇒ Object
6 7 8 |
# File 'lib/swm/commands/resize_command.rb', line 6 def self.run() new().run end |
Instance Method Details
#run ⇒ Object
34 35 36 37 38 39 |
# File 'lib/swm/commands/resize_command.rb', line 34 def run screen_dimensions = Screen.dimensions rect = [0, 0, screen_dimensions[0], screen_dimensions[1]] set_offset(rect) resize_in_rect(rect) end |