brrowser 0.1.0 → 0.1.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/README.md +8 -6
- data/bin/brrowser +44 -18
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8db3fcfbe72fe0a1f0ef54a5b99b9e7c1b3bd4030f4cc37639aa623ca492f17d
|
|
4
|
+
data.tar.gz: 19079bf7bf6ab1b632b193bf6847a81530524aac6d526864b9467eb2e1020e37
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2151be2c0a51f2b207594c4b86b9f79b4c9c8507dee66ddc9b52e8b7da149a56ad44db2f33fad762342687fae74d5699beee0f83cca4b3b354342caefbc17823
|
|
7
|
+
data.tar.gz: 21df370567d8d3e33cf0826ad240f6ddff96aab5252c671172596fadf9d6b5645673f631e74883e9af74ff6dcaef51a1e9cb6dfc515bbe382fc8a7578d51a134
|
data/README.md
CHANGED
|
@@ -22,7 +22,7 @@ A terminal web browser combining w3m-style rendering with qutebrowser-style keyb
|
|
|
22
22
|
- Ad blocking via StevenBlack hosts list
|
|
23
23
|
|
|
24
24
|
**Navigation:**
|
|
25
|
-
- `j`/`k` or arrows to scroll, `gg`/`G` for top/bottom
|
|
25
|
+
- `j`/`k` or arrows to scroll, `<`/`>` to scroll left/right, `gg`/`G` for top/bottom
|
|
26
26
|
- `TAB`/`S-TAB` to cycle through links and form fields (highlighted with reverse video)
|
|
27
27
|
- `Enter` to follow focused link or edit focused field
|
|
28
28
|
- `o` to open URL, `t` to open in new tab, `O` to edit current URL
|
|
@@ -60,12 +60,13 @@ A terminal web browser combining w3m-style rendering with qutebrowser-style keyb
|
|
|
60
60
|
- `Ctrl-l` to force redraw
|
|
61
61
|
|
|
62
62
|
**Other:**
|
|
63
|
-
- `:download URL` to save files
|
|
63
|
+
- `:download URL` to save files (configurable download folder)
|
|
64
64
|
- Binary files prompt: open with `xdg-open`, download, or cancel
|
|
65
|
-
- `P` for preferences
|
|
65
|
+
- `P` for preferences (image mode, colors, homepage, search engine, download folder)
|
|
66
66
|
- `?` for built-in help page
|
|
67
|
+
- `:about` opens the project GitHub page
|
|
67
68
|
- Cookie persistence across sessions
|
|
68
|
-
- Configurable
|
|
69
|
+
- Configurable homepage (defaults to project page)
|
|
69
70
|
|
|
70
71
|
## Installation
|
|
71
72
|
|
|
@@ -98,6 +99,7 @@ brrowser isene.org # Auto-adds https://
|
|
|
98
99
|
| Key | Action |
|
|
99
100
|
|-----|--------|
|
|
100
101
|
| `j` / `k` / arrows | Scroll up/down |
|
|
102
|
+
| `<` / `>` | Scroll left/right |
|
|
101
103
|
| `Left` / `Right` | Previous/next tab |
|
|
102
104
|
| `gg` / `G` | Top / bottom of page |
|
|
103
105
|
| `Ctrl-d` / `Ctrl-u` | Half page down/up |
|
|
@@ -114,8 +116,8 @@ brrowser isene.org # Auto-adds https://
|
|
|
114
116
|
| `/` | Search page |
|
|
115
117
|
| `n` / `N` | Next/previous search match |
|
|
116
118
|
| `b` / `B` | Bookmark / show bookmarks |
|
|
117
|
-
| `m` +
|
|
118
|
-
| `'` +
|
|
119
|
+
| `m` + key | Set quickmark (0-9, a-z) |
|
|
120
|
+
| `'` + key | Go to quickmark (0-9, a-z) |
|
|
119
121
|
| `f` | Fill and submit form |
|
|
120
122
|
| `y` / `Y` | Copy URL / copy focused element |
|
|
121
123
|
| `e` | Edit page source in $EDITOR |
|
data/bin/brrowser
CHANGED
|
@@ -25,16 +25,17 @@ end
|
|
|
25
25
|
|
|
26
26
|
# brrowser {{{1
|
|
27
27
|
module Brrowser
|
|
28
|
-
VERSION = "0.1.
|
|
29
|
-
HOMEPAGE = "
|
|
28
|
+
VERSION = "0.1.1"
|
|
29
|
+
HOMEPAGE = "https://github.com/isene/brrowser"
|
|
30
30
|
CONFIG_DIR = File.join(Dir.home, ".brrowser")
|
|
31
31
|
CONFIG_FILE = File.join(CONFIG_DIR, "config.yml")
|
|
32
32
|
|
|
33
33
|
DEFAULTS = {
|
|
34
34
|
"show_images" => true,
|
|
35
35
|
"image_mode" => "auto", # auto, termpix, ascii, off
|
|
36
|
-
"homepage" => "
|
|
36
|
+
"homepage" => "https://github.com/isene/brrowser",
|
|
37
37
|
"search_engine" => "g",
|
|
38
|
+
"download_dir" => "~/Downloads",
|
|
38
39
|
"info_fg" => 252,
|
|
39
40
|
"info_bg" => 236,
|
|
40
41
|
"tab_fg" => 252,
|
|
@@ -59,8 +60,8 @@ module Brrowser
|
|
|
59
60
|
<tr><th>Key</th><th>Action</th></tr>
|
|
60
61
|
<tr><td>j / Down</td><td>Scroll down</td></tr>
|
|
61
62
|
<tr><td>k / Up</td><td>Scroll up</td></tr>
|
|
62
|
-
<tr><td><
|
|
63
|
-
<tr><td>>
|
|
63
|
+
<tr><td><</td><td>Scroll left</td></tr>
|
|
64
|
+
<tr><td>></td><td>Scroll right</td></tr>
|
|
64
65
|
<tr><td>Left</td><td>Previous tab</td></tr>
|
|
65
66
|
<tr><td>Right</td><td>Next tab</td></tr>
|
|
66
67
|
<tr><td>gg</td><td>Go to top</td></tr>
|
|
@@ -123,8 +124,8 @@ module Brrowser
|
|
|
123
124
|
<tr><th>Key</th><th>Action</th></tr>
|
|
124
125
|
<tr><td>b</td><td>Bookmark current page</td></tr>
|
|
125
126
|
<tr><td>B</td><td>Show bookmarks</td></tr>
|
|
126
|
-
<tr><td>m +
|
|
127
|
-
<tr><td>' +
|
|
127
|
+
<tr><td>m + key</td><td>Set quickmark (0-9, a-z)</td></tr>
|
|
128
|
+
<tr><td>' + key</td><td>Go to quickmark (0-9, a-z)</td></tr>
|
|
128
129
|
<tr><td>i</td><td>Toggle images</td></tr>
|
|
129
130
|
<tr><td>p</td><td>Show stored password for site</td></tr>
|
|
130
131
|
<tr><td>I</td><td>AI summary of page</td></tr>
|
|
@@ -162,7 +163,7 @@ module Brrowser
|
|
|
162
163
|
@img_dir = File.join(Dir.tmpdir, "brrowser_images_#{Process.pid}")
|
|
163
164
|
Dir.mkdir(@img_dir) unless Dir.exist?(@img_dir)
|
|
164
165
|
|
|
165
|
-
main_loop(url || HOMEPAGE)
|
|
166
|
+
main_loop(url || @conf["homepage"] || HOMEPAGE)
|
|
166
167
|
end
|
|
167
168
|
|
|
168
169
|
# Pane layout {{{2
|
|
@@ -265,6 +266,7 @@ module Brrowser
|
|
|
265
266
|
@focus_index = -1
|
|
266
267
|
@focused_element = nil
|
|
267
268
|
@highlighted_line = nil
|
|
269
|
+
@h_scroll = 0
|
|
268
270
|
|
|
269
271
|
# Handle image URLs: display the image instead of raw binary
|
|
270
272
|
if ct.match?(/image\//) || result[:url].to_s.match?(/\.(png|jpe?g|gif|bmp|webp|svg|ico)(\?|$)/i)
|
|
@@ -346,7 +348,7 @@ module Brrowser
|
|
|
346
348
|
end
|
|
347
349
|
|
|
348
350
|
def re_render
|
|
349
|
-
return unless current_tab.url && current_tab.url
|
|
351
|
+
return unless current_tab.url && !current_tab.url.start_with?("about:")
|
|
350
352
|
result = @fetcher.fetch(current_tab.url)
|
|
351
353
|
render_page(result)
|
|
352
354
|
end
|
|
@@ -392,7 +394,7 @@ module Brrowser
|
|
|
392
394
|
end
|
|
393
395
|
|
|
394
396
|
def resolve_search(input)
|
|
395
|
-
return input if input.match?(%r{^https?://}) || input.match?(%r{^file://})
|
|
397
|
+
return input if input.match?(%r{^https?://}) || input.match?(%r{^file://}) || input.match?(%r{^about:})
|
|
396
398
|
return input if input.include?(".") && !input.include?(" ")
|
|
397
399
|
|
|
398
400
|
parts = input.split(" ", 2)
|
|
@@ -441,7 +443,8 @@ module Brrowser
|
|
|
441
443
|
end
|
|
442
444
|
|
|
443
445
|
def refresh_main
|
|
444
|
-
@
|
|
446
|
+
@original_content = current_tab.content.to_s
|
|
447
|
+
@pMain.text = @original_content
|
|
445
448
|
@pMain.refresh
|
|
446
449
|
end
|
|
447
450
|
|
|
@@ -457,6 +460,27 @@ module Brrowser
|
|
|
457
460
|
end
|
|
458
461
|
|
|
459
462
|
# Scrolling {{{2
|
|
463
|
+
def scroll_left
|
|
464
|
+
@h_scroll = [(@h_scroll || 0) - 10, 0].max
|
|
465
|
+
apply_h_scroll
|
|
466
|
+
end
|
|
467
|
+
|
|
468
|
+
def scroll_right
|
|
469
|
+
@h_scroll = (@h_scroll || 0) + 10
|
|
470
|
+
apply_h_scroll
|
|
471
|
+
end
|
|
472
|
+
|
|
473
|
+
def apply_h_scroll
|
|
474
|
+
return unless @h_scroll && @h_scroll > 0 && @original_content
|
|
475
|
+
lines = @original_content.split("\n")
|
|
476
|
+
shifted = lines.map do |line|
|
|
477
|
+
pure = line.gsub(/\e\[[0-9;]*m/, "")
|
|
478
|
+
pure.length > @h_scroll ? line[@h_scroll..] || "" : ""
|
|
479
|
+
end
|
|
480
|
+
@pMain.text = shifted.join("\n")
|
|
481
|
+
@pMain.full_refresh
|
|
482
|
+
end
|
|
483
|
+
|
|
460
484
|
def scroll_down
|
|
461
485
|
had_images = @showing_image
|
|
462
486
|
clear_images if @showing_image
|
|
@@ -1170,7 +1194,7 @@ module Brrowser
|
|
|
1170
1194
|
if result[:status] == 200
|
|
1171
1195
|
filename = File.basename(URI.parse(result[:url]).path)
|
|
1172
1196
|
filename = "download" if filename.empty?
|
|
1173
|
-
dir = File.expand_path("~/Downloads")
|
|
1197
|
+
dir = File.expand_path(@conf["download_dir"] || "~/Downloads")
|
|
1174
1198
|
Dir.mkdir(dir) unless Dir.exist?(dir)
|
|
1175
1199
|
path = File.join(dir, filename)
|
|
1176
1200
|
# Avoid overwriting
|
|
@@ -1207,14 +1231,14 @@ module Brrowser
|
|
|
1207
1231
|
end
|
|
1208
1232
|
|
|
1209
1233
|
def set_quickmark
|
|
1210
|
-
@status_msg = "Set quickmark (0-9):"
|
|
1234
|
+
@status_msg = "Set quickmark (0-9, a-z):"
|
|
1211
1235
|
refresh_cmd
|
|
1212
1236
|
chr = getchr
|
|
1213
|
-
if chr && chr.match?(/^[0-
|
|
1237
|
+
if chr && chr.length == 1 && chr.match?(/^[0-9a-z]$/)
|
|
1214
1238
|
load_quickmarks
|
|
1215
1239
|
@quickmarks[chr] = { "url" => current_tab.url, "title" => current_tab.title.to_s }
|
|
1216
1240
|
save_quickmarks
|
|
1217
|
-
@status_msg = "Quickmark #{chr} set: #{current_tab.title}"
|
|
1241
|
+
@status_msg = "Quickmark '#{chr}' set: #{current_tab.title}"
|
|
1218
1242
|
else
|
|
1219
1243
|
@status_msg = "Cancelled"
|
|
1220
1244
|
end
|
|
@@ -1222,15 +1246,15 @@ module Brrowser
|
|
|
1222
1246
|
end
|
|
1223
1247
|
|
|
1224
1248
|
def goto_quickmark
|
|
1225
|
-
@status_msg = "Go to quickmark (0-9):"
|
|
1249
|
+
@status_msg = "Go to quickmark (0-9, a-z):"
|
|
1226
1250
|
refresh_cmd
|
|
1227
1251
|
chr = getchr
|
|
1228
|
-
if chr && chr.match?(/^[0-
|
|
1252
|
+
if chr && chr.length == 1 && chr.match?(/^[0-9a-z]$/)
|
|
1229
1253
|
load_quickmarks
|
|
1230
1254
|
if @quickmarks[chr]
|
|
1231
1255
|
navigate(@quickmarks[chr]["url"])
|
|
1232
1256
|
else
|
|
1233
|
-
@status_msg = "No quickmark #{chr}"
|
|
1257
|
+
@status_msg = "No quickmark '#{chr}'"
|
|
1234
1258
|
refresh_cmd
|
|
1235
1259
|
end
|
|
1236
1260
|
else
|
|
@@ -1476,6 +1500,7 @@ module Brrowser
|
|
|
1476
1500
|
["Show images", "show_images", [true, false]],
|
|
1477
1501
|
["Homepage", "homepage", :text],
|
|
1478
1502
|
["Search engine", "search_engine", %w[g ddg w]],
|
|
1503
|
+
["Download folder", "download_dir", :text],
|
|
1479
1504
|
["Info bar fg", "info_fg", :color],
|
|
1480
1505
|
["Info bar bg", "info_bg", :color],
|
|
1481
1506
|
["Tab bar fg", "tab_fg", :color],
|
|
@@ -1595,6 +1620,7 @@ module Brrowser
|
|
|
1595
1620
|
"j" => :scroll_down, "k" => :scroll_up,
|
|
1596
1621
|
"DOWN" => :scroll_down, "UP" => :scroll_up,
|
|
1597
1622
|
"LEFT" => :prev_tab, "RIGHT" => :next_tab,
|
|
1623
|
+
"<" => :scroll_left, ">" => :scroll_right,
|
|
1598
1624
|
"G" => :go_bottom,
|
|
1599
1625
|
"d" => :close_tab, "u" => :undo_close_tab,
|
|
1600
1626
|
"o" => :open_url,
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: brrowser
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Geir Isene
|
|
@@ -42,14 +42,14 @@ dependencies:
|
|
|
42
42
|
name: termpix
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
|
-
- - "
|
|
45
|
+
- - ">="
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
47
|
version: '0.3'
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
|
-
- - "
|
|
52
|
+
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0.3'
|
|
55
55
|
description: A terminal web browser combining w3m-style rendering with qutebrowser-style
|