1
0
mirror of https://github.com/alrayyes/dotfiles/ synced 2023-11-14 15:56:30 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
41168254ff linkhandler script is only used by newsboat 2020-02-22 20:55:40 +01:00
6bd89a8715 Cleaned up shell scripts 2020-02-22 20:40:41 +01:00
a4ca365978 Fixes wal fish template 2020-02-22 19:28:58 +01:00
19 changed files with 121 additions and 151 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env fish
#Backup original #Backup original
cp config.h config.h.bak cp config.h config.h.bak

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env fish
# Build # Build
rm -rf src rm -rf src

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env fish
khal list khal list
read -s -n 1 read -s -n 1

View File

@ -1,7 +1,10 @@
#!/bin/sh #!/usr/bin/env sh
. ~/.cache/wal/colors.sh
# A dmenu binary prompt script. # A dmenu binary prompt script.
# Gives a dmenu prompt labeled with $1 to perform command $2. # Gives a dmenu prompt labeled with $1 to perform command $2.
# For example: # For example:
# `./prompt "Do you want to shutdown?" "shutdown -h now"` # `./prompt "Do you want to shutdown?" "shutdown -h now"`
[ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb darkred -sb red -sf white -nf gray )" = "Yes" ] && $2 [ "$(printf "No\\nYes" | dmenu -i -p "$1" -nb darkred -sb red -sf white -nf gray)" = "Yes" ] && $2

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env sh
### ###
# Switch wireguard vpns up/down # Switch wireguard vpns up/down
@ -7,12 +7,12 @@
STATUS="$(nmcli device status | grep -c wg0)" STATUS="$(nmcli device status | grep -c wg0)"
case $STATUS in case $STATUS in
1) 1)
sudo wg-quick down wg0 sudo wg-quick down wg0
notify-send 'Wireguard Down' notify-send 'Wireguard Down'
;; ;;
*) *)
sudo wg-quick up wg0 sudo wg-quick up wg0
notify-send 'Wireguard Up' notify-send 'Wireguard Up'
;; ;;
esac esac

View File

@ -1,3 +1,3 @@
#!/bin/sh #!/usr/bin/env sh
betterlockscreen -l blur -t "Step away from the machine!" betterlockscreen -l blur -t "Step away from the machine!"

View File

@ -1,12 +1,12 @@
#!/bin/sh #!/usr/bin/env sh
TIMESTAMP=$(date '+%Y-%m-%d-%H%M%S') TIMESTAMP=$(date '+%Y-%m-%d-%H%M%S')
case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in
"a selected area") maim -s ~/Pictures/Screenshots/pic-selected-"$TIMESTAMP".png && notify-send -i ~/Pictures/Screenshots/pic-selected-"$TIMESTAMP".png "Desktop Screenshot pic-selected-$TIMESTAMP.png" ;; "a selected area") maim -s ~/Pictures/Screenshots/pic-selected-"$TIMESTAMP".png && notify-send -i ~/Pictures/Screenshots/pic-selected-"$TIMESTAMP".png "Desktop Screenshot pic-selected-$TIMESTAMP.png" ;;
"current window") maim -i "$(xdotool getactivewindow)" ~/Pictures/Screenshots/pic-window-"$TIMESTAMP".png && notify-send -i ~/Pictures/Screenshots/pic-window-"$TIMESTAMP".png "Desktop Screenshot pic-window-$TIMESTAMP.png";; "current window") maim -i "$(xdotool getactivewindow)" ~/Pictures/Screenshots/pic-window-"$TIMESTAMP".png && notify-send -i ~/Pictures/Screenshots/pic-window-"$TIMESTAMP".png "Desktop Screenshot pic-window-$TIMESTAMP.png" ;;
"full screen") maim ~/Pictures/Screenshots/pic-full-"$TIMESTAMP".png && notify-send -i ~/Pictures/Screenshots/pic-full-"$TIMESTAMP".png "Desktop Screenshot pic-full-$TIMESTAMP.png" ;; "full screen") maim ~/Pictures/Screenshots/pic-full-"$TIMESTAMP".png && notify-send -i ~/Pictures/Screenshots/pic-full-"$TIMESTAMP".png "Desktop Screenshot pic-full-$TIMESTAMP.png" ;;
"a selected area (copy)") maim -s | xclip -selection clipboard -t image/png ;; "a selected area (copy)") maim -s | xclip -selection clipboard -t image/png ;;
"current window (copy)") maim -i "$(xdotool getactivewindow)" | xclip -selection clipboard -t image/png ;; "current window (copy)") maim -i "$(xdotool getactivewindow)" | xclip -selection clipboard -t image/png ;;
"full screen (copy)") maim | xclip -selection clipboard -t image/png ;; "full screen (copy)") maim | xclip -selection clipboard -t image/png ;;
esac esac

View File

@ -1,2 +0,0 @@
#!/usr/bin/sh
st -c scratchpad

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env sh
xrandr --newmode "2560x1440_40" 201.00 2560 2720 2984 3408 1440 1443 1448 1476 -hsync +vsync xrandr --newmode "2560x1440_40" 201.00 2560 2720 2984 3408 1440 1443 1448 1476 -hsync +vsync
xrandr --addmode HDMI-2 2560x1440_40 xrandr --addmode HDMI-2 2560x1440_40

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# Load wal colours # Load wal colours
. ~/.cache/wal/colors.sh . ~/.cache/wal/colors.sh

View File

@ -107,5 +107,3 @@ if set -q FZF_COMPLETE
bind -M insert \t '__fzf_complete' bind -M insert \t '__fzf_complete'
end end
end end
cat ~/.cache/wal/sequences

View File

@ -1,5 +1,4 @@
#!/bin/sh #!/usr/bin/env sh
# Helps open a file with xdg-open from mutt in a external program without weird side effects. # Helps open a file with xdg-open from mutt in a external program without weird side effects.
opener="setsid xdg-open" opener="setsid xdg-open"
$opener "$1" >/dev/null 2>&1 & $opener "$1" >/dev/null 2>&1 &

View File

@ -43,3 +43,5 @@ color info color236 yellow bold
highlight article "^(Title):.*$" blue default highlight article "^(Title):.*$" blue default
highlight article "https?://[^ ]+" red default highlight article "https?://[^ ]+" red default
highlight article "\\[image\\ [0-9]+\\]" green default highlight article "\\[image\\ [0-9]+\\]" green default
browser linkhandler

12
newsboat/linkhandler Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/fish
switch $argv[1]
case '**.mkv' '**.webm' '**.mp4' '**youtube.com**' '**youtu.be**' '**hooktube.com**' '**bitchute.com**' '**lbry.tv**' '**.mp3' '**.flac'
setsid mpv --input-ipc-server=/tmp/mpvsoc"(date +%s)" -quiet "$argv[1]" >/dev/null 2>&1 &
case '*'
if [ -f $argv[1] ]
"$TERMINAL" -e "$EDITOR $argv[1]"
else
setsid "$BROWSER" "$argv[1]" >/dev/null 2>&1 &
end
end

View File

@ -1,28 +0,0 @@
#!/bin/sh
# Feed script a url or file location.
# If an image, it will view in sxiv,
# if a video or gif, it will view in mpv
# if a music file or pdf, it will download,
# otherwise it opens link in browser.
export BROWSER="brave"
# Set default terminal
export TERMINAL="alacritty"
case "$1" in
*mkv|*webm|*mp4|*youtube.com*|*youtu.be*|*hooktube.com*|*bitchute.com*)
setsid mpv --input-ipc-server=/tmp/mpvsoc"$(date +%s)" -quiet "$1" >/dev/null 2>&1 & ;;
*png|*jpg|*jpe|*jpeg|*gif)
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;;
*mp3|*flac|*opus|*mp3?source*)
setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;;
*)
if [ -f "$1" ];
then
"$TERMINAL" -e "$EDITOR $1"
else
setsid "$BROWSER" "$1" >/dev/null 2>&1 &
fi ;;
esac

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env sh
readonly ID_PREVIEW="preview" readonly ID_PREVIEW="preview"
#PLAY_GIF="yes" #PLAY_GIF="yes"
@ -11,54 +11,54 @@ readonly ID_PREVIEW="preview"
# This however, requires more CPU and therefore affects the overall performance. # This however, requires more CPU and therefore affects the overall performance.
if [ -e "$FIFO_UEBERZUG" ]; then if [ -e "$FIFO_UEBERZUG" ]; then
if [[ "$1" == "draw" ]]; then if [[ "$1" == "draw" ]]; then
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW"
[x]="$2" [y]="$3" [width]="$4" [height]="$5" \ [x]="$2" [y]="$3" [width]="$4" [height]="$5"
[path]="$PWD/$6") \ [path]="$PWD/$6") \
> "$FIFO_UEBERZUG" >"$FIFO_UEBERZUG"
elif [[ "$1" == "videopreview" ]]; then elif [[ "$1" == "videopreview" ]]; then
[[ ! -d "/tmp$PWD/$6/" ]] && mkdir -p "/tmp$PWD/$6/" [[ ! -d "/tmp$PWD/$6/" ]] && mkdir -p "/tmp$PWD/$6/"
[[ ! -f "/tmp$PWD/$6.png" ]] && ffmpegthumbnailer -i "$PWD/$6" -o "/tmp$PWD/$6.png" -s 0 -q 10 [[ ! -f "/tmp$PWD/$6.png" ]] && ffmpegthumbnailer -i "$PWD/$6" -o "/tmp$PWD/$6.png" -s 0 -q 10
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW"
[x]="$2" [y]="$3" [width]="$4" [height]="$5" \ [x]="$2" [y]="$3" [width]="$4" [height]="$5"
[path]="/tmp$PWD/$6.png") \ [path]="/tmp$PWD/$6.png") \
> "$FIFO_UEBERZUG" >"$FIFO_UEBERZUG"
elif [[ "$1" == "gifpreview" ]]; then elif [[ "$1" == "gifpreview" ]]; then
[[ ! -d "/tmp$PWD/$6/" ]] && mkdir -p "/tmp$PWD/$6/" && convert -coalesce "$PWD/$6" "/tmp$PWD/$6/$6.png" [[ ! -d "/tmp$PWD/$6/" ]] && mkdir -p "/tmp$PWD/$6/" && convert -coalesce "$PWD/$6" "/tmp$PWD/$6/$6.png"
if [[ ! -z "$PLAY_GIF" ]]; then if [[ ! -z "$PLAY_GIF" ]]; then
for frame in $(ls -1 /tmp$PWD/$6/$6*.png | sort -V); do for frame in $(ls -1 /tmp$PWD/$6/$6*.png | sort -V); do
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW"
[x]="$2" [y]="$3" [width]="$4" [height]="$5" \ [x]="$2" [y]="$3" [width]="$4" [height]="$5"
[path]="$frame") \ [path]="$frame") \
> "$FIFO_UEBERZUG" >"$FIFO_UEBERZUG"
# Sleep between frames to make the animation smooth. # Sleep between frames to make the animation smooth.
sleep .07 sleep .07
done done
else else
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW"
[x]="$2" [y]="$3" [width]="$4" [height]="$5" \ [x]="$2" [y]="$3" [width]="$4" [height]="$5"
[path]="/tmp$PWD/$6/$6-0.png") \ [path]="/tmp$PWD/$6/$6-0.png") \
> "$FIFO_UEBERZUG" >"$FIFO_UEBERZUG"
fi fi
elif [[ "$1" == "epubpreview" ]]; then elif [[ "$1" == "epubpreview" ]]; then
[[ ! -d "/tmp$PWD/$6/" ]] && mkdir -p "/tmp$PWD/$6/" [[ ! -d "/tmp$PWD/$6/" ]] && mkdir -p "/tmp$PWD/$6/"
[[ ! -f "/tmp$PWD/$6.png" ]] && epub-thumbnailer "$6" "/tmp$PWD/$6.png" 512 [[ ! -f "/tmp$PWD/$6.png" ]] && epub-thumbnailer "$6" "/tmp$PWD/$6.png" 512
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW"
[x]="$2" [y]="$3" [width]="$4" [height]="$5" \ [x]="$2" [y]="$3" [width]="$4" [height]="$5"
[path]="/tmp$PWD/$6.png") \ [path]="/tmp$PWD/$6.png") \
> "$FIFO_UEBERZUG" >"$FIFO_UEBERZUG"
elif [[ "$1" == "pdfpreview" ]]; then elif [[ "$1" == "pdfpreview" ]]; then
[[ ! -d "/tmp$PWD/$6/" ]] && mkdir -p "/tmp$PWD/$6/" [[ ! -d "/tmp$PWD/$6/" ]] && mkdir -p "/tmp$PWD/$6/"
[[ ! -f "/tmp$PWD/$6.png" ]] && pdftoppm -png -singlefile "$6" "/tmp$PWD/$6" [[ ! -f "/tmp$PWD/$6.png" ]] && pdftoppm -png -singlefile "$6" "/tmp$PWD/$6"
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW"
[x]="$2" [y]="$3" [width]="$4" [height]="$5" \ [x]="$2" [y]="$3" [width]="$4" [height]="$5"
[path]="/tmp$PWD/$6.png") \ [path]="/tmp$PWD/$6.png") \
> "$FIFO_UEBERZUG" >"$FIFO_UEBERZUG"
elif [[ "$1" == "clear" ]]; then elif [[ "$1" == "clear" ]]; then
declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") \ declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") \
> "$FIFO_UEBERZUG" >"$FIFO_UEBERZUG"
[[ ! -z $AUTO_REMOVE ]] && [[ -f "/tmp$PWD/$6.png" ]] && rm -f "/tmp$PWD/$6.png" [[ ! -z $AUTO_REMOVE ]] && [[ -f "/tmp$PWD/$6.png" ]] && rm -f "/tmp$PWD/$6.png"
[[ ! -z $AUTO_REMOVE ]] && [[ -d "/tmp$PWD/$6/" ]] && rm -rf "/tmp$PWD/$6/" [[ ! -z $AUTO_REMOVE ]] && [[ -d "/tmp$PWD/$6/" ]] && rm -rf "/tmp$PWD/$6/"
fi fi
fi fi

View File

@ -1,13 +1,3 @@
#!/bin/sh #!/usr/bin/env sh
clear betterlockscreen -u $1
WIDTH=$(xrandr | grep '\*' | awk -F 'x' '{print $1}' | sed 's/ //g')
OUTPUT_IMAGE="$HOME/.cache/lock.png"
echo "Converting ${1} to ${OUTPUT_IMAGE}...."
convert "${1}" "${OUTPUT_IMAGE}"
echo "done!"
echo "Reszing ${OUTPUT_IMAGE} to width ${WIDTH}...."
convert "${OUTPUT_IMAGE}" -resize "${WIDTH}"x "${OUTPUT_IMAGE}"
echo "done!"

View File

@ -1,9 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env sh
export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}" export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}"
function cleanup { function cleanup() {
rm "$FIFO_UEBERZUG" 2>/dev/null rm "$FIFO_UEBERZUG" 2>/dev/null
pkill -P $$ 2>/dev/null pkill -P $$ 2>/dev/null
} }
pkill -P $$ 2>/dev/null pkill -P $$ 2>/dev/null
rm "$FIFO_UEBERZUG" 2>/dev/null rm "$FIFO_UEBERZUG" 2>/dev/null

View File

@ -1,36 +1,32 @@
# Shell variables # Shell variables
# Generated by 'wal' # Generated by 'wal'
set wallpaper "{wallpaper}" set -g wallpaper "{wallpaper}"
# Special # Special
set background "{background}" set -g background "{background}"
set foreground "{foreground}" set -g foreground "{foreground}"
set cursor '{cursor}' set -g cursor '{cursor}'
# Colors # Colors
set color0 "{color0}" set -g color0 "{color0}"
set color1 "{color1}" set -g color1 "{color1}"
set color2 "{color2}" set -g color2 "{color2}"
set color3 "{color3}" set -g color3 "{color3}"
set color4 "{color4}" set -g color4 "{color4}"
set color5 "{color5}" set -g color5 "{color5}"
set color6 "{color6}" set -g color6 "{color6}"
set color7 "{color7}" set -g color7 "{color7}"
set color8 "{color8}" set -g color8 "{color8}"
set color9 "{color9}" set -g color9 "{color9}"
set color10 "{color10}" set -g color10 "{color10}"
set color11 "{color11}" set -g color11 "{color11}"
set color12 "{color12}" set -g color12 "{color12}"
set color13 "{color13}" set -g color13 "{color13}"
set color14 "{color14}" set -g color14 "{color14}"
set color15 "{color15}" set -g color15 "{color15}"
# FZF colors # FZF colors
set FZF_DEFAULT_OPTS " set -g -a FZF_DEFAULT_OPTS "--color fg:7,bg:0,hl:1,fg+:232,bg+:1,hl+:255 --color info:7,prompt:2,spinner:1,pointer:232,marker:1"
$FZF_DEFAULT_OPTS
--color fg:7,bg:0,hl:1,fg+:232,bg+:1,hl+:255
--color info:7,prompt:2,spinner:1,pointer:232,marker:1
"
# Fix LS_COLORS being unreadable. # Fix LS_COLORS being unreadable.
set LS_COLORS "$LS_COLORS:su=30;41:ow=30;42:st=30;44:" set -g -a LS_COLORS ":su=30;41:ow=30;42:st=30;44:"