summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-06-04 08:13:22 -0700
committerhut <hut@lavabit.com>2009-06-04 08:13:22 -0700
commit32bacf7b37593027d60ed6318ef71713e42d7f97 (patch)
tree540988a6171c29de825a0107276c890945f92bde
parenta0de7f95bc7525b99b2c2e16f566e0ee367e9c3c (diff)
downloadranger-32bacf7b37593027d60ed6318ef71713e42d7f97.tar.gz
Initial commit
-rw-r--r--ChangeLog9
-rw-r--r--Readme0
-rw-r--r--code/keys.rb29
-rw-r--r--code/types.rb39
-rwxr-xr-xranger.rb (renamed from fm)6
5 files changed, 26 insertions, 57 deletions
diff --git a/ChangeLog b/ChangeLog
index 6c2edddd..f8e1ecd0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,7 +3,8 @@ Version 0.2.1
 2009-05-09  hut
 	Oh no. I neglegted to write change logs... in a nutshell, i changed:
 	New Hotkey: [r]...flags...[r] which runs the selected file with flags
-	like [d] to detach the process or [t] to run it in a seperate terminal
+	like [d] to detach the process or [t] to run it in a seperate terminal.
+	This example would be [r][d][t][r]
 	For that I also changed Action.run()
 
 2009-04-27  hut
@@ -15,8 +16,8 @@ Version 0.2.1
 
 2009-04-18  hut
 	Found reproducable bug which leaves it (after closing) running and using up
-		99% CPU. It happens when the window managers way of closing windows by
-		pressing the X button or pressing Alt+F4 is used to quit.
+		99% CPU. It happens if you close the window by pressing the X button,
+		 the quit hotkey, or whatever.
 	New Hotkeys: [S-TAB] is a shortcut for [`][`] and [TAB] for [`][9]
 	Better distinguishable columns
 	MIME support, allowing sorting by MIME-filetype
@@ -29,7 +30,7 @@ Version 0.2.1
 	Replaced system() calls with cp or mv with the use of FileUtils
 	Modified FileUtils for showing its progress the progressbar
 	Fixed threading problem which made it impossible to stop copying/moving
-	Fixed priority problems, fluent UI while copying.
+	Fixed priority problems, faster UI while copying.
 
 	TODO: enqueue file operations for better performance
 
diff --git a/Readme b/Readme
deleted file mode 100644
index e69de29b..00000000
--- a/Readme
+++ /dev/null
diff --git a/code/keys.rb b/code/keys.rb
index edcbab53..362adb34 100644
--- a/code/keys.rb
+++ b/code/keys.rb
@@ -5,7 +5,7 @@ module Fm
 		g d df y c Z delet cu
 		ter ta S ? ?g ?f :q
 
-		/[m`']/ /[fF/!q].*/
+		/[m`']/ /[fF/!].*/
 		/[ri]\d*\w*[^ri]/
 		/(cw|cd|mv).*/
 		/b(l(o(c(k(.*)?)?)?)?)?/
@@ -166,31 +166,6 @@ module Fm
 		when 'R'
 			@pwd.refresh!
 
-		when '@', '.'
-			if defined? @record
-				@buffer = ''
-				memo = ''
-				@record.each_char do |c|
-					if memo.empty?
-						if c == '<'
-							memo << c
-						else
-							press c
-						end
-					else
-						memo << c
-						if c == '>'
-							press memo
-							memo.clear
-						end
-					end
-				end
-			end
-			
-		when /^q.+q$/
-			@record = @buffer[1...-1]
-			@buffer = ''
-
 		when 'x'
 			@bars.first.kill unless @bars.empty?
 
@@ -567,7 +542,7 @@ module Fm
 #				Action.run(:all=>true)
 #			end
 
-		when 'ZZ', '<c-d>', ':q<cr>'
+		when 'ZZ', '<c-d>', ':q<cr>', 'Q'
 			exit
 			
 		when '<c-r>'
diff --git a/code/types.rb b/code/types.rb
index 96d67d06..adb03219 100644
--- a/code/types.rb
+++ b/code/types.rb
@@ -13,10 +13,10 @@ module Fm
 		str = files.map{|x| x.sh}.join(' ')
 		type = files.first.mimetype
 		name = files.first.basename
-#		mode = hash.mode
+		mode = hash.mode
 
 		use = lambda do |sym|
-			hash.exec = App.send(sym, hash, name, str, files)
+			hash.exec = App.send(sym, mode, name, str, files)
 		end
 
 		case type
@@ -37,8 +37,8 @@ module Fm
 	end
 
 	module App
-		def image(hash, name, str, file)
-			case hash.mode
+		def image(mode, name, str, file)
+			case mode
 			when 4; "feh --bg-scale #{str}"
 			when 5; "feh --bg-tile #{str}"
 			when 6; "feh --bg-center #{str}"
@@ -47,35 +47,27 @@ module Fm
 			else "feh #{str}"
 			end
 		end
-		def evince(hash, name, str, file)
+		def evince(mode, name, str, file)
 			"evince #{str}"
 		end
-		def mplayer(*args)
-			hash = args[0] = args[0].dup
-			str = args[2]
+		def mplayer(mode, name, str, files)
+			rest = name, str, files
 
-			if hash.detach
-				flags = '-msglevel all=-1'
-			else
-				flags = ''
-			end
-
-			case hash.mode
+			case mode
 			when nil
 				if name =~ /720p/
-					hash.mode = 1
+					mplayer(1, *rest)
 				else
-					hash.mode = 0
+					mplayer(0, *rest)
 				end
-				mplayer(*args)
 			when 0
-				return "mplayer #{flags} -fs -sid 0 #{str}"
+				return "mplayer -fs -sid 0 #{str}"
 			when 1
-				return "mplayer #{flags} -vm sdl -sid 0 #{str}"
+				return "mplayer -vm sdl -sid 0 #{str}"
 			end
 		end
-		def zsnes(hash, name, str, files)
-			case hash.mode
+		def zsnes(mode, name, str, files)
+			case mode
 			when 1
 				return "zsnes -ad sdl -o #{str}"
 			else
@@ -136,7 +128,8 @@ module Fm
 			return "aplay -q #{file.sh}"
 
 		when /\.m3u$/i
-			return "/home/hut/bin/loadplaylist #{file.sh}"
+#			return "mpc play #{File.expand_path(file)[13..-1].sh}", false
+			return "/home/hut/bin/loadplaylist.rb #{file.sh}"
 #			return "cmus-remote -c && cmus-remote -P #{file} && cmus-remote -C 'set play_library=false' && sleep 0.3 && cmus-remote -n", false
 
 		end
diff --git a/fm b/ranger.rb
index 5aa8bae3..d98e2f39 100755
--- a/fm
+++ b/ranger.rb
@@ -8,14 +8,14 @@
 LOG_LEVEL = 3
 #LOG_LEVEL = 0
 
+require 'pathname'
 
 def File::resolve_symlink( path = __FILE__ )
-   path = readlink(path) while symlink?(path)
-   expand_path(path)
+	Pathname.new(path).realpath
 end
 
 def require_from_here ( *list )
-   require File.join( FM_DIR, *list )
+	require File.join( FM_DIR, *list )
 end
 
 def fj( *args ) File.join( *args ) end