rtfm-filemanager 1.5.6 → 1.6.0

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/bin/rtfm +55 -31
  3. metadata +3 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f0131adea235fd4c83591da8e250a7eeca1cc35b0941e23c5372fd35a33caa8
4
- data.tar.gz: 52b1b04410ec57b95517e26d50c03cec83ca22c9aa21c87cb496a7b26ac689a3
3
+ metadata.gz: 4c3a3d9a904767a6ef5decf4f4924b624cea2c35c4928000084d48b318b58424
4
+ data.tar.gz: c9f94ffc2fbdac8a6be651cb90314d9042a0e54fff5031f60b8b266605fb748c
5
5
  SHA512:
6
- metadata.gz: 813931572663d1e25ab22fd1ddcc6d4de1db96fe3167f53d5fbdc199d2f2668efbc71cc54a26ce0c1592947fab7f0f76ef673748ce2b14ff3c0a2e4f8d598db8
7
- data.tar.gz: 0f04762f7209ed0dd90e4aae3820915312e924a043ab12b14496d4c2b78136795ec05d0b98a4b74276b6a8ac4bfc82be0b04af051215f2ce98275a461194f09e
6
+ metadata.gz: ddc76de2b511bb3306857e3f97c10cd2ac0c02903ff9b16d3c4d3ac33ce2035831f48ed93f7821b6b6977a9ba8207019a434f840bd7c55a9948e40f4a5a6a178
7
+ data.tar.gz: 0110652cfbd0f59040e1b606dfd653fb8c62207fbc6351d3cf7114d5a196233e13388b97376d4e8ad4878ab8fed3efd5a1343b5ef971034777f6c49b3323fb74
data/bin/rtfm CHANGED
@@ -242,7 +242,7 @@ def getchr # PROCESS KEY PRESSES
242
242
  # Note: Curses.getch blanks out @w_t
243
243
  # @w_l.getch makes Curses::KEY_DOWN etc not work
244
244
  # Therefore resorting to the generic method
245
- c = STDIN.getch(min: 0, time: 5)
245
+ c = STDIN.getch(min: 0, time: 1)
246
246
  case c
247
247
  when "\e" # ANSI escape sequences
248
248
  case $stdin.getc
@@ -324,6 +324,7 @@ def main_getkey # GET KEY FROM USER
324
324
  @directory[Dir.pwd] = @selected # Store this directory before leaving
325
325
  @marks["'"] = Dir.pwd
326
326
  open_selected()
327
+ @change_tag = true
327
328
  @w_r.update = true
328
329
  @w_b.update = true
329
330
  when 'x' # Force open with file opener (used to open HTML files in browser)
@@ -331,6 +332,7 @@ def main_getkey # GET KEY FROM USER
331
332
  @directory[Dir.pwd] = @selected # Store this directory before leaving
332
333
  @marks["'"] = Dir.pwd
333
334
  open_selected(true)
335
+ @change_tag = true
334
336
  @w_r.update = true
335
337
  @w_b.update = true
336
338
  when 'PgDOWN'
@@ -401,7 +403,10 @@ def main_getkey # GET KEY FROM USER
401
403
  @directory[Dir.pwd] = @selected # Store this directory before leaving
402
404
  @marks["'"] = Dir.pwd
403
405
  if File.symlink?(@selected)
404
- Dir.chdir(File.dirname(File.readlink(@selected)))
406
+ begin
407
+ Dir.chdir(File.dirname(File.readlink(@selected)))
408
+ rescue
409
+ end
405
410
  end
406
411
  @w_b.update = true
407
412
  when 'g' # Run 'grep' in the current directory
@@ -458,10 +463,12 @@ def main_getkey # GET KEY FROM USER
458
463
  copy_move_link("copy")
459
464
  @w_r.update = true
460
465
  @w_b.update = true
466
+ @change_tag = true
461
467
  when 'P' # Move tagged items here
462
468
  copy_move_link("move")
463
469
  @w_r.update = true
464
470
  @w_b.update = true
471
+ @change_tag = true
465
472
  when 's' # Create symlink to tagged items here
466
473
  copy_move_link("link")
467
474
  @w_r.update = true
@@ -564,11 +571,22 @@ def main_getkey # GET KEY FROM USER
564
571
  when 'S' # Show comprehensive system info
565
572
  begin
566
573
  @w_r.pager_cmd = ""
567
- uname = `uname -o`.chop + " "
568
- uname += `uname -r`.chop + " "
569
- uname += `uname -v`.chop + " "
570
- uname += `uname -p` + "\n"
574
+ uname = `uname -o`.chomp + " "
575
+ uname += `uname -r`.chomp + " "
576
+ uname += `uname -v`.chomp + " "
577
+ uname += `uname -p`.chomp + " "
578
+ uname += `awk -F '"' '/PRETTY/ {print $2}' /etc/os-release` + "\n"
571
579
  text = [[253, 1, uname]]
580
+ system = "Shell & Terminal: " + `echo $SHELL`.sub(/.*\//, '').chomp + ", " + `echo $TERM`.chomp + " "
581
+ packages = `pacman -Q | wc -l`.chomp
582
+ packages = `dpkg-query -l | grep -c '^.i'`.chomp if packages == "0"
583
+ packages = "Unrecognized" if packages == "0"
584
+ system += "Packages: " + packages + "\n"
585
+ system += "Desktop: " + `awk '/^DesktopNames/' /usr/share/xsessions/* | sed 's/DesktopNames=//g' | \\
586
+ sed 's/\\;/\\n/g' | sed '/^$/d' | sort -u | sed ':a;N;$!ba;s/\\n/, /g'`.chomp + "/"
587
+ system += `grep 'gtk-theme-name' ~/.config/gtk-3.0/* | sed 's/gtk-theme-name=//g' | \\
588
+ sed 's/-/ /g'`.sub(/.*:/, '') + "\n"
589
+ text += [[251, 0, system]]
572
590
  cpu = "CPUs = " + `nproc`.chop + " "
573
591
  cpuinfo = `lscpu`
574
592
  cpu += cpuinfo[/^.*Model name:\s*(.*)/, 1] + " "
@@ -594,7 +612,7 @@ def main_getkey # GET KEY FROM USER
594
612
  image_show("clear") if @image; @image = false
595
613
  @w_r.update = true
596
614
  @w_b.update = true
597
- when 'TAB' # Start paging
615
+ when 'TAB' # Start paging/Down one page
598
616
  if @w_r.pager == 1 and @w_r.pager_cmd != ""
599
617
  @w_r.text = `#{@w_r.pager_cmd} 2>/dev/null`
600
618
  end
@@ -624,12 +642,10 @@ def main_getkey # GET KEY FROM USER
624
642
  @searched = w_b_getstr("/ ", "")
625
643
  l = `ls #{@lsbase} #{@lsall} #{@lsorder} #{@lsinvert} #{@lsuser}`.split
626
644
  m = l.each_index.select{|n| l[n] =~ /#{@searched}/}
627
- @index = 0 unless m == []
628
- i = m.find { |n| n > @index }
629
- @index = i if i > @index unless i == nil
645
+ @index = m[0] unless m == []
630
646
  @index = 0 if @searched == ""
631
647
  @w_r.update = true
632
- when 'n'
648
+ when 'n' # Jump to next occurence of search (after '/')
633
649
  l = `ls #{@lsbase} #{@lsall} #{@lsorder} #{@lsinvert} #{@lsuser}`.split
634
650
  m = l.each_index.select{|n| l[n] =~ /#{@searched}/}
635
651
  i = m.find { |n| n > @index }
@@ -639,7 +655,7 @@ def main_getkey # GET KEY FROM USER
639
655
  @index = i
640
656
  end
641
657
  @w_r.update = true
642
- when 'N'
658
+ when 'N' # Jump to previous occurence of search (after '/')
643
659
  l = `ls #{@lsbase} #{@lsall} #{@lsorder} #{@lsinvert} #{@lsuser}`.split
644
660
  m = l.each_index.select{|n| l[n] =~ /#{@searched}/}.reverse
645
661
  i = m.find { |n| n < @index }
@@ -656,7 +672,7 @@ def main_getkey # GET KEY FROM USER
656
672
  when ';' # Show command history
657
673
  w_r_info("Command history (latest on top):\n\n" + @history.join("\n"))
658
674
  @w_b.update = true
659
- when 'y', 'Y'
675
+ when 'y', 'Y' # Copy path of selected item
660
676
  if @selected == nil
661
677
  w_b_info(" No selected item path to copy")
662
678
  else
@@ -1281,6 +1297,7 @@ def w_b_exec(cmd) # EXECUTE COMMAND FROM @W_B
1281
1297
  pager_show
1282
1298
  @w_r.update = false
1283
1299
  end
1300
+ @change_tag = true
1284
1301
  }
1285
1302
  rescue
1286
1303
  w_b_info(" Failed to execute command (#{cmd})")
@@ -1308,12 +1325,13 @@ loop do # OUTER LOOP - CATCHING REFRESHES VIA 'r'
1308
1325
  @w_b = Curses::Window.new(1, 0, maxy - 1, 0)
1309
1326
  @w_l = Curses::Window.new(maxy - 3, (maxx/@width) - 1, 2, 0)
1310
1327
  @w_r = Curses::Window.new(maxy - 4, maxx - (maxx/@width), 2, maxx/@width)
1328
+ @w_p = Curses::Window.new(1, maxx - (maxx/@width), maxy - 2, maxx/@width)
1329
+ @w_p.fg, @w_p.bg = 255, 0
1330
+ @w_p.refresh
1311
1331
  @w_t.fg, @w_t.bg = 232, 249
1312
1332
  @w_t.attr = Curses::A_BOLD
1313
1333
  @w_b.fg, @w_b.bg = 250, 238
1314
- @w_t.update = true
1315
1334
  @w_b.update = true
1316
- @w_l.update = true
1317
1335
  @w_r.update = true
1318
1336
  @w_r.pager = 0
1319
1337
  @w_r.pager_more = false
@@ -1323,13 +1341,14 @@ loop do # OUTER LOOP - CATCHING REFRESHES VIA 'r'
1323
1341
  tagged_info
1324
1342
  @w_r.update = false
1325
1343
  end
1344
+ @change = true
1345
+ @change_tag = true
1326
1346
  loop do # INNER, CORE LOOP
1327
1347
  begin # Jump to home dir if current dir is externally removed
1328
1348
  Dir.pwd
1329
1349
  rescue
1330
1350
  Dir.chdir
1331
1351
  end
1332
- system("printf \"\033]0;RTFM: #{Dir.pwd}\007\"") # Set Window title to path
1333
1352
  ls_cmd = "ls #{@lsbase} #{@lsall} #{@lsorder} #{@lsinvert} #{@lsuser}" # Get files in current directory
1334
1353
  @files = `#{ls_cmd} 2>/dev/null`.split("\n")
1335
1354
  ls_cmd += %q[ -lhgG --time-style="long-iso" | awk '{printf "%s%12s%6s%6s%5s", $1,$4,$5,$3,$2 "\n"}']
@@ -1349,28 +1368,33 @@ loop do # OUTER LOOP - CATCHING REFRESHES VIA 'r'
1349
1368
  @index = @files.index(@selected)
1350
1369
  @orderchange = false
1351
1370
  end
1352
- @index = @files.index(@selected) if @lsall != lsall_old # Change in showing all items must be handled
1353
- @index = index_old if @files.index(@selected) == nil # If item no longer is shown
1354
- @min_index = 0
1355
- @max_index = @files.size - 1
1356
- @index = @max_index if @index > @max_index # If deleted many items
1357
- @index = 0 if @index < 0
1358
- @selected = @files[@index] # Get text of selected item
1359
- @selected_safe = "\"#{@selected}\"" # Make it safe for commands
1360
- # Top window (info line)
1361
- w_t_info
1371
+ @index = @files.index(@selected) if @lsall != lsall_old # Change in showing all items must be handled
1372
+ @index = index_old if @files.index(@selected) == nil # If item no longer is shown
1373
+ @min_index = 0
1374
+ @max_index = @files.size - 1
1375
+ @index = @max_index if @index > @max_index # If deleted many items
1376
+ @index = 0 if @index < 0
1377
+ @selected = @files[@index] # Get text of selected item
1378
+ sel_old = @selected_safe
1379
+ @selected_safe = "\"#{@selected}\"" # Make it safe for commands
1380
+ @selected_safe == sel_old ? @change = false : @change = true
1381
+ @change = true if @change_tag; @change_tag = false
1382
+ if @change
1383
+ system("printf \"\033]0;RTFM: #{Dir.pwd}\007\"") # Set Window title to path
1384
+ # Top window (info line)
1385
+ w_t_info
1386
+ @w_l.setpos(0,0)
1387
+ list_dir(true)
1388
+ @w_l.refresh
1389
+ end
1362
1390
  # Bottom window (command line) Before @w_r to avoid image dropping out on startup
1363
1391
  w_b_info(nil) if @w_b.update
1364
1392
  # Left and right windows (browser & content viewer)
1365
- @w_l.setpos(0,0)
1366
- list_dir(true)
1367
- @w_l.refresh
1368
1393
  if @w_r.update and @preview
1369
1394
  w_r_show
1370
1395
  @w_r.fg = 255
1371
1396
  end
1372
- Curses.curs_set(1) # Clear residual cursor
1373
- Curses.curs_set(0) # ...from editing files
1397
+ Curses.curs_set(1); Curses.curs_set(0) # Clear residual cursor from editing files
1374
1398
  @tag = false # Clear tag pattern
1375
1399
  lsall_old = @lsall
1376
1400
  main_getkey # Get key from user
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtfm-filemanager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.6
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-15 00:00:00.000000000 Z
11
+ date: 2021-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses
@@ -33,10 +33,7 @@ dependencies:
33
33
  description: 'A full featured terminal browser with syntax highlighted files, images
34
34
  shown in the terminal, videos thumbnailed, etc. You can bookmark and jump around
35
35
  easily, delete, rename, copy, symlink and move files. RTFM has a a wide range of
36
- other features. New in 1.5.0: Expanded ''/'' to jump to the first match and ''n''
37
- to jump to the next matched item (''j'' and ''J'' are now gone). New in 1.5.4: Fixed
38
- command output error - now shown in right pane. New in 1.5.5/6: Fixed minor jump
39
- issue when searching via ''/'''
36
+ other features. New in 1.6.0: RTFM now uses even less resources.'
40
37
  email: g@isene.com
41
38
  executables:
42
39
  - rtfm