-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
void soul
committed
Feb 2, 2021
1 parent
ba69768
commit f8fa1b9
Showing
22 changed files
with
1,358 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
|
||
# Feed this script a link and it will give dmenu | ||
# some choice programs to use to open it. | ||
feed="${1:-$(printf "%s" | dmenu -p 'Paste URL or file path')}" | ||
case "$(printf "Copy URL\\nw3m\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dl\\nqueue yt-dl audio" | dmenu -i -p "Open it with?")" in | ||
"copy url") echo "$feed" | xclip -selection clipboard ;; | ||
mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;; | ||
"mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;; | ||
"mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;; | ||
"queue yt-dl") qndl "$feed" >/dev/null 2>&1 ;; | ||
"queue yt-dl audio") qndl "$feed" 'youtube-dl --add-metadata -icx -f bestaudio/best' >/dev/null 2>&1 ;; | ||
"queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;; | ||
PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;; | ||
sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;; | ||
vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;; | ||
setbg) curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;; | ||
browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;; | ||
lynx) lynx "$feed" >/dev/null 2>&1 ;; | ||
w3m) w3m "$1" >/dev/null 2>&1 ;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
pid=$(ps -u $USER -o pid,%mem,%cpu,comm | sort -b -k2 -r | sed -n '1!p' | dmenu -i -l 15 | awk '{print $1}') | ||
kill -15 $pid 2>/dev/null | ||
notify-send "👾 u killed a process, u monster" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/sh | ||
|
||
# Gives a dmenu prompt to mount unmounted drives and Android phones. If | ||
# they're in /etc/fstab, they'll be mounted automatically. Otherwise, you'll | ||
# be prompted to give a mountpoint from already existsing directories. If you | ||
# input a novel directory, it will prompt you to create that directory. | ||
|
||
getmount() { \ | ||
[ -z "$chosen" ] && exit 1 | ||
# shellcheck disable=SC2086 | ||
mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1 | ||
[ "$mp" = "" ] && exit 1 | ||
if [ ! -d "$mp" ]; then | ||
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") || exit 1 | ||
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp") | ||
fi | ||
} | ||
|
||
mountusb() { \ | ||
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1 | ||
chosen="$(echo "$chosen" | awk '{print $1}')" | ||
sudo -A mount "$chosen" 2>/dev/null && notify-send "💻 USB mounting" "$chosen mounted." && exit 0 | ||
alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not ( -path *%s -prune ) ",$3}') | ||
getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted" | ||
partitiontype="$(lsblk -no "fstype" "$chosen")" | ||
case "$partitiontype" in | ||
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;; | ||
"exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)";; | ||
*) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";; | ||
esac | ||
notify-send "💻 USB mounting" "$chosen mounted to $mp." | ||
} | ||
|
||
mountandroid() { \ | ||
chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1 | ||
chosen="$(echo "$chosen" | cut -d : -f 1)" | ||
getmount "$HOME -maxdepth 3 -type d" | ||
simple-mtpfs --device "$chosen" "$mp" | ||
echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1 | ||
simple-mtpfs --device "$chosen" "$mp" | ||
notify-send "🤖 Android Mounting" "Android device mounted to $mp." | ||
} | ||
|
||
asktype() { \ | ||
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1 | ||
case $choice in | ||
USB) mountusb ;; | ||
Android) mountandroid ;; | ||
esac | ||
} | ||
|
||
anddrives=$(simple-mtpfs -l 2>/dev/null) | ||
usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')" | ||
|
||
if [ -z "$usbdrives" ]; then | ||
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit | ||
echo "Android device(s) detected." | ||
mountandroid | ||
else | ||
if [ -z "$anddrives" ]; then | ||
echo "USB drive(s) detected." | ||
mountusb | ||
else | ||
echo "Mountable USB drive(s) and Android device(s) detected." | ||
asktype | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
# Gives a dmenu prompt to mount unmounted local NAS shares for read/write. | ||
# Requirements - "%wheel ALL=(ALL) NOPASSWD: ALL" | ||
# | ||
# Browse for mDNS/DNS-SD services using the Avahi daemon... | ||
srvname=$(avahi-browse _smb._tcp -t | awk '{print $4}' | dmenu -i -p "Which NAS?") || exit 1 | ||
notify-send "Searching for network shares..." "Please wait..." | ||
# Choose share disk... | ||
share=$(smbclient -L "$srvname" -N | grep Disk | awk '{print $1}' | dmenu -i -p "Mount which share?") || exit 1 | ||
# Format URL... | ||
share2mnt=//"$srvname".local/"$share" | ||
|
||
sharemount() { | ||
mounted=$(mount -v | grep "$share2mnt") || ([ ! -d /mnt/"$share" ] && sudo mkdir /mnt/"$share") | ||
[ -z "$mounted" ] && sudo mount -t cifs "$share2mnt" -o user=nobody,password="",noperm /mnt/"$share" && notify-send "Netshare $share mounted" && exit 0 | ||
notify-send "Netshare $share already mounted"; exit 1 | ||
} | ||
|
||
sharemount |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
#!/bin/sh | ||
|
||
# Usage: | ||
# `$0`: Ask for recording type via dmenu | ||
# `$0 screencast`: Record both audio and screen | ||
# `$0 video`: Record only screen | ||
# `$0 audio`: Record only audio | ||
# `$0 kill`: Kill existing recording | ||
# | ||
# If there is already a running instance, user will be prompted to end it. | ||
|
||
updateicon() { \ | ||
echo "$1" > /tmp/recordingicon | ||
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}" | ||
} | ||
|
||
killrecording() { | ||
recpid="$(cat /tmp/recordingpid)" | ||
# kill with SIGTERM, allowing finishing touches. | ||
kill -15 "$recpid" | ||
rm -f /tmp/recordingpid | ||
updateicon "" | ||
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}" | ||
# even after SIGTERM, ffmpeg may still run, so SIGKILL it. | ||
sleep 3 | ||
kill -9 "$recpid" | ||
exit | ||
} | ||
|
||
screencast() { \ | ||
ffmpeg -y \ | ||
-f x11grab \ | ||
-framerate 60 \ | ||
-s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \ | ||
-i "$DISPLAY" \ | ||
-f alsa -i default \ | ||
-r 30 \ | ||
-c:v h264 -crf 0 -preset ultrafast -c:a aac \ | ||
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" & | ||
echo $! > /tmp/recordingpid | ||
updateicon "⏺️🎙️" | ||
} | ||
|
||
video() { ffmpeg \ | ||
-f x11grab \ | ||
-s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \ | ||
-i "$DISPLAY" \ | ||
-c:v libx264 -qp 0 -r 30 \ | ||
"$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" & | ||
echo $! > /tmp/recordingpid | ||
updateicon "⏺️" | ||
} | ||
|
||
webcamhidef() { ffmpeg \ | ||
-f v4l2 \ | ||
-i /dev/video0 \ | ||
-video_size 1920x1080 \ | ||
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & | ||
echo $! > /tmp/recordingpid | ||
updateicon "🎥" | ||
} | ||
|
||
webcam() { ffmpeg \ | ||
-f v4l2 \ | ||
-i /dev/video0 \ | ||
-video_size 640x480 \ | ||
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" & | ||
echo $! > /tmp/recordingpid | ||
updateicon "🎥" | ||
} | ||
|
||
|
||
audio() { \ | ||
ffmpeg \ | ||
-f alsa -i default \ | ||
-c:a flac \ | ||
"$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" & | ||
echo $! > /tmp/recordingpid | ||
updateicon "🎙️" | ||
} | ||
|
||
askrecording() { \ | ||
choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:") | ||
case "$choice" in | ||
screencast) screencast;; | ||
audio) audio;; | ||
video) video;; | ||
*selected) videoselected;; | ||
webcam) webcam;; | ||
"webcam (hi-def)") webcamhidef;; | ||
esac | ||
} | ||
|
||
asktoend() { \ | ||
response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") && | ||
[ "$response" = "Yes" ] && killrecording | ||
} | ||
|
||
videoselected() | ||
{ | ||
slop -f "%x %y %w %h" > /tmp/slop | ||
read -r X Y W H < /tmp/slop | ||
rm /tmp/slop | ||
|
||
ffmpeg \ | ||
-f x11grab \ | ||
-framerate 60 \ | ||
-video_size "$W"x"$H" \ | ||
-i :0.0+"$X,$Y" \ | ||
-c:v libx264 -qp 0 -r 30 \ | ||
"$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" & | ||
echo $! > /tmp/recordingpid | ||
updateicon "⏺️" | ||
} | ||
|
||
case "$1" in | ||
screencast) screencast;; | ||
audio) audio;; | ||
video) video;; | ||
*selected) videoselected;; | ||
kill) killrecording;; | ||
*) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/sh | ||
|
||
# A dmenu prompt to unmount drives. | ||
# Provides you with mounted partitions, select one to unmount. | ||
# Drives mounted at /, /boot and /home will not be options to unmount. | ||
|
||
unmountusb() { | ||
[ -z "$drives" ] && exit | ||
chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1 | ||
chosen="$(echo "$chosen" | awk '{print $1}')" | ||
[ -z "$chosen" ] && exit | ||
sudo -A umount "$chosen" && notify-send "💻 USB unmounting" "$chosen unmounted." | ||
} | ||
|
||
unmountandroid() { \ | ||
chosen="$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")" || exit 1 | ||
[ -z "$chosen" ] && exit | ||
sudo -A umount -l "$chosen" && notify-send "🤖 Android unmounting" "$chosen unmounted." | ||
} | ||
|
||
asktype() { \ | ||
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" || exit 1 | ||
case "$choice" in | ||
USB) unmountusb ;; | ||
Android) unmountandroid ;; | ||
esac | ||
} | ||
|
||
drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}') | ||
|
||
if ! grep simple-mtpfs /etc/mtab; then | ||
[ -z "$drives" ] && echo "No drives to unmount." && exit | ||
echo "Unmountable USB drive detected." | ||
unmountusb | ||
else | ||
if [ -z "$drives" ] | ||
then | ||
echo "Unmountable Android device detected." | ||
unmountandroid | ||
else | ||
echo "Unmountable USB drive(s) and Android device(s) detected." | ||
asktype | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/sh | ||
|
||
# The famous "get a menu of emojis to copy" script. | ||
|
||
# Get user selection via dmenu from emoji file. | ||
chosen=$(cut -d ';' -f1 ~/.local/share/larbs/emoji | rofi -show -dmenu -yoffset 01 -i -l 25 | sed "s/ .*//") | ||
|
||
# Exit if none chosen. | ||
[ -z "$chosen" ] && exit | ||
|
||
# If you run this command with an argument, it will automatically insert the | ||
# character. Otherwise, show a message that the emoji has been copied. | ||
if [ -n "$1" ]; then | ||
xdotool type "$chosen" | ||
else | ||
echo "$chosen" | tr -d '\n' | xclip -selection clipboard | ||
notify-send "'$chosen' copied to clipboard." & | ||
fi | ||
|
||
# dmenu -i -l 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
if [[ -z $1 ]] | ||
then | ||
date=$(date "+%Y/%m/%d"); | ||
else | ||
date=$1; | ||
fi | ||
|
||
cachedir="$HOME/epaper" | ||
datedir=$(sed 's/\//-/g' <<<$date) | ||
|
||
mkdir -p $cachedir/$datedir | ||
|
||
for i in 0{1..9} {10..50} ; | ||
do | ||
wget -nc -O $cachedir/$datedir/$i.jpg https://epaperwmimg.amarujala.com/$date/cb/$i/hdimage.jpg || break | ||
done | ||
|
||
notify-send "Grab a 🍵cuz here is your 🗞️" | ||
sxiv -z 110 $cachedir/$datedir/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
walldir="$HOME/chitra/walls/wallhaven" | ||
maxpage=5 | ||
tagoptions="#minimalism\n#Cyberpunk 2077\n#fantasy girl\n#digital art\n#anime\n#4K\n#nature\n#League of Legends" | ||
if [ -z $1 ]; then | ||
query=$(echo -e $tagoptions | dmenu -p "Search Wallhaven: " -i) | ||
else | ||
query=$1 | ||
fi | ||
|
||
sortoptions="date_added\nrelevance\nrandom\nviews\nfavorites\ntoplist" | ||
sorting=$(echo -e $sortoptions | dmenu -p "Sort Order: " -i) | ||
|
||
query="$(sed 's/#//g' <<<$query)" | ||
query="$(sed 's/ /+/g' <<<$query)" | ||
echo $query | ||
|
||
notify-send "⬇️ Downloading wallpapers 🖼️" | ||
for i in $(seq 1 5); | ||
do | ||
curl -s https://wallhaven.cc/api/v1/search\?atleast\=1920x1080\&sorting\=$sorting\&q\=$query\&page\=$i > tmp.txt | ||
page=$(cat tmp.txt | jq '.' | grep -Eoh "https:\/\/w\.wallhaven.cc\/full\/.*(jpg|png)\b") | ||
wget -nc -P $walldir $page | ||
done | ||
rm tmp.txt | ||
notify-send "😊 Download finish ✅" | ||
sxiv -t $walldir/* | ||
mv $walldir/* ~/chitra/walls/wallhaven |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,27 @@ | ||
#!/bin/bash | ||
#!/bin/sh | ||
|
||
# This Script shows the Apps list generated by you in appslist file | ||
# This Script outputs dmenu list of text and execute everything placed after ';' written in $file | ||
# Currently I use it to run appimages saved in fuse drives to save home storage and | ||
# access config files directly from dmenu | ||
# observe the appslist and spells file for reference and create/edit your files accordingly | ||
# if you put create more files make sure to add them in #choices variable | ||
# if invoke with argument it outputs desired file or invoked without arguments shows dmenu list. | ||
# I know comments are bloat so remove them if you wish. | ||
|
||
var="$HOME/.local/share/extras/scripts/$1" | ||
choices="appslist\nconfigs\nspells" | ||
file=${1:-$(echo -e "$choices" | dmenu -i -l 15)} | ||
|
||
[ -z "$1" ] | ||
less "$var" | grep -P "^$(less "$var" | grep ";" | sed 's/\t.*//g' | dmenu -i -p "👉" -l 170 | awk '{print $1}')\s" | sed 's/.*\t;//' | ${SHELL:-"/bin/bash"} & | ||
var=$HOME/.local/share/extras/scripts/$file | ||
|
||
#dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} & | ||
[ -z "$var" ] | ||
less "$var" | grep -P "^$(less "$var" | grep ";" | sed 's/\t.*//g' | rofi -show -dmenu -yoffset 01 -i -l 25 -p "コンビニ 👉" | awk '{print $1}')\s" | sed 's/.*\t;//' | ${SHELL:-"/bin/bash"} & | ||
|
||
#xargs -r st -e | ||
# rofi -show -dmenu -yoffset 01 -i -l 25 | ||
|
||
# dmenu -i -p "👉" -l 170 | | ||
|
||
# my rough writing are from here | ||
# dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} & | ||
# [ -z "$1" ] | ||
|
||
# xargs -r st -e |
Oops, something went wrong.