Many changes
This commit is contained in:
parent
0526302f3e
commit
90fc6ab4fb
39 changed files with 1416 additions and 18 deletions
|
@ -12,6 +12,7 @@
|
|||
# config.h files: (For suckless utils) recompiles and installs program.
|
||||
# all others: run `sent` to show a presentation
|
||||
|
||||
echo "$1"
|
||||
file=$(readlink -f "$1")
|
||||
dir=$(dirname "$file")
|
||||
base="${file%.*}"
|
||||
|
@ -35,7 +36,7 @@ mdtype(){ \
|
|||
case "$command" in
|
||||
"fplreport") pandoc "$file" --metadata-file="$HOME/.pandoc/defaults.yaml" --template fellowship.latex --pdf-engine=xelatex -o "${base}.pdf" ;;
|
||||
"letter") pandoc "$file" --metadata-file="$HOME/.pandoc/defaults.yaml" --template template-letter.tex -o "${base}.pdf" ;;
|
||||
*) pandoc "$file" --metadata-file="$HOME/.pandoc/defaults.yaml" -o "$base".pdf ;;
|
||||
*) pandoc "$file" -f markdown+pipe_tables --metadata-file="$HOME/.pandoc/defaults.yaml" -o "$base".pdf ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
@ -46,6 +47,7 @@ shebangtest() {
|
|||
esac
|
||||
}
|
||||
|
||||
|
||||
case "$file" in
|
||||
*\.ms) refer -PS -e "$file" | groff -me -ms -kejpt -T pdf > "$base".pdf ;;
|
||||
*\.mom) refer -PS -e "$file" | groff -mom -kejpt -T pdf > "$base".pdf ;;
|
||||
|
@ -58,7 +60,8 @@ case "$file" in
|
|||
*\.c) cc "$file" -o "$base" && "$base" ;;
|
||||
*\.py) python "$file" ;;
|
||||
*\.js) cat "$file" | minify --js > "${base}.min.js" ;;
|
||||
*\.less) lessc --clean-css --source-map --autoprefix="last 3 versions, ie >= 11" "$file" "${base}.min.css" ;;
|
||||
#*\.less) lessc --clean-css --source-map --autoprefix="last 3 versions, ie >= 11" "$file" "${base}.min.css" ;;
|
||||
*\.less) lessc "$file" "${base}.css" ;;
|
||||
#*\.go) go run "$file" ;;
|
||||
#*) shebangtest ;;
|
||||
esac
|
||||
|
|
19
bin/.bin/dmenu/get-bookmark
Executable file
19
bin/.bin/dmenu/get-bookmark
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
BOOKMARKS="$HOME/.surf/bookmarks/"
|
||||
|
||||
function formatFile(){
|
||||
keywords="$(grep -E '^keywords:' "$1" | sed 's/^keywords://')"
|
||||
echo "$1 : $keywords" | sed 's/ / /g'
|
||||
}
|
||||
export -f formatFile
|
||||
|
||||
if [ -d "$BOOKMARKS" ]; then
|
||||
cd "$BOOKMARKS"
|
||||
selection=$(find . -type f -exec bash -c 'formatFile "{}"' \; | dmenu -l 20 | sed 's/ : .*//')
|
||||
if [ -f "$selection" ]; then
|
||||
head -n 1 "$selection"
|
||||
fi
|
||||
else
|
||||
echo "$BOOKMARKS doesn't exist"
|
||||
fi
|
12
bin/.bin/dmenu/man-page-pdf
Executable file
12
bin/.bin/dmenu/man-page-pdf
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
man -k . |\
|
||||
awk '{ print $1 " " $2 }' |\
|
||||
rofi -dmenu -p man -i -matching regex |\
|
||||
awk '{ print $2 " " $1 }' |\
|
||||
tr -d '()' |\
|
||||
xargs man -t |\
|
||||
ps2pdf - - |\
|
||||
zathura -
|
||||
|
||||
|
10
bin/.bin/dmenu/offline-aw
Executable file
10
bin/.bin/dmenu/offline-aw
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Offline version of aw in markdown
|
||||
|
||||
AW_FOLDER="$HOME/GitRepos/arch-wiki-md-repo/wiki/_content/english/"
|
||||
|
||||
cd "$AW_FOLDER"
|
||||
selection=$(find . -name \*.md | rofi -dmenu -i -p "Page")
|
||||
compiler "$selection"
|
||||
opout "$selection"
|
10
bin/.bin/dmenu/open-file
Executable file
10
bin/.bin/dmenu/open-file
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
while name=$(xsel -o | dmenu -p 'Find File') || exit
|
||||
do
|
||||
[[ $name ]] || exit
|
||||
list=$(sudo locate -A -e -i $name)
|
||||
[[ $list ]] || continue
|
||||
file=$(echo -e "$list" | dmenu -l 12 -p 'Open') || exit
|
||||
echo -n "$file" | xsel -b -i
|
||||
xdg-open "$file"
|
||||
done
|
5
bin/.bin/dmenu/ports
Executable file
5
bin/.bin/dmenu/ports
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
|
||||
|
||||
cat "$SCRIPTPATH/ports-common.csv" "$SCRIPTPATH/ports-uncommon.csv" | tr ',' '\t' | rofi -dmenu -i
|
7
bin/.bin/dmenu/screenlayout
Executable file
7
bin/.bin/dmenu/screenlayout
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
FOLDER="$HOME/.dotfiles/bin/.bin/screenlayouts/"
|
||||
script=$(ls "$FOLDER" | sed 's/\.sh$//' | rofi -dmenu -p "Layout" )
|
||||
"${FOLDER}${script}.sh"
|
||||
|
27
bin/.bin/download
Executable file
27
bin/.bin/download
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ "$1" = "surf-download" ]]; then
|
||||
echo "Doing surf"
|
||||
shift
|
||||
# I am shifting so that the vaiable numbers here are the same as in surf
|
||||
useragent="$1"
|
||||
cookiefile="$2"
|
||||
referer="$3"
|
||||
url="$4"
|
||||
fi
|
||||
|
||||
path="~/Downloads/"
|
||||
project=$(project current --path)
|
||||
if [ -n "$project" ]; then
|
||||
path="$project/Downloads/"
|
||||
fi
|
||||
|
||||
mkcd -p "$path"
|
||||
cd "$path"
|
||||
|
||||
echo "$useragent"
|
||||
echo "$cookiefile"
|
||||
echo "$referer"
|
||||
echo "$url"
|
||||
|
||||
curl -g -L -J -O -A "$useragent" -b "$cookiefile" -c "$cookiefile" -e "$referer" "$url"
|
8
bin/.bin/nmap/nmap-get
Executable file
8
bin/.bin/nmap/nmap-get
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cat | grep -v 'host down' |\
|
||||
grep -v Increa |\
|
||||
grep -v Ignoring |\
|
||||
grep -v '^#' |\
|
||||
awk -v RS="\n\n" -v ORS="\n\n" '{if ($0 ~ "'"$1"'" ) print $0}'
|
||||
|
10
bin/.bin/offline-aw
Executable file
10
bin/.bin/offline-aw
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Offline version of aw in markdown
|
||||
|
||||
AW_FOLDER="$HOME/GitRepos/arch-wiki-md-repo/wiki/_content/english/"
|
||||
|
||||
cd "$AW_FOLDER"
|
||||
selection=$(find . -name \*.md | rofi -dmenu -i -p "Page")
|
||||
compiler "$selection"
|
||||
opout "$selection"
|
187
bin/.bin/project
Executable file
187
bin/.bin/project
Executable file
|
@ -0,0 +1,187 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This script sets things based on my current project and will set the symlink ~/Projects/current to the correct folder
|
||||
|
||||
PROJECTS_PATH="$HOME/Projects"
|
||||
SYMLINC="$PROJECTS_PATH/current"
|
||||
|
||||
function print_help(){
|
||||
echo "Manages projects"
|
||||
echo ""
|
||||
echo -e "Usage: $0 <command> [<args>]"
|
||||
echo ""
|
||||
echo -e "Commands"
|
||||
echo -e "list\t\t\tLists The available projects"
|
||||
echo -e "switch\t\t\tSwitches the current project"
|
||||
echo -e "\t--auto\t\tAutomatically deduce the project based on current working directory"
|
||||
echo -e "\t--fzf\t\tUses fzf to choose a project"
|
||||
echo -e "\t--dmenu\t\tUses dmenu to choose a project"
|
||||
echo -e "\t--rofi\t\tUses rofi to choose a project"
|
||||
echo -e "\t--unset\t\tUnsets the project"
|
||||
echo -e "\t<project>\tSets the project"
|
||||
echo -e "current\t\t\tPrints the current project"
|
||||
echo -e "\t--notify\t\tUses notify send to print current project"
|
||||
echo -e "\t--path\t\tPrints the full path rather than the name"
|
||||
exit 0
|
||||
}
|
||||
|
||||
function list_projects(){
|
||||
if [[ "$1" == "--options" ]]; then
|
||||
if [ -L "$SYMLINC" ]; then
|
||||
echo "--unset"
|
||||
fi
|
||||
echo "--new"
|
||||
fi
|
||||
find "$PROJECTS_PATH/" -maxdepth 1 -mindepth 1 -type d | xargs -L 1 basename
|
||||
}
|
||||
|
||||
function switch(){
|
||||
local switchto="$1"
|
||||
if [[ "$1" == "--auto" ]]; then
|
||||
if echo "$PWD" | grep -q "$PROJECTS_PATH"; then
|
||||
switchto=$( echo "$PWD" | sed "s#$PROJECTS_PATH/##")
|
||||
switchto="${switchto%/*}"
|
||||
if [[ "$PWD" == "$PROJECTS_PATH" ]]; then
|
||||
switchto="--unset"
|
||||
fi
|
||||
else
|
||||
switchto="--unset"
|
||||
fi
|
||||
elif [[ "$1" == "--fzf" ]]; then
|
||||
switchto=$(list_projects --options | fzf)
|
||||
elif [[ "$1" == "--dmenu" ]]; then
|
||||
switchto=$(list_projects --options | dmenu -i )
|
||||
elif [[ "$1" == "--rofi" ]]; then
|
||||
switchto=$(list_projects --options | rofi -dmenu -i )
|
||||
elif [[ "$1" == "--unset" ]]; then
|
||||
if [ -L "$SYMLINC" ]; then
|
||||
rm "$SYMLINC" 2> /dev/null
|
||||
# See note about SIGWINCH below
|
||||
pkill -u $USER -SIGWINCH zsh
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
# If $switchto is --unset, it has just been selected from one of the menus
|
||||
# Re-run switch with the --unset flag
|
||||
if [[ "$switchto" == "--unset" ]]; then
|
||||
switch --unset
|
||||
exit 0
|
||||
fi
|
||||
if [[ "$switchto" == "--new" ]]; then
|
||||
new_project "$1"
|
||||
exit 0
|
||||
fi
|
||||
switchto="$PROJECTS_PATH/$switchto"
|
||||
# This sends the SIGWINCH signal to all zsh processes
|
||||
# This tells zsh that the window has been resized.
|
||||
# Althouph we are not resizing the window, it causes zsh to re-draw the prompt
|
||||
pkill -u $USER -SIGWINCH zsh
|
||||
if [ -d "$switchto" ]; then
|
||||
if [ -L "$SYMLINC" ]; then
|
||||
rm "$SYMLINC" 2> /dev/null
|
||||
fi
|
||||
ln -s "$switchto" "$SYMLINC"
|
||||
else
|
||||
echo "No such directory $switchto"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function get_current(){
|
||||
if [ -L "$SYMLINC" ]; then
|
||||
local current=$(readlink "$SYMLINC")
|
||||
if [[ "$1" != "--path" ]]; then
|
||||
if [ -f "$current"/index.yaml ]; then
|
||||
current=$(cat "$current/index.yaml" | yq -r '.name')
|
||||
else
|
||||
current=$(echo "$current" | xargs -L 1 basename)
|
||||
fi
|
||||
fi
|
||||
if [[ "$1" == "--notify" ]]; then
|
||||
notify-send "Current Project" "$current"
|
||||
else
|
||||
echo "$current"
|
||||
fi
|
||||
|
||||
else
|
||||
if [[ "$1" == "--notify" ]]; then
|
||||
notify-send "Current Project" "not set"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function new_project(){
|
||||
local name="$1"
|
||||
local default_dirs=( bin screenshots Downloads )
|
||||
if [ ! -n "$name" ]; then
|
||||
echo -n "Project name: "
|
||||
read name < /dev/tty
|
||||
elif [[ "$name" == "--rofi" ]]; then
|
||||
name=$(rofi -dmenu -l 0 -p "Project name" )
|
||||
elif [[ "$name" == "--dmenu" ]]; then
|
||||
name=$(echo "" | dmenu -l 0 -p "Project name: " )
|
||||
fi
|
||||
# If name still empty, exit
|
||||
if [ ! -n "$name" ]; then
|
||||
exit 1
|
||||
fi
|
||||
mkdir "$PROJECTS_PATH/$name"
|
||||
# Make all the directories
|
||||
for dir in "${default_dirs[@]}"; do
|
||||
mkdir "$PROJECTS_PATH/$name/$dir"
|
||||
done
|
||||
switch "$name"
|
||||
}
|
||||
|
||||
function copyto(){
|
||||
local current="$(get_current --path)"
|
||||
if [ -n "$current" ]; then
|
||||
local destination="$current/"
|
||||
if [[ "$1" == "--bin" ]]; then
|
||||
destination="$current/bin/"
|
||||
shift
|
||||
fi
|
||||
mkdir -p "$destination"
|
||||
cp -r "$@" "$destination"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ -n "$1" ] ; then
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
print_help
|
||||
exit 0
|
||||
;;
|
||||
list)
|
||||
list_projects
|
||||
exit 0
|
||||
;;
|
||||
switch)
|
||||
switch "$2"
|
||||
exit 0
|
||||
;;
|
||||
current)
|
||||
get_current "$2"
|
||||
exit 0
|
||||
;;
|
||||
new)
|
||||
new_project "$2"
|
||||
exit 0
|
||||
;;
|
||||
copy)
|
||||
shift
|
||||
copyto "$@"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown command $1"
|
||||
print_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
2
bin/.bin/screenlayouts/docked.sh
Executable file
2
bin/.bin/screenlayouts/docked.sh
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
xrandr --output eDP-1 --primary --mode 1920x1080 --pos 1920x0 --rotate normal --output DP-1 --off --output HDMI-1 --off --output DP-2 --off --output HDMI-2 --mode 1920x1080 --pos 0x0 --rotate normal
|
2
bin/.bin/screenlayouts/laptop-only.sh
Executable file
2
bin/.bin/screenlayouts/laptop-only.sh
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DP-1 --off --output HDMI-1 --off --output DP-2 --off --output HDMI-2 --off
|
2
bin/.bin/screenlayouts/mirrored.sh
Executable file
2
bin/.bin/screenlayouts/mirrored.sh
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DP-1 --off --output HDMI-1 --off --output DP-2 --off --output HDMI-2 --mode 1920x1080 --pos 0x0 --rotate normal
|
|
@ -4,15 +4,25 @@
|
|||
#
|
||||
# When run, the screenshot will be added to she clipboard
|
||||
|
||||
path='/tmp'
|
||||
|
||||
#If a project is set we will put screenshots in the project's folder
|
||||
project=$(project current --path)
|
||||
if [ -n "$project" ]; then
|
||||
path="$project/screenshots"
|
||||
#Make the directory if it doesn't exist
|
||||
mkdir "$path" 2> /dev/null
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
"window")
|
||||
file=$(scrot -u '/tmp/%F_%T_$wx$h.png' -e 'echo -n /tmp/%F_%T_$wx$h.png')
|
||||
file=$(scrot -u "$path/%F_%T_\$wx\$h.png" -e "echo -n $path/%F_%T_\$wx\$h.png")
|
||||
;;
|
||||
"select")
|
||||
file=$(sleep 0.2; scrot -s '/tmp/%F_%T_$wx$h.png' -e 'echo -n /tmp/%F_%T_$wx$h.png')
|
||||
file=$(sleep 0.2; scrot -s "$path/%F_%T_\$wx\$h.png" -e "echo -n $path/%F_%T_\$wx\$h.png")
|
||||
;;
|
||||
*)
|
||||
file=$(scrot '/tmp/%F_%T_$wx$h.png' -e 'echo -n /tmp/%F_%T_$wx$h.png')
|
||||
file=$(scrot "$path/%F_%T_\$wx\$h.png" -e "echo -n $path/%F_%T_\$wx\$h.png")
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
rngback -fg "#404552" -bg "#5294e2" 3840 2160 30 15 -o ~/background.gif
|
||||
rngback -fg "#3c3836" -bg "#282828" 3840 2160 30 15 -o ~/background.gif
|
||||
|
||||
feh --bg-fill ~/background.gif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue