colszowka-window_resizer 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -1 +1,54 @@
1
- Todooo
1
+ h1. Window Resizer
2
+
3
+ This is a tool for resizing and positioning the active window in the X window system.
4
+
5
+ h2. Usage
6
+ <code>$ sudo gem install colszowka-window_resizer</code>
7
+
8
+ Please note that you need to have the <code>wmctrl</code> package installed. On Debian-based systems, installing can be done with <code>sudo apt-get install wmctrl</code>
9
+
10
+ For a list of available commands, type:
11
+ <code>$ resize_current_window --help</code>
12
+
13
+ h2. Examples
14
+
15
+ Place window in the center of the screen, using 85% of available height and width (a.k.a. defaults):
16
+ <code>resize_current_window</code>
17
+
18
+ Place window at the left screen border, make it use full height and half width:
19
+ <code>resize_current_window --left -x 0.5 -y 1.0</code>
20
+
21
+ Place window in the upper right corner, make it use 50% height and width:
22
+ <code>resize_current_window --top -x 0.5 -y 0.5</code>
23
+
24
+ Place window in the upper right corner, make it use 50% height and width:
25
+ <code>resize_current_window --top -x 0.5 -y 0.5</code>
26
+
27
+ Place window in the lower right corner, make it use 50% height and width:
28
+ <code>resize_current_window --bottom -x 0.5 -y 0.5</code>
29
+
30
+ Place window centered at the bottom of the screen, make it use 50% height and 100% width:
31
+ <code>resize_current_window --bottom -x 1.0 -y 0.5</code>
32
+
33
+ h2. Keybindings in Gnome
34
+
35
+ On my machines, I have the following key bindings set up:
36
+ <pre>
37
+ # Window resizer keybindings
38
+ gconftool-2 --set /apps/metacity/keybinding_commands/command_9 --type string "/usr/bin/resize_current_window"
39
+ gconftool-2 --set /apps/metacity/global_keybindings/run_command_9 --type string "<Alt><Shift>Down"
40
+ gconftool-2 --set /apps/metacity/keybinding_commands/command_10 --type string "/usr/bin/resize_current_window --left -x 0.55 -y 1.0"
41
+ gconftool-2 --set /apps/metacity/global_keybindings/run_command_10 --type string "<Alt><Shift>Left"
42
+ gconftool-2 --set /apps/metacity/keybinding_commands/command_11 --type string "/usr/bin/resize_current_window --right --top -x 0.44 -y 0.45"
43
+ gconftool-2 --set /apps/metacity/global_keybindings/run_command_11 --type string "<Alt><Shift>Up"
44
+ gconftool-2 --set /apps/metacity/keybinding_commands/command_12 --type string "/usr/bin/resize_current_window --right --bottom -x 0.44 -y 0.45"
45
+ gconftool-2 --set /apps/metacity/global_keybindings/run_command_12 --type string "<Alt><Shift>Right"
46
+ </pre>
47
+
48
+ You can run this set of commands in your command line (CAUTION: this will overwrite existing keybindings for the named commands!), and afterwards will be able to "tile" your current screen using <code><Alt><Shift>(Down|Left|Up|Right)</code>. Feel free to customize the settings to your needs :)
49
+
50
+ To learn about keybindings in Gnome with <code>gconf-editor</code>, you can also have a look at: http://www.linuxformat.co.uk/wiki/index.php/Setting_Key_Bindings_in_GNOME
51
+
52
+ h2. Copyright
53
+
54
+ window_resizer is Copyright &copy; 2009 Christoph Olszowka, It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
@@ -11,8 +11,6 @@ opt_parser = OptionParser.new do |opts|
11
11
 
12
12
  opts.on("-x X", "--width-ratio X", Float, "Resize ratio for window width relative to screen resolution. Defaults to 0.85") do |x|
13
13
  options[:resize_factors][:x] = x
14
- # Fall back to default
15
- options[:resize_factors][:x] ||= 0.85
16
14
  # Show error if resize ratio is invalid
17
15
  if options[:resize_factors][:x] < 0.1 or options[:resize_factors][:x] > 1.0
18
16
  raise OptionParser::InvalidArgument, "Width resize ratio must be > 0.1 and <= 1.0"
@@ -21,8 +19,6 @@ opt_parser = OptionParser.new do |opts|
21
19
 
22
20
  opts.on("-y X", "--height-ratio X", Float, "Resize ratio for window height relative to screen resolution. Defaults to 0.85") do |y|
23
21
  options[:resize_factors][:y] = y
24
- # Fall back to default
25
- options[:resize_factors][:y] ||= 0.85
26
22
  # Show error if resize ratio is invalid
27
23
  if options[:resize_factors][:y] < 0.1 or options[:resize_factors][:y] > 1.0
28
24
  raise OptionParser::InvalidArgument, "Height resize ratio must be > 0.1 and <= 1.0"
@@ -45,6 +41,9 @@ opt_parser = OptionParser.new do |opts|
45
41
  # Fall back to centered positions of none given
46
42
  options[:positions][:x] ||= :center
47
43
  options[:positions][:y] ||= :center
44
+ # Fall back to defaults for resize factors if none given
45
+ options[:resize_factors][:x] ||= 0.85
46
+ options[:resize_factors][:y] ||= 0.85
48
47
  end
49
48
 
50
49
  # Parse options and exit on failure
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colszowka-window_resizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Olszowka