nautilus_scripts 0.0.2

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 +7 -0
  2. data/lib/nautilus_scripts.rb +49 -0
  3. metadata +44 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 347415f99c5045f394b9618cff1bec51f037f884
4
+ data.tar.gz: d3e8c763d1d4a12612af94143c47874c129cedf5
5
+ SHA512:
6
+ metadata.gz: e175b4c4a9cb4f4c182e5ea267a3b5fc2d9d6975998851b47b11050cd8a1050e679c9694555cf25ed7a4d05a920822e988cd6224f627a713fc9bba75c78842fd
7
+ data.tar.gz: 5b7f6d164926ed04f0fc50e93b206802461acb7728a64f3cf1bf58aa0f1ed590292a16542ffb8cb16b76ffb450d6f1ed4124796e677893bc827adedf146898ee
@@ -0,0 +1,49 @@
1
+
2
+ module Nautilus
3
+ class Scripts
4
+ include Enumerable
5
+
6
+ def initialize(items=nil)
7
+ @items = []
8
+ Scripts.selected_uris(items).each { |item|
9
+ @items << defile(item)
10
+ }
11
+ end
12
+
13
+ def defile(item)
14
+ item.sub(/^file:\/\//, "").gsub(/%20/, " ")
15
+ end
16
+
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
+ def self.current_uri(default="")
22
+ ENV['NAUTILUS_SCRIPT_CURRENT_URI']||default
23
+ end
24
+
25
+ def self.selected_file_paths(default="")
26
+ (ENV['NAUTILUS_SCRIPT_SELECTED_FILE_PATHS']||default).split(/\n/)
27
+ end
28
+
29
+ def self.selected_uris(default="")
30
+ (ENV['NAUTILUS_SCRIPT_SELECTED_URIS']||default).split(/\n/)
31
+ end
32
+
33
+ def self.window_geometry(default="")
34
+ geo=ENV['NAUTILUS_SCRIPT_WINDOW_GEOMETRY']||default
35
+ m=geo.match(/(?<w>\d+)x(?<h>\d+)\+(?<x>\d+)\+(?<y>\d+)/)
36
+ h={}
37
+ [:x, :y, :w, :h].each { |k|
38
+ h[k]=m.nil? ? nil : m[k]
39
+ }
40
+ return h
41
+ end
42
+
43
+ def each(&block)
44
+ @items.each { |item|
45
+ block.call(item)
46
+ }
47
+ end
48
+ end
49
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nautilus_scripts
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Steeve McCauley
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-12-03 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple hello world gem
14
+ email: steeve@oneguycoding.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/nautilus_scripts.rb
20
+ homepage: http://rubygems.org/gems/nautilus
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.5.1
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: gnome nautilus scripts
44
+ test_files: []