Introduction
Introduction Statistics Contact Development Disclaimer Help
Giving w3m a try over lynx browser. - dotfiles - These are my dotfiles. There a…
git clone git://jay.scot/dotfiles
Log
Files
Refs
README
---
commit 66115a683f5837f349a98b68c6303438c368fe02
parent bb5259bfef8dc33826d4c835465fa7d95c510baf
Author: Jay Scott <[email protected]>
Date: Fri, 7 Feb 2025 20:42:28 +0000
Giving w3m a try over lynx browser.
Diffstat:
M README | 2 +-
M bin/link-handler | 2 +-
A bin/open-w3m-bookmarks | 21 +++++++++++++++++++++
M bootstrap.sh | 3 +++
M isync/mbsyncrc | 2 +-
M kshrc | 8 ++++++--
M mutt/mailcap | 1 -
M mutt/muttrc | 1 +
A w3m/bookmark.html | 39 +++++++++++++++++++++++++++++…
A w3m/cgi-bin/gemini.cgi | 28 ++++++++++++++++++++++++++++
A w3m/config | 165 +++++++++++++++++++++++++++++…
A w3m/keymap | 12 ++++++++++++
A w3m/urimethodmap | 1 +
13 files changed, 279 insertions(+), 6 deletions(-)
---
diff --git a/README b/README
@@ -16,7 +16,7 @@ main desktop OS and are forever evolving.
window manager : cwm
terminal : xterm
email : neomutt / isync / smtpd
- browser : firefox / lynx
+ browser : firefox / w3m
media : mpv
password mgmt : pass
vpn : mullvad
diff --git a/bin/link-handler b/bin/link-handler
@@ -3,7 +3,7 @@
# applications
player="mpv --autofit=30% --really-quiet --no-terminal"
gemini="xterm -e amfora"
-gopher="xterm -e lynx"
+gopher="xterm -e w3m"
pdf="mupdf"
images="feh"
torrent="qbittorrent"
diff --git a/bin/open-w3m-bookmarks b/bin/open-w3m-bookmarks
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+HTML_FILE="$HOME/.w3m/bookmark.html"
+
+if [ ! -f "$HTML_FILE" ]; then
+ echo "File not found: $HTML_FILE"
+ exit 1
+fi
+
+# Extract links from <li> elements
+LINKS=$(sed -n 's/.*<li[^>]*>\s*<a href="\([^"]*\)".*/\1/p' "$HTML_FILE")
+
+if [ -z "$LINKS" ]; then
+ echo "No links found in <li> elements."
+ exit 1
+fi
+
+# Use fzf to select a link
+SELECTED_LINK=$(echo "$LINKS" | fzf --height 40% --reverse)
+
+w3m "$SELECTED_LINK"
diff --git a/bootstrap.sh b/bootstrap.sh
@@ -4,17 +4,20 @@ DOTFILES=$(pwd)
FILES='cwmrc kshrc profile Xdefaults xsession'
ROOT='bin'
+ROOT_HIDDEN='w3m'
CONFIG='git lynx mpd mutt ncmpcpp nvim isync'
link() {
for f in $FILES; do ln -sfn "$DOTFILES/$f" "$HOME/.$f"; done
for f in $ROOT; do ln -sfn "$DOTFILES/$f" "$HOME/$f"; done
+ for f in $ROOT_HIDDEN; do ln -sfn "$DOTFILES/$f" "$HOME/.$f"; done
for f in $CONFIG; do ln -sfn "$DOTFILES/$f" "$HOME/.config/$f"; done
}
unlink() {
for f in $FILES; do unlink "$HOME/.$f"; done
for f in $ROOT; do unlink "$HOME/$f"; done
+ for f in $ROOT_HIDDEN; do unlink "$HOME/.$f"; done
for f in $CONFIG; do unlink "$HOME/.config/$f"; done
}
diff --git a/isync/mbsyncrc b/isync/mbsyncrc
@@ -7,7 +7,7 @@ SyncState *
IMAPAccount jay
Host imap.mailbox.org
User [email protected]
-PassCmd "pass tech/mailbox.org | head -n1"
+PassCmd "gopass show -o tech/mailbox.org"
TLSType IMAPS
IMAPStore jay-remote
diff --git a/kshrc b/kshrc
@@ -27,6 +27,8 @@ alias rm='rm -i'
# random alias
alias weather='curl wttr.in/?1QF'
+alias ls='colorls -G'
+alias pass='gopass'
# git alias
alias ga='git add -A'
@@ -35,6 +37,10 @@ alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%…
alias gd='git diff'
alias gma='git commit -am'
+# browser
+alias sr='sr -browser=w3m'
+alias b='open-w3m-bookmarks'
+
# neo
alias vim='nvim'
alias mutt='neomutt'
@@ -52,6 +58,4 @@ export PS1="\[\e[00;34m\]▶▶▶ \W \[\e[0m\]"
export HISTFILE=/home/jay/.cache/sh_history
export HISTSIZE=1000
-alias ls='colorls -G'
set -o emacs
-
diff --git a/mutt/mailcap b/mutt/mailcap
@@ -1,2 +1 @@
-#text/html; lynx -assume_charset=%{charset} -display_charset=utf-8 -collapse_b…
text/html; w3m -I %{charset} -T text/html; copiousoutput;
diff --git a/mutt/muttrc b/mutt/muttrc
@@ -64,6 +64,7 @@ macro index o "<shell-escape>mbsync -a -c \"$XDG_CONFIG_HOME\…
macro index C "<copy-message>?<toggle-mailboxes>" "copy a message to a mailbox"
macro index A "<save-message>=jay/archive<enter><enter><sync-mailbox><enter>" …
macro index M "<save-message>?<toggle-mailboxes>" "move a message to a mailbox"
+macro index,pager O "<pipe-message>urlscan -c<Enter>" "call urlscan to extract…
# sorting
set sort = threads
diff --git a/w3m/bookmark.html b/w3m/bookmark.html
@@ -0,0 +1,39 @@
+<head>
+<META http-equiv="content-type" content="text/html;charset=utf-8">
+<title>Bookmark file</title>
+</head>
+
+<h1>Bookmarks</h1>
+
+<h2>Gopher</h2>
+<ul>
+<li><a href="gopher://jay.scot/">jay.scot</a>
+<li><a href="gopher://1436.ninja/1/Port70News">Port 70 News</a>
+<li><a href="gopher://gopher.metafilter.com/1/MetaFilter">Metafilter</a>
+<li><a href="gopher://hngopher.com">Hacker News</a>
+<li><a href="gopher://gopherpedia.com/">gopherpedia</a>
+<li><a href="gopher://bitreich.org/1/lawn">The Gopher Lawn</a>
+<li><a href="gopher://gopher.black/1/moku-pona">Aggregator of phlog</a>
+<li><a href="gopher://i-logout.cz/1/bongusta/">Bongusta</a>
+<li><a href="gopher://gopher.icu/">Ian J</a>
+<li><a href="gopher://floodgap.com/">Floodgap</a>
+<!--End of section (do not delete this comment)-->
+</ul>
+<h2>Web</h2>
+<ul>
+<li><a href="https://text.npr.org/">NPR</a>
+<li><a href="https://neuters.de/">Reuters</a>
+<li><a href="http://lite.cnn.com/">CNN</a>
+<!--End of section (do not delete this comment)-->
+</ul>
+<h2>Search</h2>
+<ul>
+<li><a href="https://lite.duckduckgo.com/lite/">DuckDuckGo</a>
+<!--End of section (do not delete this comment)-->
+</ul>
+<h2>Gemini</h2>
+<ul>
+<li><a href="https://portal.mozz.us/gemini/calcuode.com/gmisub-aggregate.gmi">…
+<!--End of section (do not delete this comment)-->
+</ul>
+</body>
diff --git a/w3m/cgi-bin/gemini.cgi b/w3m/cgi-bin/gemini.cgi
@@ -0,0 +1,28 @@
+#!/usr/bin/env sh
+# AUTHOR: gotbletu (@gmail|twitter|youtube|github|lbry)
+# https://www.youtube.com/user/gotbletu
+# DESC: gemini proxy to connect over http with w3m web browser
+# DEMO: https://youtu.be/mfnCqn4qhL0
+# DEPEND: coreutils curl grep
+# REQD: 1. touch ~/.w3m/urimethodmap
+# 2. echo "gemini: file:/cgi-bin/gemini.cgi?%s" >> ~/.w3m/urimethodmap
+# 3. chmod +x ~/.w3m/cgi-bin/gemini.cgi
+# 4. sed -i 's@cgi_bin.*@cgi_bin ~/.w3m/cgi-bin:/usr/lib/w3m/cgi-bin:/…
+# 5. sed -i 's@urimethodmap.*@urimethodmap ~/.w3m/urimethodmap, /usr/e…
+# CLOG:
+# 2021-07-30 use curl instead of ping
+
+# gemini://gempaper.strangled.net/mirrorlist/
+# gemini://simplynews.metalune.xyz
+# gemini://geminispace.info/search?tmux
+
+# remove gemini:// header
+QUERY_STRING=$(echo "$QUERY_STRING" | cut -d '/' -f3-)
+
+if [ "$(curl --connect-timeout 1 -s -I "https://portal.mozz.us/about" | head -…
+ echo "W3m-control: GOTO https://portal.mozz.us/gemini/$QUERY_STRING"
+elif [ "$(curl --connect-timeout 1 -s -I "https://proxy.vulpes.one" | head -n1…
+ echo "W3m-control: GOTO https://proxy.vulpes.one/gemini/$QUERY_STRING"
+else
+ echo "W3m-control: GOTO https://gemproxy.koyu.space/$QUERY_STRING"
+fi
diff --git a/w3m/config b/w3m/config
@@ -0,0 +1,165 @@
+tabstop 8
+indent_incr 4
+pixel_per_char 11
+pixel_per_line 23
+frame 0
+target_self 0
+open_tab_blank 0
+open_tab_dl_list 0
+display_link 1
+display_link_number 1
+decode_url 1
+display_lineinfo 1
+ext_dirlist 1
+dirlist_cmd file:///$LIB/dirlist.cgi
+use_dictcommand 1
+dictcommand file:///$LIB/w3mdict.cgi
+multicol 0
+alt_entity 0
+graphic_char 0
+display_borders 0
+disable_center 0
+fold_textarea 0
+display_ins_del 1
+ignore_null_img_alt 1
+view_unseenobject 0
+display_image 0
+pseudo_inlines 1
+auto_image 1
+max_load_image 4
+ext_image_viewer 1
+image_scale 100
+inline_img_protocol 0
+imgdisplay w3mimgdisplay
+image_map_list 1
+fold_line 0
+show_lnum 0
+show_srch_str 1
+label_topline 0
+nextpage_topline 0
+color 1
+high-intensity 0
+basic_color terminal
+anchor_color blue
+image_color green
+form_color red
+mark_color cyan
+bg_color terminal
+active_style 0
+active_color cyan
+visited_anchor 0
+visited_color magenta
+pagerline 10000
+use_history 1
+history 100
+save_hist 0
+confirm_qq 1
+close_tab_back 0
+mark 0
+emacs_like_lineedit 0
+space_autocomplete 0
+vi_prec_num 0
+mark_all_pages 0
+wrap_search 0
+ignorecase_search 1
+use_mouse 1
+reverse_mouse 0
+relative_wheel_scroll 0
+relative_wheel_scroll_ratio 30
+fixed_wheel_scroll_count 5
+clear_buffer 1
+decode_cte 0
+auto_uncompress 0
+preserve_timestamp 1
+keymap_file keymap
+document_root
+personal_document_root
+cgi_bin ~/.w3m/cgi-bin:/usr/lib/w3m/cgi-bin:/usr/local/libexec/w3m/cgi-bin
+index_file
+tmp_dir
+mime_types ~/.mime.types, /etc/mime.types
+mailcap ~/.w3m/mailcap, /etc/w3m/mailcap
+urimethodmap ~/.w3m/urimethodmap, /usr/etc/w3m/urimethodmap
+editor /usr/bin/vi
+mailto_options 1
+mailer
+extbrowser link-handler
+extbrowser2
+extbrowser3
+extbrowser4
+extbrowser5
+extbrowser6
+extbrowser7
+extbrowser8
+extbrowser9
+bgextviewer 1
+use_lessopen 0
+passwd_file ~/.w3m/passwd
+disable_secret_security_check 0
+ftppasswd
+ftppass_hostnamegen 1
+pre_form_file ~/.w3m/pre_form
+siteconf_file ~/.w3m/siteconf
+user_agent
+no_referer 0
+cross_origin_referer 1
+accept_language en;q=1.0
+accept_encoding gzip, compress, bzip, bzip2, deflate, br
+accept_media text/html, text/*;q=0.5, image/*
+argv_is_url 1
+retry_http 1
+default_url 1
+follow_redirection 10
+meta_refresh 0
+localhost_only 0
+dns_order 0
+nntpserver
+nntpmode
+max_news 50
+use_proxy 1
+http_proxy
+https_proxy
+gopher_proxy
+ftp_proxy
+no_proxy
+noproxy_netaddr 1
+no_cache 1
+ssl_forbid_method 2, 3, t, 5
+ssl_min_version
+ssl_cipher DEFAULT:!LOW:!RC4:!EXP
+ssl_verify_server 1
+ssl_cert_file
+ssl_key_file
+ssl_ca_path
+ssl_ca_file
+ssl_ca_default 1
+use_cookie 0
+show_cookie 0
+accept_cookie 1
+accept_bad_cookie 0
+cookie_reject_domains
+cookie_accept_domains
+cookie_avoid_wrong_number_of_dots
+display_charset UTF-8
+document_charset UTF-8
+auto_detect 2
+system_charset UTF-8
+follow_locale 1
+ext_halfdump 0
+use_wide 1
+use_combining 1
+east_asian_width 0
+use_language_tag 1
+ucs_conv 1
+pre_conv 0
+search_conv 1
+fix_width_conv 1
+use_gb12345_map 0
+use_jisx0201 0
+use_jisc6226 0
+use_jisx0201k 0
+use_jisx0212 0
+use_jisx0213 0
+strict_iso2022 1
+gb18030_as_ucs 0
+simple_preserve_space 0
diff --git a/w3m/keymap b/w3m/keymap
@@ -0,0 +1,12 @@
+# clean page
+keymap C COMMAND "READ_SHELL 'rdrview $W3M_URL -H 2> /dev/null 1> /tmp/readabl…
+
+# hide/show images
+keymap i COMMAND "SET_OPTION display_image=toggle ; RESHAPE"
+
+# hints
+keymap f COMMAND "RESHAPE ; LINK_BEGIN ; GOTO_LINK"
+keymap F COMMAND "RESHAPE ; LINK_BEGIN ; TAB_LINK"
+
+# external
+keymap o EXTERN_LINK
diff --git a/w3m/urimethodmap b/w3m/urimethodmap
@@ -0,0 +1 @@
+gemini: file:/cgi-bin/gemini.cgi?%s
You are viewing proxied material from jay.scot. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.