Añadir qutebrowser

This commit is contained in:
drymer 2016-10-14 12:07:29 +02:00
parent 2f23f54736
commit 31cf2cabba
8 changed files with 2248 additions and 5 deletions

View File

@ -17,4 +17,6 @@ Este repositorio contiene los siguientes archivos y directorios:
- El directorio =mutt= que contiene archivos de configuración y scripts para neomutt, offlineimap, abook y notmuch. Los nombres de los archivos son lógicos, por lo que no requieren explicación. Se puede leer más sobre el tema en este [[https://daemons.cf/posts/neomutt-offlineimap-notmuch-abook-sustituyendo-a-los-gestores-de-correo-monstruosos/index.html][articulo]].
- El directorio =qutebrowser= que contiene archivos de configuración para qutebrowser. Incluye el script para capturar links en =org-mode= y para reproducir videos.
Ver ayuda con =bash instala.sh=.

View File

@ -4,8 +4,8 @@ time='<span foreground="#729FCF"></span> '"$(date '+%H:%M:%S')"
date='<span foreground="#729FCF"></span> '"$(date '+%d/%m/%Y')"
case $BLOCK_BUTTON in
1) notify-send "$date" ;;
3) notify-send "$date" ;;
1) notify-send -u low "$date" ;;
3) notify-send -u low "$date" ;;
esac
echo -n "$time"

View File

@ -23,8 +23,8 @@ else
fi
case $BLOCK_BUTTON in
1) notify-send "`echo "$changelog"`" ;;
3) notify-send "`echo "$changelog"`" ;;
1) notify-send -u low "`echo "$changelog"`" ;;
3) notify-send -u low "`echo "$changelog"`" ;;
esac
wget -q -O - $mirror$arch-$version/ChangeLog.txt | iconv -f ISO-8859-1 -t UTF-8 > /tmp/changelog.txt

22
qutebrwoser/capture Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# windows: bind Y spawn mintty --nopin -w hide -e C:\\cygwin\\usr\\local\\bin\\capture.py {url};; yank -t
# gnu/linux: bind Y yank -t;; spawn capture {url}
#
# (setq org-capture-templates
# ...
# ("w" "Marcadors" entry (file "~/org/web.org")
# "* %x\n %U\n %c"
# :empty-lines 1)
# ...
# ))
from urllib import quote
from sys import argv, exit
from subprocess import call
url = quote(argv[1], safe='')
call(['emacsclient', 'org-protocol:/capture:/w/' + url])

680
qutebrwoser/keys.conf Normal file
View File

@ -0,0 +1,680 @@
# vim: ft=conf
#
# In this config file, qutebrowser's key bindings are configured.
# The format looks like this:
#
# [keymode]
#
# command
# keychain
# keychain2
# ...
#
# All blank lines and lines starting with '#' are ignored.
# Inline-comments are not permitted.
#
# keymode is a comma separated list of modes in which the key binding should be
# active. If keymode starts with !, the key binding is active in all modes
# except the listed modes.
#
# For special keys (can't be part of a keychain), enclose them in `<`...`>`.
# For modifiers, you can use either `-` or `+` as delimiters, and these names:
#
# * Control: `Control`, `Ctrl`
# * Meta: `Meta`, `Windows`, `Mod4`
# * Alt: `Alt`, `Mod1`
# * Shift: `Shift`
#
# For simple keys (no `<>`-signs), a capital letter means the key is pressed
# with Shift. For special keys (with `<>`-signs), you need to explicitly add
# `Shift-` to match a key pressed with shift. You can bind multiple commands
# by separating them with `;;`.
#
# Note that default keybindings are always bound, and need to be explicitly
# unbound if you wish to remove them:
#
# <unbound>
# keychain
# keychain2
# ...
[!normal]
clear-keychain ;; leave-mode
<escape>
[normal]
# Keybindings for normal mode.
fake-key <ctrl-c>
<alt-w>
fake-key <ctrl-v>
<ctrl-y>
clear-keychain ;; search
<ctrl-g>
set-cmd-text /
<ctrl-s>
<ctrl-r>
set-cmd-text :
<alt-x>
set-cmd-text -s :open
o
set-cmd-text :open {url:pretty}
go
set-cmd-text -s :open -t
<ctrl+t>
tab-close
<ctrl-w>
tab-focus
<ctrl-k>
tab-prev
<ctrl-j>
reload
r
<f5>
back
H
forward
L
forward -t
tl
forward -w
wl
hint
f
hint all tab
F
hint all tab-bg
;b
hint all tab-fg
;f
hint all hover
;h
hint images
;i
hint images tab
;I
hint images tab-bg
.i
hint links fill :open {hint-url}
;o
hint links fill :open -t {hint-url}
;O
hint links fill :open -b {hint-url}
.o
hint links yank-primary
;Y
hint --rapid links tab-bg
<ctrl-a>
hint --rapid links window
;R
scroll left
h
scroll down
j
scroll up
k
scroll right
l
undo
<ctrl-shift-t>
scroll-perc 0
gg
scroll-perc
G
search-next
n
search-prev
N
enter-mode insert
i
enter-mode set_mark
`
enter-mode jump_mark
''
yank
yy
yank -s
yY
yank -t
yt
yank -ts
yT
yank -d
yd
yank -ds
yD
yank -p
yp
yank -ps
yP
paste
pp
paste -s
pP
paste -t
Pp
paste -ts
PP
paste -w
wp
paste -ws
wP
quickmark-save
m
set-cmd-text -s :quickmark-load
b
set-cmd-text -s :quickmark-load -t
B
set-cmd-text -s :quickmark-load -w
wb
bookmark-add
M
set-cmd-text -s :bookmark-load
gb
set-cmd-text -s :bookmark-load -t
gB
set-cmd-text -s :bookmark-load -w
wB
save
sf
set-cmd-text -s :set
ss
set-cmd-text -s :set -t
sl
set-cmd-text -s :set keybind
sk
zoom-out
-
zoom-in
+
zoom
=
navigate prev
[[
navigate next
]]
navigate prev -t
{{
navigate next -t
}}
navigate up
gu
navigate up -t
gU
navigate increment
<ctrl-ò>
navigate decrement
<ctrl-`>
inspector
wi
download
<ctrl-e>
download-cancel
<ctrl+g>
download-clear
cd
view-source
<ctrl-shift-u>
set-cmd-text -s :buffer
gt
tab-focus last
<ctrl-tab>
quit
<ctrl-q>
tab-focus 1
<alt-1>
tab-focus 2
<alt-2>
tab-focus 3
<alt-3>
tab-focus 4
<alt-4>
tab-focus 5
<alt-5>
tab-focus 6
<alt-6>
tab-focus 7
<alt-7>
tab-focus 8
<alt-8>
tab-focus 9
<alt-9>
home
<ctrl-h>
stop
<ctrl-gg>
print
<ctrl-alt-p>
open qute:settings
Ss
follow-selected
<return>
<ctrl-m>
<shift-return>
<enter>
<shift-enter>
follow-selected -t
<ctrl-return>
<ctrl-enter>
open -t
ga
<ctrl-t>
hint inputs
;t
repeat-command
.
spawn umpv {url}
u
hint all spawn umpv {hint-url}
U
yank -t;; spawn capture {url}
Y
hint links yank
;y
set-cmd-text :open -t {url:pretty}
gO
set-cmd-text -s :open -b
xo
set-cmd-text :open -b {url:pretty}
xO
set-cmd-text -s :open -w
wo
set-cmd-text :open -w {url:pretty}
wO
open -w
<ctrl-n>
tab-close -o
D
tab-only
co
tab-move
gm
tab-move -
gl
tab-move +
gr
tab-clone
gC
reload -f
R
<ctrl-f5>
back -t
th
back -w
wh
fullscreen
<f11>
hint all window
wf
hint links download
;d
enter-mode caret
v
enter-mode passthrough
<ctrl-v>
scroll-page 0 1
<ctrl-f>
scroll-page 0 -1
<ctrl-b>
scroll-page 0 0.5
<ctrl-d>
scroll-page 0 -0.5
<ctrl-u>
[insert]
# Keybindings for insert mode.
# Since normal keypresses are passed through, only special keys are
# supported in this mode.
# Useful hidden commands to map in this section:
# * `open-editor`: Open a texteditor with the focused field.
# * `paste-primary`: Paste primary selection at cursor position.
open-editor
<ctrl-e>
paste-primary
<ctrl-y>
[hint]
# Keybindings for hint mode.
# Since normal keypresses are passed through, only special keys are
# supported in this mode.
# Useful hidden commands to map in this section:
# * `follow-hint`: Follow the currently selected hint.
follow-hint
<return>
<ctrl-m>
<ctrl-j>
<shift-return>
<enter>
<shift-enter>
hint --rapid links tab-bg
<ctrl-r>
hint links
<ctrl-f>
hint all tab-bg
<ctrl-b>
[command]
# Keybindings for command mode.
# Since normal keypresses are passed through, only special keys are
# supported in this mode.
# Useful hidden commands to map in this section:
# * `command-history-prev`: Switch to previous command in history.
# * `command-history-next`: Switch to next command in history.
# * `completion-item-prev`: Select previous item in completion.
# * `completion-item-next`: Select next item in completion.
# * `command-accept`: Execute the command currently in the commandline.
command-history-prev
<ctrl-ù>
command-history-next
<ctrl-à>
completion-item-prev
<ctrl-p>
<up>
completion-item-next
<ctrl-n>
<down>
completion-item-del
<ctrl-á>
command-accept
<return>
<ctrl-m>
<ctrl-j>
<shift-return>
<enter>
<shift-enter>
[prompt]
# Keybindings for prompts in the status line.
# You can bind normal keys in this mode, but they will be only active
# when a yes/no-prompt is asked. For other prompt modes, you can only
# bind special keys.
# Useful hidden commands to map in this section:
# * `prompt-accept`: Confirm the entered value.
# * `prompt-yes`: Answer yes to a yes/no question.
# * `prompt-no`: Answer no to a yes/no question.
prompt-accept
<return>
<ctrl-m>
<ctrl-j>
<shift-return>
<enter>
<shift-enter>
prompt-yes
y
s
prompt-no
n
prompt-open-download
<ctrl-x>
[command,prompt]
rl-backward-char
<ctrl-b>
rl-forward-char
<ctrl-f>
rl-backward-word
<alt-b>
rl-forward-word
<alt-f>
rl-beginning-of-line
<ctrl-a>
rl-end-of-line
<ctrl-e>
rl-unix-line-discard
<ctrl-u>
rl-kill-line
<ctrl-k>
rl-kill-word
<alt-d>
rl-unix-word-rubout
<ctrl-w>
<alt-backspace>
rl-yank
<ctrl-y>
rl-delete-char
<ctrl-?>
rl-backward-delete-char
<ctrl-h>
[caret]
toggle-selection
v
<space>
drop-selection
<ctrl-space>
enter-mode normal
c
move-to-next-line
j
move-to-prev-line
k
move-to-next-char
l
move-to-prev-char
h
move-to-end-of-word
e
move-to-next-word
w
move-to-prev-word
b
move-to-start-of-next-block
]
move-to-start-of-prev-block
[
move-to-end-of-next-block
}
move-to-end-of-prev-block
{
move-to-start-of-line
0
move-to-end-of-line
$
move-to-start-of-document
gg
move-to-end-of-document
G
yank-selected -p
Y
yank-selected
y
<return>
<ctrl-m>
<ctrl-j>
<shift-return>
<enter>
<shift-enter>
scroll left
H
scroll down
J
scroll up
K
scroll right
L

1447
qutebrwoser/qutebrowser.conf Normal file

File diff suppressed because it is too large Load Diff

92
qutebrwoser/umpv Executable file
View File

@ -0,0 +1,92 @@
#!/usr/bin/env python
"""
This script emulates "unique application" functionality on Linux. When starting
playback with this script, it will try to reuse an already running instance of
mpv (but only if that was started with umpv). Other mpv instances (not started
by umpv) are ignored, and the script doesn't know about them.
This only takes filenames as arguments. Custom options can't be used; the script
interprets them as filenames. If mpv is already running, the files passed to
umpv are appended to mpv's internal playlist. If a file does not exist or is
otherwise not playable, mpv will skip the playlist entry when attempting to
play it (from the GUI perspective, it's silently ignored).
If mpv isn't running yet, this script will start mpv and let it control the
current terminal. It will not write output to stdout/stderr, because this
will typically just fill ~/.xsession-errors with garbage.
mpv will terminate if there are no more files to play, and running the umpv
script after that will start a new mpv instance.
Note that you can control the mpv instance by writing to the command fifo:
echo "cycle fullscreen" > ~/.umpv_fifo
Note: you can supply custom mpv path and options with the MPV environment
variable. The environment variable will be split on whitespace, and the
first item is used as path to mpv binary and the rest is passed as options
_if_ the script starts mpv. If mpv is not started by the script (i.e. mpv
is already running), this will be ignored.
"""
import sys
import os
import errno
import subprocess
import fcntl
import stat
import string
files = sys.argv[1:]
# this is the same method mpv uses to decide this
def is_url(filename):
parts = filename.split("://", 1)
if len(parts) < 2:
return False
# protocol prefix has no special characters => it's an URL
allowed_symbols = string.ascii_letters + string.digits + '_'
prefix = parts[0]
return all(map(lambda c: c in allowed_symbols, prefix))
# make them absolute; also makes them safe against interpretation as options
def make_abs(filename):
if not is_url(filename):
return os.path.abspath(filename)
return filename
files = [make_abs(f) for f in files]
FIFO = os.path.join(os.getenv("HOME"), ".umpv_fifo")
fifo_fd = -1
try:
fifo_fd = os.open(FIFO, os.O_NONBLOCK | os.O_WRONLY)
except OSError as e:
if e.errno == errno.ENXIO:
pass # pipe has no writer
elif e.errno == errno.ENOENT:
pass # doesn't exist
else:
raise e
if fifo_fd >= 0:
# Unhandled race condition: what if mpv is terminating right now?
fcntl.fcntl(fifo_fd, fcntl.F_SETFL, 0) # set blocking mode
fifo = os.fdopen(fifo_fd, "w")
for f in files:
# escape: \ \n "
f = f.replace("\\", "\\\\").replace("\"", "\\\"").replace("\n", "\\n")
f = "\"" + f + "\""
fifo.write("raw loadfile " + f + " append\n")
else:
# Recreate pipe if it doesn't already exist.
# Also makes sure it's safe, and no other user can create a bogus pipe
# that breaks security.
try:
os.unlink(FIFO)
except OSError as e:
pass
os.mkfifo(FIFO, 0o600)
opts = (os.getenv("MPV") or "mpv").split()
# opts.extend(["--no-terminal", "--force-window", "--ytdl-format=worstvideo+worstaudio", "--input-file=" + FIFO,
opts.extend(["--no-terminal", "--force-window", "--input-file=" + FIFO,
"--"])
opts.extend(files)
subprocess.check_call(opts)

View File

@ -1,5 +1,5 @@
set -g default-terminal "screen-256color"
set -g prefix C-a
set -g prefix C-b
set-window-option -g xterm-keys on
set -g status-bg colour235