ampv 1.2.0 → 1.2.1
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.
- checksums.yaml +4 -4
- data/lib/ampv.rb +9 -8
- data/lib/ampv/config.rb +16 -16
- data/lib/ampv/playlist.rb +1 -1
- data/lib/ampv/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 943c6cc8f359174b3bf8d5c51c38761dacf1523b
|
4
|
+
data.tar.gz: 8a2c814830826c6c8f3c698bd1f8ec0ab7a1cde5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 081a7c98b93fad0f3604c8f1de457b9966477562941db6093954a1dffd5749fa9e3dd4eb7ea8bafa17e32a42b95c8d86e3c50061e2ce0fd383cc94f816b8c928
|
7
|
+
data.tar.gz: 3bed50ec7e8b7b2150321d2a7970c6eca6069de872869cc854c1b052658e31e77d7f2036ff066d348ec11cee5cb36f21f4a12b4edec14c154455e504ed62be5b
|
data/lib/ampv.rb
CHANGED
@@ -163,12 +163,10 @@ module Ampv
|
|
163
163
|
end
|
164
164
|
|
165
165
|
def handle_mouse_event(e)
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
end
|
171
|
-
mouse_cursor_timeout
|
166
|
+
button = e.event_type == Gdk::Event::SCROLL ? WHEEL_BUTTONS[e.direction] : e.button
|
167
|
+
return if Config["mouse_bindings"][e.event_type].nil?
|
168
|
+
process_cmd(Config["mouse_bindings"][e.event_type][button])
|
169
|
+
mouse_cursor_timeout(true)
|
172
170
|
end
|
173
171
|
|
174
172
|
def handle_keyboard_event(e)
|
@@ -182,11 +180,14 @@ module Ampv
|
|
182
180
|
end
|
183
181
|
end
|
184
182
|
|
185
|
-
def mouse_cursor_timeout
|
186
|
-
window.set_cursor(nil)
|
183
|
+
def mouse_cursor_timeout(mevent = false)
|
187
184
|
GLib::Source.remove(@cursor_timeout) if @cursor_timeout
|
185
|
+
window.set_cursor(nil)
|
188
186
|
@cursor_timeout = GLib::Timeout.add(1000) {
|
189
187
|
window.set_cursor(Gdk::Cursor.new(Gdk::Cursor::BLANK_CURSOR)) unless @mpv.is_paused
|
188
|
+
# hacky workaround when called after a mouse event
|
189
|
+
# without this the cursor is still shown when it should not be.
|
190
|
+
Gdk::Display.default.warp_pointer(*Gdk::Display.default.pointer[0..2]) if mevent
|
190
191
|
false
|
191
192
|
}
|
192
193
|
end
|
data/lib/ampv/config.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module Ampv
|
2
2
|
class Config
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
CONFIG_FILE = "#{(ENV["XDG_CONFIG_HOME"] || "#{Dir.home}/.config")}/ampv.conf"
|
5
|
+
INPUT_CONFIG = File.exists?("#{Dir.home}/.mpv/input.conf") ?
|
6
6
|
"#{Dir.home}/.mpv/input.conf" : File.expand_path("../../../input.conf", __FILE__)
|
7
|
-
|
7
|
+
KEY_NAMES = {
|
8
8
|
"esc" => "Escape",
|
9
9
|
"space" => "space",
|
10
10
|
"right" => "Right",
|
@@ -18,8 +18,7 @@ module Ampv
|
|
18
18
|
"ins" => "Insert",
|
19
19
|
"del" => "Delete",
|
20
20
|
}
|
21
|
-
|
22
|
-
@@defaults = {
|
21
|
+
DEFAULTS = {
|
23
22
|
"width" => Gdk::Screen.default.width > 1280 ? 1280 : 853,
|
24
23
|
"height" => Gdk::Screen.default.width > 1280 ? 726 : 486,
|
25
24
|
"x" => -1,
|
@@ -42,20 +41,21 @@ module Ampv
|
|
42
41
|
"key_bindings" => [ ],
|
43
42
|
"mouse_bindings" => [ ]
|
44
43
|
}
|
44
|
+
@@config = { }
|
45
45
|
|
46
46
|
def self.load
|
47
|
-
if File.exists?(
|
48
|
-
File.readlines(
|
47
|
+
if File.exists?(CONFIG_FILE)
|
48
|
+
File.readlines(CONFIG_FILE).each { |line|
|
49
49
|
key, _, val = line.partition("=")
|
50
50
|
key.strip!
|
51
51
|
val.strip!
|
52
|
-
next unless
|
52
|
+
next unless DEFAULTS.has_key?(key) and key[0] != "#"
|
53
53
|
|
54
|
-
if
|
54
|
+
if DEFAULTS[key].is_a?(Integer)
|
55
55
|
val = val.to_i
|
56
|
-
elsif
|
56
|
+
elsif DEFAULTS[key].is_a?(TrueClass) or DEFAULTS[key].is_a?(FalseClass)
|
57
57
|
val = val == "true"
|
58
|
-
elsif
|
58
|
+
elsif DEFAULTS[key].is_a?(Gdk::Color)
|
59
59
|
begin
|
60
60
|
val = Gdk::Color.parse(val)
|
61
61
|
rescue
|
@@ -78,8 +78,8 @@ module Ampv
|
|
78
78
|
# load input config
|
79
79
|
self["mouse_bindings"] = [ ]
|
80
80
|
self["key_bindings"] = [ ]
|
81
|
-
if File.exists?(
|
82
|
-
File.readlines(
|
81
|
+
if File.exists?(INPUT_CONFIG)
|
82
|
+
File.readlines(INPUT_CONFIG).each { |line|
|
83
83
|
line.strip!
|
84
84
|
if line.start_with?("MOUSE_BTN")
|
85
85
|
# 4 = up, 5 = down, 6 = left, 7 = right
|
@@ -91,7 +91,7 @@ module Ampv
|
|
91
91
|
self["mouse_bindings"][type][button] = cmd
|
92
92
|
elsif !line.empty?
|
93
93
|
key, cmd = line.match(/^([^\s]+)\s+(.+)$/).captures
|
94
|
-
if name =
|
94
|
+
if name = KEY_NAMES[key.downcase]
|
95
95
|
keyval = Gdk::Keyval.from_name(name)
|
96
96
|
else
|
97
97
|
keyval = Gdk::Keyval.from_name(key)
|
@@ -104,7 +104,7 @@ module Ampv
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def self.[](key)
|
107
|
-
@@config[key].nil? ?
|
107
|
+
@@config[key].nil? ? DEFAULTS[key] : @@config[key]
|
108
108
|
end
|
109
109
|
|
110
110
|
def self.[]=(key, value)
|
@@ -112,7 +112,7 @@ module Ampv
|
|
112
112
|
end
|
113
113
|
|
114
114
|
def self.save
|
115
|
-
File.open(
|
115
|
+
File.open(CONFIG_FILE, "w") { |file|
|
116
116
|
@@config.each { |k, v| file.puts("#{k}=#{v}") unless k == "key_bindings" or k == "mouse_bindings" }
|
117
117
|
}
|
118
118
|
end
|
data/lib/ampv/playlist.rb
CHANGED
@@ -42,7 +42,7 @@ module Ampv
|
|
42
42
|
vbox.border_width = 10
|
43
43
|
sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)
|
44
44
|
|
45
|
-
@treeview.set_enable_search
|
45
|
+
@treeview.set_enable_search(false)
|
46
46
|
@treeview.set_rubber_banding(true)
|
47
47
|
@treeview.set_reorderable(true)
|
48
48
|
@treeview.set_tooltip_column(0)
|
data/lib/ampv/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ampv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ahoka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gtk2
|
@@ -61,11 +61,11 @@ extra_rdoc_files: []
|
|
61
61
|
files:
|
62
62
|
- LICENSE
|
63
63
|
- input.conf
|
64
|
-
- lib/ampv/
|
64
|
+
- lib/ampv/playlist.rb
|
65
65
|
- lib/ampv/progressbarwidget.rb
|
66
66
|
- lib/ampv/config.rb
|
67
|
-
- lib/ampv/playlist.rb
|
68
67
|
- lib/ampv/version.rb
|
68
|
+
- lib/ampv/mpvwidget.rb
|
69
69
|
- lib/ampv.rb
|
70
70
|
- bin/ampv
|
71
71
|
homepage: https://github.com/ahodesuka/ampv
|