nautilus_scripts 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nautilus_scripts.rb +15 -8
  3. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 347415f99c5045f394b9618cff1bec51f037f884
4
- data.tar.gz: d3e8c763d1d4a12612af94143c47874c129cedf5
3
+ metadata.gz: 1b6aee57620c0e7a515e7c1e03aa5ba0bce527bf
4
+ data.tar.gz: db098d058f7a7cedc58a341f77f9cc535e57fea7
5
5
  SHA512:
6
- metadata.gz: e175b4c4a9cb4f4c182e5ea267a3b5fc2d9d6975998851b47b11050cd8a1050e679c9694555cf25ed7a4d05a920822e988cd6224f627a713fc9bba75c78842fd
7
- data.tar.gz: 5b7f6d164926ed04f0fc50e93b206802461acb7728a64f3cf1bf58aa0f1ed590292a16542ffb8cb16b76ffb450d6f1ed4124796e677893bc827adedf146898ee
6
+ metadata.gz: 8bd9113e7dc6334d13312cb09e0d5d39a11d3cc97365217bd5cbbe6c0f15d16a7eaa4721716501f5b965182d759072984f0e705ec9104ec6fddb76a89a8bbfd8
7
+ data.tar.gz: bda781cc758fc493e21936299b20c2f0648c1fa2ada10c375b0bfe4f6cf8e9c07883a0b4c082b0510cbc8c5efa2c5cefed57889a1b76a57a9fb7f1c069715231
@@ -1,5 +1,8 @@
1
1
 
2
2
  module Nautilus
3
+ GEOMETRY_RE=/(?<w>\d+)x(?<h>\d+)\+(?<x>\d+)\+(?<y>\d+)/
4
+ GEOMETRY_KEYS=[:x, :y, :w, :h]
5
+
3
6
  class Scripts
4
7
  include Enumerable
5
8
 
@@ -10,33 +13,37 @@ module Nautilus
10
13
  }
11
14
  end
12
15
 
16
+ # Convert file URI to filesystem path
13
17
  def defile(item)
14
18
  item.sub(/^file:\/\//, "").gsub(/%20/, " ")
15
19
  end
16
20
 
17
- #NAUTILUS_SCRIPT_CURRENT_URI=file:///home/tmp/steeve/nexus_5/links/20161202/Internal%20shared%20storage/DCIM/Camera
18
- #NAUTILUS_SCRIPT_SELECTED_FILE_PATHS='/home/tmp/steeve/nexus_5/links/20161202/Internal shared storage/DCIM/Camera/IMG_20131122_111539.jpg
19
- #NAUTILUS_SCRIPT_SELECTED_URIS='file:///home/tmp/steeve/nexus_5/links/20161202/Internal%20shared%20storage/DCIM/Camera/IMG_20131122_111539.jpg
20
- #NAUTILUS_SCRIPT_WINDOW_GEOMETRY=1540x808+26+23
21
+ # Convert filesystem path to file URI
22
+ def refile(item)
23
+ item.sub(/^/, "file://").gsub(/\s/, "%20")
24
+ end
25
+
26
+ #NAUTILUS_SCRIPT_CURRENT_URI=file:///home/tmp/bjs/nexus_5/links/20161202/Internal%20shared%20storage/DCIM/Camera
21
27
  def self.current_uri(default="")
22
28
  ENV['NAUTILUS_SCRIPT_CURRENT_URI']||default
23
29
  end
24
30
 
31
+ #NAUTILUS_SCRIPT_SELECTED_FILE_PATHS='/home/tmp/bjs/nexus_5/links/20161202/Internal shared storage/DCIM/Camera/IMG_20131122_111539.jpg
25
32
  def self.selected_file_paths(default="")
26
33
  (ENV['NAUTILUS_SCRIPT_SELECTED_FILE_PATHS']||default).split(/\n/)
27
34
  end
28
35
 
36
+ #NAUTILUS_SCRIPT_SELECTED_URIS='file:///home/tmp/bjs/nexus_5/links/20161202/Internal%20shared%20storage/DCIM/Camera/IMG_20131122_111539.jpg
29
37
  def self.selected_uris(default="")
30
38
  (ENV['NAUTILUS_SCRIPT_SELECTED_URIS']||default).split(/\n/)
31
39
  end
32
40
 
41
+ #NAUTILUS_SCRIPT_WINDOW_GEOMETRY=1540x808+26+23
33
42
  def self.window_geometry(default="")
34
43
  geo=ENV['NAUTILUS_SCRIPT_WINDOW_GEOMETRY']||default
35
- m=geo.match(/(?<w>\d+)x(?<h>\d+)\+(?<x>\d+)\+(?<y>\d+)/)
44
+ m=geo.match(GEOMETRY_RE)
36
45
  h={}
37
- [:x, :y, :w, :h].each { |k|
38
- h[k]=m.nil? ? nil : m[k]
39
- }
46
+ [:x, :y, :w, :h].map { |k| h[k]=m.nil? ? nil : m[k] }
40
47
  return h
41
48
  end
42
49
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nautilus_scripts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steeve McCauley
@@ -10,7 +10,8 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2016-12-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: A simple hello world gem
13
+ description: class for nautilus scripts to manipulate files selected in the filemanager
14
+ in the scripts directory (~/.local/share/nautilus/scripts)
14
15
  email: steeve@oneguycoding.com
15
16
  executables: []
16
17
  extensions: []