summaryrefslogtreecommitdiff
path: root/.aliases
blob: d08daf24d9fc02ab09f3b3bf6de69609ec383fcb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Aliases

alias cp="cp -i"
alias dd="dd status=progress"
alias define="dict -d gcide"
alias df="df -h"
alias du="du -h -c"
alias e="$EDITOR"
alias ffmpeg="ffmpeg -hide_banner"
alias ffprobe="ffprobe -hide_banner"
alias g="git status -s"
alias gg="git add -A && git commit ; git push"
alias grep="grep --color -i"
alias l="ls"
alias less="less --mouse --quit-if-one-screen --ignore-case --LINE-NUMBERS"
alias lightgtk="GTK2_RC_FILES= GTK_DATA_PREFIX= GTK_THEME=Adwaita"
alias ll="ls -lahGF"
alias ln="ln -v"
alias lr="ls -R"
alias ls="ls -GF"
alias noprompt="PROMPT= RPROMPT= "
alias q="ls|grep"
alias qq="find .|grep"
alias sigil="crispy-doom -iwad ~/games/doom/DOOM.WAD -file ~/games/doom/SIGIL_v1_21/SIGIL_COMPAT_v1_21.wad"
alias sudo="doas"
alias synonym="dict -d moby-thesaurus"
alias tar="tar -v"

# Useful functions

function o() {
	case "$1" in 
		*.wad|*.WAD)
			crispy-doom -iwad "$1" &
			;;
		*.pdf|*.epub|*.xhtml|*.xps)
			mupdf "$1"
			;;
		*.jpg|*.png|*.bmp|*.gif|*.jpeg|*.JPG|*.JPEG|*.webp|*.tiff)
			find "$(dirname $1)" -type f -depth 1 -exec sxiv -a "$1" "{}" + 2>/dev/null &
			;;
		*.xcf)
			gimp "$1" 2>/dev/null &
			;;
		*.wav|*.mp3|*.flac|*.m4a|*.wma|*.ape|*.ac3|*.og|*.ogagx|*.spx|*.opus)
			mpv --no-video "$1" 2>/dev/null
			;;
		*.avi|*.mp4|*.wmv|*.dat|*.3gp|*.ogv|*.mkv|*.mpg|*.mpeg|*.vob|*.m2v|*.mov|*.webm|*.ts|*.mts|*.m4v|*.qt|*.divx)
			mpv "$1" 2>/dev/null & 
			;;
		*.html|*.htm)
			$BROWSER "$1" 2>/dev/null &
			;;
		*.zip|*.jar|*.war|*.7z|*.7zip|*.tar|*.tar.gz|*.tgz|*.tar.xz|*.xz|*.txz|*.iso)
			tar -xvf "$1"
			;;
		*.xls|*.xlsx|*.csv)
			sc-im "$1"
			;;
		*.lcd|*.ldr|*.mpd)
			leocad "$1"
			;;
		*)
			[ -f "$1" ] && less "$1" || echo Unsure what to do...
			;;
	esac
}

theme_add() {
	indir="${1:-~/downloads}"
	[ -d "$indir" ] || exit 

	outdir=~/.local/share/wallpapers
	[ -d "$outdir" ] || mkdir -p "$outdir"

	sxiv -rot "$indir" | while read infile; do
		outfile="$outdir/$(echo ${infile##*/} | tr -s [:blank:] - | tr [:upper:] [:lower:])"
		convert "$infile" -geometry '2560x1440^' -gravity center -crop 2560x1440+0+0 "$outfile"
		wpg -a "$outfile"
	done
}

theme_set() {
	theme="$(sxiv -rot ~/.config/wpg/wallpapers | head -1)"
	[ -f "$theme" ] && wpg -s "$theme"
}

theme_reset() {
	wpg -s "$(wpg -c)"
}