aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bashrc30
-rw-r--r--.repos/dwm/config.h11
-rwxr-xr-x.scripts/adblock7
-rwxr-xr-x.scripts/batnot13
-rwxr-xr-x.scripts/checkapts13
-rw-r--r--.scripts/feed.log23
-rwxr-xr-x.scripts/ipcam526
-rwxr-xr-x.scripts/scrot6
-rwxr-xr-x.scripts/stats14
-rwxr-xr-x.scripts/typeclip4
-rwxr-xr-x.scripts/voice19
-rwxr-xr-x.scripts/vpn22
-rwxr-xr-x.scripts/wallset4
-rwxr-xr-x.scripts/weather14
-rwxr-xr-x.scripts/z.sh267
-rw-r--r--.xinitrc4
16 files changed, 943 insertions, 34 deletions
diff --git a/.bashrc b/.bashrc
index a9eb207..9bf7db8 100644
--- a/.bashrc
+++ b/.bashrc
@@ -28,6 +28,9 @@ alias ls='ls --color=auto'
alias vi='vim'
alias v='vim'
alias zat='setsid -f zathura'
+alias mtoot='madonctl -i chaos.social toot'
+alias toot='vipe | mtoot --stdin'
+alias npm="node --dns-result-order=ipv4first $(which npm)"
alias gi='git init'
alias gs='git status'
@@ -48,4 +51,31 @@ set -o vi
stty susp undef
bind -x '"\C-z":"fg"'
+f() {
+ RG_PREFIX="rga --files-with-matches"
+ local file
+ file="$(
+ FZF_DEFAULT_COMMAND="$RG_PREFIX '$1'" \
+ fzf --sort --preview="[[ ! -z {} ]] && rga --pretty --context 5 {q} {}" \
+ --phony -q "$1" \
+ --bind "change:reload:$RG_PREFIX {q}" \
+ --preview-window="70%:wrap"
+ )" &&
+ echo "opening $file" &&
+ xdg-open "$file"
+}
+
+k() {
+ local pid=$(ps -ef | sed 1d | eval "fzf ${FZF_DEFAULT_OPTS} -m --header='[kill:process]'" | awk '{print $2}')
+
+ if [ "x$pid" != "x" ]; then
+ echo $pid | xargs kill -${1:-9}
+ k
+ fi
+}
+
+e() {
+ $EDITOR $(rg --files | fzf)
+}
+
. ~/.scripts/z.sh
diff --git a/.repos/dwm/config.h b/.repos/dwm/config.h
index 9e5bfa9..33a6d78 100644
--- a/.repos/dwm/config.h
+++ b/.repos/dwm/config.h
@@ -30,6 +30,7 @@ const char *spcmd5[] = {"weather", "show", NULL };
const char *spcmd6[] = {"term", "-t", "spalsa", "-e", "alsamixer", NULL };
const char *spcmd7[] = {"term", "-t", "spcale", "-e", "calcurse", NULL };
const char *spcmd8[] = {"term", "-t", "sptop", "-e", "htop", NULL };
+const char *spcmd9[] = {"term", "-t", "spnode", "-e", "node", NULL };
static Sp scratchpads[] = {
/* name cmd */
{"spterm", spcmd1},
@@ -40,6 +41,7 @@ static Sp scratchpads[] = {
{"spalsa", spcmd6},
{"spcale", spcmd7},
{"sptop", spcmd8},
+ {"spnode", spcmd9},
};
/* tagging */
@@ -58,6 +60,7 @@ static const Rule rules[] = {
{ NULL, NULL, "spalsa", SPTAG(5), 1, -1 },
{ NULL, NULL, "spcale", SPTAG(6), 1, -1 },
{ NULL, NULL, "sptop", SPTAG(7), 1, -1 },
+ { NULL, NULL, "spnode", SPTAG(8), 1, -1 },
};
/* layout(s) */
@@ -93,6 +96,7 @@ static const char *termcmd[] = { "term", NULL };
static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
+ { MODKEY|ShiftMask, XK_p, spawn, SHCMD("scrot") },
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
@@ -127,6 +131,7 @@ static Key keys[] = {
{ MODKEY|ShiftMask, XK_a, togglescratch, {.ui = 5 } },
{ MODKEY|ShiftMask, XK_c, togglescratch, {.ui = 6 } },
{ MODKEY|ShiftMask, XK_h, togglescratch, {.ui = 7 } },
+ { MODKEY|ShiftMask, XK_apostrophe,togglescratch,{.ui = 8} },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
@@ -144,9 +149,9 @@ static Key keys[] = {
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("amixer set Master 5%+") },
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("amixer set Master 5%-") },
{ 0, XF86XK_AudioMicMute, spawn, SHCMD("amixer set Capture toggle") },
- { 0, XF86XK_MonBrightnessDown, spawn, SHCMD("brightnessctl s 50-") },
- { 0, XF86XK_MonBrightnessUp, spawn, SHCMD("brightnessctl s 50+") },
- { 0, XF86XK_WLAN, spawn, SHCMD("wifi toggle") },
+ { 0, XF86XK_MonBrightnessDown, spawn, SHCMD("brightnessctl s 20-") },
+ { 0, XF86XK_MonBrightnessUp, spawn, SHCMD("brightnessctl s 20+") },
+ { 0, XF86XK_WLAN, spawn, SHCMD("wifi off") },
//{ 0, XF86XK_WakeUp, spawn, SHCMD("scrot") },
{ 0, XF86XK_Display, spawn, SHCMD("screen") },
{ 0, XF86XK_Favorites, spawn, SHCMD("slock") },
diff --git a/.scripts/adblock b/.scripts/adblock
index e02cf92..3fdbb97 100755
--- a/.scripts/adblock
+++ b/.scripts/adblock
@@ -1,10 +1,9 @@
#!/bin/bash
-if grep -Fxq "##START" /etc/hosts
-then
+if grep -Fxq "##START" /etc/hosts; then
sudo sed -i "/##START/,/##END/s/#\(.\)/\1/" /etc/hosts
- echo Enabled adblock!
+ notify-send "Enabled adblock!"
else
sudo sed -i "/#START/,/#END/s/./#&/" /etc/hosts
- echo Disabled adblock!
+ notify-send "Disabled adblock!"
fi
diff --git a/.scripts/batnot b/.scripts/batnot
new file mode 100755
index 0000000..b8fa5ae
--- /dev/null
+++ b/.scripts/batnot
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+bat=$(cat /sys/class/power_supply/BAT0/capacity)
+state=$(cat /sys/class/power_supply/BAT0/status)
+
+if [ "$bat" -le 7 ] && [ "$state" != "Charging" ]; then
+ export XAUTHORITY=/home/melvin/.Xauthority
+ export DISPLAY=:0
+ export XDG_RUNTIME_DIR=/run/user/1000
+ export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
+
+ notify-send -u critical "Battery low" "Battery level is at $bat%!"
+fi
diff --git a/.scripts/checkapts b/.scripts/checkapts
new file mode 100755
index 0000000..3319c23
--- /dev/null
+++ b/.scripts/checkapts
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+flat=$(curl "https://tl1host.eu/SWTUE/ajax/privroom/search?languageId=1&s_Group=T%C3%BCbingen&s_Einzugsbereich=-1&s_ZimmerArt=3&s_Mietobergrenze=500&s_AnzahlZimmer=1" | jq length)
+apt=$(curl "https://tl1host.eu/SWTUE/ajax/privroom/search?languageId=1&s_Group=T%C3%BCbingen&s_Einzugsbereich=-1&s_ZimmerArt=2&s_Mietobergrenze=500&s_AnzahlZimmer=1" | jq length)
+
+if [ $flat -ne 0 ] || [ $apt -ne 0 ]; then
+ export XAUTHORITY=/home/melvin/.Xauthority
+ export DISPLAY=:0
+ export XDG_RUNTIME_DIR=/run/user/1000
+ export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
+
+ notify-send -u critical "Interessante StuWe Wohnung!" "tl1host/#privateroom"
+fi
diff --git a/.scripts/feed.log b/.scripts/feed.log
new file mode 100644
index 0000000..708eb5c
--- /dev/null
+++ b/.scripts/feed.log
@@ -0,0 +1,23 @@
+Setting pipeline to PAUSED ...
+Pipeline is live and does not need PREROLL ...
+Got context from element 'souphttpsrc0': gst.soup.session=context, session=(GstSoupSession)NULL;
+Pipeline is PREROLLED ...
+Setting pipeline to PLAYING ...
+New clock: GstSystemClock
+/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = image/jpeg
+/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = image/jpeg
+/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstJpegDec:jpegdec0.GstPad:sink: caps = image/jpeg
+/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:sink: caps = image/jpeg
+/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:sink: caps = image/jpeg
+/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstJpegDec:jpegdec0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)jpeg, colorimetry=(string)1:4:0:0, framerate=(fraction)0/1
+/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)0/1, format=(string)YUY2, colorimetry=(string)2:4:7:1
+/GstPipeline:pipeline0/GstVideoScale:videoscale0.GstPad:src: caps = video/x-raw, width=(int)640, height=(int)480, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)4/3, framerate=(fraction)0/1, format=(string)YUY2, colorimetry=(string)2:4:7:1
+/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, width=(int)640, height=(int)480, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)4/3, framerate=(fraction)0/1, format=(string)YUY2, colorimetry=(string)2:4:7:1
+/GstPipeline:pipeline0/GstV4l2Sink:v4l2sink0.GstPad:sink: caps = video/x-raw, width=(int)640, height=(int)480, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)4/3, framerate=(fraction)0/1, format=(string)YUY2, colorimetry=(string)2:4:7:1
+/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw, width=(int)640, height=(int)480, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)4/3, framerate=(fraction)0/1, format=(string)YUY2, colorimetry=(string)2:4:7:1
+/GstPipeline:pipeline0/GstVideoScale:videoscale0.GstPad:sink: caps = video/x-raw, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)0/1, format=(string)YUY2, colorimetry=(string)2:4:7:1
+/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)jpeg, colorimetry=(string)1:4:0:0, framerate=(fraction)0/1
+/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstDecodePad:src_0.GstProxyPad:proxypad1: caps = video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)jpeg, colorimetry=(string)1:4:0:0, framerate=(fraction)0/1
+FOUND TAG : found by element "v4l2sink0".
+container format: Multipart
+Redistribute latency...
diff --git a/.scripts/ipcam b/.scripts/ipcam
new file mode 100755
index 0000000..3bc6d73
--- /dev/null
+++ b/.scripts/ipcam
@@ -0,0 +1,526 @@
+#!/bin/bash
+
+### FUNCTIONS
+
+show_help() {
+ echo "Usage:"
+ echo " $0 [options]"
+ echo
+ echo "Script for using IP Webcam as a microphone/webcam."
+ echo
+ echo "Options:"
+ echo " -a, --audio capture only audio"
+ echo " -b, --adb-path <path> set adb location if not in PATH"
+ echo " -C, --no-echo-cancel do not set up echo cancellation"
+ echo " -d, --device <device> force video device to use"
+ echo " -f, --flip <flip> flip image"
+ echo " -h, --height <height> set image height (default 480)"
+ echo " -l, --adb-flags <id> adb flags to specify device id"
+ echo " -i, --use-wifi <ip> use wi-fi mode with specified ip"
+ echo " -p, --port <port> port on which IP Webcam is listening (default 8080)"
+ echo " -P, --password <pass> password for accesing the IP Webcam"
+ echo " -s, --no-sync No force syncing to timestamps"
+ echo " -t, --with-tee adds the 'tee' multiplexer to the pipeline, to workaround 'single-frame' capture issue (see issue #97)"
+ echo " -u, --username <user> username for accesing the IP Webcam"
+ echo " -v, --video capture only video"
+ echo " -w, --width <width> set image width (default 640)"
+ echo " -x, --no-proxy disable proxy while acessing IP"
+ echo " --help show this help"
+}
+check_os_version() {
+ # checks if the OS version can use newer GStreamer version
+ DIST="$1"
+ RELEASE="$2"
+
+ case "$DIST" in
+ "Debian") return "$(echo "$RELEASE < 8.0" | bc)" ;;
+ "Ubuntu") return "$(echo "$RELEASE < 14.04" | bc)" ;;
+ "LinuxMint") return "$(echo "$RELEASE < 14.04" | bc)" ;;
+ "Arch") return 0 ;;
+ esac
+ # assume other Distributions are also new enough, by now
+ return 0
+}
+
+error() {
+ zenity --error --no-wrap --text "$@" >/dev/null 2>&1
+ exit 1
+}
+
+warning() {
+ zenity --warning --no-wrap --text "$@" >/dev/null 2>&1
+}
+
+info() {
+ zenity --info --no-wrap --text "$@" >/dev/null 2>&1
+}
+
+confirm() {
+ zenity --question --no-wrap --text "$@" >/dev/null 2>&1
+}
+
+can_run() {
+ # It's either the path to a file, or the name of an executable in $PATH
+ which "$1" >/dev/null 2>/dev/null
+}
+
+start_adb() {
+ can_run "$ADB" && "$ADB" $ADB_FLAGS start-server
+}
+
+phone_plugged() {
+ test "$("$ADB" $ADB_FLAGS get-state 2>/dev/null)" = "device"
+}
+
+url_reachable() {
+ CURL_OPTIONS=""
+ if [ $DISABLE_PROXY = 1 ]; then
+ CURL_OPTIONS+="--noproxy $IP"
+ fi
+
+ if [[ $USERNAME != "" && $PASSWORD != "" ]]; then
+ CURL_OPTIONS+="-u $USERNAME:$PASSWORD"
+ fi
+ # -f produces a non-zero status code when answer is 4xx or 5xx
+ curl $CURL_OPTIONS -f -m 5 -sI "$1" >/dev/null
+}
+
+iw_server_is_started() {
+ if [ $CAPTURE_STREAM = av ]; then
+ : # help me optimize this code
+ temp=$(url_reachable "$AUDIO_URL")
+ au=$? #echo au=$au
+ temp=$(url_reachable "$VIDEO_URL")
+ vu=$? #echo vu=$vu
+ if [ $au = 0 -a $vu = 0 ]; then return 0; else return 1; fi
+ elif [ $CAPTURE_STREAM = a ]; then
+ if url_reachable "$AUDIO_URL"; then return 0; else return 1; fi
+ elif [ $CAPTURE_STREAM = v ]; then
+ if url_reachable "$VIDEO_URL"; then return 0; else return 1; fi
+ else
+ error "Incorrect CAPTURE_STREAM value ($CAPTURE_STREAM). Should be a, v or av."
+ fi
+}
+
+module_id_by_sinkname() {
+ pactl list sinks | grep -e "Name:" -e "Module:" | grep -A1 "Name: $1$" | grep Module: | cut -f2 -d: | tr -d ' '
+}
+
+### CONFIGURATION
+
+# Exit on first error
+set -e
+
+# Choose which stream to capture.
+# a - audio only, v - video only, av - audio and video.
+# Make sure that IP webcam is streaming corresponding streams, otherwise error will occur.
+# Defaults to audio and video, ovverrided by command line options.
+CAPTURE_STREAM=av
+
+# Choose audio codec from wav, aac or opus
+# do not choose opus until editing pipeline. If choose opus, pipeline will not work
+# and some errors will appear in feed.log.
+# I do not know how to edit pipelines for now.
+AUDIO_CODEC=wav
+
+# Port on which IP Webcam is listening
+# Defaults to 8080, ovverrided by command line options.
+PORT=8080
+
+# If your "adb" is not in your $PATH, specify it on command line.
+if can_run adb; then ADB=$(which adb); fi
+
+# Flags for ADB.
+# when you need to pick from several devices, specify deviceid on command line (list deviceids with 'adb devices').
+ADB_FLAGS=
+
+# set on command line
+FLIP_METHOD=
+
+# Default dimensions of video, can be overridden on command line.
+# Make sure both dimensions are multiples of 16 (see issue #97).
+WIDTH=640
+HEIGHT=480
+
+# Force syncing to timestamps. Useful to keep audio and video in sync,
+# but may impact performance in slow connections. If you see errors about
+# timestamping or you do not need audio, you can try changing this to false from command line.
+SYNC=true
+
+# To disable proxy while acessing IP (set value 1 to disable, 0 for not)
+# For cases when host m/c is connected to a Proxy-Server and IP belongs to local network
+DISABLE_PROXY=0
+
+# To disable echo cancellation
+DISABLE_ECHO_CANCEL=0
+
+# Use exclusive caps by default (required by Chrome, Cheese and others)
+V4L2_OPTS="exclusive_caps=1"
+
+USERNAME=""
+PASSWORD=""
+
+OPTS=$(getopt -o ab:Cd:f:h:l:i:p:P:stu:vw:x --long audio,adb-path:,no-echo-cancel,device:,flip:,height:,help,adb-flags:,use-wifi:,port:,password:,no-sync,with-tee,username:,video,width:,no-proxy -n "$0" -- "$@")
+eval set -- "$OPTS"
+
+while true; do
+ case "$1" in
+ -a | --audio)
+ CAPTURE_STREAM="a"
+ shift
+ ;;
+ -b | --adb-path)
+ ADB="$2"
+ shift 2
+ ;;
+ -C | --no-echo-cancel)
+ DISABLE_ECHO_CANCEL=1
+ shift
+ ;;
+ -d | --device)
+ DEVICE="$2"
+ shift 2
+ ;;
+ -f | --flip)
+ FLIP_METHOD="$2"
+ shift 2
+ ;;
+ -h | --height)
+ HEIGHT="$2"
+ shift 2
+ ;;
+ -l | --adb-flags)
+ ADB_FLAGS="-s $2"
+ shift 2
+ ;;
+ -i | --use-wifi)
+ IP="$2"
+ shift 2
+ ;;
+ -p | --port)
+ PORT="$2"
+ shift 2
+ ;;
+ -P | --password)
+ PASSWORD="$2"
+ shift 2
+ ;;
+ -u | --username)
+ USERNAME="$2"
+ shift 2
+ ;;
+ -s | --no-sync)
+ SYNC=false
+ shift
+ ;;
+ -t | --with-tee)
+ USE_TEE=true
+ shift
+ ;;
+ -v | --video)
+ CAPTURE_STREAM="v"
+ shift
+ ;;
+ -w | --width)
+ WIDTH="$2"
+ shift 2
+ ;;
+ -x | --no-proxy)
+ DISABLE_PROXY=1
+ shift
+ ;;
+ --help)
+ show_help
+ exit
+ shift
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *)
+ echo "Internal error!"
+ exit 1
+ ;;
+ esac
+done
+
+declare -A DISTS
+DISTS=(["Debian"]=1 ["Ubuntu"]=2 ["Arch"]=3 ["LinuxMint"]=4)
+
+if can_run lsb_release; then
+ DIST=$(lsb_release -i | cut -f2 -d ":")
+ RELEASE=$(lsb_release -r | cut -f2 -d ":")
+fi
+if [ -z "$DIST" ] || [ -z "${DISTS[$DIST]}" ]; then
+ if [ -f "/etc/arch-release" ]; then
+ DIST="Arch"
+ RELEASE=""
+ elif [ -f "/etc/debian_version" ]; then
+ DIST="Debian"
+ RELEASE=$(perl -ne 'chomp; if(m:(jessie|testing|sid):){print "8.0"}elsif(m:[\d\.]+:){print}else{print "0.0"}' </etc/debian_version)
+ fi
+fi
+
+GST_VER="0.10"
+GST_VIDEO_CONVERTER="ffmpegcolorspace"
+GST_VIDEO_MIMETYPE="video/x-raw-yuv"
+GST_VIDEO_FORMAT="format=(fourcc)YUY2"
+
+GST_AUDIO_MIMETYPE="audio/x-raw-int"
+GST_AUDIO_FORMAT="width=16,depth=16,endianness=1234,signed=true"
+GST_AUDIO_RATE="rate=44100"
+GST_AUDIO_CHANNELS="channels=1"
+GST_AUDIO_LAYOUT=""
+
+set +e
+check_os_version $DIST $RELEASE
+set -e
+if [ $? -eq 0 ]; then
+ GST_VER="1.0"
+ GST_VIDEO_CONVERTER="videoconvert"
+ GST_VIDEO_MIMETYPE="video/x-raw"
+ GST_VIDEO_FORMAT="format=YUY2"
+
+ GST_AUDIO_MIMETYPE="audio/x-raw"
+ GST_AUDIO_FORMAT="format=S16LE"
+ GST_AUDIO_LAYOUT=",layout=interleaved"
+fi
+
+DIMENSIONS="width=$WIDTH,height=$HEIGHT"
+
+GST_VIDEO_CAPS="$GST_VIDEO_MIMETYPE,$GST_VIDEO_FORMAT,$DIMENSIONS"
+GST_AUDIO_CAPS="$GST_AUDIO_MIMETYPE,$GST_AUDIO_FORMAT$GST_AUDIO_LAYOUT,$GST_AUDIO_RATE,$GST_AUDIO_CHANNELS"
+PA_AUDIO_CAPS="$GST_AUDIO_FORMAT $GST_AUDIO_RATE $GST_AUDIO_CHANNELS"
+
+# GStreamer debug string (see gst-launch manpage)
+GST_DEBUG=souphttpsrc:0,videoflip:0,$GST_CONVERTER:0,v4l2sink:0,pulse:0
+# Is $GST_CONVERTER defined anywhere? Maybe you mean videoconvert vs ffmpegcolorspace? It is in GST_VIDEO_CONVERTER
+
+### MAIN BODY
+
+# Probe module if not probed yet
+if lsmod | grep -w v4l2loopback >/dev/null 2>/dev/null; then
+ # module is already loaded, do nothing
+ :
+elif [ $CAPTURE_STREAM = v -o $CAPTURE_STREAM = av ]; then
+ if can_run sudo; then
+ echo Loading module
+ sudo modprobe v4l2loopback $V4L2_OPTS #-q > /dev/null 2>&1
+ sleep .05
+ else
+ echo Load module with \"modprobe v4l2loopback $V4L2_OPTS\"
+ fi
+fi
+
+# If the user hasn't manually specified which /dev/video* to use
+# through DEVICE, use the first "v4l2 loopback" device as the webcam:
+# this should help when loading v4l2loopback on a system that already
+# has a regular webcam. If that doesn't work, fall back to /dev/video0.
+if [ -z "$DEVICE" ]; then
+ if can_run v4l2-ctl; then
+ for d in /dev/video*; do
+ if v4l2-ctl -d "$d" -D | grep -q "v4l2 loopback"; then
+ DEVICE=$d
+ break
+ fi
+ done
+ fi
+ if [ -z "$DEVICE" ]; then
+ DEVICE=/dev/video0
+ warning "Could not find the v4l2loopback device: falling back to $DEVICE"
+ fi
+fi
+
+# Test that we can read from and write to the device
+if ! test -r "$DEVICE"; then
+ error "$DEVICE is not readable: please fix your permissions"
+fi
+if ! test -w "$DEVICE"; then
+ error "$DEVICE is not writable: please fix your permissions"
+fi
+
+# Decide whether to connect through USB or through wi-fi
+if [ -z $IP ]; then
+ # start adb daemon to avoid relaunching it in while
+ if ! can_run "$ADB"; then
+ error "adb is not available: you'll have to use Wi-Fi, which will be slower.\nNext time, please install the Android SDK from developer.android.com/sdk or install adb package."
+ fi
+ start_adb
+ if ! phone_plugged; then
+ error "adb is available, but the phone is not plugged in.\nConnect your phone to USB and allow usb debugging under developer settings or use Wi-Fi (slower)."
+ fi
+ if ss -ln src ":$PORT" | grep -q ":$PORT"; then
+ PIDOF_ADB="$(pidof adb)"
+ if test -n "$PIDOF_ADB" && ss -lptn src ":$PORT" | grep -q "pid=${PIDOF_ADB}"; then
+ if confirm "Your port $PORT seems to be in use by ADB: would you like to clear the previous port before continuing?"; then
+ adb forward --remove tcp:$PORT
+ else
+ exit 1
+ fi
+ else
+ error "Your port $PORT seems to be in use: try using Wi-Fi.\nIf you would like to use USB forwarding, please free it up and try again."
+ fi
+ fi
+ "$ADB" $ADB_FLAGS forward tcp:$PORT tcp:$PORT
+ IP=127.0.0.1
+ MODE=adb
+else
+ MODE=wifi
+fi
+
+BASE_URL=http://$IP:$PORT
+VIDEO_URL=$BASE_URL/videofeed
+AUDIO_URL=$BASE_URL/audio.$AUDIO_CODEC
+
+if ! iw_server_is_started; then
+ if [ $CAPTURE_STREAM = av ]; then
+ MESSAGE="The IP Webcam audio feed is not reachable at <a href=\"$AUDIO_URL\">$AUDIO_URL</a>.\nThe IP Webcam video feed is not reachable at <a href=\"$VIDEO_URL\">$VIDEO_URL</a>."
+ elif [ $CAPTURE_STREAM = a ]; then
+ MESSAGE="The IP Webcam audio feed is not reachable at <a href=\"$AUDIO_URL\">$AUDIO_URL</a>."
+ elif [ $CAPTURE_STREAM = v ]; then
+ MESSAGE="The IP Webcam video feed is not reachable at <a href=\"$VIDEO_URL\">$VIDEO_URL</a>."
+ else
+ error "Incorrect CAPTURE_STREAM value ($CAPTURE_STREAM). Should be a, v or av."
+ fi
+ error "$MESSAGE\nPlease install and open IP Webcam in your phone and start the server.\nMake sure that values of variables IP, PORT, CAPTURE_STREAM in this script are equal with settings in IP Webcam."
+fi
+
+# Test if audio server is running on pipewire
+if pactl info | grep -q PipeWire; then
+ if [ "$CAPTURE_STREAM" = v ]; then
+ :
+ else
+ # currently setting audio sinks errors out, so give user a workaround
+ error "Only video streams on Pipewire are currently supported. Audio is a WIP. Please set CAPTURE_STREAM value to v."
+ fi
+fi
+
+if [ $CAPTURE_STREAM = a -o $CAPTURE_STREAM = av ]; then
+ # idea: check if default-source is correct. If two copy of script are running,
+ # then after ending first before second you will be set up with $SINK_NAME.monitor,
+ # but not with your original defauld source.
+ # The same issue if script was not end correctly, and you restart it.
+ DEFAULT_SINK=$(pactl info | grep "Sink" | cut -f3 -d " ")
+ DEFAULT_SOURCE=$(pactl info | grep "Source" | cut -f3 -d " ")
+
+ SINK_NAME="ipwebcam"
+ SINK_ID=$(module_id_by_sinkname $SINK_NAME)
+ ECANCEL_ID=$(module_id_by_sinkname "${SINK_NAME}_echo_cancel")
+
+ # Registering audio device if not yet registered
+ if [ -z $SINK_ID ]; then
+ SINK_ID=$(pactl load-module module-null-sink \
+ sink_name="$SINK_NAME" \
+ $PA_AUDIO_CAPS \
+ sink_properties="device.description='IP\ Webcam'")
+ fi
+
+ if [ $DISABLE_ECHO_CANCEL = 1 ]; then
+ :
+ elif [ -z $ECANCEL_ID ]; then
+ ECANCEL_ID=$(pactl load-module module-echo-cancel \
+ sink_name="${SINK_NAME}_echo_cancel" \
+ source_master="$SINK_NAME.monitor" \
+ sink_master="$DEFAULT_SINK" \
+ $PA_AUDIO_CAPS \
+ aec_method="webrtc" save_aec=true use_volume_sharing=true) || true
+ fi
+
+ pactl set-default-source $SINK_NAME.monitor
+fi
+
+# Check for gst-launch
+GSTLAUNCH=gst-launch-${GST_VER}
+if ! can_run "$GSTLAUNCH"; then
+ error "Could not find gst-launch. Exiting."
+fi
+
+# Start the GStreamer graph needed to grab the video and audio
+set +e
+
+#sudo v4l2loopback-ctl set-caps $GST_0_10_VIDEO_CAPS $DEVICE
+
+pipeline_video() {
+ GST_FLIP=""
+ GST_TEE=""
+ if [ $FLIP_METHOD ]; then
+ GST_FLIP="! videoflip method=\"$FLIP_METHOD\" "
+ fi
+ # Due to what seems an issue between v4l2loopback and gst-1.0 (https://github.com/umlaeute/v4l2loopback/issues/83),
+ # the pipeline might need the "tee" multiplexer to enforce an additional buffer copy.
+ # Here we enable it if the user explicitly asked to.
+ # TODO: consider automatically enabling this if using gst-1.0 and specific version ranges of v4l2loopback.
+ if [ "$USE_TEE" = "true" ]; then
+ GST_TEE="! tee "
+ fi
+
+ echo souphttpsrc location="$VIDEO_URL" do-timestamp=true is-live=true user-id="$USERNAME" user-pw="$PASSWORD" \
+ ! queue \
+ ! multipartdemux \
+ ! decodebin \
+ $GST_FLIP \
+ ! $GST_VIDEO_CONVERTER \
+ ! videoscale \
+ ! $GST_VIDEO_CAPS \
+ $GST_TEE \
+ ! v4l2sink device="$DEVICE" sync=$SYNC
+}
+
+pipeline_audio() {
+ echo souphttpsrc location="$AUDIO_URL" do-timestamp=true is-live=true user-id="$USERNAME" user-pw="$PASSWORD" \
+ ! $GST_AUDIO_CAPS ! queue \
+ ! pulsesink device="$SINK_NAME" sync=$SYNC
+}
+
+if [ $CAPTURE_STREAM = av ]; then
+ PIPELINE="$(pipeline_audio) $(pipeline_video)"
+elif [ $CAPTURE_STREAM = a ]; then
+ PIPELINE=$(pipeline_audio)
+elif [ $CAPTURE_STREAM = v ]; then
+ PIPELINE=$(pipeline_video)
+else
+ error "Incorrect CAPTURE_STREAM value ($CAPTURE_STREAM). Should be a, v or av."
+fi
+
+# echo "$PIPELINE"
+
+if [ $DISABLE_PROXY = 1 ]; then
+ # Disabling proxy to access WIFI_IP viz. on local network
+ unset http_proxy
+fi
+
+"$GSTLAUNCH" -e -vt --gst-plugin-spew \
+ --gst-debug="$GST_DEBUG" \
+ $PIPELINE \
+ >feed.log 2>&1 &
+# Maybe we need edit this pipeline to transfer it to "Monitor of IP Webcam" to be able to use it as a microphone?
+
+GSTLAUNCH_PID=$!
+
+if [ $CAPTURE_STREAM = av ]; then
+ MESSAGE="IP Webcam audio is streaming through pulseaudio sink '$SINK_NAME'.\nIP Webcam video is streaming through v4l2loopback device $DEVICE.\n"
+elif [ $CAPTURE_STREAM = a ]; then
+ MESSAGE="IP Webcam audio is streaming through pulseaudio sink '$SINK_NAME'.\n"
+elif [ $CAPTURE_STREAM = v ]; then
+ MESSAGE="IP Webcam video is streaming through v4l2loopback device $DEVICE.\n"
+else
+ error "Incorrect CAPTURE_STREAM value ($CAPTURE_STREAM). Should be a, v or av."
+fi
+info "${MESSAGE}You can now open your videochat app."
+
+echo "Press enter to end stream"
+read
+
+kill $GSTLAUNCH_PID >/dev/null 2>&1 || echo ""
+if [ $CAPTURE_STREAM = a -o $CAPTURE_STREAM = av ]; then
+ pactl set-default-source ${DEFAULT_SOURCE}
+ pactl unload-module ${ECANCEL_ID}
+ pactl unload-module ${SINK_ID}
+fi
+
+# Remove the port forwarding, to avoid issues on the next run
+if [ $MODE = adb ]; then "$ADB" $ADB_FLAGS forward --remove tcp:$PORT; fi
+
+echo "Disconnected from IP Webcam. Have a nice day!"
+# idea: capture ctrl-c signal and set default source back
diff --git a/.scripts/scrot b/.scripts/scrot
index a26b5fd..a37a1ce 100755
--- a/.scripts/scrot
+++ b/.scripts/scrot
@@ -1,3 +1,5 @@
-#!/bin/sh
+#!/bin/bash
-maim -us | clip image/png
+# maim -us | clip image/png
+killall -9 flameshot
+(flameshot &) && (sleep 0.5s && flameshot gui)
diff --git a/.scripts/stats b/.scripts/stats
index 0072018..a71b40f 100755
--- a/.scripts/stats
+++ b/.scripts/stats
@@ -6,5 +6,17 @@ battery="$(cat /sys/class/power_supply/BAT0/capacity)%"
charging="$(awk '{print $1*10^-6 "W"}' /sys/class/power_supply/BAT0/power_now)"
time=$(date +'%d.%m | %H:%M')
weather=$(weather text)
+mem=$(free -m | awk '/^Mem:/{printf("%.1fGb\n",$3/1000)}')
+swap=$(free -m | awk '/^Swap:/{printf("%.1fGb\n",$3/1000)}')
+cpu=$(awk '{u=$2+$4; t=$2+$4+$5; if (NR==1){u1=u; t1=t;} else printf "%.1f%", (($2+$4-u1) * 100 / (t-t1)); }' <(grep 'cpu ' /proc/stat) <(sleep .5; grep 'cpu ' /proc/stat))
-echo "$battery ($charging) | $temp | $net | $weather | $time"
+mouse=$(upower -d | grep -A 10 mouse | awk '/percentage/{printf("| M%s ",$2)}')
+
+if bluetooth | grep -q on; then
+btdev=$(bluetoothctl info)
+btname=$(echo "$btdev" | awk '/Name/{$1=""; printf("|%s",$0)}')
+btbat=$(echo "$btdev" | awk '/Battery/{printf(" %s ",$4)}')
+bt="$btname$btbat"
+fi
+
+echo "$battery ($charging) $mouse$bt| $temp | $cpu | $mem | $swap | $net | $weather | $time"
diff --git a/.scripts/typeclip b/.scripts/typeclip
new file mode 100755
index 0000000..6b1a585
--- /dev/null
+++ b/.scripts/typeclip
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+sleep 0.1
+xdotool type "$(xclip -o -selection clipboard)"
diff --git a/.scripts/voice b/.scripts/voice
new file mode 100755
index 0000000..7d3d754
--- /dev/null
+++ b/.scripts/voice
@@ -0,0 +1,19 @@
+#!/bin/sh
+TEMP=$(mktemp)
+while sleep 1; do
+ tput sc
+ tput cup 0 0
+ cat "${TEMP}" | tail -n1
+ tput rc
+done &
+while true; do
+ VOICE=$(
+ dialog --title "Voice list" --stdout --no-ok --no-cancel --no-tags --menu "Select which voice modification you want to use." 0 0 0 \
+ "-d -d pitch 700 contrast 100 echo 0 1 20 0.4" "child" \
+ "-d -d pitch -200 contrast 100 echo 0 1 20 0.4" "young adult" \
+ "-d -d pitch -500 contrast 100 echo 0 1 20 0.4" "old man"
+ )
+ kill $APP_PID
+ sox $VOICE 1>/dev/null 2>"${TEMP}" &
+ export APP_PID=$!
+done
diff --git a/.scripts/vpn b/.scripts/vpn
index 62aab79..46ac1fb 100755
--- a/.scripts/vpn
+++ b/.scripts/vpn
@@ -8,25 +8,29 @@ if [ "$EUID" -eq 0 ]; then
fi
if ! wg &>/dev/null; then
- wg-quick down wg0
+ wg-quick down wg0 || wg-quick down wg1
echo "Disconnected from Wireguard!"
exit
fi
if sudo pppstats &>/dev/null; then
- sudo poff uni-tuebingen
- echo "Disconnected from Tübingen!"
+ sudo poff uni
+ echo "Disconnected from Universität Tübingen!"
exit
fi
-read -p "[T]uebingen or [W]ireguard? " -n 1 -r
+read -p "[U]ni, [T]übingen or [L]angenau? " -n 1 -r
echo
-if [[ $REPLY =~ ^[Tt]$ ]]; then
- sudo pon uni-tuebingen
- echo "Connected to Tübingen!"
+if [[ $REPLY =~ ^[Uu]$ ]]; then
+ sudo pon uni
+ echo "Connected to Universität Tübingen!"
exit
-elif [[ $REPLY =~ ^[Ww]$ ]]; then
+elif [[ $REPLY =~ ^[Ll]$ ]]; then
wg-quick up wg0
- echo "Connected to Wireguard!"
+ echo "Connected to Langenau Eaglefit!"
+ exit
+elif [[ $REPLY =~ ^[Tt]$ ]]; then
+ wg-quick up wg1
+ echo "Connected to Tübingen home!"
exit
fi
diff --git a/.scripts/wallset b/.scripts/wallset
index f6a39fc..0f3f12a 100755
--- a/.scripts/wallset
+++ b/.scripts/wallset
@@ -1,3 +1,5 @@
#!/bin/bash
-hsetroot -cover $HOME/.scripts/wall.png
+random=$(find $HOME/.walls -maxdepth 1 -name "k*" -type f | shuf -n 1)
+echo $random
+hsetroot -cover "$random"
diff --git a/.scripts/weather b/.scripts/weather
index 345e702..a5c868a 100755
--- a/.scripts/weather
+++ b/.scripts/weather
@@ -12,7 +12,6 @@ usage() {
show : show picture according to time
get : get image from wttr.in
reload : get and show
- full : curl wttr.in [:help|p|q]
text : print one line text
clear : clear text cache
example: weather f 'Kitchener_0pq'
@@ -31,13 +30,8 @@ onlyprinttext() {
get_image() {
hasnet || exit 1
- curl -s 'wttr.in/Tübingen_1pq.png' >$CACHEFILE
- curl -s 'wttr.in/Tübingen?format=%t' >$CACHE_ONELINE
-}
-
-print_detail() {
- echo curl -s "wttr.in/"$OPTION
- curl -s "wttr.in"/$OPTION
+ (curl -f -s 'wttr.in/Tübingen_1pq.png' || echo "ERR") >$CACHEFILE
+ (curl -f -s 'wttr.in/Tübingen?format=%t' || echo "ERR") >$CACHE_ONELINE
}
show_image() {
@@ -58,10 +52,6 @@ h | -h* | --h*) usage ;;
show | s) show_image ;;
get | g) get_image ;;
reload | r) get_image && show_image ;;
-full | f)
- print_detail
- OPTION=$2
- ;;
text | t) onlyprinttext ;;
*)
onlyprinttext
diff --git a/.scripts/z.sh b/.scripts/z.sh
new file mode 100755
index 0000000..67f504e
--- /dev/null
+++ b/.scripts/z.sh
@@ -0,0 +1,267 @@
+# Copyright (c) 2009 rupa deadwyler. Licensed under the WTFPL license, Version 2
+
+# maintains a jump-list of the directories you actually use
+#
+# INSTALL:
+# * put something like this in your .bashrc/.zshrc:
+# . /path/to/z.sh
+# * cd around for a while to build up the db
+# * PROFIT!!
+# * optionally:
+# set $_Z_CMD in .bashrc/.zshrc to change the command (default z).
+# set $_Z_DATA in .bashrc/.zshrc to change the datafile (default ~/.z).
+# set $_Z_MAX_SCORE lower to age entries out faster (default 9000).
+# set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution.
+# set $_Z_NO_PROMPT_COMMAND if you're handling PROMPT_COMMAND yourself.
+# set $_Z_EXCLUDE_DIRS to an array of directories to exclude.
+# set $_Z_OWNER to your username if you want use z while sudo with $HOME kept
+#
+# USE:
+# * z foo # cd to most frecent dir matching foo
+# * z foo bar # cd to most frecent dir matching foo and bar
+# * z -r foo # cd to highest ranked dir matching foo
+# * z -t foo # cd to most recently accessed dir matching foo
+# * z -l foo # list matches instead of cd
+# * z -e foo # echo the best match, don't cd
+# * z -c foo # restrict matches to subdirs of $PWD
+# * z -x # remove the current directory from the datafile
+# * z -h # show a brief help message
+
+[ -d "${_Z_DATA:-$HOME/.z}" ] && {
+ echo "ERROR: z.sh's datafile (${_Z_DATA:-$HOME/.z}) is a directory."
+}
+
+_z() {
+
+ local datafile="${_Z_DATA:-$HOME/.z}"
+
+ # if symlink, dereference
+ [ -h "$datafile" ] && datafile=$(readlink "$datafile")
+
+ # bail if we don't own ~/.z and $_Z_OWNER not set
+ [ -z "$_Z_OWNER" -a -f "$datafile" -a ! -O "$datafile" ] && return
+
+ _z_dirs () {
+ [ -f "$datafile" ] || return
+
+ local line
+ while read line; do
+ # only count directories
+ [ -d "${line%%\|*}" ] && echo "$line"
+ done < "$datafile"
+ return 0
+ }
+
+ # add entries
+ if [ "$1" = "--add" ]; then
+ shift
+
+ # $HOME and / aren't worth matching
+ [ "$*" = "$HOME" -o "$*" = '/' ] && return
+
+ # don't track excluded directory trees
+ if [ ${#_Z_EXCLUDE_DIRS[@]} -gt 0 ]; then
+ local exclude
+ for exclude in "${_Z_EXCLUDE_DIRS[@]}"; do
+ case "$*" in "$exclude"*) return;; esac
+ done
+ fi
+
+ # maintain the data file
+ local tempfile="$datafile.$RANDOM"
+ local score=${_Z_MAX_SCORE:-9000}
+ _z_dirs | awk -v path="$*" -v now="$(date +%s)" -v score=$score -F"|" '
+ BEGIN {
+ rank[path] = 1
+ time[path] = now
+ }
+ $2 >= 1 {
+ # drop ranks below 1
+ if( $1 == path ) {
+ rank[$1] = $2 + 1
+ time[$1] = now
+ } else {
+ rank[$1] = $2
+ time[$1] = $3
+ }
+ count += $2
+ }
+ END {
+ if( count > score ) {
+ # aging
+ for( x in rank ) print x "|" 0.99*rank[x] "|" time[x]
+ } else for( x in rank ) print x "|" rank[x] "|" time[x]
+ }
+ ' 2>/dev/null >| "$tempfile"
+ # do our best to avoid clobbering the datafile in a race condition.
+ if [ $? -ne 0 -a -f "$datafile" ]; then
+ env rm -f "$tempfile"
+ else
+ [ "$_Z_OWNER" ] && chown $_Z_OWNER:"$(id -ng $_Z_OWNER)" "$tempfile"
+ env mv -f "$tempfile" "$datafile" || env rm -f "$tempfile"
+ fi
+
+ # tab completion
+ elif [ "$1" = "--complete" -a -s "$datafile" ]; then
+ _z_dirs | awk -v q="$2" -F"|" '
+ BEGIN {
+ q = substr(q, 3)
+ if( q == tolower(q) ) imatch = 1
+ gsub(/ /, ".*", q)
+ }
+ {
+ if( imatch ) {
+ if( tolower($1) ~ q ) print $1
+ } else if( $1 ~ q ) print $1
+ }
+ ' 2>/dev/null
+
+ else
+ # list/go
+ local echo fnd last list opt typ
+ while [ "$1" ]; do case "$1" in
+ --) while [ "$1" ]; do shift; fnd="$fnd${fnd:+ }$1";done;;
+ -*) opt=${1:1}; while [ "$opt" ]; do case ${opt:0:1} in
+ c) fnd="^$PWD $fnd";;
+ e) echo=1;;
+ h) echo "${_Z_CMD:-z} [-cehlrtx] args" >&2; return;;
+ l) list=1;;
+ r) typ="rank";;
+ t) typ="recent";;
+ x) sed -i -e "\:^${PWD}|.*:d" "$datafile";;
+ esac; opt=${opt:1}; done;;
+ *) fnd="$fnd${fnd:+ }$1";;
+ esac; last=$1; [ "$#" -gt 0 ] && shift; done
+ [ "$fnd" -a "$fnd" != "^$PWD " ] || list=1
+
+ # if we hit enter on a completion just go there
+ case "$last" in
+ # completions will always start with /
+ /*) [ -z "$list" -a -d "$last" ] && builtin cd "$last" && return;;
+ esac
+
+ # no file yet
+ [ -f "$datafile" ] || return
+
+ local cd
+ cd="$( < <( _z_dirs ) awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -F"|" '
+ function frecent(rank, time) {
+ # relate frequency and time
+ dx = t - time
+ return int(10000 * rank * (3.75/((0.0001 * dx + 1) + 0.25)))
+ }
+ function output(matches, best_match, common) {
+ # list or return the desired directory
+ if( list ) {
+ if( common ) {
+ printf "%-10s %s\n", "common:", common > "/dev/stderr"
+ }
+ cmd = "sort -n >&2"
+ for( x in matches ) {
+ if( matches[x] ) {
+ printf "%-10s %s\n", matches[x], x | cmd
+ }
+ }
+ } else {
+ if( common && !typ ) best_match = common
+ print best_match
+ }
+ }
+ function common(matches) {
+ # find the common root of a list of matches, if it exists
+ for( x in matches ) {
+ if( matches[x] && (!short || length(x) < length(short)) ) {
+ short = x
+ }
+ }
+ if( short == "/" ) return
+ for( x in matches ) if( matches[x] && index(x, short) != 1 ) {
+ return
+ }
+ return short
+ }
+ BEGIN {
+ gsub(" ", ".*", q)
+ hi_rank = ihi_rank = -9999999999
+ }
+ {
+ if( typ == "rank" ) {
+ rank = $2
+ } else if( typ == "recent" ) {
+ rank = $3 - t
+ } else rank = frecent($2, $3)
+ if( $1 ~ q ) {
+ matches[$1] = rank
+ } else if( tolower($1) ~ tolower(q) ) imatches[$1] = rank
+ if( matches[$1] && matches[$1] > hi_rank ) {
+ best_match = $1
+ hi_rank = matches[$1]
+ } else if( imatches[$1] && imatches[$1] > ihi_rank ) {
+ ibest_match = $1
+ ihi_rank = imatches[$1]
+ }
+ }
+ END {
+ # prefer case sensitive
+ if( best_match ) {
+ output(matches, best_match, common(matches))
+ exit
+ } else if( ibest_match ) {
+ output(imatches, ibest_match, common(imatches))
+ exit
+ }
+ exit(1)
+ }
+ ')"
+
+ if [ "$?" -eq 0 ]; then
+ if [ "$cd" ]; then
+ if [ "$echo" ]; then echo "$cd"; else builtin cd "$cd"; fi
+ fi
+ else
+ return $?
+ fi
+ fi
+}
+
+alias ${_Z_CMD:-z}='_z 2>&1'
+
+[ "$_Z_NO_RESOLVE_SYMLINKS" ] || _Z_RESOLVE_SYMLINKS="-P"
+
+if type compctl >/dev/null 2>&1; then
+ # zsh
+ [ "$_Z_NO_PROMPT_COMMAND" ] || {
+ # populate directory list, avoid clobbering any other precmds.
+ if [ "$_Z_NO_RESOLVE_SYMLINKS" ]; then
+ _z_precmd() {
+ (_z --add "${PWD:a}" &)
+ : $RANDOM
+ }
+ else
+ _z_precmd() {
+ (_z --add "${PWD:A}" &)
+ : $RANDOM
+ }
+ fi
+ [[ -n "${precmd_functions[(r)_z_precmd]}" ]] || {
+ precmd_functions[$(($#precmd_functions+1))]=_z_precmd
+ }
+ }
+ _z_zsh_tab_completion() {
+ # tab completion
+ local compl
+ read -l compl
+ reply=(${(f)"$(_z --complete "$compl")"})
+ }
+ compctl -U -K _z_zsh_tab_completion _z
+elif type complete >/dev/null 2>&1; then
+ # bash
+ # tab completion
+ complete -o filenames -C '_z --complete "$COMP_LINE"' ${_Z_CMD:-z}
+ [ "$_Z_NO_PROMPT_COMMAND" ] || {
+ # populate directory list. avoid clobbering other PROMPT_COMMANDs.
+ grep "_z --add" <<< "$PROMPT_COMMAND" >/dev/null || {
+ PROMPT_COMMAND="$PROMPT_COMMAND"$'\n''(_z --add "$(command pwd '$_Z_RESOLVE_SYMLINKS' 2>/dev/null)" 2>/dev/null &);'
+ }
+ }
+fi
diff --git a/.xinitrc b/.xinitrc
index 253994b..355bbdc 100644
--- a/.xinitrc
+++ b/.xinitrc
@@ -3,7 +3,7 @@ lxsession &
inputset &
-while true; do xsetroot -name "$(stats)"; sleep 10; done &
+while true; do xsetroot -name "$(stats)"; sleep 5; done &
while true; do weather get; sleep 600; done &
for f in /etc/X11/xinit/xinitrc.d/?*.sh; do
@@ -11,7 +11,7 @@ for f in /etc/X11/xinit/xinitrc.d/?*.sh; do
done
unset f
-copyq &
+# copyq &
redshift -l 48.5:9.1 &
touchegg &