Compare commits
No commits in common. "master" and "v2" have entirely different histories.
66 changed files with 321 additions and 4746 deletions
11
.gitignore
vendored
11
.gitignore
vendored
|
@ -1,13 +1,4 @@
|
|||
git_user
|
||||
|
||||
vim/.netrwhist
|
||||
vim/bundle/*
|
||||
vim/cache/*
|
||||
|
||||
git_user
|
||||
config/kitty/.local.conf
|
||||
config/mpv/watch_later
|
||||
config/nvim/.netrwhist
|
||||
|
||||
src/*
|
||||
!src/Makefile
|
||||
!src/*.*
|
||||
|
|
23
aliases
23
aliases
|
@ -5,17 +5,14 @@
|
|||
# Detect if we have GNU coreutils or BSD
|
||||
if date --version > /dev/null 2>&1 ;then
|
||||
alias ls='ls --classify --tabsize=0 --literal --color=auto --show-control-chars -h'
|
||||
alias lh='ls -trhgGN --color=always | cut -d" " -f3-' # List files in chronological order
|
||||
alias diff='diff --color'
|
||||
alias diff='diff -u --color'
|
||||
alias less='less --quiet'
|
||||
alias grep="grep --color"
|
||||
alias rm='rm -I'
|
||||
alias ip='ip --color'
|
||||
alias ipa='ip route && echo && ip --brief address'
|
||||
alias ipr='ip --brief address && echo && ip route'
|
||||
alias cal='cal -m -3'
|
||||
else
|
||||
alias ls='ls -FGh'
|
||||
alias ipa='ip address'
|
||||
alias ipa='ip route'
|
||||
fi
|
||||
|
@ -23,29 +20,18 @@ if which sl > /dev/null 2>&1; then
|
|||
alias l='sl'
|
||||
alias lll='sl'
|
||||
fi
|
||||
if which nvim > /dev/null 2>&1; then
|
||||
alias vim='nvim'
|
||||
fi
|
||||
if [ -f "$HOME/howto/how_to" ]; then
|
||||
alias howto="vim $HOME/howto/how_to"
|
||||
fi
|
||||
case $(uname -s) in
|
||||
case $(lsb_release -i | awk -F ':\t' '/Distributor ID/{print $2}') in
|
||||
Arch)
|
||||
alias redwm='cd ~/aur/dwm-git; updpkgsums; makepkg -fi --noconfirm; killall dwm'
|
||||
alias upgrade='sudo pacman -Syu';;
|
||||
Debian|Ubuntu)
|
||||
alias upgrade='sudo apt-get update && sudo apt-get -dy dist-upgrade && sudo apt-get dist-upgrade';;
|
||||
VoidLinux)
|
||||
alias upgrade='sudo xbps-install -Su';;
|
||||
Darwin)
|
||||
if which mvim > /dev/null 2>&1; then
|
||||
alias vim='mvim -v'
|
||||
fi;;
|
||||
esac
|
||||
alias ll='ls -lha'
|
||||
alias df='df -h'
|
||||
alias diff='diff -u'
|
||||
alias du='du -h'
|
||||
alias neomutt='pushd $HOME; neomutt; popd'
|
||||
alias feh="feh -. --auto-rotate --action1 'dragon -x %F'"
|
||||
alias which='which -a'
|
||||
# The infamous cd ...etc
|
||||
|
@ -57,7 +43,8 @@ alias -g .......='../../../../../..'
|
|||
alias -g ........='../../../../../../..'
|
||||
# Hackish tweaks
|
||||
alias steam-wine="WINEDEBUG=-all wine $WINEPREFIX/drive_c/Program\ Files\ \(x86\)/Steam/Steam.exe -no-dwrite -no-cef-sandbox &"
|
||||
alias minecraft='prismlauncher'
|
||||
alias redwm='cd ~/aur/dwm-git; updpkgsums; makepkg -fi --noconfirm; killall dwm'
|
||||
alias minecraft='java -jar $HOME/.minecraft/launcher.jar'
|
||||
alias rot13="tr '[A-Za-z]' '[N-ZA-Mn-za-m]'"
|
||||
alias shuffle='mpv --shuffle --display-tags= --no-audio-display'
|
||||
alias steam="LD_PRELOAD='/usr/\$LIB/libstdc++.so.6 /usr/\$LIB/libgcc_s.so.1 /usr/\$LIB/libxcb.so.1 /usr/\$LIB/libgpg-error.so' /usr/bin/steam"
|
||||
|
|
|
@ -1,14 +1,22 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Load helper functions
|
||||
source "$(dirname "$(rreadlink "$0")")/../lib/utils.sh"
|
||||
|
||||
# TODO: detect term or set it globally
|
||||
TERM_EMU="kitty"
|
||||
|
||||
if ! check_exists wl-paste && [ ! -z "$WAYLAND_DISPLAY" ]; then
|
||||
die() {
|
||||
notify-send "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_exists() {
|
||||
for c in $@; do
|
||||
which "$c" > /dev/null 2>&1 || return 1
|
||||
done
|
||||
}
|
||||
|
||||
if ! which wl-paste > /dev/null && [ ! -z "$WAYLAND_DISPLAY" ]; then
|
||||
die "Wayland detected and wl-paste not found"
|
||||
elif ! check_exists xsel && [ -z "$WAYLAND_DISPLAY" ]; then
|
||||
elif ! which xsel > /dev/null && [ -z "$WAYLAND_DISPLAY" ]; then
|
||||
die "xsel not found"
|
||||
fi
|
||||
|
||||
|
@ -19,30 +27,23 @@ else
|
|||
clip="$(wl-paste)"
|
||||
fi
|
||||
|
||||
urls="$(echo $clip | grep -o 'https\?://[a-zA-Z0-9~#%&_+=,.?@/-]\+')"
|
||||
urls="$(echo $clip | grep -o 'https\?://[a-zA-Z0-9~#%&_+=,.?/-]\+')"
|
||||
|
||||
# Check the requirements for every option
|
||||
opts="fav|rot13"
|
||||
check_exists "$TERM_EMU" "mpv" "yt-dlp" &&
|
||||
opts="audio-search|$opts"
|
||||
opts="rot13"
|
||||
check_exists "$TERM_EMU" "mpv" "youtube-dl" &&
|
||||
opts="$(printf "audio-search\n%s" "$opts")"
|
||||
check_exists "dragon" &&
|
||||
opts="drag-n-drop|$opts"
|
||||
opts="$(printf "drag-n-drop\n%s" "$opts")"
|
||||
# Enable additional features when the clipboard contains an URL
|
||||
if [ -n "$urls" ] && check_exists "yt-dlp"; then
|
||||
if echo "$urls" | grep -qF "scribblehub.com"; then
|
||||
check_exists "lncrawl" && opts="crawl|$opts"
|
||||
else
|
||||
check_exists "mpv" && opts="play|low-play|$opts"
|
||||
check_exists "mpc" && opts="queue|$opts"
|
||||
opts="download|$opts"
|
||||
fi
|
||||
if [ -n "$urls" ] && check_exists "youtube-dl"; then
|
||||
check_exists "mpv" &&
|
||||
opts="$(printf "play\n%s" "$opts")"
|
||||
opts="$(printf "download\n%s" "$opts")"
|
||||
fi
|
||||
# Load default choice last
|
||||
check_exists "qrencode" "feh" &&
|
||||
opts="qr|$opts"
|
||||
|
||||
# Split into multiple lines for dmenu
|
||||
opts="$(printf "%s" "$opts" | sed 's/|/\n/g')"
|
||||
opts="$(printf "qr\n%s" "$opts")"
|
||||
|
||||
choice="$(printf "%s" "$opts" | dmenu -p "$(printf "%s" "$clip" | cut -c 1-48)")"
|
||||
case "$choice" in
|
||||
|
@ -52,32 +53,17 @@ case "$choice" in
|
|||
# Download supports optional folder target
|
||||
"download"*)
|
||||
path="$HOME/mus/$(printf "%s" "$choice" | cut -d " " -f 2-)"
|
||||
mp3dl -d "$path" "$urls"
|
||||
;;
|
||||
"crawl")
|
||||
path="$HOME/books/"
|
||||
[ -d "$path" ] || mkdir -p "$path"
|
||||
cd "$path" || exit
|
||||
out="$(lncrawl --single --all --format epub --filename-only --suppress -s "$urls" | grep -vFe "Input is suppressed" -e "Namespace(")"
|
||||
errors="$(printf "%s" "$out" | grep -Fe " ❗ ")"
|
||||
if [ -n "$errors" ]; then
|
||||
printf "%s" "$errors" | notify_err
|
||||
else
|
||||
printf "%s" "$out" | sed -ne '/^NOVEL: /s/NOVEL: \(.*\)/Successfully crawled "\1"/p' | xargs -0 -n1 notify-send
|
||||
fi
|
||||
youtube-dl -x --audio-format mp3 --no-playlist -o "%(title)s.%(ext)s" "$clip" 2>&1 | grep 'ERROR:' | xargs -n1 -d "\n" notify-send
|
||||
#notify-send "Error while downloading: $clip"
|
||||
;;
|
||||
"drag-n-drop")
|
||||
"drag-n-drop"*)
|
||||
dragon -x "$clip"
|
||||
;;
|
||||
"play")
|
||||
playvideo "$clip"
|
||||
;;
|
||||
"low-play")
|
||||
playvideo -l "$clip"
|
||||
;;
|
||||
"queue")
|
||||
out="$(mpdurlqueue "$urls" 2>&1)" && notify-send "cliplumber" "stream queued"
|
||||
printf "%s" "$out" | grep "ERROR:" | notify_err
|
||||
mpv --ytdl-format='bestvideo[height<=?720]+bestaudio/best' "$clip" 2>&1 | grep 'ERROR:' | xargs -n1 -d "\n" notify-send
|
||||
|
||||
;;
|
||||
"audio-search")
|
||||
"$TERM_EMU" --single-instance mpv --ytdl-format=bestaudio ytdl://ytsearch:"$clip"
|
||||
|
@ -89,14 +75,6 @@ case "$choice" in
|
|||
wl-copy -n "$(wl-paste | tr 'A-Za-z' 'N-ZA-Mn-za-m')"
|
||||
fi
|
||||
;;
|
||||
# Optional argument to set a description for the fav
|
||||
"f"*)
|
||||
desc="$(printf "%s" "$choice" | cut -d " " -s -f 2-)"
|
||||
if [ -n "$desc" ]; then
|
||||
printf "# %s\n" "$desc" >> "$HOME/favs"
|
||||
fi
|
||||
printf "%s\n" "$urls" >> "$HOME/favs"
|
||||
;;
|
||||
*)
|
||||
printf 'Nope\n'
|
||||
;;
|
||||
|
|
BIN
bin/detectbepo
BIN
bin/detectbepo
Binary file not shown.
11
bin/dragon
11
bin/dragon
|
@ -1,11 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# We use a script instead of an alias because we want this utility in our path,
|
||||
# usable from dmenu
|
||||
|
||||
# Load helper functions
|
||||
source "$(dirname "$(rreadlink "$0")")/../lib/utils.sh"
|
||||
|
||||
assert_exists dragon-drag-and-drop
|
||||
|
||||
dragon-drag-and-drop "$@"
|
|
@ -1,19 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Inspired from https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
|
||||
|
||||
# usage: import-gsettings
|
||||
config="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini"
|
||||
if [ ! -f "$config" ]; then exit 1; fi
|
||||
|
||||
gnome_schema="org.gnome.desktop.interface"
|
||||
|
||||
gtk_theme="$(sed -nE '/^gtk-theme-name/s/^gtk-theme-name\s*=\s*//p' "$config")"
|
||||
icon_theme="$(sed -nE '/^gtk-icon-theme-name/s/^gtk-icon-theme-name\s*=\s*//p' "$config")"
|
||||
cursor_theme="$(sed -nE '/^gtk-cursor-theme-name/s/^gtk-cursor-theme-name\s*=\s*//p' "$config")"
|
||||
font_theme="$(sed -nE '/^gtk-font-name/s/^gtk-font-name\s*=\s*//p' "$config")"
|
||||
|
||||
gsettings set "$gnome_schema" gtk-theme "$gtk_theme"
|
||||
gsettings set "$gnome_schema" icon-theme "$icon_theme"
|
||||
gsettings set "$gnome_schema" cursor-theme "$cursor_theme"
|
||||
gsettings set "$gnome_schema" font-name "$font_name"
|
12
bin/mailsync
12
bin/mailsync
|
@ -1,10 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
die () {
|
||||
2>&1 echo "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
maildir=~/mail
|
||||
mailboxes=$(find "$maildir" -mindepth 1 -maxdepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch -printf '%f\n')
|
||||
|
||||
|
@ -18,13 +13,10 @@ if [ -e "$LOCKFILE" ] && kill -0 "$(cat "$LOCKFILE")"; then
|
|||
fi
|
||||
|
||||
# make sure the lockfile is removed when we exit and then claim it
|
||||
trap "rm -f '$LOCKFILE'; exit" INT TERM EXIT
|
||||
trap "rm -f $LOCKFILE; exit" INT TERM EXIT
|
||||
echo $$ > "$LOCKFILE"
|
||||
|
||||
# Try a single short sync to test password availability
|
||||
mbsync "$(echo "$mailboxes" | head -n 1)" || die "Please unlock password database"
|
||||
|
||||
for m in $(echo "$mailboxes" | tail -n+2); do
|
||||
for m in $mailboxes; do
|
||||
mbsync "$m" &
|
||||
sleep 1
|
||||
done
|
||||
|
|
45
bin/mp3dl
45
bin/mp3dl
|
@ -1,45 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
# Load helper functions
|
||||
source "$(dirname "$(rreadlink "$0")")/../lib/utils.sh"
|
||||
|
||||
usage() {
|
||||
>&2 echo "Usage: $0 [-d folder_dest] <video url>"
|
||||
exit 1
|
||||
}
|
||||
|
||||
dest="$HOME/mus/download/"
|
||||
url=""
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
arg="$1"
|
||||
case $arg in
|
||||
-h|--help)
|
||||
usage
|
||||
;;
|
||||
-d)
|
||||
dest="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
url="$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$url" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
check_exists yt-dlp || die "yt-dlp not found"
|
||||
|
||||
[ -d "$dest" ] || mkdir -p "$dest"
|
||||
|
||||
notify-send -t 3000 "mp3dl" "Downloading $url..."
|
||||
|
||||
yt-dlp -x --audio-format mp3 --no-playlist --add-metadata -o "$dest/%(title)s.%(ext)s" "$url" 2>&1 \
|
||||
| grep 'ERROR:' \
|
||||
| notify_err
|
|
@ -1,61 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
A simple script to pipe URIs through yt-dlp and mpd
|
||||
|
||||
Credit: https://gist.github.com/phaer/86bdcc3fb59cd3fcd9534bfe84d9fe5f
|
||||
"""
|
||||
import sys
|
||||
import mpd
|
||||
import yt_dlp
|
||||
|
||||
mpd_host = ('localhost', 6600)
|
||||
ydl_opts = {
|
||||
'format': 'bestaudio/audio',
|
||||
'quiet': True,
|
||||
}
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) != 2:
|
||||
print("usage: {} <url>".format(sys.argv[0]), file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
source_url = sys.argv[1]
|
||||
client = mpd.MPDClient()
|
||||
|
||||
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
||||
try:
|
||||
info = ydl.extract_info(source_url, process=False, download=False)
|
||||
except yt_dlp.utils.DownloadError:
|
||||
# Don't print anything, yt-dlp is already on it
|
||||
sys.exit(1)
|
||||
|
||||
if info.get("_type") is not None and info.get("_type") == "playlist":
|
||||
print("Queuing playlists not supported yet.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
info = ydl.process_ie_result(info, download=False)
|
||||
url = info.get('url')
|
||||
title = info.get('title')
|
||||
source = info.get('extractor_key')
|
||||
|
||||
# This info is only available for songs
|
||||
# that have been tagged as such on youtube
|
||||
artist = info.get('artist')
|
||||
|
||||
if not (url and title and source):
|
||||
print("youtube-dl error.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
client.connect(*mpd_host)
|
||||
|
||||
# Get current playing song index and then append the stream just after
|
||||
# This is analogous to `mpc insert <song>`
|
||||
pos = int(client.status()["song"])
|
||||
song_id = client.addid(url, pos + 1)
|
||||
|
||||
client.addtagid(song_id, 'title', title)
|
||||
client.addtagid(song_id, 'album', source)
|
||||
if artist is not None:
|
||||
client.addtagid(song_id, 'artist', artist)
|
||||
|
||||
client.disconnect()
|
114
bin/mutt_bgrun
114
bin/mutt_bgrun
|
@ -1,114 +0,0 @@
|
|||
#!/bin/sh
|
||||
# @(#) mutt_bgrun $Revision: 1.4 $
|
||||
|
||||
# mutt_bgrun - run an attachment viewer from mutt in the background
|
||||
# Copyright (C) 1999-2002 Gary A. Johnson
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# SYNOPSIS
|
||||
# mutt_bgrun viewer [viewer options] file
|
||||
#
|
||||
# DESCRIPTION
|
||||
# Mutt invokes external attachment viewers by writing the
|
||||
# attachment to a temporary file, executing the pipeline specified
|
||||
# for that attachment type in the mailcap file, waiting for the
|
||||
# pipeline to terminate, writing nulls over the temporary file,
|
||||
# then deleting it. This causes problems when using graphical
|
||||
# viewers such as qvpview and acroread to view attachments.
|
||||
#
|
||||
# If qvpview, for example, is executed in the foreground, the mutt
|
||||
# user interface is hung until qvpview exits, so the user can't do
|
||||
# anything else with mutt until he or she finishes reading the
|
||||
# attachment and exits qvpview. This is especially annoying when
|
||||
# a message contains several MS Office attachments--one would like
|
||||
# to have them all open at once.
|
||||
#
|
||||
# If qvpview is executed in the background, it must be given
|
||||
# enough time to completely read the file before returning control
|
||||
# to mutt, since mutt will then obliterate the file. Qvpview is
|
||||
# so slow that this time can exceed 20 seconds, and the bound is
|
||||
# unknown. So this is again annoying.
|
||||
#
|
||||
# The solution provided here is to invoke the specified viewer
|
||||
# from this script after first copying mutt's temporary file to
|
||||
# another temporary file. This script can then quickly return
|
||||
# control to mutt while the viewer can take as much time as it
|
||||
# needs to read and render the attachment.
|
||||
#
|
||||
# EXAMPLE
|
||||
# To use qvpview to view MS Office attachments from mutt, add the
|
||||
# following lines to mutt's mailcap file.
|
||||
#
|
||||
# application/msword; mutt_bgrun qvpview %s
|
||||
# application/vnd.ms-excel; mutt_bgrun qvpview %s
|
||||
# application/vnd.ms-powerpoint; mutt_bgrun qvpview %s
|
||||
#
|
||||
# AUTHOR
|
||||
# Gary A. Johnson
|
||||
# <garyjohn@spk.agilent.com>
|
||||
#
|
||||
# ACKNOWLEDGEMENTS
|
||||
# My thanks to the people who have commented on this script and
|
||||
# offered solutions to shortcomings and bugs, especially Edmund
|
||||
# GRIMLEY EVANS <edmundo@rano.org> and Andreas Somogyi
|
||||
# <aso@somogyi.nu>.
|
||||
|
||||
prog=${0##*/}
|
||||
|
||||
# Check the arguments first.
|
||||
|
||||
if [ "$#" -lt "2" ]
|
||||
then
|
||||
echo "usage: $prog viewer [viewer options] file" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Separate the arguments. Assume the first is the viewer, the last is
|
||||
# the file, and all in between are options to the viewer.
|
||||
|
||||
viewer="$1"
|
||||
shift
|
||||
|
||||
while [ "$#" -gt "1" ]
|
||||
do
|
||||
options="$options $1"
|
||||
shift
|
||||
done
|
||||
|
||||
file=$1
|
||||
|
||||
# Create a temporary directory for our copy of the temporary file.
|
||||
#
|
||||
# This is more secure than creating a temporary file in an existing
|
||||
# directory.
|
||||
|
||||
tmpdir=/tmp/$LOGNAME$$
|
||||
umask 077
|
||||
mkdir "$tmpdir" || exit 1
|
||||
tmpfile="$tmpdir/${file##*/}"
|
||||
|
||||
# Copy mutt's temporary file to our temporary directory so that we can
|
||||
# let mutt overwrite and delete it when we exit.
|
||||
|
||||
cp "$file" "$tmpfile"
|
||||
|
||||
# Run the viewer in the background and delete the temporary files when done.
|
||||
|
||||
(
|
||||
"$viewer" $options "$tmpfile"
|
||||
rm -f "$tmpfile"
|
||||
rmdir "$tmpdir"
|
||||
) &
|
136
bin/notify.py
136
bin/notify.py
|
@ -1,136 +0,0 @@
|
|||
# Copyright (C) 2009 www.stani.be
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see http://www.gnu.org/licenses/
|
||||
|
||||
# Follows PEP8
|
||||
|
||||
APP_NAME = 'notify.py'
|
||||
|
||||
from sys import stderr
|
||||
|
||||
# Notify (linux)
|
||||
try:
|
||||
# import Notify
|
||||
# import gobject
|
||||
# gobject.threads_init()
|
||||
import gi
|
||||
gi.require_version('Notify', '0.7')
|
||||
from gi.repository import Notify
|
||||
except (ImportError, ValueError):
|
||||
Notify = None
|
||||
|
||||
# Growl (Mac Os X)
|
||||
if Notify:
|
||||
Growl = None
|
||||
else:
|
||||
try:
|
||||
import Growl
|
||||
except ImportError:
|
||||
Growl = None
|
||||
|
||||
# Toasterbox (Windows)
|
||||
if Notify or Growl:
|
||||
TB = None
|
||||
else:
|
||||
try:
|
||||
import wx
|
||||
import other.pyWx.toasterbox as TB
|
||||
except ImportError:
|
||||
TB = None
|
||||
|
||||
|
||||
def register(app_name):
|
||||
global APP_NAME
|
||||
APP_NAME = app_name
|
||||
|
||||
|
||||
def init(app_name, icon=None):
|
||||
print("Warning: couldn't find any notification API", file=stderr)
|
||||
register(app_name)
|
||||
|
||||
if Notify:
|
||||
|
||||
def init(app_name, icon=None):
|
||||
register(app_name)
|
||||
Notify.init(app_name)
|
||||
|
||||
def send(title, message, icon='gtk-dialog-info', wxicon=None,
|
||||
urgent=False, timeout=None):
|
||||
n = Notify.Notification.new(title, message, icon)
|
||||
if urgent:
|
||||
n.set_urgency(2)
|
||||
if timeout:
|
||||
n.set_timeout(timeout)
|
||||
n.show()
|
||||
|
||||
elif Growl:
|
||||
|
||||
def init(app_name, icon=None):
|
||||
"""Create a growl notifier with appropriate icon if specified.
|
||||
The notification classes default to [APP_NAME]. The user can
|
||||
enable/disable notifications based on this class name."""
|
||||
global growl
|
||||
register(app_name)
|
||||
if icon is None:
|
||||
icon = {}
|
||||
else:
|
||||
icon = {'applicationIcon': Growl.Image.imageFromPath(icon)}
|
||||
growl = Growl.GrowlNotifier(APP_NAME, [APP_NAME], **icon)
|
||||
|
||||
def send(title, message, icon='gtk-dialog-info', wxicon=None,
|
||||
urgent=False, timeout=None):
|
||||
global growl
|
||||
growl.notify(APP_NAME, title, message)
|
||||
|
||||
elif TB:
|
||||
|
||||
def send(title, message, icon='gtk-dialog-info',
|
||||
wxicon=None, urgent=False, timeout=None):
|
||||
if wxicon == None:
|
||||
wxicon = wx.ArtProvider_GetBitmap(wx.ART_INFORMATION,
|
||||
wx.ART_OTHER, (48, 48))
|
||||
tb = TB.ToasterBox(wx.GetApp().GetTopWindow(),
|
||||
TB.TB_COMPLEX, TB.DEFAULT_TB_STYLE, TB.TB_ONTIME)
|
||||
tb.SetPopupSize((300, 80))
|
||||
tb.SetPopupPauseTime(5000)
|
||||
tb.SetPopupScrollSpeed(8)
|
||||
tb.SetPopupPositionByInt(3)
|
||||
|
||||
#wx controls
|
||||
tbpanel = tb.GetToasterBoxWindow()
|
||||
panel = wx.Panel(tbpanel, -1)
|
||||
panel.SetBackgroundColour(wx.WHITE)
|
||||
wxicon = wx.StaticBitmap(panel, -1, wxicon)
|
||||
title = wx.StaticText(panel, -1, title)
|
||||
message = wx.StaticText(panel, -1, message)
|
||||
|
||||
# wx layout controls
|
||||
ver_sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
ver_sizer.Add(title, 0, wx.ALL, 4)
|
||||
ver_sizer.Add(message, 0, wx.ALL, 4)
|
||||
|
||||
hor_sizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
hor_sizer.Add(wxicon, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL \
|
||||
| wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 4)
|
||||
hor_sizer.Add(ver_sizer, 1, wx.EXPAND)
|
||||
hor_sizer.Layout()
|
||||
panel.SetSizer(hor_sizer)
|
||||
|
||||
tb.AddPanel(panel)
|
||||
tb.Play()
|
||||
|
||||
else:
|
||||
|
||||
def send(*args, **keyw):
|
||||
pass
|
|
@ -1,20 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Load helper functions
|
||||
source "$(dirname "$(rreadlink "$0")")/../lib/utils.sh"
|
||||
|
||||
if [ "$1" = "-h" ] || [ "$#" -lt "1" ]; then
|
||||
>&2 echo "Usage: $0 [-l] <video url>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
quality=720
|
||||
|
||||
if [ "$1" = "-l" ]; then
|
||||
shift
|
||||
quality=360
|
||||
fi
|
||||
|
||||
# https://github.com/mpv-player/mpv/issues/4241
|
||||
#mpv --ytdl-format="bestvideo[height<=?$quality]+bestaudio/best" "$@" 2>&1 | grep 'ERROR:' | notify_err
|
||||
mpv --ytdl-format="bestvideo[height<=?$quality][fps<=?30][vcodec!=?vp9]+bestaudio/best[height<=?$quality]" "$@" 2>&1 | grep 'ERROR:' | notify_err
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
zbarcam --raw --oneshot -q | tee /dev/fd/2 | xsel -bi
|
|
@ -1,55 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Function by mklement0
|
||||
# https://stackoverflow.com/a/29835459/5309963
|
||||
# The following, POSIX-compliant shell function implements what
|
||||
# GNU's readlink -e does and is a reasonably robust solution
|
||||
# that only fails in two rare edge cases:
|
||||
# - paths with embedded newlines (very rare)
|
||||
# - filenames containing literal string -> (also rare)
|
||||
|
||||
( # Execute the function in a *subshell* to localize variables and the effect of `cd`.
|
||||
|
||||
target=$1 fname= targetDir= CDPATH=
|
||||
|
||||
# Try to make the execution environment as predictable as possible:
|
||||
# All commands below are invoked via `command`, so we must make sure that `command`
|
||||
# itself is not redefined as an alias or shell function.
|
||||
# (Note that command is too inconsistent across shells, so we don't use it.)
|
||||
# `command` is a *builtin* in bash, dash, ksh, zsh, and some platforms do not even have
|
||||
# an external utility version of it (e.g, Ubuntu).
|
||||
# `command` bypasses aliases and shell functions and also finds builtins
|
||||
# in bash, dash, and ksh. In zsh, option POSIX_BUILTINS must be turned on for that
|
||||
# to happen.
|
||||
{ \unalias command; \unset -f command; } >/dev/null 2>&1
|
||||
[ -n "$ZSH_VERSION" ] && options[POSIX_BUILTINS]=on # make zsh find *builtins* with `command` too.
|
||||
|
||||
while :; do # Resolve potential symlinks until the ultimate target is found.
|
||||
[ -L "$target" ] || [ -e "$target" ] || { command printf '%s\n' "ERROR: '$target' does not exist." >&2; return 1; }
|
||||
command cd "$(command dirname -- "$target")" # Change to target dir; necessary for correct resolution of target path.
|
||||
fname=$(command basename -- "$target") # Extract filename.
|
||||
[ "$fname" = '/' ] && fname='' # !! curiously, `basename /` returns '/'
|
||||
if [ -L "$fname" ]; then
|
||||
# Extract [next] target path, which may be defined
|
||||
# *relative* to the symlink's own directory.
|
||||
# Note: We parse `ls -l` output to find the symlink target
|
||||
# which is the only POSIX-compliant, albeit somewhat fragile, way.
|
||||
target=$(command ls -l "$fname")
|
||||
target=${target#* -> }
|
||||
continue # Resolve [next] symlink target.
|
||||
fi
|
||||
break # Ultimate target reached.
|
||||
done
|
||||
targetDir=$(command pwd -P) # Get canonical dir. path
|
||||
# Output the ultimate target's canonical path.
|
||||
# Note that we manually resolve paths ending in /. and /.. to make sure we have a normalized path.
|
||||
if [ "$fname" = '.' ]; then
|
||||
command printf '%s\n' "${targetDir%/}"
|
||||
elif [ "$fname" = '..' ]; then
|
||||
# Caveat: something like /var/.. will resolve to /private (assuming /var@ -> /private/var), i.e. the '..' is applied
|
||||
# AFTER canonicalization.
|
||||
command printf '%s\n' "$(command dirname -- "${targetDir}")"
|
||||
else
|
||||
command printf '%s\n' "${targetDir%/}/$fname"
|
||||
fi
|
||||
)
|
22
bin/shot
22
bin/shot
|
@ -1,8 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Load helper functions
|
||||
bin_path="$(dirname "$(rreadlink "$0")")"
|
||||
source "$bin_path/../lib/utils.sh"
|
||||
die() {
|
||||
# When run from WM, $TERM appear to be set to "linux"
|
||||
# TODO: find a less brittle solution
|
||||
[ "$TERM" = "linux" ] && notify-send "$@" || echo "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_exists() {
|
||||
which "$1" > /dev/null 2>&1 || die "$1 doesn't appear to be installed"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
NAME="shot_$(date '+%Y%m%d%H%M%S').png"
|
||||
|
@ -14,12 +21,13 @@ SCREEN_DIR="$HOME/img/screenshots"
|
|||
mkdir -p "$SCREEN_DIR"
|
||||
# Let's try to detect Wayland running
|
||||
if [ -z "$WAYLAND_DISPLAY" ]; then
|
||||
assert_exists "maim"
|
||||
maim --hidecursor --select "$SCREEN_DIR/$NAME"
|
||||
check_exists "maim"
|
||||
maim -s "$SCREEN_DIR/$NAME"
|
||||
# Fail silently if xsel isn't installed, the clipboard feature isn't critical
|
||||
echo "$SCREEN_DIR/$NAME" | xsel --clipboard --input > /dev/null 2>&1
|
||||
echo "$SCREEN_DIR/$NAME" | xsel -b -i > /dev/null 2>&1
|
||||
else
|
||||
assert_exists "grim" "slop"
|
||||
check_exists "grim"
|
||||
check_exists "slop"
|
||||
slop | awk -F '[x+]' '{printf "%s,%s %sx%s",$3,$4,$1,$2}' | grim -g - "$SCREEN_DIR/$NAME"
|
||||
# Same as xsel
|
||||
wl-copy -n "$SCREEN_DIR/$NAME" > /dev/null 2>&1
|
||||
|
|
167
bin/volcont
167
bin/volcont
|
@ -1,167 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# finds the active sink for pulse audio and increments the volume. useful when you have multiple audio outputs and have a key bound to vol-up and down
|
||||
# Taken from http://customlinux.blogspot.fr/2013/02/pavolumesh-control-active-sink-volume.html
|
||||
# and slightly adapted by lhark to work with notify-send
|
||||
|
||||
notify='dunst' # no/yes/dunst
|
||||
notiftime='400'
|
||||
notifid='42'
|
||||
inc='2'
|
||||
capvol='yes'
|
||||
maxvol='200'
|
||||
autosync='no'
|
||||
|
||||
icon_up='audio-volume-high-symbolic'
|
||||
icon_down='audio-volume-low-symbolic'
|
||||
icon_mute='audio-volume-muted-symbolic'
|
||||
|
||||
main_sink=$(pacmd list-sinks |awk '/* index:/{print $3}')
|
||||
active_sinks=$(pacmd list-sinks |awk '/index:/{print $NF}' | tr '\n' ' ' | sed 's/ $/\n/g')
|
||||
limit=$((100 - inc))
|
||||
maxlimit=$((maxvol - inc))
|
||||
|
||||
updateSinks () {
|
||||
active_sinks=$(pacmd list-sinks |awk '/index:/{print $NF}' | tr '\n' ' ' | sed 's/ $/\n/g')
|
||||
}
|
||||
|
||||
|
||||
volUp () {
|
||||
updateSinks
|
||||
getCurVol
|
||||
|
||||
for sink in ${active_sinks}; do
|
||||
if [ ${capvol} = 'yes' ]; then
|
||||
if [ "${curVol}" -le 100 ] && [ "${curVol}" -ge ${limit} ]; then
|
||||
pactl set-sink-volume "${sink}" 100%
|
||||
elif [ "${curVol}" -lt ${limit} ]; then
|
||||
pactl set-sink-volume "${sink}" +${inc}%
|
||||
fi
|
||||
elif [ "${curVol}" -le ${maxvol} ] && [ "${curVol}" -ge ${maxlimit} ]; then
|
||||
pactl set-sink-volume "${sink}" ${maxvol}%
|
||||
elif [ "${curVol}" -lt ${maxlimit} ]; then
|
||||
pactl set-sink-volume "${sink}" +${inc}%
|
||||
fi
|
||||
done
|
||||
|
||||
getCurVol
|
||||
|
||||
if [ ${notify} = 'yes' ]; then
|
||||
notify-send "Volume : ${curVol}%" -t ${notiftime}
|
||||
elif [ "$notify" = 'dunst' ]; then
|
||||
dunstify -r "$notifid" -t "$notiftime" -i "$icon_up" "Volume: $curVol%"
|
||||
fi
|
||||
|
||||
if [ ${autosync} = 'yes' ]; then
|
||||
volSync
|
||||
fi
|
||||
}
|
||||
|
||||
volDown () {
|
||||
updateSinks
|
||||
for sink in ${active_sinks}; do
|
||||
pactl set-sink-volume "${sink}" -${inc}%
|
||||
done
|
||||
getCurVol
|
||||
|
||||
if [ ${notify} = 'yes' ]; then
|
||||
notify-send "Volume : ${curVol}%" -t ${notiftime}
|
||||
elif [ "$notify" = 'dunst' ]; then
|
||||
dunstify -r "$notifid" -t "$notiftime" -i "$icon_down" "Volume: $curVol%"
|
||||
fi
|
||||
|
||||
if [ ${autosync} = 'yes' ]; then
|
||||
volSync
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
volSync () {
|
||||
updateSinks
|
||||
getCurVol
|
||||
|
||||
for each in ${active_sinks}; do
|
||||
pactl set-sink-volume "${each}" "${curVol}"%
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
getCurVol () {
|
||||
curVol=$(pacmd list-sinks |grep -A 15 'index: '"${main_sink}"'' |grep 'volume:' |egrep -v 'base volume:' |awk -F : '{print $3}' |grep -o -P '.{0,3}%'|sed s/.$// | tr -d ' ')
|
||||
}
|
||||
|
||||
|
||||
volMute () {
|
||||
case "$1" in
|
||||
mute)
|
||||
for sink in ${active_sinks}; do
|
||||
pactl set-sink-mute "${sink}" 1
|
||||
done
|
||||
curVol=0
|
||||
status=1
|
||||
;;
|
||||
unmute)
|
||||
for sink in ${active_sinks}; do
|
||||
pactl set-sink-mute "${sink}" 0
|
||||
done
|
||||
getCurVol
|
||||
status=0
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ ${notify} = 'yes' ]; then
|
||||
notify-send "$([ "${status}" = 1 ] && echo "Sound muted" || echo "Sound unmuted")" -t ${notiftime}
|
||||
elif [ "$notify" = 'dunst' ]; then
|
||||
[ "$status" = 1 ] && icon="$icon_mute" || icon="$icon_up"
|
||||
dunstify -r "$notifid" -t "$notiftime" -i "$icon" "$([ "${status}" = 1 ] && echo "Sound muted" || echo "Sound unmuted")"
|
||||
fi
|
||||
}
|
||||
|
||||
volMuteStatus () {
|
||||
curStatus=$(pacmd list-sinks |grep -A 15 'index: '"${main_sink}"'' |awk '/muted/{ print $2}')
|
||||
|
||||
if [ "${curStatus}" = 'yes' ]; then
|
||||
volMute unmute
|
||||
else
|
||||
volMute mute
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
volHelp () {
|
||||
echo "Finds the active sink for pulse audio and manages the volume."
|
||||
echo "Options :"
|
||||
echo ""
|
||||
echo " --down"
|
||||
echo " --help"
|
||||
echo " --mute"
|
||||
echo " --sync Sync all sinks volumes"
|
||||
echo " --toggle"
|
||||
echo " --unmute"
|
||||
echo " --up"
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
--up)
|
||||
volUp
|
||||
;;
|
||||
--down)
|
||||
volDown
|
||||
;;
|
||||
--toggle)
|
||||
volMuteStatus
|
||||
;;
|
||||
--help)
|
||||
volHelp
|
||||
;;
|
||||
--mute)
|
||||
volMute mute
|
||||
;;
|
||||
--unmute)
|
||||
volMute unmute
|
||||
;;
|
||||
--sync)
|
||||
volSync
|
||||
;;
|
||||
esac
|
296
bin/work
296
bin/work
|
@ -1,296 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import argparse
|
||||
import notify
|
||||
from signal import signal, SIGINT
|
||||
import sys
|
||||
from time import sleep
|
||||
from os.path import expanduser, join
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
TIME_FILE = join(expanduser("~"), "timekeeping.csv")
|
||||
TODAY_FILE = join(expanduser("~"), ".timekeeping")
|
||||
|
||||
is_on_break = False
|
||||
today_fields = []
|
||||
start_time = datetime.now()
|
||||
|
||||
|
||||
def die(*args):
|
||||
print("Error: {}".format(*args), file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def log(*args):
|
||||
print(*args, file=sys.stderr)
|
||||
|
||||
|
||||
def signal_handler(signal, frame):
|
||||
global today_fields
|
||||
now = datetime.now()
|
||||
hour = now.strftime("%H:%M")
|
||||
if not is_on_break:
|
||||
sys.exit(0)
|
||||
else:
|
||||
break_time = now - start_time
|
||||
log("\nBreak ended at {} and lasted {}".format(
|
||||
hour, td_format(break_time)))
|
||||
today_fields.append(start_time.strftime("%H:%M"))
|
||||
today_fields.append(hour)
|
||||
with open(TODAY_FILE, "w") as f:
|
||||
f.write(",".join(today_fields))
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
def td_format(td):
|
||||
prefix = ""
|
||||
if td < timedelta(0):
|
||||
td = -td
|
||||
prefix = "-"
|
||||
hours, remainder = divmod(td.total_seconds(), 3600)
|
||||
minutes, seconds = divmod(remainder, 60)
|
||||
|
||||
return '{}{:d}:{:02d}'.format(prefix, int(hours), int(minutes))
|
||||
|
||||
|
||||
def get_today_fields():
|
||||
try:
|
||||
with open(TODAY_FILE, "r") as f:
|
||||
line_count = 0
|
||||
for line in f:
|
||||
line_count += 1
|
||||
if line_count > 1:
|
||||
log("Warning: incomplete day leftover in {}".format(TODAY_FILE))
|
||||
if line.startswith(start_time.strftime("%Y-%m-%d")):
|
||||
return line.strip().split(",")
|
||||
except FileNotFoundError:
|
||||
return []
|
||||
return []
|
||||
|
||||
|
||||
def work(args):
|
||||
total_delta = timedelta()
|
||||
month_delta = timedelta()
|
||||
count = 0
|
||||
month_count = 0
|
||||
with open(TIME_FILE, "r") as f:
|
||||
for line in f:
|
||||
fields = line.strip().split(",", 5)
|
||||
date = datetime.strptime(fields[0], "%Y-%m-%d")
|
||||
t = datetime.strptime(fields[4], "%H:%M")
|
||||
delta = timedelta(hours=t.hour, minutes=t.minute)
|
||||
if date.month == start_time.month:
|
||||
month_delta += delta
|
||||
month_count += 1
|
||||
total_delta += delta
|
||||
count += 1
|
||||
eight_h = timedelta(hours=8) * count
|
||||
mean_time = total_delta / count if count > 0 else total_delta
|
||||
minutes = total_delta - eight_h
|
||||
month_mean_time = month_delta / month_count if month_count > 0 else month_delta
|
||||
month_min = month_delta - timedelta(hours=(8 * month_count))
|
||||
print("stats: {}, {}".format(
|
||||
td_format(mean_time),
|
||||
td_format(minutes)))
|
||||
print("month stats: {}, {}".format(
|
||||
td_format(month_mean_time),
|
||||
td_format(month_min)))
|
||||
|
||||
# Try to calculate remaining time
|
||||
fields = get_today_fields()
|
||||
hour = start_time.strftime("%H:%M")
|
||||
if not fields:
|
||||
print("No work ongoing")
|
||||
return
|
||||
fields.append(hour)
|
||||
# Test for even number of timestamp (but fields[0] is the date)
|
||||
if len(fields) < 3:
|
||||
die("not enough fields in {}".format(TODAY_FILE))
|
||||
elif len(fields) % 2 == 0:
|
||||
# Break in progress
|
||||
log("Break in progress")
|
||||
return
|
||||
begin_time = None
|
||||
worked_time = timedelta()
|
||||
for field in fields[1:]:
|
||||
try:
|
||||
if begin_time is None:
|
||||
begin_time = datetime.strptime(field, "%H:%M")
|
||||
else:
|
||||
end_time = datetime.strptime(field, "%H:%M")
|
||||
worked_time += end_time - begin_time
|
||||
begin_time = None
|
||||
except ValueError:
|
||||
die("couldn't parse field '{}' in {}".format(
|
||||
field, TODAY_FILE))
|
||||
day_start = datetime.strptime(fields[1], "%H:%M")
|
||||
day_end = datetime.strptime(fields[-1], "%H:%M")
|
||||
total_time = day_end - day_start
|
||||
break_time = total_time - worked_time
|
||||
day_end_estimation = day_start + timedelta(hours=8) + break_time
|
||||
print("Worked {} already today. Estimated leave at {}".format(
|
||||
td_format(worked_time),
|
||||
day_end_estimation.strftime("%H:%M")))
|
||||
|
||||
|
||||
|
||||
def work_start(args):
|
||||
fields = get_today_fields()
|
||||
try:
|
||||
hour = datetime.strptime(args.time, "%H:%M")
|
||||
except ValueError:
|
||||
die("Error: {} is not a valid time".format(args.time))
|
||||
if fields:
|
||||
die("You already started working")
|
||||
with open(TODAY_FILE, "a") as f:
|
||||
f.write("{},{}".format(
|
||||
start_time.strftime("%Y-%m-%d"),
|
||||
hour.strftime("%H:%M")))
|
||||
log("Started working at {}".format(hour.strftime("%H:%M")))
|
||||
|
||||
|
||||
def work_pause(args):
|
||||
global is_on_break
|
||||
global today_fields
|
||||
is_on_break = True
|
||||
today_fields = get_today_fields()
|
||||
hour = start_time.strftime("%H:%M")
|
||||
if not today_fields:
|
||||
die("no work to take a break from")
|
||||
log("Taking a break at {}".format(hour))
|
||||
|
||||
notify.init("work")
|
||||
# Wait to be stopped by a Ctrl-C
|
||||
reminder_interval = 5 # In minutes
|
||||
count = 0
|
||||
while True:
|
||||
sleep(reminder_interval * 60)
|
||||
count += 1
|
||||
notify.send("Pause reminder",
|
||||
"It has now been {} minutes".format(count * reminder_interval))
|
||||
|
||||
|
||||
def work_end(args):
|
||||
fields = get_today_fields()
|
||||
hour = start_time.strftime("%H:%M")
|
||||
if not fields:
|
||||
die("Why try to leave when you haven't even started")
|
||||
fields.append(hour)
|
||||
if len(fields) < 3:
|
||||
die("not enough fields in {}".format(TODAY_FILE))
|
||||
# Test for even number of timestamp (but fields[0] is the date)
|
||||
elif len(fields) % 2 == 0:
|
||||
die("odd number of timestamps in {}".format(TODAY_FILE))
|
||||
begin_time = None
|
||||
worked_time = timedelta()
|
||||
for field in fields[1:]:
|
||||
try:
|
||||
if begin_time is None:
|
||||
begin_time = datetime.strptime(field, "%H:%M")
|
||||
else:
|
||||
end_time = datetime.strptime(field, "%H:%M")
|
||||
worked_time += end_time - begin_time
|
||||
begin_time = None
|
||||
except ValueError:
|
||||
die("couldn't parse field '{}' in {}".format(
|
||||
field, TODAY_FILE))
|
||||
day_start = datetime.strptime(fields[1], "%H:%M")
|
||||
day_end = datetime.strptime(fields[-1], "%H:%M")
|
||||
total_time = day_end - day_start
|
||||
break_time = total_time - worked_time
|
||||
with open(TIME_FILE, "a") as f:
|
||||
f.write('{},{},{},{},{},"{}"\n'.format(
|
||||
fields[0],
|
||||
day_start.strftime("%H:%M"),
|
||||
start_time.strftime("%H:%M"),
|
||||
td_format(break_time),
|
||||
td_format(worked_time),
|
||||
args.description))
|
||||
# Erase TODAY_FILE
|
||||
with open(TODAY_FILE, "w") as f:
|
||||
f.write("")
|
||||
f.flush()
|
||||
log("Finished working at {} after working {}".format(
|
||||
hour, td_format(worked_time)))
|
||||
|
||||
|
||||
def work_export(args):
|
||||
print("export")
|
||||
|
||||
|
||||
def work_parse(args):
|
||||
new_lines = []
|
||||
try:
|
||||
with open(args.file, "r") as f:
|
||||
for line in f:
|
||||
fields = line.strip().split(",")
|
||||
if len(fields) < 6:
|
||||
log("Record: '{}' hasn't got enough fields ({})".format(line, len(fields)))
|
||||
continue
|
||||
times = []
|
||||
for field in fields[1:]:
|
||||
try:
|
||||
time = datetime.strptime(field, "%H:%M")
|
||||
times.append(time)
|
||||
except ValueError:
|
||||
break
|
||||
if len(times) % 2 != 0:
|
||||
die("Error: uneven number of timestamps ({}) in line '{}'".format(len(times), line))
|
||||
|
||||
desc = ','.join(fields[len(times)+1:]).strip()
|
||||
|
||||
worked_time = timedelta()
|
||||
for i in range(int(len(times) / 2)):
|
||||
worked_time += times[i * 2 + 1] - times[i * 2]
|
||||
|
||||
morning = times[0]
|
||||
evening = times[-1]
|
||||
full_day = evening - morning
|
||||
break_time = full_day - worked_time
|
||||
new_lines.append('{},{},{},{},{},{}'.format(
|
||||
fields[0],
|
||||
morning.strftime("%H:%M"),
|
||||
evening.strftime("%H:%M"),
|
||||
td_format(break_time),
|
||||
td_format(worked_time),
|
||||
desc))
|
||||
except FileNotFoundError:
|
||||
die("file not found: {}".format(args.file))
|
||||
# TODO do sanity checking, like if a day already exists
|
||||
with open(TIME_FILE, "a") as f:
|
||||
for line in new_lines:
|
||||
f.write("{}\n".format(line))
|
||||
log("Written {} new entries to {}".format(len(new_lines), TIME_FILE))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Handle Ctrl-C
|
||||
signal(SIGINT, signal_handler)
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.set_defaults(func=work)
|
||||
commands = parser.add_subparsers(dest="command")
|
||||
|
||||
start_parser = commands.add_parser("start")
|
||||
pause_parser = commands.add_parser("pause")
|
||||
end_parser = commands.add_parser("end")
|
||||
export_parser = commands.add_parser("export")
|
||||
parse_parser = commands.add_parser("parse")
|
||||
|
||||
start_parser.set_defaults(func=work_start)
|
||||
start_parser.add_argument("time", nargs="?", default=datetime.now().strftime("%H:%M"))
|
||||
pause_parser.set_defaults(func=work_pause)
|
||||
end_parser.set_defaults(func=work_end)
|
||||
end_parser.add_argument("description")
|
||||
export_parser.set_defaults(func=work_export)
|
||||
parse_parser.set_defaults(func=work_parse)
|
||||
parse_parser.add_argument("file")
|
||||
|
||||
args = parser.parse_args()
|
||||
args.func(args)
|
||||
|
||||
#now = datetime.now()
|
||||
#with open(TIME_FILE, "r") as f:
|
||||
# for line in f:
|
||||
# print(line.strip())
|
71
bin/work.old
71
bin/work.old
|
@ -1,71 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
TIMEFILE="$HOME/timekeeping.csv"
|
||||
|
||||
usage () {
|
||||
>&2 printf "usage:\n\t%s <start|pause|end>" "$(basename "$0")"
|
||||
exit 0
|
||||
}
|
||||
|
||||
die () {
|
||||
>&2 echo "Error: $*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
from_ts () {
|
||||
if ! date --version >/dev/null 2>&1; then # BSD
|
||||
date -r "$1" '+%H:%M'
|
||||
else # GNU
|
||||
date -d "@$1" '+%H:%M'
|
||||
fi
|
||||
}
|
||||
|
||||
pause_end () {
|
||||
if [ "$ACTION" = "pause" ]; then
|
||||
now="$(date '+%s')"
|
||||
printf "%s," "$((now - START))" >> "$TIMEFILE"
|
||||
>&2 printf "\nYou took a %d minutes pause\n" "$(( (now - START) / 60))"
|
||||
fi
|
||||
}
|
||||
|
||||
trap pause_end INT
|
||||
|
||||
test -z "$1" && usage
|
||||
test -e "$TIMEFILE" || touch "$TIMEFILE"
|
||||
|
||||
TODAY="$(date '+%Y-%m-%d')"
|
||||
START="$(date '+%s')"
|
||||
ACTION="$1"
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
grep -qE "^$TODAY" "$TIMEFILE" && die "you already started your day"
|
||||
printf "%s,%s," "$TODAY" "$(date '+%s')" >> "$TIMEFILE"
|
||||
>&2 printf "Started work at %s\n" "$(date '+%H:%M')";;
|
||||
pause)
|
||||
grep -qE "^$TODAY" "$TIMEFILE" || die "You haven't even started your day!"
|
||||
awk -F, "/^$TODAY/"'{if (NF > 4) exit 1}' "$TIMEFILE" || die "You're already done for the day"
|
||||
awk -F, "/^$TODAY/"'{if (NF > 2) exit 1}' "$TIMEFILE" || die "You've already expanded your daily break allowance"
|
||||
>&2 echo "Taking a break..."
|
||||
sleep 9999999;;
|
||||
end)
|
||||
test -z "$2" && die "Tell me what you did today"
|
||||
grep -qE "^$TODAY" "$TIMEFILE" || die "You haven't even started your day!"
|
||||
start_hour="$(from_ts "$(tail -n1 "$TIMEFILE" | cut -f 2 -d ,)")"
|
||||
end_hour="$(date '+%H:%M')"
|
||||
shift 1
|
||||
msg="$(printf "%s" "$*" | sed 's/"/""/g')"
|
||||
line="$(awk -F ',' -v now="$START" -v start="$start_hour" -v end="$end_hour" -v msg="$msg" \
|
||||
"/^$TODAY/"'{
|
||||
total=now-$2-$3;
|
||||
h=int(total/3600);
|
||||
m=int(total/60%60);
|
||||
ph=int($3/3600);
|
||||
pm=int($3/60%60);
|
||||
printf "%s,%s,%s,%s:%s,%s:%s,\"%s\"",$1,start,end,ph,pm,h,m,msg;
|
||||
}' \
|
||||
"$TIMEFILE")"
|
||||
printf "\$d\nw\n\q" | ed "$TIMEFILE" > /dev/null 2>&1
|
||||
printf "%s\n" "$line" >> "$TIMEFILE";;
|
||||
esac
|
|
@ -41,7 +41,7 @@
|
|||
# The transparency of the window. Range: [0; 100].
|
||||
# This option will only work if a compositing window manager is
|
||||
# present (e.g. xcompmgr, compiz, etc.).
|
||||
transparency = 20
|
||||
transparency = 30
|
||||
|
||||
# The height of the entire notification. If the height is smaller
|
||||
# than the font height and padding combined, it will be raised
|
||||
|
@ -166,7 +166,7 @@
|
|||
max_icon_size = 64
|
||||
|
||||
# Paths to default icons.
|
||||
icon_path = /usr/share/icons/gruvbox-dark-icons-gtk/symbolic/status/
|
||||
icon_path = /usr/share/icons/gnome/32x32/status/:/usr/share/icons/gnome/32x32/devices/
|
||||
|
||||
### History ###
|
||||
|
||||
|
@ -183,7 +183,7 @@
|
|||
dmenu = /usr/bin/dmenu -p dunst:
|
||||
|
||||
# Browser for opening urls in context menu.
|
||||
browser = /usr/bin/xdg-open
|
||||
browser = /usr/bin/firefox -new-tab
|
||||
|
||||
# Always run rule-defined scripts, even if the notification is suppressed
|
||||
always_run_script = true
|
||||
|
@ -303,10 +303,6 @@
|
|||
# NOTE: It might be helpful to run dunst -print in a terminal in order
|
||||
# to find fitting options for rules.
|
||||
|
||||
[dino]
|
||||
appname = "Dino"
|
||||
timeout = 10
|
||||
|
||||
#[espeak]
|
||||
# summary = "*"
|
||||
# script = dunst_espeak.sh
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
### Variables
|
||||
#
|
||||
# Logo key. Use Mod1 for Alt, Mod4 for Super
|
||||
set $mod Mod1
|
||||
# Logo key. Use Mod1 for Alt.
|
||||
set $mod Mod4
|
||||
# Home row direction keys, like vim
|
||||
set $left h
|
||||
set $down j
|
||||
|
@ -34,18 +34,7 @@ set $ws8 "8:8"
|
|||
set $ws9 "9:9"
|
||||
set $ws10 "10:10"
|
||||
# Your preferred terminal emulator
|
||||
set $term kitty --single-instance --instance-group i3
|
||||
|
||||
# Other utilities
|
||||
set $backlightinc light -A 5
|
||||
set $backlightdec light -U 5
|
||||
set $volinc volcont --up
|
||||
set $voldec volcont --down
|
||||
set $voltog volcont --toggle
|
||||
set $cliplumber cliplumber
|
||||
set $mpdtoggle mpc toggle
|
||||
set $mpdnext mpc next
|
||||
set $mpdprev mpc prev
|
||||
set $term kitty --single-instance
|
||||
|
||||
# Font for window titles and bar
|
||||
font pango:Hack 8
|
||||
|
@ -71,10 +60,10 @@ client.background $base07
|
|||
# Basics:
|
||||
|
||||
# exit i3/sway
|
||||
bindsym $mod+Shift+q exec $exit
|
||||
bindsym $mod+Shift+e exec $exit
|
||||
|
||||
# lock session
|
||||
bindsym Mod4+l exec $lock
|
||||
bindsym Ctrl+Mod1+l exec $lock
|
||||
|
||||
# application launcher
|
||||
bindsym $mod+r exec $menu
|
||||
|
@ -83,24 +72,12 @@ client.background $base07
|
|||
bindsym $mod+Return exec $term
|
||||
|
||||
# call clipboard plumber
|
||||
bindsym $mod+v exec $cliplumber
|
||||
bindsym $mod+v exec cliplumber
|
||||
|
||||
# volume control
|
||||
bindsym XF86AudioRaiseVolume exec $volinc
|
||||
bindsym XF86AudioLowerVolume exec $voldec
|
||||
bindsym XF86AudioMute exec $voltog
|
||||
|
||||
# MPD control
|
||||
bindsym $mod+greater exec $mpdnext
|
||||
bindsym $mod+less exec $mpdprev
|
||||
bindsym $mod+p exec $mpdtoggle
|
||||
bindsym XF86AudioNext exec $mpdnext
|
||||
bindsym XF86AudioPrev exec $mpdprev
|
||||
bindsym XF86AudioPlay exec $mpdtoggle
|
||||
|
||||
# brightness control (using Super because MSI weirdness)
|
||||
bindsym Mod4+Up exec $backlightinc
|
||||
bindsym Mod4+Down exec $backlightdec
|
||||
bindsym XF86AudioRaiseVolume exec amixer -q set Master 1%+ unmute
|
||||
bindsym XF86AudioLowerVolume exec amixer -q set Master 1%- unmute
|
||||
bindsym XF86AudioMute exec amixer -q set Master toggle
|
||||
|
||||
# reload the configuration file
|
||||
bindsym $mod+Shift+r reload
|
||||
|
@ -231,9 +208,6 @@ bindsym $mod+Ctrl+$down resize grow height 5 px or 5 ppt
|
|||
bindsym $mod+Ctrl+$up resize shrink height 5 px or 5 ppt
|
||||
bindsym $mod+Ctrl+$right resize grow width 5 px or 5 ppt
|
||||
|
||||
# App specific settings
|
||||
for_window [class="mpv"] floating enable
|
||||
|
||||
### Status Bar
|
||||
#
|
||||
# Read `man 5 sway-bar` for more information about this section.
|
||||
|
|
|
@ -96,11 +96,6 @@ client.background $base07
|
|||
bindsym XF86AudioLowerVolume exec amixer -q set Master 1%- unmute
|
||||
bindsym XF86AudioMute exec amixer -q set Master toggle
|
||||
|
||||
# music control
|
||||
bindsym $mod+p exec mpc toggle
|
||||
bindsym $mod+less exec mpc prev
|
||||
bindsym $mod+Shift+less exec mpc next
|
||||
|
||||
# reload the configuration file
|
||||
bindsym $mod+Shift+r reload
|
||||
|
||||
|
@ -274,6 +269,3 @@ set $lock i3lock -c 000000
|
|||
|
||||
# Application launcher
|
||||
set $menu dmenu_run
|
||||
|
||||
# App specific settings
|
||||
for_window [class="mpv"] floating enable
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
# Download current video as mp3 using youtube-dl
|
||||
g-d run mp3dl ${path}
|
||||
#y-y run yank url
|
|
@ -1 +0,0 @@
|
|||
screenshot-directory=~/img/screenshots/mpv/
|
|
@ -1,11 +1,10 @@
|
|||
set sendmail = "/usr/bin/msmtp $my_msmtp_conf -a $my_account"
|
||||
set sendmail = "/usr/bin/msmtp -a $my_account"
|
||||
set spoolfile = "+$my_account/Inbox"
|
||||
set record = "+$my_account/Sent"
|
||||
set postponed = "+$my_account/Draft"
|
||||
set trash = "+$my_account/Trash"
|
||||
|
||||
macro index,pager gs "<shell-escape>mbsync $my_mbsync_conf $my_account<enter>" "IMAP sync account"
|
||||
macro index,pager gi "<shell-escape>mbsync $my_mbsync_conf $my_account:INBOX<enter>" "IMAP sync Inbox"
|
||||
macro index,pager gf "<shell-escape>fdm fetch -a $my_account<enter>" "fdm filter mailbox"
|
||||
macro index,pager gs "<shell-escape>mbsync $my_account<enter>" "IMAP sync account"
|
||||
macro index,pager gi "<shell-escape>mbsync $my_account:Inbox<enter>" "IMAP sync Inbox"
|
||||
|
||||
# vim: syntax=neomuttrc
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
set copy # See also $record
|
||||
unmailboxes *
|
||||
source "~/.config/neomutt/mailboxes.sh $folder|"
|
||||
|
||||
# Load external configs
|
||||
source sidebar.rc
|
||||
source colors.rc
|
||||
source gpg.rc
|
||||
source keys.rc
|
||||
|
||||
# Accounts
|
||||
source "~/.config/neomutt/folder-hooks.sh $folder|"
|
||||
|
||||
# Basic options
|
||||
unset wait_key # Only wait if command exited != 0
|
||||
set delete # delete messages for real
|
||||
unset confirmappend # don't ask when adding to a mailbox
|
||||
set quit #default; <quit> exits neomutt
|
||||
unset move #default; don't move read messages
|
||||
unset mark_old # don't mark unread mail as old when exiting mailbox
|
||||
set beep_new # Hope your term bell is set to something sensible :P
|
||||
unset pipe_decode # decode and weed headers before <pipe-message>, urlscan seems to require it unset
|
||||
set thorough_search #default; decode mail before searching ~b and ~h
|
||||
set sleep_time = 0 # Speed up folder opening
|
||||
set change_folder_next # Default to next folder in list
|
||||
set mail_check = 5 #default; look for new mail every 'n' seconds
|
||||
set mail_check_stats # Allow mail stats gathering
|
||||
set mail_check_stats_interval = 10 # Mail stats calc interval
|
||||
|
||||
# Status bar
|
||||
set status_chars = " *%A" # mailbox unchanged/changed/RO/attach-msg mode
|
||||
set status_format = "───[ Folder: %f ]───[%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]───%>─%?p?( %p postponed )?───"
|
||||
|
||||
#########
|
||||
# Index #
|
||||
#########
|
||||
set date_format = "%d/%m/%y %H:%M"
|
||||
set index_format = "[%Z] %D - %-20.20F %s"
|
||||
set sort = threads
|
||||
set sort_aux = last-date-received
|
||||
set uncollapse_jump # Jump to unread when unfolding
|
||||
set sort_re #default; useful for mailbox sort in sidebar
|
||||
unset narrow_tree #default; compact thread tree arrows
|
||||
|
||||
#########
|
||||
# Pager #
|
||||
#########
|
||||
set pager_index_lines = 10 # lines aboves the pager
|
||||
set pager_context = 3 # lines of context around selected msg in index
|
||||
set pager_stop # don't jump to next msg when scrolling past the end
|
||||
set menu_scroll # don't skip to next page when reaching bottom
|
||||
set tilde # pad blank lines with '~'
|
||||
unset markers # remove '+' on wrapped lines
|
||||
set smart_wrap #default; wrap at word boundaries
|
||||
set quote_regex = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
|
||||
# Prefer plaintext and process html through mailcap
|
||||
alternative_order text/plain text/enriched text/html
|
||||
auto_view text/html
|
||||
# Prune headers
|
||||
ignore *
|
||||
unignore From To Reply-To Cc Bcc Subject Date
|
||||
unignore Organization X-Label X-Mailer User-Agent
|
||||
|
||||
###########
|
||||
# Compose #
|
||||
###########
|
||||
# https://www.zigg.com/2018/natalie-nguyen.html
|
||||
my_hdr X-Clacks-Overhead: GNU Elise Nodel, Laura, Natalie Nguyen, Terry Pratchett
|
||||
set use_from # set a From: header
|
||||
set use_envelope_from # which from?
|
||||
set sig_dashes # dashes before sig
|
||||
set edit_headers # show headers when composing
|
||||
set fast_reply # skip to compose when replying
|
||||
set askcc # ask for CC:
|
||||
set fcc_attach # save attachments with the body
|
||||
unset mime_forward # forward attachments as part of body
|
||||
set forward_format = "Fwd: %s" # format of subject when forwarding
|
||||
set forward_decode # decode when forwarding
|
||||
set attribution = "On %d, %n wrote:" # format of quoting header
|
||||
set reply_to # reply to Reply to: field
|
||||
set reverse_name # reply as whomever it was to
|
||||
set include # include message in replies
|
||||
set forward_quote # include message in forwards
|
||||
set send_charset = utf-8
|
||||
set sendmail_wait = 0 # wait for msmtp to finish sending
|
||||
set abort_noattach = ask-yes # warn for missing attachment
|
||||
set abort_noattach_regex = "\\<(attach(|ed|ments?)|(attaché|attachés|attache|attachons|joint|jointe|joints|jointes|joins|joignons))\\>"
|
||||
|
||||
set editor = "vim -c 'set tw=70 et wrap' '+/^$' "
|
||||
|
||||
set mask = ".*" # Which files to match
|
||||
|
||||
# vim: syntax=neomuttrc
|
|
@ -1,75 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
text="$(cat)"
|
||||
|
||||
# The Mime Format emails we're trying to parse have the following layout
|
||||
#
|
||||
# To: mail@example.org
|
||||
# ... <misc headers>
|
||||
#
|
||||
# Content-Type: multipart/mixed;
|
||||
# boundary="=_c4f4c8bf54a05b2b47ef558c3c61e418"
|
||||
# ...<more headers>
|
||||
#
|
||||
# This is a message in Mime Format. If you see this, your mail reader does not support this format.
|
||||
#
|
||||
# --=_c4f4c8bf54a05b2b47ef558c3c61e418
|
||||
# Content-Type: multipart/alternative;
|
||||
# boundary="=_935b3ef6db1361fbfde9e3eb2b1debe5"
|
||||
# Content-Transfer-Encoding: 8bit
|
||||
#
|
||||
#
|
||||
# --=_935b3ef6db1361fbfde9e3eb2b1debe5
|
||||
# Content-Type: text/plain; charset=iso-8859-1
|
||||
# Content-Transfer-Encoding: quoted-printable
|
||||
#
|
||||
# ...<text content, if any>
|
||||
#
|
||||
# --=_935b3ef6db1361fbfde9e3eb2b1debe5
|
||||
# Content-Type: text/html; charset=iso-8859-1
|
||||
# Content-Transfer-Encoding: quoted-printable
|
||||
#
|
||||
# <html>=0A <head>=0A <meta http-equiv=3D"Content-Type" content=3D"text/=
|
||||
# html; charset=3DISO-8859-1">=09=0A <link rel=3D"stylesheet" href=3D=
|
||||
# ...<and more quoted-printable html>
|
||||
# ...<and misc eventual attachment parts>
|
||||
# --=_c4f4c8bf54a05b2b47ef558c3c61e418--
|
||||
|
||||
# We're only interested in the text/html part of the multipart email
|
||||
# TODO parse actual encoding instead of defaulting to iso-8859-1
|
||||
mailto="$(printf "%s" "$text" \
|
||||
| awk '
|
||||
boundary {
|
||||
if ($0 ~ boundary) {
|
||||
boundary = "";
|
||||
next
|
||||
}
|
||||
print $0
|
||||
}
|
||||
|
||||
/Content-Type: text\/html;/ {
|
||||
boundary=line
|
||||
}
|
||||
|
||||
{
|
||||
line=$0
|
||||
}' \
|
||||
| qprint -d \
|
||||
| iconv -f iso-8859-1 -t utf-8 \
|
||||
| grep -Eo '<a href="mailto:.*?</a>')"
|
||||
|
||||
to="$(printf "%s" "$mailto" | sed -En 's/.*mailto:(.*?)\?subject=.*/\1/p')"
|
||||
subject="$(printf "%s" "$mailto" | sed -En 's/.*\?subject=(.*?)" .*/\1/p')"
|
||||
# TODO extract original To: to emulate use_envelope_from
|
||||
|
||||
datadir="${XDG_DATA_HOME:-"$HOME/.local/share"}/neomutt"
|
||||
mkdir -p "$datadir"
|
||||
|
||||
format_str="unmy_hdr To: Subject:
|
||||
my_hdr To: \"%s\"
|
||||
my_hdr Subject: \"%s\"
|
||||
echo \`rm \"%s\"\`"
|
||||
|
||||
printf "$format_str" "$to" "$subject" "$datadir/info.rc" > "$datadir/info.rc"
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
usage() {
|
||||
>&2 echo "$0 <mutt \$folder>"
|
||||
>&2 echo " Generate mutt folder hooks for every maildir account in \$folder"
|
||||
echo "$0 <mutt \$folder>"
|
||||
echo " Generate mutt folder hooks for every maildir account in \$folder"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -14,12 +14,14 @@ acc_dir="$HOME/.config/neomutt/accounts/"
|
|||
mail_dir="$1"
|
||||
|
||||
# Select default account
|
||||
#default="$(find "$acc_dir" -name "*.mail" -printf "source '%p'\n" -quit)"
|
||||
default="$(find "$acc_dir" -name "*.mail" -printf "source '%p'\n" -quit)"
|
||||
|
||||
#if [ -z "$default" ]; then
|
||||
# >&2 echo "No mail accounts found in $acc_dir"
|
||||
# exit 1
|
||||
#fi
|
||||
if [ -z "$default" ]; then
|
||||
>&2 echo "No mail accounts found in $acc_dir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf '%s\n' "$default"
|
||||
|
||||
# Order of the keys to use for the account switch macro
|
||||
chars="1234567890azertyuiopqsdfghjklmwxcvbn"
|
||||
|
@ -28,12 +30,6 @@ i=1
|
|||
# Setup folder hooks for all the accounts
|
||||
for f in "$acc_dir"*.mail; do
|
||||
account="$(basename -s '.mail' "$f")"
|
||||
if [ ! -d "$mail_dir/$account" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ -z "$default" ]; then
|
||||
default="source '$f'"
|
||||
fi
|
||||
inbox="$(find "$mail_dir/$account" -maxdepth 1 -iname "inbox" -type d -printf "%f" -quit)"
|
||||
printf 'folder-hook =%s '\''source %s'\''\n' "$account" "$f"
|
||||
key="$(printf '%s' "$chars" | cut -c "$i")"
|
||||
|
@ -41,7 +37,3 @@ for f in "$acc_dir"*.mail; do
|
|||
"$key" "$account" "$inbox" "$account"
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
if [ ! -z "$default" ]; then
|
||||
printf '%s\n' "$default"
|
||||
fi
|
||||
|
|
|
@ -2,16 +2,11 @@
|
|||
# GENERAL #
|
||||
###########
|
||||
bind index,pager N search-opposite
|
||||
bind generic,index,pager \Cu half-up
|
||||
bind generic,index,pager \Cd half-down
|
||||
bind generic,index,pager g noop # required to define multikeys binds
|
||||
bind generic,index gg first-entry
|
||||
bind generic,index G last-entry
|
||||
|
||||
bind index,pager \Cu half-up
|
||||
bind index,pager \Cd half-down
|
||||
bind index,pager g noop # required to define multikeys binds
|
||||
bind index,pager <tab> sync-mailbox
|
||||
|
||||
macro index,pager ga "<shell-escape>mailsync<enter>" "Sync all IMAP mailboxes"
|
||||
|
||||
###########
|
||||
# SIDEBAR #
|
||||
###########
|
||||
|
@ -25,6 +20,8 @@ bind index,pager B sidebar-toggle-visible # Toggle sidebar
|
|||
#########
|
||||
# INDEX #
|
||||
#########
|
||||
bind index gg first-entry
|
||||
bind index G last-entry
|
||||
bind index h noop # display-toggle-weed is rubbish in index view
|
||||
bind index l display-message
|
||||
bind index p recall-message
|
||||
|
@ -54,19 +51,11 @@ bind pager R group-reply
|
|||
bind pager gh display-toggle-weed
|
||||
bind pager ge extract-keys
|
||||
|
||||
macro pager gu "<pipe-message> urlscan <enter>"
|
||||
# Answer emails with a reply address in the body
|
||||
# https://unix.stackexchange.com/a/586010/248368
|
||||
macro pager gr "<pipe-message> ~/.config/neomutt/extract-reply.sh <enter>\
|
||||
<enter-command>source ~/.local/share/neomutt/info.rc <enter>\
|
||||
<mail><enter><enter><enter>"
|
||||
# Use a hook to reset sender and subject just after creating the reply
|
||||
send-hook . 'unmy_hdr To: Subject:'
|
||||
|
||||
##########
|
||||
# ATTACH #
|
||||
##########
|
||||
bind attach l view-text # Force viewing as text
|
||||
# http://stevelosh.com/blog/2012/10/the-homely-mutt/
|
||||
bind attach l view-mailcap
|
||||
|
||||
###########
|
||||
# NOTMUCH #
|
||||
|
@ -76,8 +65,7 @@ bind index,pager \Cf vfolder-from-query
|
|||
bind index,pager z entire-thread
|
||||
# Addresses autocompetion using notmuch
|
||||
# https://github.com/neomutt/neomutt/issues/629
|
||||
# https://github.com/neomutt/neomutt/issues/1333
|
||||
set query_command = "echo '' && notmuch address from:%s"
|
||||
set query_command = "notmuch address from:%s"
|
||||
bind editor <Tab> complete-query
|
||||
bind editor ^T complete
|
||||
set query_format="%4c %t %-70.70a %-70.70n %?e?(%e)?"
|
||||
|
@ -91,7 +79,7 @@ bind compose P pgp-menu
|
|||
###########
|
||||
# Browser #
|
||||
###########
|
||||
bind browser l descend-directory
|
||||
bind browser l select-entry
|
||||
bind browser h goto-parent
|
||||
|
||||
# vim: syntax=neomuttrc
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
usage() {
|
||||
>&2 echo "$0 <maildirs \$folder>"
|
||||
>&2 echo " Generate neomutt mailboxes & named-mailboxes for every maildir in \$folder"
|
||||
echo "$0 <neomutt \$folder>"
|
||||
echo " Generate neomutt mailboxes & named-mailboxes for every maildir in \$folder"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -12,18 +12,11 @@ fi
|
|||
|
||||
maildir="$1"
|
||||
|
||||
mailboxes=$(find "$maildir" -mindepth 1 -maxdepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch | sort)
|
||||
|
||||
# Order of the keys to use for the account switch macro
|
||||
chars="1234567890azertyuiopqsdfghjklmwxcvbn"
|
||||
i=1
|
||||
mailboxes=$(find "$maildir" -mindepth 1 -maxdepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch)
|
||||
|
||||
for m in $mailboxes; do
|
||||
inbox="$(find "$m" -maxdepth 1 -iname "inbox" -type d -printf "%f" -quit)"
|
||||
key="$(printf '%s' "$chars" | cut -c "$i")"
|
||||
printf "named-mailboxes '[%s] %s' '%s'\n" "$key" "$(basename "$m")" "$m/$inbox"
|
||||
printf "sidebar_whitelist '%s'\n" "$m/$inbox"
|
||||
echo "named-mailboxes '$(basename "$m")' '$m/$inbox'"
|
||||
printf "mailboxes "
|
||||
find "$m" -mindepth 1 -type d ! -name cur ! -name tmp ! -name new -printf '"%p"\0' | xargs -0
|
||||
i=$((i+1))
|
||||
done
|
||||
|
|
|
@ -1,6 +1,94 @@
|
|||
# Default config
|
||||
# Maildir setup
|
||||
set mbox_type = Maildir
|
||||
set copy # See also $record (f*ckin recursion)
|
||||
set folder = "~/mail"
|
||||
set my_msmtp_conf = "" # Leave empty for default
|
||||
set my_mbsync_conf = "" # Leave empty for default
|
||||
source common.rc
|
||||
unmailboxes *
|
||||
source "~/.config/neomutt/mailboxes.sh $folder|"
|
||||
|
||||
# Load external configs
|
||||
source sidebar.rc
|
||||
source colors.rc
|
||||
source gpg.rc
|
||||
source keys.rc
|
||||
|
||||
# Accounts
|
||||
source "~/.config/neomutt/folder-hooks.sh $folder|"
|
||||
|
||||
# Basic options
|
||||
unset wait_key # Only wait if command exited != 0
|
||||
set delete # delete messages for real
|
||||
unset confirmappend # don't ask when adding to a mailbox
|
||||
set quit #default; <quit> exits neomutt
|
||||
unset move #default; don't move read messages
|
||||
unset mark_old # don't mark unread mail as old when exiting mailbox
|
||||
set beep_new # Hope your term bell is set to something sensible :P
|
||||
set pipe_decode # decode and weed headers before <pipe-message>
|
||||
set thorough_search #default; decode mail before searching ~b and ~h
|
||||
set sleep_time = 0 # Speed up folder opening
|
||||
set change_folder_next # Default to next folder in list
|
||||
set mail_check = 5 #default; look for new mail every 'n' seconds
|
||||
set mail_check_stats # Allow mail stats gathering
|
||||
set mail_check_stats_interval = 10 # Mail stats calc interval
|
||||
|
||||
# Status bar
|
||||
set status_chars = " *%A" # mailbox unchanged/changed/RO/attach-msg mode
|
||||
set status_format = "───[ Folder: %f ]───[%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]───%>─%?p?( %p postponed )?───"
|
||||
|
||||
#########
|
||||
# Index #
|
||||
#########
|
||||
set date_format = "%d/%m/%y %H:%M"
|
||||
set index_format = "[%Z] %D - %-20.20F %s"
|
||||
set sort = threads
|
||||
set sort_aux = last-date-received
|
||||
set uncollapse_jump # Jump to unread when unfolding
|
||||
set sort_re #default; useful for mailbox sort in sidebar
|
||||
unset narrow_tree #default; compact thread tree arrows
|
||||
|
||||
#########
|
||||
# Pager #
|
||||
#########
|
||||
set pager_index_lines = 10 # lines aboves the pager
|
||||
set pager_context = 3 # lines of context around selected msg in index
|
||||
set pager_stop # don't jump to next msg when scrolling past the end
|
||||
set menu_scroll # don't skip to next page when reaching bottom
|
||||
set tilde # pad blank lines with '~'
|
||||
unset markers # remove '+' on wrapped lines
|
||||
set smart_wrap #default; wrap at word boundaries
|
||||
set quote_regex = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
|
||||
# Prefer plaintext and process html through mailcap
|
||||
alternative_order text/plain text/enriched text/html
|
||||
auto_view text/html
|
||||
# Prune headers
|
||||
ignore *
|
||||
unignore From To Reply-To Cc Bcc Subject Date
|
||||
unignore Organization X-Label X-Mailer User-Agent
|
||||
|
||||
###########
|
||||
# Compose #
|
||||
###########
|
||||
# https://www.zigg.com/2018/natalie-nguyen.html
|
||||
my_hdr X-Clacks-Overhead: GNU Natalie Nguyen, Terry Pratchett
|
||||
set use_from # set a From: header
|
||||
set use_envelope_from # which from?
|
||||
set sig_dashes # dashes before sig
|
||||
set edit_headers # show headers when composing
|
||||
set fast_reply # skip to compose when replying
|
||||
set askcc # ask for CC:
|
||||
set fcc_attach # save attachments with the body
|
||||
unset mime_forward # forward attachments as part of body
|
||||
set forward_format = "Fwd: %s" # format of subject when forwarding
|
||||
set forward_decode # decode when forwarding
|
||||
set attribution = "On %d, %n wrote:" # format of quoting header
|
||||
set reply_to # reply to Reply to: field
|
||||
set reverse_name # reply as whomever it was to
|
||||
set include # include message in replies
|
||||
set forward_quote # include message in forwards
|
||||
set send_charset = utf-8
|
||||
set sendmail_wait = 0 # wait for msmtp to finish sending
|
||||
set abort_noattach = ask-yes # warn for missing attachment
|
||||
set abort_noattach_regex = "\\<(attach(|ed|ments?)|(attaché|attachés|attache|attachons|joint|jointe|joints|jointes|joins|joignons))\\>"
|
||||
|
||||
set editor = "vim -c 'set tw=70 et wrap' '+/^$' "
|
||||
|
||||
set mask = ".*" # Which files to match
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
set sidebar_visible
|
||||
set mail_check_stats # update unread/flagged/total counts
|
||||
set sidebar_format = '%D%?F? [%!]?%* %?N?%N/?%?S?%S?'
|
||||
set sidebar_format = '%B%?F? [%!]?%* %?N?%N/?%?S?%S?'
|
||||
set sidebar_width = 32 # Note: some chars take two columns (chinese)
|
||||
set sidebar_short_path # Keep only end of mailbox path
|
||||
set sidebar_component_depth = 1 # nb of parent subdirs to hide
|
||||
set sidebar_component_depth = 0 # nb of parent subdirs to hide
|
||||
set sidebar_delim_chars = '/.' # mailbox path sep, '.' is used with IMAP
|
||||
set sidebar_divider_char = '|' # UI separator bar char
|
||||
set sidebar_folder_indent # indent according to path tree
|
||||
|
@ -12,10 +12,8 @@ set sidebar_new_mail_only # Only display mailbox with new/flagged mail
|
|||
unset sidebar_next_new_wrap # wrap <sidebar-{next,prev}-new> to beginning
|
||||
unset sidebar_on_right # keep bar on the left
|
||||
set sidebar_sort_method = 'path' # sort by mailbox path alphabetically
|
||||
|
||||
# Override sidebar_new_mail_only
|
||||
sidebar_whitelist `find $folder -mindepth 1 -maxdepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch -printf '"%f"\0' | xargs -0`
|
||||
sidebar_whitelist `find $folder -mindepth 1 -maxdepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch -printf '"%p"\0' | xargs -0`
|
||||
sidebar_whitelist `find $folder -mindepth 1 -type d -iname inbox -printf '"%p"\0' | xargs -0`
|
||||
sidebar_whitelist `find ~/mail -mindepth 1 -maxdepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch -printf '"%p"\0' | xargs -0`
|
||||
sidebar_whitelist `find ~/mail -mindepth 1 -type d -iname inbox -printf '"%p"\0' | xargs -0`
|
||||
|
||||
# vim: syntax=neomuttrc
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
# Work config
|
||||
set mbox_type = Maildir
|
||||
set folder = "~/work/mail"
|
||||
set my_msmtp_conf = "-C $folder/msmtprc" # Leave empty for default
|
||||
set my_mbsync_conf = "-c $folder/mbsyncrc" # Leave empty for default
|
||||
source common.rc
|
||||
|
||||
# Override sidebar_new_mail_only
|
||||
# Move back to sidebar.rc once the issue is resolved
|
||||
# https://github.com/neomutt/neomutt/issues/2208
|
||||
sidebar_whitelist `find ~/work/mail -mindepth 1 -maxdepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch -printf '"%p"\0' | xargs -0`
|
||||
sidebar_whitelist `find ~/work/mail -mindepth 1 -type d -iname inbox -printf '"%p"\0' | xargs -0`
|
||||
|
||||
# vim: syntax=neomuttrc
|
|
@ -1,4 +0,0 @@
|
|||
" http://vimcasts.org/episodes/meet-neovim/
|
||||
set runtimepath^=~/.vim runtimepath+=~/.vim/after
|
||||
let &packpath=&runtimepath
|
||||
source ~/.vimrc
|
7
config/pipe-viewer/.gitignore
vendored
7
config/pipe-viewer/.gitignore
vendored
|
@ -1,7 +0,0 @@
|
|||
cli-history.txt
|
||||
gtk-history.txt
|
||||
instances.json
|
||||
session.dat
|
||||
users.txt
|
||||
playlists
|
||||
watched.txt
|
|
@ -1,91 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# GTK+ Pipe Viewer 0.0.5 - configuration file
|
||||
|
||||
our $CONFIG = {
|
||||
active_channel_type_combobox => 0,
|
||||
active_more_options_expander => 0,
|
||||
active_panel_account_combobox => 0,
|
||||
active_resolution_combobox => 4,
|
||||
active_subscriptions_order_combobox => 0,
|
||||
api_host => "auto",
|
||||
audio_only => 0,
|
||||
auto_captions => 0,
|
||||
autoscroll_to_end => 0,
|
||||
cache_dir => "$ENV{HOME}/.cache/pipe-viewer",
|
||||
clear_search_list => 1,
|
||||
clear_text_entries_on_click => 0,
|
||||
comments_order => "top",
|
||||
comments_width => 80,
|
||||
cookie_file => undef,
|
||||
dash => 1,
|
||||
debug => 0,
|
||||
default_notebook_page => 1,
|
||||
downloads_dir => ".",
|
||||
entry_completion_limit => 10,
|
||||
env_proxy => 1,
|
||||
fullscreen => 0,
|
||||
get_captions => 1,
|
||||
hfr => 1,
|
||||
history => 1,
|
||||
history_file => "$ENV{HOME}/.config/pipe-viewer/gtk-history.txt",
|
||||
history_limit => 100000,
|
||||
hpaned_position => 1152,
|
||||
hpaned_width => 250,
|
||||
http_proxy => undef,
|
||||
ignore_av1 => 0,
|
||||
m4a_audio => 1,
|
||||
mainw_centered => 0,
|
||||
mainw_fullscreen => 0,
|
||||
mainw_maximized => 0,
|
||||
mainw_size => "1920x1061",
|
||||
maxResults => 10,
|
||||
pipe_viewer => "/usr/bin/pipe-viewer",
|
||||
pipe_viewer_args => [],
|
||||
prefer_av1 => 0,
|
||||
prefer_fork => 0,
|
||||
prefer_mp4 => 0,
|
||||
recent_history => 10,
|
||||
region => undef,
|
||||
remember_session => 1,
|
||||
remember_session_depth => 10,
|
||||
resolution => 720,
|
||||
save_titles_to_history => 0,
|
||||
show_thumbs => 1,
|
||||
split_videos => 1,
|
||||
srt_languages => ["en", "fr"],
|
||||
terminal => "/usr/bin/fbterm",
|
||||
terminal_exec => "-e '%s'",
|
||||
thousand_separator => ",",
|
||||
thumbnail_type => "medium",
|
||||
timeout => undef,
|
||||
tooltip_max_len => 512,
|
||||
tooltips => 1,
|
||||
user_agent => undef,
|
||||
video_player_selected => "mpv",
|
||||
video_players => {
|
||||
mpv => {
|
||||
arg => "--really-quiet --force-media-title=*TITLE* --no-ytdl *VIDEO*",
|
||||
audio => "--audio-file=*AUDIO*",
|
||||
cmd => "/usr/bin/mpv",
|
||||
fs => "--fullscreen",
|
||||
srt => "--sub-file=*SUB*",
|
||||
},
|
||||
vlc => {
|
||||
arg => "--quiet --play-and-exit --no-video-title-show --input-title-format=*TITLE* *VIDEO*",
|
||||
audio => "--input-slave=*AUDIO*",
|
||||
cmd => "vlc",
|
||||
fs => "--fullscreen",
|
||||
srt => "--sub-file=*SUB*",
|
||||
},
|
||||
},
|
||||
videoDimension => undef,
|
||||
videoLicense => undef,
|
||||
web_browser => undef,
|
||||
youtube_channel_url => "https://www.youtube.com/channel/%s",
|
||||
youtube_playlist_url => "https://www.youtube.com/playlist?list=%s",
|
||||
youtube_users_file => "$ENV{HOME}/.config/pipe-viewer/users.txt",
|
||||
youtube_video_url => "https://www.youtube.com/watch?v=%s",
|
||||
ytdl => 1,
|
||||
ytdl_cmd => "/usr/bin/youtube-dl",
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# CLI Pipe Viewer 0.4.5 - configuration file
|
||||
|
||||
use utf8;
|
||||
|
||||
our $CONFIG = {
|
||||
api_host => "auto",
|
||||
audio_quality => "best",
|
||||
auto_captions => 0,
|
||||
autoplay_mode => 0,
|
||||
bypass_age_gate_native => 0,
|
||||
bypass_age_gate_with_proxy => 0,
|
||||
cache_dir => "$ENV{HOME}/.cache/pipe-viewer",
|
||||
colors => 1,
|
||||
comments_order => "top",
|
||||
confirm => 0,
|
||||
convert_cmd => "ffmpeg -i *IN* *OUT*",
|
||||
convert_to => undef,
|
||||
cookie_file => undef,
|
||||
copy_caption => 0,
|
||||
custom_channel_layout_format => [
|
||||
{ align => "right", color => "bold", text => "*NO*.", width => 3 },
|
||||
{ align => "left", color => "bold blue", text => "*AUTHOR*", width => "55%" },
|
||||
{ align => "right", color => "green", text => "*VIDEOS* videos", width => 14 },
|
||||
{
|
||||
align => "right",
|
||||
color => "green",
|
||||
text => "*SUBS_SHORT* subs",
|
||||
width => 10,
|
||||
},
|
||||
],
|
||||
custom_layout_format => [
|
||||
{ align => "right", color => "bold", text => "*NO*.", width => 3 },
|
||||
{ align => "left", color => "bold blue", text => "*TITLE*", width => "55%" },
|
||||
{ align => "left", color => "yellow", text => "*AUTHOR*", width => "15%" },
|
||||
{ align => "right", color => "green", text => "*AGE_SHORT*", width => 3 },
|
||||
{ align => "right", color => "green", text => "*VIEWS_SHORT*", width => 5 },
|
||||
{ align => "right", color => "blue", text => "*TIME*", width => 8 },
|
||||
],
|
||||
custom_playlist_layout_format => [
|
||||
{ align => "right", color => "bold", text => "*NO*.", width => 3 },
|
||||
{ align => "left", color => "bold blue", text => "*TITLE*", width => "55%" },
|
||||
{ align => "right", color => "green", text => "*ITEMS* videos", width => 14 },
|
||||
{ align => "left", color => "magenta", text => "*AUTHOR*", width => "20%" },
|
||||
],
|
||||
dash => 1,
|
||||
date => undef,
|
||||
debug => 0,
|
||||
download_and_play => 0,
|
||||
download_with_wget => 1,
|
||||
download_with_ytdl => 1,
|
||||
downloads_dir => ".",
|
||||
env_proxy => 1,
|
||||
fat32safe => 0,
|
||||
features => [],
|
||||
ffmpeg_cmd => "/usr/bin/ffmpeg",
|
||||
force_fallback => 0,
|
||||
fullscreen => 0,
|
||||
get_captions => 1,
|
||||
get_subscriptions_in_parallel => 0,
|
||||
get_term_width => 1,
|
||||
hfr => 1,
|
||||
highlight_color => "bold",
|
||||
highlight_watched => 1,
|
||||
history => 1,
|
||||
history_file => "$ENV{HOME}/.config/pipe-viewer/cli-history.txt",
|
||||
history_limit => 100000,
|
||||
http_proxy => undef,
|
||||
ignore_av1 => 0,
|
||||
ignored_projections => [],
|
||||
interactive => 1,
|
||||
keep_original_video => 0,
|
||||
local_playlist_limit => -1,
|
||||
maxResults => 20,
|
||||
merge_into_mkv => 1,
|
||||
merge_into_mkv_args => "-loglevel warning -c:s srt -c:v copy -c:a copy -disposition:s forced",
|
||||
merge_with_captions => 1,
|
||||
order => undef,
|
||||
page => 1,
|
||||
prefer_av1 => 0,
|
||||
prefer_invidious => 0,
|
||||
prefer_m4a => 0,
|
||||
prefer_mp4 => 0,
|
||||
region => undef,
|
||||
remove_played_file => 0,
|
||||
resolution => "720p",
|
||||
saved_channels_file => "$ENV{HOME}/.config/pipe-viewer/users.txt",
|
||||
show_video_info => 1,
|
||||
skip_if_exists => 1,
|
||||
skip_watched => 0,
|
||||
split_videos => 1,
|
||||
srt_languages => ["en", "fr"],
|
||||
subscribed_channels_file => "$ENV{HOME}/.config/pipe-viewer/subscribed_channels.txt",
|
||||
subscriptions_lifetime => 600,
|
||||
subscriptions_limit => 10000,
|
||||
thousand_separator => ",",
|
||||
timeout => undef,
|
||||
user_agent => undef,
|
||||
video_filename_format => "*FTITLE* - *ID*.*FORMAT*",
|
||||
video_player_selected => "mpv",
|
||||
video_players => {
|
||||
mpv => {
|
||||
arg => "--really-quiet --force-media-title=*TITLE* --no-ytdl *VIDEO*",
|
||||
audio => "--audio-file=*AUDIO*",
|
||||
cmd => "/usr/bin/mpv",
|
||||
fs => "--fullscreen",
|
||||
novideo => "--no-video",
|
||||
srt => "--sub-file=*SUB*",
|
||||
},
|
||||
vlc => {
|
||||
arg => "--quiet --play-and-exit --no-video-title-show --input-title-format=*TITLE* *VIDEO*",
|
||||
audio => "--input-slave=*AUDIO*",
|
||||
cmd => "vlc",
|
||||
fs => "--fullscreen",
|
||||
novideo => "--intf=dummy --novideo",
|
||||
srt => "--sub-file=*SUB*",
|
||||
},
|
||||
},
|
||||
videoDuration => undef,
|
||||
watch_history => 1,
|
||||
watch_history_file => "$ENV{HOME}/.config/pipe-viewer/watched.txt",
|
||||
wget_cmd => "/usr/bin/wget",
|
||||
youtube_channel_url => "https://www.youtube.com/channel/%s",
|
||||
youtube_playlist_url => "https://www.youtube.com/playlist?list=%s",
|
||||
youtube_video_url => "https://www.youtube.com/watch?v=%s",
|
||||
ytdl => 1,
|
||||
ytdl_cmd => "/usr/bin/yt-dlp",
|
||||
ytdlp_comments => 0,
|
||||
ytdlp_max_comments => 10,
|
||||
ytdlp_max_replies => 3,
|
||||
}
|
4
config/qutebrowser/.gitignore
vendored
4
config/qutebrowser/.gitignore
vendored
|
@ -1,4 +0,0 @@
|
|||
local.py
|
||||
qsettings
|
||||
bookmarks
|
||||
quickmarks
|
|
@ -1,20 +0,0 @@
|
|||
# base16-qutebrowser (https://github.com/theova/base16-qutebrowser)
|
||||
# Base16 qutebrowser template by theova
|
||||
# Gruvbox dark, medium scheme by Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)
|
||||
|
||||
base00 = "#282828"
|
||||
base01 = "#3c3836"
|
||||
base02 = "#504945"
|
||||
base03 = "#665c54"
|
||||
base04 = "#bdae93"
|
||||
base05 = "#d5c4a1"
|
||||
base06 = "#ebdbb2"
|
||||
base07 = "#fbf1c7"
|
||||
base08 = "#fb4934"
|
||||
base09 = "#fe8019"
|
||||
base0A = "#fabd2f"
|
||||
base0B = "#b8bb26"
|
||||
base0C = "#8ec07c"
|
||||
base0D = "#83a598"
|
||||
base0E = "#d3869b"
|
||||
base0F = "#d65d0e"
|
|
@ -1,381 +0,0 @@
|
|||
import base16_gruvbox_dark_medium as b16
|
||||
from local import GPG_KEY, NOTIF_GRANTS
|
||||
|
||||
# pylint: disable=C0111
|
||||
c = c # noqa: F821 pylint: disable=E0602,C0103
|
||||
config = config # noqa: F821 pylint: disable=E0602,C0103
|
||||
|
||||
config.load_autoconfig(False)
|
||||
|
||||
########
|
||||
# Misc #
|
||||
########
|
||||
|
||||
config.set("auto_save.session", True)
|
||||
config.set("colors.webpage.preferred_color_scheme", "dark")
|
||||
config.set("content.autoplay", False)
|
||||
config.set("content.default_encoding", "utf-8")
|
||||
config.set("content.pdfjs", False)
|
||||
config.set("content.plugins", False)
|
||||
config.set("downloads.location.directory", "~/dl")
|
||||
config.set("session.lazy_restore", True)
|
||||
config.set("tabs.background", True)
|
||||
config.set("tabs.last_close", "close")
|
||||
config.set("tabs.mousewheel_switching", False)
|
||||
config.set("tabs.new_position.unrelated", "next")
|
||||
config.set("tabs.position", "left")
|
||||
config.set("tabs.show", "multiple")
|
||||
config.set("tabs.width", "10%")
|
||||
|
||||
##############
|
||||
# Privileges #
|
||||
##############
|
||||
|
||||
# Cookies
|
||||
config.set("content.cookies.accept", "never", "*://*.medium.com/*")
|
||||
|
||||
# Media capture
|
||||
config.set("content.media.audio_capture", True, "*://discord.com/*")
|
||||
config.set("content.media.audio_video_capture", True, "*://discord.com/*")
|
||||
config.set("content.media.video_capture", True, "*://discord.com/*")
|
||||
|
||||
# Notifications
|
||||
for pattern in NOTIF_GRANTS:
|
||||
config.set("content.notifications.enabled", True, pattern)
|
||||
config.set("content.notifications.enabled", True, "*://app.slack.com/*")
|
||||
config.set("content.notifications.enabled", True, "*://discord.com/*")
|
||||
config.set("content.notifications.enabled", False, "*://*.reddit.com/*")
|
||||
|
||||
############
|
||||
# Bindings #
|
||||
############
|
||||
|
||||
# Hinting
|
||||
config.bind("F", "hint all tab-bg")
|
||||
config.bind(";p", "hint links spawn cliplumber {hint-url}")
|
||||
config.bind(";v", "hint links spawn playvideo {hint-url}")
|
||||
config.bind(";i", "hint images download")
|
||||
|
||||
config.bind("wi", "devtools window")
|
||||
|
||||
# Keepass autotype
|
||||
config.bind("<Alt-Shift-u>",
|
||||
"spawn --userscript qute-keepassxc --key " + GPG_KEY,
|
||||
mode="insert")
|
||||
config.bind("pw",
|
||||
"spawn --userscript qute-keepassxc --key " + GPG_KEY,
|
||||
mode="normal")
|
||||
|
||||
# Toggle socks proxy
|
||||
config.bind("gp",
|
||||
(
|
||||
'config-cycle -t -p content.proxy '
|
||||
'"socks://127.0.0.1:8080/" '
|
||||
'"system"'
|
||||
))
|
||||
|
||||
# Gruvbox dark theme hotswappable on demand
|
||||
config.bind("<Ctrl-R>",
|
||||
(
|
||||
'config-cycle -t content.user_stylesheets '
|
||||
'"~/.config/qutebrowser/css/gruvbox-all-sites.css" '
|
||||
'""'
|
||||
))
|
||||
|
||||
##############
|
||||
# Adblocking #
|
||||
##############
|
||||
|
||||
config.set("content.blocking.enabled", True)
|
||||
config.set("content.blocking.method", "adblock")
|
||||
|
||||
config.set(
|
||||
"content.blocking.adblock.lists",
|
||||
[
|
||||
str(config.configdir) + "/custom-block.txt",
|
||||
"https://easylist.to/easylist/easylist.txt",
|
||||
"https://easylist.to/easylist/easyprivacy.txt",
|
||||
# "https://easylist.to/easylist/fanboy-annoyance.txt",
|
||||
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters.txt",
|
||||
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/annoyances.txt",
|
||||
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/badware.txt",
|
||||
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/privacy.txt",
|
||||
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/resource-abuse.txt",
|
||||
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/unbreak.txt",
|
||||
],
|
||||
)
|
||||
|
||||
###############
|
||||
# Color theme #
|
||||
###############
|
||||
|
||||
# Text color of the completion widget. May be a single color to use for
|
||||
# all columns or a list of three colors, one for each column.
|
||||
c.colors.completion.fg = b16.base05
|
||||
|
||||
# Background color of the completion widget for odd rows.
|
||||
c.colors.completion.odd.bg = b16.base03
|
||||
|
||||
# Background color of the completion widget for even rows.
|
||||
c.colors.completion.even.bg = b16.base00
|
||||
|
||||
# Foreground color of completion widget category headers.
|
||||
c.colors.completion.category.fg = b16.base0A
|
||||
|
||||
# Background color of the completion widget category headers.
|
||||
c.colors.completion.category.bg = b16.base00
|
||||
|
||||
# Top border color of the completion widget category headers.
|
||||
c.colors.completion.category.border.top = b16.base00
|
||||
|
||||
# Bottom border color of the completion widget category headers.
|
||||
c.colors.completion.category.border.bottom = b16.base00
|
||||
|
||||
# Foreground color of the selected completion item.
|
||||
c.colors.completion.item.selected.fg = b16.base01
|
||||
|
||||
# Background color of the selected completion item.
|
||||
c.colors.completion.item.selected.bg = b16.base0A
|
||||
|
||||
# Top border color of the selected completion item.
|
||||
c.colors.completion.item.selected.border.top = b16.base0A
|
||||
|
||||
# Bottom border color of the selected completion item.
|
||||
c.colors.completion.item.selected.border.bottom = b16.base0A
|
||||
|
||||
# Foreground color of the matched text in the selected completion item.
|
||||
c.colors.completion.item.selected.match.fg = b16.base08
|
||||
|
||||
# Foreground color of the matched text in the completion.
|
||||
c.colors.completion.match.fg = b16.base0B
|
||||
|
||||
# Color of the scrollbar handle in the completion view.
|
||||
c.colors.completion.scrollbar.fg = b16.base05
|
||||
|
||||
# Color of the scrollbar in the completion view.
|
||||
c.colors.completion.scrollbar.bg = b16.base00
|
||||
|
||||
# Background color of the context menu. If set to null, the Qt default is used.
|
||||
c.colors.contextmenu.menu.bg = b16.base00
|
||||
|
||||
# Foreground color of the context menu. If set to null, the Qt default is used.
|
||||
c.colors.contextmenu.menu.fg = b16.base05
|
||||
|
||||
# Background color of the context menu’s selected item.
|
||||
# If set to null, the Qt default is used.
|
||||
c.colors.contextmenu.selected.bg = b16.base0A
|
||||
|
||||
# Foreground color of the context menu’s selected item.
|
||||
# If set to null, the Qt default is used.
|
||||
c.colors.contextmenu.selected.fg = b16.base01
|
||||
|
||||
# Background color for the download bar.
|
||||
c.colors.downloads.bar.bg = b16.base00
|
||||
|
||||
# Color gradient start for download text.
|
||||
c.colors.downloads.start.fg = b16.base00
|
||||
|
||||
# Color gradient start for download backgrounds.
|
||||
c.colors.downloads.start.bg = b16.base0D
|
||||
|
||||
# Color gradient end for download text.
|
||||
c.colors.downloads.stop.fg = b16.base00
|
||||
|
||||
# Color gradient stop for download backgrounds.
|
||||
c.colors.downloads.stop.bg = b16.base0C
|
||||
|
||||
# Foreground color for downloads with errors.
|
||||
c.colors.downloads.error.fg = b16.base08
|
||||
|
||||
# Font color for hints.
|
||||
c.colors.hints.fg = b16.base00
|
||||
|
||||
# Background color for hints. Note that you can use a `rgba(...)` value
|
||||
# for transparency.
|
||||
c.colors.hints.bg = b16.base0A
|
||||
|
||||
# Font color for the matched part of hints.
|
||||
c.colors.hints.match.fg = b16.base05
|
||||
|
||||
# Text color for the keyhint widget.
|
||||
c.colors.keyhint.fg = b16.base05
|
||||
|
||||
# Highlight color for keys to complete the current keychain.
|
||||
c.colors.keyhint.suffix.fg = b16.base05
|
||||
|
||||
# Background color of the keyhint widget.
|
||||
c.colors.keyhint.bg = b16.base00
|
||||
|
||||
# Foreground color of an error message.
|
||||
c.colors.messages.error.fg = b16.base00
|
||||
|
||||
# Background color of an error message.
|
||||
c.colors.messages.error.bg = b16.base08
|
||||
|
||||
# Border color of an error message.
|
||||
c.colors.messages.error.border = b16.base08
|
||||
|
||||
# Foreground color of a warning message.
|
||||
c.colors.messages.warning.fg = b16.base00
|
||||
|
||||
# Background color of a warning message.
|
||||
c.colors.messages.warning.bg = b16.base0E
|
||||
|
||||
# Border color of a warning message.
|
||||
c.colors.messages.warning.border = b16.base0E
|
||||
|
||||
# Foreground color of an info message.
|
||||
c.colors.messages.info.fg = b16.base05
|
||||
|
||||
# Background color of an info message.
|
||||
c.colors.messages.info.bg = b16.base00
|
||||
|
||||
# Border color of an info message.
|
||||
c.colors.messages.info.border = b16.base00
|
||||
|
||||
# Foreground color for prompts.
|
||||
c.colors.prompts.fg = b16.base05
|
||||
|
||||
# Border used around UI elements in prompts.
|
||||
c.colors.prompts.border = b16.base00
|
||||
|
||||
# Background color for prompts.
|
||||
c.colors.prompts.bg = b16.base00
|
||||
|
||||
# Background color for the selected item in filename prompts.
|
||||
c.colors.prompts.selected.bg = b16.base0A
|
||||
|
||||
# Foreground color of the statusbar.
|
||||
c.colors.statusbar.normal.fg = b16.base0B
|
||||
|
||||
# Background color of the statusbar.
|
||||
c.colors.statusbar.normal.bg = b16.base00
|
||||
|
||||
# Foreground color of the statusbar in insert mode.
|
||||
c.colors.statusbar.insert.fg = b16.base00
|
||||
|
||||
# Background color of the statusbar in insert mode.
|
||||
c.colors.statusbar.insert.bg = b16.base0D
|
||||
|
||||
# Foreground color of the statusbar in passthrough mode.
|
||||
c.colors.statusbar.passthrough.fg = b16.base00
|
||||
|
||||
# Background color of the statusbar in passthrough mode.
|
||||
c.colors.statusbar.passthrough.bg = b16.base0C
|
||||
|
||||
# Foreground color of the statusbar in private browsing mode.
|
||||
c.colors.statusbar.private.fg = b16.base00
|
||||
|
||||
# Background color of the statusbar in private browsing mode.
|
||||
c.colors.statusbar.private.bg = b16.base03
|
||||
|
||||
# Foreground color of the statusbar in command mode.
|
||||
c.colors.statusbar.command.fg = b16.base05
|
||||
|
||||
# Background color of the statusbar in command mode.
|
||||
c.colors.statusbar.command.bg = b16.base00
|
||||
|
||||
# Foreground color of the statusbar in private browsing + command mode.
|
||||
c.colors.statusbar.command.private.fg = b16.base05
|
||||
|
||||
# Background color of the statusbar in private browsing + command mode.
|
||||
c.colors.statusbar.command.private.bg = b16.base00
|
||||
|
||||
# Foreground color of the statusbar in caret mode.
|
||||
c.colors.statusbar.caret.fg = b16.base00
|
||||
|
||||
# Background color of the statusbar in caret mode.
|
||||
c.colors.statusbar.caret.bg = b16.base0E
|
||||
|
||||
# Foreground color of the statusbar in caret mode with a selection.
|
||||
c.colors.statusbar.caret.selection.fg = b16.base00
|
||||
|
||||
# Background color of the statusbar in caret mode with a selection.
|
||||
c.colors.statusbar.caret.selection.bg = b16.base0D
|
||||
|
||||
# Background color of the progress bar.
|
||||
c.colors.statusbar.progress.bg = b16.base0D
|
||||
|
||||
# Default foreground color of the URL in the statusbar.
|
||||
c.colors.statusbar.url.fg = b16.base05
|
||||
|
||||
# Foreground color of the URL in the statusbar on error.
|
||||
c.colors.statusbar.url.error.fg = b16.base08
|
||||
|
||||
# Foreground color of the URL in the statusbar for hovered links.
|
||||
c.colors.statusbar.url.hover.fg = b16.base05
|
||||
|
||||
# Foreground color of the URL in the statusbar on successful load
|
||||
# (http).
|
||||
c.colors.statusbar.url.success.http.fg = b16.base0C
|
||||
|
||||
# Foreground color of the URL in the statusbar on successful load
|
||||
# (https).
|
||||
c.colors.statusbar.url.success.https.fg = b16.base0B
|
||||
|
||||
# Foreground color of the URL in the statusbar when there's a warning.
|
||||
c.colors.statusbar.url.warn.fg = b16.base0E
|
||||
|
||||
# Background color of the tab bar.
|
||||
c.colors.tabs.bar.bg = b16.base00
|
||||
|
||||
# Color gradient start for the tab indicator.
|
||||
c.colors.tabs.indicator.start = b16.base0D
|
||||
|
||||
# Color gradient end for the tab indicator.
|
||||
c.colors.tabs.indicator.stop = b16.base0C
|
||||
|
||||
# Color for the tab indicator on errors.
|
||||
c.colors.tabs.indicator.error = b16.base08
|
||||
|
||||
# Foreground color of unselected odd tabs.
|
||||
c.colors.tabs.odd.fg = b16.base05
|
||||
|
||||
# Background color of unselected odd tabs.
|
||||
c.colors.tabs.odd.bg = b16.base03
|
||||
|
||||
# Foreground color of unselected even tabs.
|
||||
c.colors.tabs.even.fg = b16.base05
|
||||
|
||||
# Background color of unselected even tabs.
|
||||
c.colors.tabs.even.bg = b16.base00
|
||||
|
||||
# Background color of pinned unselected even tabs.
|
||||
c.colors.tabs.pinned.even.bg = b16.base0C
|
||||
|
||||
# Foreground color of pinned unselected even tabs.
|
||||
c.colors.tabs.pinned.even.fg = b16.base07
|
||||
|
||||
# Background color of pinned unselected odd tabs.
|
||||
c.colors.tabs.pinned.odd.bg = b16.base0B
|
||||
|
||||
# Foreground color of pinned unselected odd tabs.
|
||||
c.colors.tabs.pinned.odd.fg = b16.base07
|
||||
|
||||
# Background color of pinned selected even tabs.
|
||||
c.colors.tabs.pinned.selected.even.bg = b16.base05
|
||||
|
||||
# Foreground color of pinned selected even tabs.
|
||||
c.colors.tabs.pinned.selected.even.fg = b16.base00
|
||||
|
||||
# Background color of pinned selected odd tabs.
|
||||
c.colors.tabs.pinned.selected.odd.bg = b16.base05
|
||||
|
||||
# Foreground color of pinned selected odd tabs.
|
||||
c.colors.tabs.pinned.selected.odd.fg = b16.base0E
|
||||
|
||||
# Foreground color of selected odd tabs.
|
||||
c.colors.tabs.selected.odd.fg = b16.base00
|
||||
|
||||
# Background color of selected odd tabs.
|
||||
c.colors.tabs.selected.odd.bg = b16.base05
|
||||
|
||||
# Foreground color of selected even tabs.
|
||||
c.colors.tabs.selected.even.fg = b16.base00
|
||||
|
||||
# Background color of selected even tabs.
|
||||
c.colors.tabs.selected.even.bg = b16.base05
|
||||
|
||||
# Background color for webpages if unset (or empty to use the theme's
|
||||
# color).
|
||||
# c.colors.webpage.bg = b16.base00
|
File diff suppressed because it is too large
Load diff
|
@ -1,3 +0,0 @@
|
|||
||*.youtube.com
|
||||
||tweetdeck.twitter.com
|
||||
||twitter.com
|
|
@ -1,332 +0,0 @@
|
|||
// ==UserScript==
|
||||
// @name Direct links out
|
||||
// @name:ru Прямые ссылки наружу
|
||||
// @description Removes all "You are leaving our site" and redirection stuff from links
|
||||
// @description:ru Убирает "Бла-бла-бла, Вы покидаете наш сайт" и переадресации из ссылок
|
||||
// @namespace https://github.com/nokeya
|
||||
// @author nokeya
|
||||
// @update https://github.com/nokeya/direct-links-out/raw/master/direct-links-out.user.js
|
||||
// @icon https://raw.githubusercontent.com/nokeya/direct-links-out/master/icon.png
|
||||
// @version 2.19
|
||||
// @grant none
|
||||
//google
|
||||
// @include *://google.*
|
||||
// @include *://www.google.*
|
||||
// @include *://encrypted.google.*
|
||||
//yandex
|
||||
// @match *://yandex.ru/*
|
||||
// @match *://yandex.ua/*
|
||||
// @match *://yandex.by/*
|
||||
// @match *://yandex.kz/*
|
||||
// @match *://yandex.com.tr/*
|
||||
// @match *://yandex.com/*
|
||||
// @match *://*.yandex.ru/*
|
||||
// @match *://*.yandex.ua/*
|
||||
// @match *://*.yandex.by/*
|
||||
// @match *://*.yandex.kz/*
|
||||
// @match *://*.yandex.com.tr/*
|
||||
// @match *://*.yandex.com/*
|
||||
//youtube
|
||||
// @match *://youtube.com/*
|
||||
// @match *://*.youtube.com/*
|
||||
//wikimapia
|
||||
// @match *://wikimapia.org/*
|
||||
//deviantart
|
||||
// @match *://deviantart.com/*
|
||||
// @match *://*.deviantart.com/*
|
||||
//joyreactor
|
||||
// @match *://joyreactor.cc/*
|
||||
// @match *://*.joyreactor.cc/*
|
||||
// @match *://reactor.cc/*
|
||||
// @match *://*.reactor.cc/*
|
||||
// @match *://joyreactor.com/*
|
||||
// @match *://*.joyreactor.com/*
|
||||
//vk
|
||||
// @match *://vk.com/*
|
||||
// @match *://*.vk.com/*
|
||||
//ok
|
||||
// @match *://ok.ru/*
|
||||
// @match *://*.ok.ru/*
|
||||
//steam
|
||||
// @match *://steamcommunity.com/*
|
||||
// @match *://*.steamcommunity.com/*
|
||||
//fb
|
||||
// @match *://facebook.com/*
|
||||
// @match *://*.facebook.com/*
|
||||
//twitter
|
||||
// @match *://twitter.com/*
|
||||
// @match *://*.twitter.com/*
|
||||
//4pda
|
||||
// @match *://4pda.ru/*
|
||||
// @match *://*.4pda.ru/*
|
||||
//kickass
|
||||
// @match *://kat.cr/*
|
||||
// @match *://kickassto.co/*
|
||||
// @match *://katproxy.is/*
|
||||
// @match *://thekat.tv/*
|
||||
// @match *://*.kat.cr/*
|
||||
// @match *://*.kickassto.co/*
|
||||
// @match *://*.katproxy.is/*
|
||||
// @match *://*.thekat.tv/*
|
||||
//AMO
|
||||
// @match *://addons.mozilla.org/*
|
||||
//pixiv
|
||||
// @match *://pixiv.net/*
|
||||
// @match *://*.pixiv.net/*
|
||||
//tumblr
|
||||
// @match *://tumblr.com/*
|
||||
// @match *://*.tumblr.com/*
|
||||
//danieldefo
|
||||
// @match *://danieldefo.ru/*
|
||||
// @match *://*.danieldefo.ru/*
|
||||
//yaplakal
|
||||
// @match *://yaplakal.com/*
|
||||
// @match *://*.yaplakal.com/*
|
||||
//soundcloud
|
||||
// @match *://soundcloud.com/*
|
||||
// @match *://*.soundcloud.com/*
|
||||
//upwork
|
||||
// @match *://upwork.com/*
|
||||
// @match *://*.upwork.com/*
|
||||
//picarto
|
||||
// @match *://picarto.tv/*
|
||||
// @match *://*.picarto.tv/*
|
||||
//taker
|
||||
// @match *://taker.im/*
|
||||
// @match *://*.taker.im/*
|
||||
//forumavia
|
||||
// @match *://*.forumavia.ru/*
|
||||
//slack
|
||||
// @match *://*.slack.com/*
|
||||
//instagram
|
||||
// @match *://instagram.com/*
|
||||
// @match *://*.instagram.com/*
|
||||
|
||||
// ==/UserScript==
|
||||
(function() {
|
||||
// anchors and functions
|
||||
var anchor;
|
||||
var after;
|
||||
var rwLink = function(){};
|
||||
var rwAll = function(){};
|
||||
var retTrue = function() { return true; }; //dummy function to always return true
|
||||
|
||||
// simple rewrite link - based on anchors
|
||||
function rwSimple(link){
|
||||
if (anchor){
|
||||
var ndx = link.href.indexOf(anchor);
|
||||
if (ndx != -1){
|
||||
var newlink = link.href.substring(ndx + anchor.length);
|
||||
if (after){
|
||||
ndx = newlink.indexOf(after);
|
||||
if (ndx != -1)
|
||||
newlink = newlink.substring(0, ndx);
|
||||
}
|
||||
link.href = unescape(newlink);
|
||||
}
|
||||
}
|
||||
}
|
||||
function rwaSimple(){
|
||||
var links = document.getElementsByTagName('a');
|
||||
for (var i = 0; i < links.length; ++i)
|
||||
rwLink(links[i]);
|
||||
}
|
||||
// vk
|
||||
function rwVK(link){
|
||||
if (link.className === 'page_media_link_thumb')
|
||||
{
|
||||
var parent = link.parentNode;
|
||||
link.href = parent.getAttribute("href");
|
||||
parent.removeAttribute('href');
|
||||
parent.removeAttribute('onclick');
|
||||
link.removeAttribute('onclick');
|
||||
}
|
||||
|
||||
var ndx = link.href.indexOf(anchor);
|
||||
if (ndx != -1){
|
||||
var newlink = link.href.substring(ndx + anchor.length);
|
||||
var afterArr = ['&post=', '&el=snippet', '&cc_key='];
|
||||
for (var i = 0; i < afterArr.length; ++i){
|
||||
ndx = newlink.indexOf(afterArr[i]);
|
||||
if (ndx != -1)
|
||||
newlink = newlink.substring(0, ndx);
|
||||
}
|
||||
link.href = unescape(newlink);
|
||||
}
|
||||
}
|
||||
// twitter
|
||||
function rwTwitter(link){
|
||||
if (link.hasAttribute('data-expanded-url')){
|
||||
link.href = link.getAttribute('data-expanded-url');
|
||||
link.removeAttribute('data-expanded-url');
|
||||
}
|
||||
}
|
||||
function rwaTwitter(){
|
||||
var links = document.getElementsByClassName('twitter-timeline-link');
|
||||
for (var i = 0; i < links.length; ++i)
|
||||
rwLink(links[i]);
|
||||
}
|
||||
// kickass
|
||||
function rwKickass(link){
|
||||
var ndx = link.href.indexOf(anchor);
|
||||
if (ndx != -1){
|
||||
link.href = window.atob(unescape(link.href.substring(ndx + anchor.length, link.href.length - 1)));
|
||||
link.className = '';
|
||||
}
|
||||
}
|
||||
// youtube
|
||||
function rwYoutube(link){
|
||||
if (/redirect/i.test(link.className))
|
||||
link.setAttribute('data-redirect-href-updated', 'true');
|
||||
rwSimple(link);
|
||||
}
|
||||
// facebook
|
||||
function rwFacebook(link){
|
||||
if (/referrer_log/i.test(link.onclick)){
|
||||
link.removeAttribute('onclick');
|
||||
link.removeAttribute('onmouseover');
|
||||
}
|
||||
rwSimple(link);
|
||||
}
|
||||
// google
|
||||
function rwGoogle(link){
|
||||
// replace global rwt script
|
||||
if (window.rwt && window.rwt != retTrue){
|
||||
delete window.rwt;
|
||||
Object.defineProperty(window, 'rwt', { value: retTrue, writable: false });
|
||||
}
|
||||
|
||||
// main search
|
||||
if (link.hasAttribute('onmousedown'))
|
||||
link.removeAttribute('onmousedown');
|
||||
// images
|
||||
if (link.hasAttribute('jsaction')){
|
||||
var tmp = link.getAttribute('jsaction');
|
||||
if (tmp)
|
||||
link.setAttribute('jsaction', tmp.replace(/(mousedown:irc.rl|keydown:irc.rlk)/g,''));
|
||||
}
|
||||
}
|
||||
|
||||
// yandex
|
||||
function rwYandex(link){
|
||||
// main search
|
||||
if (link.hasAttribute('onmousedown'))
|
||||
link.removeAttribute('onmousedown');
|
||||
// images
|
||||
anchor = '&img_url=';
|
||||
after = '&pos=';
|
||||
rwSimple(link);
|
||||
}
|
||||
//mozilla addons store
|
||||
function rwAMO(link){
|
||||
if (/outgoing.prod.mozaws.net/i.test(link.href)){
|
||||
var tmp = link.href;
|
||||
link.href = "#";
|
||||
// we have to fight mozilla's replacing of direct redirect string with jquery events
|
||||
setTimeout(function(){ link.href = unescape(tmp.replace(/(http|https):\/\/outgoing.prod.mozaws.net\/v1\/[0-9a-zA-Z]+\//i,'')); }, 100);
|
||||
}
|
||||
}
|
||||
|
||||
// daniueldefo
|
||||
function rwDanielDefo(link){
|
||||
if (link.hasAttribute('data-proxy-href'))
|
||||
link.removeAttribute('data-proxy-href');
|
||||
}
|
||||
|
||||
// slack
|
||||
function rwSlack(link){
|
||||
link.removeAttribute('onclick');
|
||||
link.removeAttribute('onmouseover');
|
||||
}
|
||||
|
||||
// determine anchors, functions and listeners
|
||||
(function ()
|
||||
{
|
||||
rwLink = rwSimple;
|
||||
rwAll = rwaSimple;
|
||||
|
||||
var loc = window.location.hostname;
|
||||
if (/google/i.test(loc))
|
||||
rwLink = rwGoogle;
|
||||
else if (/youtube/i.test(loc)){
|
||||
anchor = 'redirect?q=';
|
||||
after = '&redir_token=';
|
||||
rwLink = rwYoutube;
|
||||
}
|
||||
else if (/facebook/i.test(loc)){
|
||||
anchor = 'u=';
|
||||
after = '&h=';
|
||||
rwLink = rwFacebook;
|
||||
}
|
||||
else if (/instagram/i.test(loc)){
|
||||
anchor = 'u=';
|
||||
after = '&e=';
|
||||
}
|
||||
else if (/twitter/i.test(loc)){
|
||||
rwLink = rwTwitter;
|
||||
rwAll = rwaTwitter;
|
||||
}
|
||||
else if (/yandex/i.test(loc))
|
||||
rwLink = rwYandex;
|
||||
else if (/vk/i.test(loc)){
|
||||
anchor = 'to=';
|
||||
rwLink = rwVK;
|
||||
}
|
||||
else if (/ok/i.test(loc)){
|
||||
anchor = 'st.link=';
|
||||
after = '&st.name=';
|
||||
}
|
||||
else if (/pixiv/i.test(loc))
|
||||
anchor = 'jump.php?';
|
||||
else if (/tumblr/i.test(loc)){
|
||||
anchor = "redirect?z=";
|
||||
after = "&t=";
|
||||
}
|
||||
else if (/deviantart/i.test(loc))
|
||||
anchor = 'outgoing?';
|
||||
else if (/(steam|reactor)/i.test(loc))
|
||||
anchor = 'url=';
|
||||
else if (/(kat|kickass)/i.test(loc)){
|
||||
anchor = 'confirm/url/';
|
||||
rwLink = rwKickass;
|
||||
}
|
||||
else if (/soundcloud/i.test(loc))
|
||||
anchor = "exit.sc/?url=";
|
||||
else if (/upwork/i.test(loc))
|
||||
anchor = 'leaving-odesk?ref=';
|
||||
else if (/4pda/i.test(loc)){
|
||||
anchor = 'go/?u=';
|
||||
after = '&e=';
|
||||
}
|
||||
else if (/mozilla/i.test(loc))
|
||||
rwLink = rwAMO;
|
||||
else if (/danieldefo/i.test(loc))
|
||||
rwLink = rwDanielDefo;
|
||||
else if (/yaplakal/i.test(loc))
|
||||
anchor = "go/?";
|
||||
else if (/wikimapia.org/i.test(loc))
|
||||
anchor = 'external_link?url=';
|
||||
else if (/forumavia.ru/i.test(loc))
|
||||
anchor = '/e/?l=';
|
||||
else if (/picarto/i.test(loc)){
|
||||
anchor = "referrer?go=";
|
||||
after = "&ref=";
|
||||
}
|
||||
else if (/taker/i.test(loc))
|
||||
anchor = "phpBB2/goto/";
|
||||
else if (/slack/i.test(loc))
|
||||
rwLink = rwSlack;
|
||||
|
||||
document.addEventListener('DOMNodeInserted', function(event){
|
||||
if (!event || !event.target || !(event.target instanceof HTMLElement))
|
||||
return;
|
||||
var node = event.target;
|
||||
if (node instanceof HTMLAnchorElement)
|
||||
rwLink(node);
|
||||
var links = node.getElementsByTagName('a');
|
||||
for (var i = 0; i < links.length; ++i)
|
||||
rwLink(links[i]);
|
||||
}, false);
|
||||
})();
|
||||
rwAll();
|
||||
})();
|
|
@ -1,79 +0,0 @@
|
|||
// https://github.com/joeywatts/disable-autogain-control-extension/blob/master/disableAutogain.js
|
||||
(function() {
|
||||
function setLegacyChromeConstraint(constraint, name, value) {
|
||||
if (constraint.mandatory && name in constraint.mandatory) {
|
||||
constraint.mandatory[name] = value;
|
||||
return;
|
||||
}
|
||||
if (constraint.optional) {
|
||||
const element = constraint.optional.find(opt => name in opt);
|
||||
if (element) {
|
||||
element[name] = value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// `mandatory` options throw errors for unknown keys, so avoid that by
|
||||
// setting it under optional.
|
||||
if (!constraint.optional) {
|
||||
constraint.optional = [];
|
||||
}
|
||||
constraint.optional.push({ [name]: value });
|
||||
}
|
||||
function setConstraint(constraint, name, value) {
|
||||
if (constraint.advanced) {
|
||||
const element = constraint.advanced.find(opt => name in opt);
|
||||
if (element) {
|
||||
element[name] = value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
constraint[name] = value;
|
||||
}
|
||||
function disableAutogain(constraints) {
|
||||
console.log("Automatically unsetting gain!", constraints);
|
||||
if (constraints && constraints.audio) {
|
||||
if (typeof constraints.audio !== "object") {
|
||||
constraints.audio = {};
|
||||
}
|
||||
if (constraints.audio.optional || constraints.audio.mandatory) {
|
||||
setLegacyChromeConstraint(constraints.audio, "googAutoGainControl", false);
|
||||
setLegacyChromeConstraint(constraints.audio, "googAutoGainControl2", false);
|
||||
} else {
|
||||
setConstraint(constraints.audio, "autoGainControl", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function patchFunction(object, name, createNewFunction) {
|
||||
if (name in object) {
|
||||
var original = object[name];
|
||||
object[name] = createNewFunction(original);
|
||||
}
|
||||
}
|
||||
|
||||
patchFunction(navigator.mediaDevices, "getUserMedia", function (original) {
|
||||
return function getUserMedia(constraints) {
|
||||
disableAutogain(constraints);
|
||||
return original.call(this, constraints);
|
||||
};
|
||||
});
|
||||
function patchDeprecatedGetUserMedia(original) {
|
||||
return function getUserMedia(constraints, success, error) {
|
||||
disableAutogain(constraints);
|
||||
return original.call(this, constraints, success, error);
|
||||
};
|
||||
}
|
||||
patchFunction(navigator, "getUserMedia", patchDeprecatedGetUserMedia);
|
||||
patchFunction(navigator, "mozGetUserMedia", patchDeprecatedGetUserMedia);
|
||||
patchFunction(navigator, "webkitGetUserMedia", patchDeprecatedGetUserMedia);
|
||||
patchFunction(MediaStreamTrack.prototype, "applyConstraints", function (original) {
|
||||
return function applyConstraints(constraints) {
|
||||
disableAutogain(constraints);
|
||||
return original.call(this, constraints);
|
||||
};
|
||||
});
|
||||
console.log(
|
||||
"Disable Autogain by Joey Watts!",
|
||||
navigator.mediaDevices.getUserMedia
|
||||
);
|
||||
})();
|
|
@ -1,15 +0,0 @@
|
|||
// ==UserScript==
|
||||
// @name Nitter redirector
|
||||
// @namespace https://gist.github.com/bitraid/d1901de54382532a03b9b22a207f0417
|
||||
// @version 1.0
|
||||
// @description reddit to teddit
|
||||
// @match *://*.twitter.com/*
|
||||
// @match *://twitter.com/*
|
||||
// @grant none
|
||||
// @run-at document-start
|
||||
// ==/UserScript==
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
top.location.hostname = "nitter.privacydev.net";
|
||||
})();
|
|
@ -1,7 +0,0 @@
|
|||
GPG_KEY = "D1D400EBE283A278E72A6ED40FDA27891A60E157"
|
||||
NOTIF_GRANTS = [
|
||||
"*://example.com/*",
|
||||
"*://cool.website/*",
|
||||
]
|
||||
|
||||
# vim: syntax=python
|
|
@ -7,7 +7,7 @@
|
|||
include ../i3/common
|
||||
|
||||
# exit sway (logs you out of your Wayland session)
|
||||
set $exit swaymsg exit
|
||||
set $exit swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'
|
||||
|
||||
# Screen locker
|
||||
set $lock swaylock -f -c 000000
|
||||
|
@ -16,29 +16,15 @@ set $lock swaylock -f -c 000000
|
|||
# Note: it's recommended that you pass the final command to sway
|
||||
set $menu dmenu_path | bemenu | xargs swaymsg exec --
|
||||
|
||||
# App specific settings
|
||||
for_window [app_id="mpv"] floating enable
|
||||
|
||||
# Default wallpaper
|
||||
output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
|
||||
|
||||
# Apps autostart (run on each config reload)
|
||||
exec_always {
|
||||
import-gsettings
|
||||
}
|
||||
|
||||
# Set keyboard layout
|
||||
input * xkb_layout fr,ru,fr
|
||||
input * xkb_variant oss,phonetic,bepo
|
||||
input * xkb_layout fr,ru
|
||||
input * xkb_variant ,phonetic
|
||||
input * xkb_options grp:shift_caps_toggle
|
||||
input * xkb_numlock enable
|
||||
|
||||
# Configure touchpad (man 5 sway-input)
|
||||
input type:touchpad {
|
||||
tap enabled
|
||||
tap_button_map lmr
|
||||
}
|
||||
|
||||
############
|
||||
# Examples #
|
||||
############
|
||||
|
|
|
@ -28,7 +28,6 @@ our $CONFIG = {
|
|||
noinfo => 0, # bool -- Do not display package information when installing an AUR package.
|
||||
noinstall => 0, # bool -- Do not install built packages -- builds only.
|
||||
nopull => 0, # bool -- Do not `git pull` new changes from the AUR git server.
|
||||
one_line_edit => 0, # bool -- Select one or more build files to view/edit with one-line prompt.
|
||||
packages_in_stats => 5, # int -- The number of packages to display in `--stats`
|
||||
pacman_command => "/usr/bin/pacman", # str -- The `pacman` command that is used internally for pacman operations.
|
||||
pacman_local_dir => "/var/lib/pacman/local", # str -- Absolute path to the pacman's local directory.
|
||||
|
@ -49,7 +48,7 @@ our $CONFIG = {
|
|||
sudo_autorepeat_interval => 180, # int -- Interval, in seconds, after which `sudo -v` is executed in background (with `sudo_autorepeat`).
|
||||
sudo_command => "/usr/bin/sudo", # str -- Command used when special permissions are required and `use_sudo` is set to 1.
|
||||
sudo_remove_timestamp => 1, # bool -- Remove the cached sudo credentials before `makepkg` is executed (`sudo --remove-timestamp`).
|
||||
syntax_highlighting => 1, # bool -- Syntax highlighting of the build files, using the `highlight` tool from [community].
|
||||
syntax_highlighting => 1, # bool -- Syntax hightling of the build files, using the `highlight` tool from [community].
|
||||
syntax_highlighting_cmd => "/usr/bin/highlight -O ansi", # str -- The `highlight` command used in highlighting the syntax of the build files (with `syntax_highlighting`).
|
||||
use_github_api => 1, # bool -- Check GitHub sources for updates using GitHub's API. (during `--devel --needed`)
|
||||
use_gitlab_api => 1, # bool -- Check GitLab sources for updates using GitLab's API. (during `--devel --needed`)
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
partial alphanumeric_keys
|
||||
xkb_symbols "fr_oss_ansi" {
|
||||
// Brings < and > to ANSI keyboards
|
||||
|
||||
include "fr(oss)"
|
||||
|
||||
name[Group1]="French (alt., ansi)";
|
||||
|
||||
key <AB01> { [w, W, less, guillemotleft ] }; // w W < «
|
||||
key <AB02> { [x, X, greater, guillemotright ] }; // x X > »
|
||||
};
|
||||
|
||||
partial alphanumeric_keys
|
||||
xkb_symbols "fr_afnor" {
|
||||
// new AFNOR azerty adapted for programming and use with an ANSI keyboard
|
||||
include "fr(afnor)"
|
||||
|
||||
key <AE07> {[ leftsinglequotemark, 7, grave, dead_macron ]}; // ‘ 7 `
|
||||
key <AE12> {[ circumflex, dead_diaeresis, dead_circumflex, dead_caron ]}; // ^
|
||||
key <AB06> {[ n, N, tilde, dead_tilde ]}; // n N ~
|
||||
|
||||
key <AD04> {[ r, R, registered, copyright ]}; // r R ® ©
|
||||
|
||||
key <AB01> { [w, W, less, lessthanequal ] }; // w W < ≤
|
||||
key <AB02> { [x, X, greater, greaterthanequal ] }; // x X > ≥
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
# General
|
||||
set statusbar-h-padding 0
|
||||
set statusbar-v-padding 0
|
||||
set window-title-basename "true"
|
||||
set selection-clipboard "clipboard"
|
||||
|
||||
|
||||
#Appearance
|
||||
|
||||
set font "Hack 10"
|
||||
|
||||
set notification-error-bg "#282828" # bg
|
||||
set notification-error-fg "#fb4934" # bright:red
|
||||
set notification-warning-bg "#282828" # bg
|
||||
set notification-warning-fg "#fabd2f" # bright:yellow
|
||||
set notification-bg "#282828" # bg
|
||||
set notification-fg "#b8bb26" # bright:green
|
||||
|
||||
set completion-bg "#504945" # bg2
|
||||
set completion-fg "#ebdbb2" # fg
|
||||
set completion-group-bg "#3c3836" # bg1
|
||||
set completion-group-fg "#928374" # gray
|
||||
set completion-highlight-bg "#83a598" # bright:blue
|
||||
set completion-highlight-fg "#504945" # bg2
|
||||
|
||||
# Define the color in index mode
|
||||
set index-bg "#504945" # bg2
|
||||
set index-fg "#ebdbb2" # fg
|
||||
set index-active-bg "#83a598" # bright:blue
|
||||
set index-active-fg "#504945" # bg2
|
||||
|
||||
set inputbar-bg "#282828" # bg
|
||||
set inputbar-fg "#ebdbb2" # fg
|
||||
|
||||
set statusbar-bg "#504945" # bg2
|
||||
set statusbar-fg "#ebdbb2" # fg
|
||||
|
||||
set highlight-color "#fabd2f" # bright:yellow
|
||||
set highlight-active-color "#fe8019" # bright:orange
|
||||
|
||||
set default-bg "#282828" # bg
|
||||
set default-fg "#ebdbb2" # fg
|
||||
set render-loading true
|
||||
set render-loading-bg "#282828" # bg
|
||||
set render-loading-fg "#ebdbb2" # fg
|
||||
|
||||
# Recolor book content's color
|
||||
set recolor-lightcolor "#282828" # bg
|
||||
set recolor-darkcolor "#ebdbb2" # fg
|
||||
set recolor "true"
|
||||
set recolor-reverse-video "true" # Keep original image colors
|
||||
set recolor-keephue "true"
|
|
@ -1 +1 @@
|
|||
Subproject commit a47b5088636c3678c7baa22710d10b0c45bc9265
|
||||
Subproject commit edf7ac5c1e61c505201385846361fe3c2b69b31b
|
47
fsh_theme.zsh
Normal file
47
fsh_theme.zsh
Normal file
|
@ -0,0 +1,47 @@
|
|||
zstyle :plugin:fast-syntax-highlighting theme "default"
|
||||
typeset -g FAST_THEME_NAME="default"
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultdefault]:=none}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultunknown-token]:=fg=red,bold}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultreserved-word]:=fg=yellow}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultalias]:=fg=green}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultsuffix-alias]:=fg=green}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultbuiltin]:=fg=green}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultfunction]:=fg=green}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultcommand]:=fg=green}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultprecommand]:=fg=green}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultcommandseparator]:=none}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaulthashed-command]:=fg=green}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultpath]:=fg=white,underline}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultpath_pathseparator]:=}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultglobbing]:=fg=blue,bold}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaulthistory-expansion]:=fg=blue,bold}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultsingle-hyphen-option]:=fg=cyan}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultdouble-hyphen-option]:=fg=cyan}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultback-quoted-argument]:=none}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultsingle-quoted-argument]:=fg=yellow}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultdouble-quoted-argument]:=fg=yellow}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultdollar-quoted-argument]:=fg=yellow}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultback-or-dollar-double-quoted-argument]:=fg=cyan}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultback-dollar-quoted-argument]:=fg=cyan}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultassign]:=none}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultredirection]:=none}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultcomment]:=fg=black,bold}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultvariable]:=fg=113}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultmathvar]:=fg=blue,bold}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultmathnum]:=fg=magenta}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultmatherr]:=fg=red}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultassign-array-bracket]:=fg=green}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultfor-loop-variable]:=none}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultfor-loop-number]:=fg=magenta}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultfor-loop-operator]:=fg=yellow}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultfor-loop-separator]:=fg=yellow,bold}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultexec-descriptor]:=fg=yellow,bold}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaulthere-string-tri]:=fg=yellow}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaulthere-string-word]:=bg=blue}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultsecondary]:=}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultcase-input]:=fg=green}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultcase-parentheses]:=fg=yellow}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultcase-condition]:=bg=blue}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultcorrect-subtle]:=bg=blue}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultincorrect-subtle]:=fg=red}
|
||||
: ${FAST_HIGHLIGHT_STYLES[defaultsubtle-bg]:=bg=blue}
|
46
functions
46
functions
|
@ -2,19 +2,16 @@
|
|||
# Debugging #
|
||||
#############
|
||||
|
||||
# Detect if we have GNU coreutils or BSD
|
||||
if date --version > /dev/null 2>&1 ;then
|
||||
# Global counter that can be used to diagnose duplicated calls
|
||||
printf "0" > /dev/shm/debug_counter
|
||||
debug_counter_inc() {
|
||||
count="$(cat /dev/shm/debug_counter)"
|
||||
((count++))
|
||||
printf "%d" "$count" > /dev/shm/debug_counter
|
||||
}
|
||||
debug_counter_print(){
|
||||
printf "%d" "$(cat /dev/shm/debug_counter)"
|
||||
}
|
||||
fi
|
||||
# Global counter that can be used to diagnose duplicated calls
|
||||
printf "0" > /dev/shm/debug_counter
|
||||
debug_counter_inc() {
|
||||
count="$(cat /dev/shm/debug_counter)"
|
||||
((count++))
|
||||
printf "%d" "$count" > /dev/shm/debug_counter
|
||||
}
|
||||
debug_counter_print(){
|
||||
printf "%d" "$(cat /dev/shm/debug_counter)"
|
||||
}
|
||||
|
||||
###################
|
||||
# Update checking #
|
||||
|
@ -22,14 +19,14 @@ fi
|
|||
|
||||
check_rc_update () {
|
||||
# Get rc dir path
|
||||
RC_PATH=$(dirname "$(realpath -- "${(%):-%x}")")
|
||||
RC_PATH=$(dirname "$(readlink -f ${(%):-%x})")
|
||||
|
||||
CUR_DIR="$(pwd)"
|
||||
CUR_DIR=`pwd`
|
||||
cd $RC_PATH
|
||||
|
||||
# In case the network is down, don't lock the terminal
|
||||
GIT_SSH_COMMAND='ssh -oBatchMode=yes' GIT_TERMINAL_PROMPT=0 timeout 6 git fetch > /dev/null 2>&1
|
||||
|
||||
timeout 6 git fetch > /dev/null 2>&1
|
||||
#
|
||||
# Timeout returns 124 on timeout
|
||||
if [ "$?" -ge "124" ]; then
|
||||
echo 'git_network_unreachable' >> /dev/shm/prompt_msg
|
||||
|
@ -37,9 +34,9 @@ check_rc_update () {
|
|||
|
||||
# Check if the repo is clean
|
||||
git_st=$(command git status --porcelain -b 2> /dev/null)
|
||||
if $(echo "$git_st" | grep '^## .*ahead' > /dev/null 2>&1); then
|
||||
if $(echo "$git_st" | grep '^## .*ahead' &> /dev/null); then
|
||||
echo 'git_unpushed' >> /dev/shm/prompt_msg
|
||||
elif $(echo "$git_st" | grep '^## .*behind' > /dev/null 2>&1); then
|
||||
elif $(echo "$git_st" | grep '^## .*behind' &> /dev/null); then
|
||||
echo 'update_rc' >> /dev/shm/prompt_msg
|
||||
fi
|
||||
|
||||
|
@ -48,7 +45,7 @@ check_rc_update () {
|
|||
|
||||
check_sys_update () {
|
||||
case $(lsb_release -i | awk -F ':\t' '/Distributor ID/{print $2}') in
|
||||
Arch|Artix)
|
||||
Arch)
|
||||
nb_maj=$(checkupdates | wc -l);;
|
||||
Debian|Ubuntu)
|
||||
nb_maj=$(aptitude search '~U' | wc -l);;
|
||||
|
@ -97,13 +94,4 @@ ssh_kitty () {
|
|||
kitty +kitten ssh "$@"
|
||||
}
|
||||
|
||||
mp4togif() {
|
||||
if [ "$1" = "-h" ] || [ "$#" -ne "2" ]; then
|
||||
>&2 echo "Usage: $0 <input.mp4> <output.gif>"
|
||||
return 1
|
||||
fi
|
||||
|
||||
ffmpeg -i "$1" -vf "fps=10,scale=320:-1:flags=lanczos,split[x][z];[z]palettegen[y];[x][y]paletteuse" -loop 0 "$2"
|
||||
}
|
||||
|
||||
# vim: ft=zsh
|
||||
|
|
21
gitconfig
21
gitconfig
|
@ -1,9 +1,5 @@
|
|||
[init]
|
||||
defaultBranch = dev
|
||||
[core]
|
||||
excludesfile = ~/.gitignore_global
|
||||
[user]
|
||||
useConfigOnly = true
|
||||
[include]
|
||||
path = ~/.git_user
|
||||
[master]
|
||||
|
@ -17,18 +13,13 @@
|
|||
conflictstyle = diff3
|
||||
[alias]
|
||||
# Basics
|
||||
am = commit --amend
|
||||
br = branch
|
||||
c = commit
|
||||
ck = checkout
|
||||
st = status -s
|
||||
cl = clone
|
||||
cm = commit -m
|
||||
cma = commit -am
|
||||
ds = diff --staged
|
||||
g = grep -En
|
||||
gf = grep -Fn --
|
||||
gi = grep -iFn --
|
||||
st = status -s
|
||||
ck = checkout
|
||||
br = branch
|
||||
gr = grep -I
|
||||
|
||||
# Tweak defaults
|
||||
bra = branch -ra
|
||||
|
@ -45,7 +36,3 @@
|
|||
|
||||
# pull rebase
|
||||
prb = pull --rebase
|
||||
[status]
|
||||
submoduleSummary = true
|
||||
[pull]
|
||||
rebase = false
|
||||
|
|
14
install.sh
14
install.sh
|
@ -1,14 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
#SCRIPT=$(readlink -f "$0")
|
||||
#RC_PATH=$(dirname "$SCRIPT")
|
||||
RC_PATH=$(cd "$(dirname "$0")"; pwd)
|
||||
SCRIPT=$(readlink -f "$0")
|
||||
RC_PATH=$(dirname "$SCRIPT")
|
||||
HOST=$(hostname)
|
||||
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
|
||||
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
|
||||
|
||||
# List of the config files to install
|
||||
FILES="vimrc zshrc gitconfig vim gitignore_global git_user ctags.d mailcap xinitrc"
|
||||
FILES="vimrc zshrc gitconfig vim gitignore_global git_user ctags.d mailcap"
|
||||
CONF_DIR="config"
|
||||
DATA_DIR="data"
|
||||
|
||||
|
@ -23,6 +22,9 @@ cd "$RC_PATH" || exit
|
|||
git submodule update --init --recursive
|
||||
cd - > /dev/null || exit
|
||||
|
||||
# Setup fast-syntax-highlighting theme customization
|
||||
cp "$RC_PATH/fsh_theme.zsh" "$RC_PATH/fast-syntax-highlighting/current_theme.zsh"
|
||||
|
||||
# Create symbolic links in the user's home dir
|
||||
for file in $FILES
|
||||
do
|
||||
|
@ -38,6 +40,6 @@ mkdir -p "$XDG_CONFIG_HOME"
|
|||
mkdir -p "$XDG_DATA_HOME"
|
||||
# https://github.com/koalaman/shellcheck/wiki/SC2156
|
||||
find "$RC_PATH/$CONF_DIR" -mindepth 1 -maxdepth 1 -type d \
|
||||
-exec sh -c 'ln -s "$2" "$1" 2> /dev/null || ( link="$1/$(basename "$2")"; test -L "$link" || >&2 echo "Folder $link exists. Keeping old version.")' _ "$XDG_CONFIG_HOME" '{}' \;
|
||||
-exec sh -c 'ln -s -t "$1" "$2" 2> /dev/null || ( link="$1/$(basename "$2")"; test -L "$link" || >&2 echo "Folder $link exists. Keeping old version.")' _ "$XDG_CONFIG_HOME" '{}' \;
|
||||
find "$RC_PATH/$DATA_DIR" -mindepth 1 -maxdepth 1 -type d \
|
||||
-exec sh -c 'ln -s "$2" "$1" 2> /dev/null || ( link="$1/$(basename "$2")"; test -L "$link" || >&2 echo "Folder $link exists. Keeping old version.")' _ "$XDG_DATA_HOME" '{}' \;
|
||||
-exec sh -c 'ln -s -t "$1" "$2" 2> /dev/null || ( link="$1/$(basename "$2")"; test -L "$link" || >&2 echo "Folder $link exists. Keeping old version.")' _ "$XDG_DATA_HOME" '{}' \;
|
||||
|
|
24
lib/utils.sh
24
lib/utils.sh
|
@ -1,24 +0,0 @@
|
|||
die() {
|
||||
# Use notify-send to send errors when not in a terminal
|
||||
# [ -t 0 ] only works outside of pipes
|
||||
[ -t 0 ] || notify-send "$@" && >&2 echo "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Output error to stderr and to graphical notification
|
||||
notify_err() {
|
||||
tee /dev/fd/2 | xargs -r -n1 -d "\n" notify-send
|
||||
}
|
||||
|
||||
assert_exists() {
|
||||
for c in $@; do
|
||||
which "$c" > /dev/null 2>&1 || die "$c doesn't appear to be installed"
|
||||
done
|
||||
}
|
||||
|
||||
check_exists() {
|
||||
for c in $@; do
|
||||
which "$c" > /dev/null 2>&1 || return 1
|
||||
done
|
||||
}
|
||||
|
41
mailcap
41
mailcap
|
@ -1,40 +1,5 @@
|
|||
text/html; unshare -n -r w3m -I %{charset} -T text/html; copiousoutput;
|
||||
image/*; mutt_bgrun /usr/bin/feh -. %s; test=test -n "$DISPLAY"
|
||||
application/pdf; mutt_bgrun /usr/bin/zathura %s; test=test -n "$DISPLAY"
|
||||
image/*; /usr/local/bin/mutt_bgrun /usr/bin/feh -. %s; test=test -n "$DISPLAY"
|
||||
#application/pdf; /usr/local/bin/mutt_bgrun /usr/bin/evince %s; test=test -n "$DISPLAY"
|
||||
application/pdf; /usr/bin/evince %s; test=test -n "$DISPLAY"
|
||||
|
||||
# Fichiers LibreOffice, Word, Excel et PowerPoint
|
||||
application/vnd.openxmlformats-officedocument.wordprocessingml.document; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||
application/vnd.openxmlformats-officedocument.wordprocessingml.template; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||
application/vnd.openxmlformats-officedocument.spreadsheetml.template; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||
application/vnd.openxmlformats-officedocument.presentationml.presentation; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||
|
||||
application/msword; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||
application/vnd.msword; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||
|
||||
application/excel; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||
application/msexcel; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||
application/x-excel; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||
application/x-msexcel; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||
application/vnd.ms-excel; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||
application/ms-Excel; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||
|
||||
application/vnd.ms-powerpoint; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||
application/x-mspowerpoint; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||
application/ppt; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||
|
||||
application/rtf; mutt_bgrun libreoffice --nologo '%s'; test=test -n "$DISPLAY"
|
||||
|
||||
# # MS documents to txt
|
||||
# application/msword; tika -t %s | less;
|
||||
# application/vnd.msword; tika -t %s | less;
|
||||
# application/excel; tika %s | less;
|
||||
# application/msexcel; tika %s | less;
|
||||
# application/x-excel; tika %s | less;
|
||||
# application/x-msexcel; tika %s | less;
|
||||
# application/vnd.ms-excel; tika %s | less;
|
||||
# application/ms-Excel; tika %s | less;
|
||||
# application/vnd.ms-powerpoint; tika %s | w3m -dump -T text/html | less;
|
||||
# application/x-mspowerpoint; tika %s | w3m -dump -T text/html | less;
|
||||
# application/ppt; tika %s | w3m -dump -T text/html | less;
|
||||
# application/rtf; tika %s | w3m -dump -T text/html | less;
|
||||
|
|
52
prompt
52
prompt
|
@ -6,29 +6,27 @@
|
|||
# and changes the color of the username
|
||||
color_username () {
|
||||
if [[ $EUID -eq 0 ]]; then
|
||||
echo "%{$fg_no_bold[red]%}%n"
|
||||
echo "%{$fg_bold[red]%}%n"
|
||||
else
|
||||
echo "%{$fg_no_bold[blue]%}%n"
|
||||
echo "%{$fg_bold[green]%}%n"
|
||||
fi
|
||||
}
|
||||
|
||||
color_prompt_char () {
|
||||
if [[ $EUID -eq 0 ]]; then
|
||||
echo "%{$fg_no_bold[red]%G#$reset_color%}"
|
||||
echo "%{$fg_no_bold[red]%}#%{$reset_color%}"
|
||||
else
|
||||
echo "%{$fg_no_bold[blue]%G\$$reset_color%}"
|
||||
echo "%{$fg_no_bold[green]%}$%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Host coloring, personalise to your own taste
|
||||
# Host coloring, specific to Rezometz
|
||||
color_host () {
|
||||
local couleur_hote=""
|
||||
case $HOST in
|
||||
TwelveYearsAndStillGoingStrong|lharkinateur|BecauseROSThatSWhy|lharktop|blieuxor)
|
||||
couleur_hote=green;;
|
||||
pixie)
|
||||
couleur_hote=cyan;;
|
||||
chimay|orval|serenity)
|
||||
chimay|orval)
|
||||
couleur_hote=magenta;;
|
||||
babel|taima|era|vidar|okami|athena)
|
||||
couleur_hote=red;;
|
||||
|
@ -45,7 +43,7 @@ last_status () {
|
|||
}
|
||||
|
||||
virtual_env() {
|
||||
local prefix="%{$fg_bold[green]%}(%{%b%}"
|
||||
local prefix="%{$fg_bold[green]%}(%{%b$fg[green]%}"
|
||||
local suffix="%{$reset_color$fg_bold[green]%})%{$reset_color%}"
|
||||
[[ -n ${VIRTUAL_ENV} ]] || return
|
||||
printf '%s' "${prefix}${VIRTUAL_ENV:t}${suffix}"
|
||||
|
@ -54,9 +52,9 @@ virtual_env() {
|
|||
prompt_chars() {
|
||||
local git_char=''
|
||||
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
|
||||
local git_char="%{$fg_no_bold[blue]%G±$reset_color%}"
|
||||
local git_char="%{$fg_no_bold[blue]%}±%{$reset_color%}"
|
||||
fi
|
||||
printf '%s' "$(last_status) $(color_prompt_char)"
|
||||
printf '%s' "${_GIT_CHAR}$(last_status) $(color_prompt_char)"
|
||||
}
|
||||
|
||||
charge_batterie() {
|
||||
|
@ -118,8 +116,8 @@ prompt_msg () {
|
|||
# Display vim mode while using zle line editing
|
||||
# https://dougblack.io/words/zsh-vi-mode.html
|
||||
vim_mode () {
|
||||
VIM_NORMAL="%{$fg_bold[red]%}[N]"
|
||||
VIM_INSERT="%{$fg_bold[blue]%}[I]"
|
||||
VIM_NORMAL="%{$fg_bold[red]%}[% N]% "
|
||||
VIM_INSERT="%{$fg_bold[green]%}[% I]% "
|
||||
VIM_PROMPT="${${KEYMAP/vicmd/$VIM_NORMAL}/(main|viins)/$VIM_INSERT}"
|
||||
echo "$VIM_PROMPT%{$reset_color%}"
|
||||
}
|
||||
|
@ -129,25 +127,25 @@ vim_mode () {
|
|||
# %S - path in the repository
|
||||
# %a - action (e.g. rebase-i)
|
||||
# %b - branchname
|
||||
# %c - stagedstr (see below)
|
||||
# %c - stangedstr (see below)
|
||||
# %i - The current revision number or identifier.
|
||||
# %m - Misc. In case of Git, show information about stashes
|
||||
# %r - The name of the root directory of the repository
|
||||
# %s - The current version control system, like git or svn
|
||||
# %u - unstagedstr (see below)
|
||||
fmt_branch="%b%{$reset_color%}%u%c%m%{$reset_color%}" # e.g. master¹²
|
||||
fmt_action="%{$fg[red]%}%a%{$reset_color%}" # e.g. (rebase-i)
|
||||
fmt_pre="%{$fg_bold[blue]%G[$reset_color$fg[blue]%}"
|
||||
fmt_post="%{$fg_bold[blue]%G]$reset_color%}"
|
||||
fmt_branch="%b%{$reset_color%} %u%c%m%{$reset_color%}" # e.g. master¹²
|
||||
fmt_action="(%{$fg[red]%}%a%{$reset_color%})" # e.g. (rebase-i)
|
||||
fmt_pre="%{$fg_bold[blue]%}[%{$reset_color%}%{$fg[blue]%}"
|
||||
fmt_post="%{$fg_bold[blue]%}]%{$reset_color%}"
|
||||
|
||||
# check-for-changes can be really slow.
|
||||
# you should disable it, if you work with large repositories
|
||||
zstyle ':vcs_info:*' enable git cvs svn
|
||||
zstyle ':vcs_info:*' check-for-changes true
|
||||
zstyle ':vcs_info:*' unstagedstr "%{$fg_no_bold[yellow]%G●%}"
|
||||
zstyle ':vcs_info:*' stagedstr "%{$fg_no_bold[green]%G●%}"
|
||||
zstyle ':vcs_info:*' actionformats "${fmt_pre}${fmt_branch}|${fmt_action}${fmt_post}"
|
||||
zstyle ':vcs_info:*' formats "${fmt_pre}${fmt_branch}${fmt_post}"
|
||||
zstyle ':vcs_info:*' unstagedstr "%{$fg_no_bold[yellow]%}●"
|
||||
zstyle ':vcs_info:*' stagedstr "%{$fg_no_bold[green]%}●"
|
||||
zstyle ':vcs_info:*' actionformats "${fmt_pre}${fmt_branch}${fmt_action}${fmt_post} "
|
||||
zstyle ':vcs_info:*' formats "${fmt_pre}${fmt_branch}${fmt_post} "
|
||||
zstyle ':vcs_info:*' nvcsformats ""
|
||||
zstyle ':vcs_info:*+*:*' debug false # Set to true to see which hooks are being run
|
||||
zstyle ':vcs_info:git*+set-message:*' hooks git-st git-untracked
|
||||
|
@ -161,7 +159,7 @@ zstyle ':vcs_info:git*+set-message:*' hooks git-st git-untracked
|
|||
# If instead you want to show the marker only if there are untracked
|
||||
# files in $PWD, use:
|
||||
#[[ -n $(git ls-files --others --exclude-standard) ]] ; then
|
||||
hook_com[unstaged]="%{$fg_no_bold[red]%G●$reset_color%}"$hook_com[unstaged]
|
||||
hook_com[unstaged]="%{$fg_no_bold[red]%}●%{$reset_color%}"$hook_com[unstaged]
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -173,12 +171,12 @@ zstyle ':vcs_info:git*+set-message:*' hooks git-st git-untracked
|
|||
# for git prior to 1.7
|
||||
# ahead=$(git rev-list origin/${hook_com[branch]}..HEAD | wc -l)
|
||||
ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
|
||||
(( $ahead )) && gitstatus+="%{$fg_no_bold[cyan]%G▴$reset_color%}"
|
||||
(( $ahead )) && gitstatus+="%{$fg_no_bold[cyan]%}▴%{$reset_color%}"
|
||||
|
||||
# for git prior to 1.7
|
||||
# behind=$(git rev-list HEAD..origin/${hook_com[branch]} | wc -l)
|
||||
behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
|
||||
(( $behind )) && gitstatus+="%{$fg_no_bold[magenta]%G▾$reset_color%}"
|
||||
(( $behind )) && gitstatus+="%{$fg_no_bold[magenta]%}▾%{$reset_color%}"
|
||||
|
||||
hook_com[misc]+=${gitstatus}
|
||||
}
|
||||
|
@ -209,13 +207,13 @@ prompt_create zle-line-init zle-keymap-select () {
|
|||
PROMPT+="%{$fg[red]%} $(prompt_msg)"
|
||||
|
||||
# Change the background for the whole line and line feed
|
||||
PROMPT+=$'\n'
|
||||
PROMPT+="%{$fg_bold[green]%}%E"$'\n'
|
||||
|
||||
# Prompt characters for virtualenv, git and zsh
|
||||
PROMPT+="$(virtual_env)$(prompt_chars) %{$reset_color%}"
|
||||
|
||||
# Right prompt with current repo informations
|
||||
RPROMPT="${vcs_info_msg_0_}%E"
|
||||
RPROMPT="${vcs_info_msg_0_}%E%{$reset_color%}"
|
||||
|
||||
zle reset-prompt
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
detectbepo: detectbepo.c
|
||||
${CC} -I/usr/include $^ -lX11 -lxkbfile -o $@
|
||||
cp $@ ../bin/
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
rm -f detectbepo
|
|
@ -1,53 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/XKBlib.h>
|
||||
#include <X11/extensions/XKBrules.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
Display *dpy = XOpenDisplay(NULL);
|
||||
|
||||
if (dpy == NULL) {
|
||||
fprintf(stderr, "Cannot open display\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
XkbStateRec state;
|
||||
XkbGetState(dpy, XkbUseCoreKbd, &state);
|
||||
|
||||
XkbDescPtr desc = XkbGetKeyboard(dpy, XkbAllComponentsMask, XkbUseCoreKbd);
|
||||
char *group = XGetAtomName(dpy, desc->names->groups[state.group]);
|
||||
//printf("Full name: %s\n", group);
|
||||
|
||||
XkbRF_VarDefsRec vd;
|
||||
XkbRF_GetNamesProp(dpy, NULL, &vd);
|
||||
|
||||
char *layout = strtok(vd.layout, ",");
|
||||
|
||||
for (int i = 0; i < state.group; i++) {
|
||||
layout = strtok(NULL, ",");
|
||||
if (layout == NULL) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
//printf("Layout name: %s\n", tok);
|
||||
if (strcmp(layout, "fr"))
|
||||
return 1;
|
||||
|
||||
char *variant = strtok(vd.variant, ",");
|
||||
|
||||
for (int i = 0; i < state.group; i++) {
|
||||
variant = strtok(NULL, ",");
|
||||
if (variant == NULL) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
//printf("Variant name: %s\n", variant);
|
||||
if (strcmp(variant, "bepo"))
|
||||
return 1;
|
||||
|
||||
printf("Bépo détecté\n");
|
||||
return 0;
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
" Additional shader extensions
|
||||
autocmd! BufNewFile,BufRead *.fsh,*.vsh set filetype=glsl
|
|
@ -4,4 +4,3 @@ setlocal shiftwidth=4
|
|||
setlocal expandtab
|
||||
setlocal autoindent
|
||||
setlocal fileformat=unix
|
||||
setlocal colorcolumn=80
|
||||
|
|
83
vim/bepo.vim
83
vim/bepo.vim
|
@ -1,83 +0,0 @@
|
|||
" From https://bepo.fr/wiki/Vim
|
||||
"
|
||||
" {W} -> [É]
|
||||
" ——————————
|
||||
" On remappe W sur É :
|
||||
noremap é w
|
||||
noremap É W
|
||||
" Corollaire: on remplace les text objects aw, aW, iw et iW
|
||||
" pour effacer/remplacer un mot quand on n’est pas au début (daé / laé).
|
||||
onoremap aé aw
|
||||
onoremap aÉ aW
|
||||
onoremap ié iw
|
||||
onoremap iÉ iW
|
||||
" Pour faciliter les manipulations de fenêtres, on utilise {W} comme un Ctrl+W :
|
||||
noremap w <C-w>
|
||||
noremap W <C-w><C-w>
|
||||
|
||||
" [HJKL] -> {CTSR}
|
||||
" ————————————————
|
||||
" {cr} = « gauche / droite »
|
||||
noremap c h
|
||||
noremap r l
|
||||
" {ts} = « haut / bas »
|
||||
map t j
|
||||
map s k
|
||||
" {CR} = « haut / bas de l'écran »
|
||||
noremap C H
|
||||
noremap R L
|
||||
" {TS} = « joindre / aide »
|
||||
noremap T J
|
||||
noremap S K
|
||||
" Corollaire : repli suivant / précédent
|
||||
noremap zs zj
|
||||
noremap zt zk
|
||||
|
||||
" {HJKL} <- [CTSR]
|
||||
" ————————————————
|
||||
" {J} = « Jusqu'à » (j = suivant, J = précédant)
|
||||
noremap j t
|
||||
noremap J T
|
||||
" {L} = « Change » (l = attend un mvt, L = jusqu'à la fin de ligne)
|
||||
noremap l c
|
||||
noremap L C
|
||||
" {H} = « Remplace » (h = un caractère slt, H = reste en « Remplace »)
|
||||
noremap h r
|
||||
noremap H R
|
||||
" {K} = « Substitue » (k = caractère, K = ligne)
|
||||
noremap k s
|
||||
noremap K S
|
||||
" Corollaire : correction orthographique
|
||||
noremap ]k ]s
|
||||
noremap [k [s
|
||||
|
||||
" Désambiguation de {g}
|
||||
" —————————————————————
|
||||
" ligne écran précédente / suivante (à l'intérieur d'une phrase)
|
||||
noremap gs gk
|
||||
noremap gt gj
|
||||
" onglet précédent / suivant
|
||||
noremap gb gT
|
||||
noremap gé gt
|
||||
" optionnel : {gB} / {gÉ} pour aller au premier / dernier onglet
|
||||
noremap gB :exe "silent! tabfirst"<CR>
|
||||
noremap gÉ :exe "silent! tablast"<CR>
|
||||
" optionnel : {g"} pour aller au début de la ligne écran
|
||||
noremap g" g0
|
||||
|
||||
" <> en direct
|
||||
" ————————————
|
||||
noremap « <
|
||||
noremap » >
|
||||
|
||||
" Remaper la gestion des fenêtres
|
||||
" ———————————————————————————————
|
||||
nmap <C-t> <C-j>
|
||||
nmap <C-s> <C-k>
|
||||
nmap <C-c> <C-h>
|
||||
nmap <C-r> <C-l>
|
||||
noremap wd <C-w>c
|
||||
noremap wo <C-w>s
|
||||
noremap wp <C-w>o
|
||||
noremap w<SPACE> :split<CR>
|
||||
noremap w<CR> :vsplit<CR>
|
115
vimrc
115
vimrc
|
@ -1,4 +1,3 @@
|
|||
scriptencoding utf-8
|
||||
set nocompatible
|
||||
if &shell =~# 'fish$'
|
||||
set shell=sh
|
||||
|
@ -16,10 +15,8 @@ if has("unix") || has("mac")
|
|||
"[Run Plug-ins]"
|
||||
set runtimepath+=$HOME/.vim/bundle/Vundle.vim
|
||||
call vundle#begin()
|
||||
|
||||
Plugin 'gmarik/Vundle.vim'
|
||||
map <F3> :VundleUpdate<CR>
|
||||
|
||||
Plugin 'dag/vim-fish'
|
||||
if isdirectory(expand("$HOME/.vim/bundle/YouCompleteMe"))
|
||||
"[Workaround for YCM non-portability]"
|
||||
|
@ -35,7 +32,6 @@ if has("unix") || has("mac")
|
|||
else
|
||||
Plugin 'AutoComplPop'
|
||||
endif
|
||||
|
||||
Plugin 'w0rp/ale'
|
||||
let g:ale_linters = {
|
||||
\ 'cpp': ['g++'],
|
||||
|
@ -44,39 +40,20 @@ if has("unix") || has("mac")
|
|||
let g:ale_c_gcc_options='-std=c99 -pedantic'
|
||||
let g:ale_sign_error = '●'
|
||||
let g:ale_sign_warning = '●'
|
||||
|
||||
Plugin 'itchyny/lightline.vim'
|
||||
let g:lightline = {'colorscheme': 'base16_default_dark'}
|
||||
|
||||
if executable('ctags')
|
||||
Plugin 'ludovicchabant/vim-gutentags'
|
||||
endif
|
||||
|
||||
Plugin 'beyondmarc/opengl.vim'
|
||||
Plugin 'arrufat/vala.vim'
|
||||
let g:vala_syntax_folding_enabled = 0
|
||||
|
||||
Plugin 'tikhomirov/vim-glsl'
|
||||
Plugin 'jamessan/vim-gnupg'
|
||||
Plugin 'https://git.sr.ht/~sircmpwn/hare.vim'
|
||||
Plugin 'romainl/vim-cool'
|
||||
Plugin 'machakann/vim-highlightedyank'
|
||||
let g:highlightedyank_highlight_duration = 200
|
||||
"[Needed only with old vim versions]"
|
||||
if !exists('##TextYankPost')
|
||||
map y <Plug>(highlightedyank)
|
||||
endif
|
||||
|
||||
"[Autodetect indent style of a file]"
|
||||
Plugin 'tcbbd/detectindent'
|
||||
let g:detectindent_preferred_indent=4
|
||||
let g:detectindent_autodetect=1
|
||||
|
||||
"[Allow writing of unwritable file with sudo, until neovim#1716 is fixed]"
|
||||
if has('nvim')
|
||||
Plugin 'lambdalisue/suda.vim'
|
||||
let g:suda_smart_edit = 1
|
||||
endif
|
||||
call vundle#end()
|
||||
endif
|
||||
" Allow backspacing over everything in insert mode.
|
||||
|
@ -85,10 +62,9 @@ set number
|
|||
set relativenumber
|
||||
"[Hide/show the white-space and more invisible symbols]"
|
||||
set list
|
||||
set listchars=tab:▸\ ,nbsp:¬,trail:-
|
||||
" | | + Trailing spaces
|
||||
" | + Non breakable spaces
|
||||
" + Tabulations: `tab xy`, x: first char, y: following chars
|
||||
set listchars=nbsp:¬,trail:-
|
||||
"set listchars+=tab:│\ ,
|
||||
set listchars+=tab:▸\ ,
|
||||
set nojoinspaces
|
||||
"[Indent & Tab/mode-line settings]"
|
||||
set breakindent
|
||||
|
@ -115,6 +91,7 @@ set textwidth=0
|
|||
set modeline
|
||||
set modelines=1
|
||||
|
||||
set history=200 " keep 200 lines of command line history
|
||||
set ruler " show the cursor position all the time
|
||||
set showcmd " display incomplete commands
|
||||
set laststatus=2
|
||||
|
@ -123,8 +100,6 @@ set noshowmode
|
|||
"[Command mode autocompletion]"
|
||||
set wildmenu
|
||||
set wildmode=longest:full,full
|
||||
" `------------|---- First complete till longest common string, open wildmenu
|
||||
" `---- Then, complete next full match
|
||||
|
||||
set ttimeout " time out for key codes
|
||||
set ttimeoutlen=100 " wait up to 100ms after Esc for special key
|
||||
|
@ -136,20 +111,6 @@ set history=1000
|
|||
set nowritebackup
|
||||
set undolevels=5000
|
||||
|
||||
"[Setup history file]"
|
||||
set viminfo=%,<0,'10,/16,:16,h,f0
|
||||
" | | | | | | + file marks 0-9,A-Z 0=NOT stored
|
||||
" | | | | | + disable 'hlsearch' loading viminfo
|
||||
" | | | | + command-line history saved
|
||||
" | | | + search history saved
|
||||
" | | + files marks saved
|
||||
" | + lines saved each register (old name for <, vi6.2): NOT STORED
|
||||
" + save/restore buffer list
|
||||
if !has('nvim')
|
||||
"[Declutter $HOME]"
|
||||
set viminfo+=n~/.vim/cache/.viminfo
|
||||
endif
|
||||
|
||||
" Show @@@ in the last line if it is truncated.
|
||||
set display=truncate
|
||||
"[Splitting rules]"
|
||||
|
@ -179,10 +140,6 @@ set ignorecase
|
|||
set wrapscan
|
||||
"[When on, the ":substitute" flag 'g' is default on]"
|
||||
set nogdefault
|
||||
"[Enable realtime feedback for substitution]"
|
||||
if has("nvim")
|
||||
set inccommand=nosplit
|
||||
endif
|
||||
|
||||
|
||||
"[Kitty doesn't support background color erase]"
|
||||
|
@ -226,6 +183,8 @@ nnoremap <leader>o o<Esc>
|
|||
nnoremap <leader>O O<Esc>
|
||||
"[Clear search highlights]"
|
||||
nnoremap // :nohlsearch<CR>
|
||||
" Don't use Ex mode, use Q for formatting.
|
||||
map Q gq
|
||||
"[Reflow current paragraph]"
|
||||
"[http://stevelosh.com/blog/2010/09/coming-home-to-vim/]"
|
||||
nnoremap <silent> <leader>q :call ReflowParagraph()<CR>
|
||||
|
@ -237,8 +196,6 @@ for prefix in ['i', 'n', 'v']
|
|||
execute prefix . "noremap " . key . " <Nop>"
|
||||
endfor
|
||||
endfor
|
||||
"[Switch quickly between source and header]"
|
||||
nnoremap <leader>f :e <C-r>=SwapExtension()<CR><CR>
|
||||
|
||||
|
||||
|
||||
|
@ -264,15 +221,14 @@ endif
|
|||
"[Reflow current paragraph]"
|
||||
function! ReflowParagraph()
|
||||
let l:view = winsaveview()
|
||||
normal gwip
|
||||
normal gqip
|
||||
call winrestview(l:view)
|
||||
endfunction
|
||||
"[Remove tabs and spaces at the end of lines]"
|
||||
function! DeleteTrailingTWS()
|
||||
"[Do not clean up trailing spaces in binary mode or in diff files]"
|
||||
if &binary || &ft =~ 'diff'
|
||||
if &ft =~ 'diff'
|
||||
return
|
||||
endif
|
||||
end
|
||||
let l:view = winsaveview()
|
||||
silent %s/[ \t]*$//g
|
||||
silent %s/\s\+$//ge
|
||||
|
@ -286,33 +242,14 @@ function! ChangeScriptMode()
|
|||
endif
|
||||
endif
|
||||
endfunction
|
||||
"[Swap file extensions, for example cpp/h]"
|
||||
"https://stackoverflow.com/a/22145246"
|
||||
function! SwapExtension()
|
||||
let [rest, ext] = [expand('%:r'), expand('%:e')]
|
||||
if ext ==? 'h'
|
||||
if filereadable(rest . '.c')
|
||||
let ext = 'c'
|
||||
elseif filereadable(rest . '.cpp')
|
||||
let ext = 'cpp'
|
||||
endif
|
||||
elseif ext ==? 'cpp' || ext ==? 'c'
|
||||
let ext = 'h'
|
||||
"swap between vertex and fragment shader"
|
||||
elseif ext ==? 'vsh'
|
||||
let ext = 'fsh'
|
||||
elseif ext ==? 'fsh'
|
||||
let ext = 'vsh'
|
||||
endif
|
||||
return rest . '.' . ext
|
||||
endfunction
|
||||
|
||||
" Only do this part when compiled with support for autocommands.
|
||||
if has("autocmd")
|
||||
|
||||
" Enable file type detection. Use the default filetype settings, so that
|
||||
" mail gets 'tw' set to 72, 'cindent' is on in C files, etc. Also load
|
||||
" indent files, to automatically do language-dependent indenting.
|
||||
" Enable file type detection.
|
||||
" Use the default filetype settings, so that mail gets 'tw' set to 72,
|
||||
" 'cindent' is on in C files, etc.
|
||||
" Also load indent files, to automatically do language-dependent indenting.
|
||||
" Revert with ":filetype off".
|
||||
filetype plugin indent on
|
||||
|
||||
|
@ -326,29 +263,19 @@ if has("autocmd")
|
|||
" (happens when dropping a file on gvim) and for a commit message (it's
|
||||
" likely a different one than last time).
|
||||
autocmd BufReadPost *
|
||||
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' |
|
||||
\ exe "normal! g`\"" |
|
||||
\ endif
|
||||
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
|
||||
\ | exe "normal! g`\""
|
||||
\ | endif
|
||||
|
||||
augroup END
|
||||
|
||||
"[Try not to pollute the undo tree (https://vi.stackexchange.com/a/13401)]"
|
||||
autocmd BufWritePre *
|
||||
\ try |
|
||||
\ undojoin |
|
||||
\ catch /^Vim\%((\a\+)\)\=:E790/ |
|
||||
\ finally |
|
||||
\ call DeleteTrailingTWS() |
|
||||
\ endtry
|
||||
"
|
||||
"[Do not clean up trailing spaces in binary mode]"
|
||||
if !&binary
|
||||
autocmd BufWritePre * call DeleteTrailingTWS()
|
||||
endif
|
||||
|
||||
if has("unix") || has("mac")
|
||||
autocmd BufWritePost * call ChangeScriptMode()
|
||||
endif
|
||||
|
||||
endif " has("autocmd")
|
||||
|
||||
" Enable bépo layout if detected
|
||||
silent call system("detectbepo")
|
||||
if v:shell_error == 0
|
||||
source ~/.vim/bepo.vim
|
||||
endif
|
||||
|
|
53
xinitrc
53
xinitrc
|
@ -1,53 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
userresources=$HOME/.Xresources
|
||||
usermodmap=$HOME/.Xmodmap
|
||||
sysresources=/etc/X11/xinit/.Xresources
|
||||
sysmodmap=/etc/X11/xinit/.Xmodmap
|
||||
|
||||
# merge in defaults and keymaps
|
||||
if [ -f $sysresources ]; then
|
||||
xrdb -merge $sysresources
|
||||
fi
|
||||
if [ -f $sysmodmap ]; then
|
||||
xmodmap $sysmodmap
|
||||
fi
|
||||
if [ -f "$userresources" ]; then
|
||||
xrdb -merge "$userresources"
|
||||
fi
|
||||
if [ -f "$usermodmap" ]; then
|
||||
xmodmap "$usermodmap"
|
||||
fi
|
||||
|
||||
# Run xinitrc.d setup scripts
|
||||
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
|
||||
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
|
||||
[ -x "$f" ] && . "$f"
|
||||
done
|
||||
unset f
|
||||
fi
|
||||
|
||||
#export QT_STYLE_OVERRIDE=kvantum
|
||||
export QT_QPA_PLATFORMTHEME=qt5ct
|
||||
|
||||
# Statusbar loop
|
||||
~/suckless/slstatus/slstatus&
|
||||
|
||||
while true; do
|
||||
feh --randomize --no-fehbg --bg-scale "$HOME/wallpapers/"*.{jpeg,jpg,png}
|
||||
sleep 10m
|
||||
done &
|
||||
|
||||
pasystray &
|
||||
|
||||
##blueman-applet &
|
||||
|
||||
# In case of unwanted shadows, break glass:
|
||||
# https://www.reddit.com/r/suckless/comments/hzop00/dwm_how_to_remove_picomcompton_shadow_from/
|
||||
picom&
|
||||
|
||||
mpd&
|
||||
|
||||
#kitty --single-instance zsh -c 'task ready; zsh'&
|
||||
|
||||
exec ~/dev/linux-utils/loopdwm
|
|
@ -1 +1 @@
|
|||
Subproject commit ae315ded4dba10685dbbafbfa2ff3c1aefeb490d
|
||||
Subproject commit d43c309f888153d6c46d8b6a3a0186f4148680fd
|
37
zshrc
37
zshrc
|
@ -10,38 +10,16 @@
|
|||
# Uncomment this line for perfomance analysis
|
||||
#zmodload zsh/zprof
|
||||
|
||||
export PATH="$PATH:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/sbin"
|
||||
# Get rc dir path
|
||||
#RC_PATH=$(dirname "$(readlink -f ${(%):-%x})")
|
||||
# https://stackoverflow.com/questions/9901210/bash-source0-equivalent-in-zsh#comment45012039_23259585
|
||||
RC_PATH=$(dirname "$(realpath -- "${(%):-%x}")")
|
||||
export PATH="$PATH:$RC_PATH/bin:~/bin:/opt/cuda/bin:~/.cargo/bin:~/go/bin"
|
||||
|
||||
# Prevent golang from littering $HOME and force it to follow XDG
|
||||
export GOPATH="$HOME/.local/share/go"
|
||||
|
||||
# Use all cores when building with cmake (using number of physical cores)
|
||||
# https://unix.stackexchange.com/a/377945/248368
|
||||
# TODO Check if we should use virtual cores count instead
|
||||
cores="$(cat /proc/cpuinfo | grep -c "cpu cores")"
|
||||
export CMAKE_BUILD_PARALLEL_LEVEL="$cores"
|
||||
RC_PATH=$(dirname "$(readlink -f ${(%):-%x})")
|
||||
|
||||
export PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin:$RC_PATH/bin:~/bin:/opt/cuda/bin:~/.cargo/bin:~/go/bin"
|
||||
# Add ruby gems to path
|
||||
if which ruby >/dev/null && which gem >/dev/null; then
|
||||
PATH="$(ruby -r rubygems -e 'puts Gem.user_dir')/bin:$PATH"
|
||||
fi
|
||||
# Add emscripten to path
|
||||
if [ -d "$HOME/emsdk" ]; then
|
||||
PATH="$PATH:~/emsdk:~/emsdk/node/12.9.1_64bit/bin:~/emsdk/fastcomp/emscripten" #:~/emsdk/fastcomp/emscripten/tools"
|
||||
fi
|
||||
export BROWSER='/usr/bin/w3m -T "text/html"'
|
||||
if which nvim > /dev/null 2>&1; then
|
||||
export EDITOR=/usr/bin/nvim
|
||||
else
|
||||
export EDITOR=/usr/bin/vim
|
||||
fi
|
||||
# Disable `less` history file
|
||||
export LESSHISTFILE='/dev/null'
|
||||
export EDITOR=/usr/bin/vim
|
||||
export GPG_TTY="$(tty)"
|
||||
# Prevent mime associations by wine
|
||||
export WINEPREFIX="$HOME/.wine"
|
||||
|
@ -71,12 +49,9 @@ colors
|
|||
. "$RC_PATH/functions"
|
||||
. "$RC_PATH/aliases"
|
||||
. "$RC_PATH/prompt"
|
||||
|
||||
# Detect if we have GNU coreutils or BSD
|
||||
if date --version > /dev/null 2>&1 ;then
|
||||
# Setup colors for GNU ls
|
||||
eval "$(dircolors -b)"
|
||||
fi
|
||||
# Setup colors for GNU ls
|
||||
# TODO: check for GNU ls
|
||||
eval "$(dircolors -b)"
|
||||
|
||||
# Check for rc updates in the background
|
||||
(check_rc_update&) 2> /dev/null
|
||||
|
|
Loading…
Reference in a new issue