13.09.2020 Update init
This commit is contained in:
commit
3f61fb4240
|
@ -0,0 +1,60 @@
|
|||
Xft.dpi: 96
|
||||
Xft.antialias: true
|
||||
Xft.hinting: true
|
||||
Xft.rgba: rgb
|
||||
Xft.autohint: false
|
||||
Xft.hintstyle: hintslight
|
||||
Xft.lcdfilter: lcddefault
|
||||
|
||||
#include ".colors/dui"
|
||||
|
||||
!URxvt.font: xft:CozetteVector:size=9
|
||||
!URxvt.font: xft:Hack Nerd Font Mono:size=9
|
||||
|
||||
!!! xlsfonts | grep ttyp0
|
||||
URxvt.font: -uw-ttyp0-medium-r-normal--13-120-75-75-c-70-iso10646-1,xft:Hack Nerd Font Mono:size=9
|
||||
URxvt.boldFont: -uw-ttyp0-medium-r-normal--13-120-75-75-c-70-iso10646-1,xft:Hack Nerd Font Mono:size=9
|
||||
|
||||
!URxvt.termname: xterm-256color
|
||||
URxvt.iconFile: /usr/share/icons/Papirus/48x48/apps/urxvt.svg
|
||||
URxvt.geometry: 84x22
|
||||
URxvt.internalBorder: 15
|
||||
URxvt.letterSpace: 0
|
||||
URxvt.antialias: true
|
||||
URxvt.pointerBlank: true
|
||||
URxvt.saveLines: 7000
|
||||
URxvt.scrollBar: false
|
||||
URxvt.cursorBlink: true
|
||||
URxvt.urgentOnBell: true
|
||||
URxvt.scrollTtyOutput: true
|
||||
URxvt.scrollWithBuffer: true
|
||||
URxvt.scrollTtyKeypress: true
|
||||
URxvt.transparent:false
|
||||
URxvt.depth: 32
|
||||
URxvt.iso14755: false
|
||||
URxvt.iso14755_52: false
|
||||
|
||||
URxvt.perl-ext-common: default,matcher,clipboard,keyboard-select,resize-font,url-select
|
||||
URxvt.url-launcher: /usr/bin/xdg-open
|
||||
URxvt.url-select.underline: true
|
||||
URxvt.matcher.button: 1
|
||||
URxvt.keysym.C-u: perl:url-select:select_next
|
||||
|
||||
URxvt.keysym.C-Escape: perl:keyboard-select:activate
|
||||
URxvt.keysym.C-/: perl:keyboard-select:search
|
||||
|
||||
URxvt.clipboard.autocopy: true
|
||||
URxvt.keysym.Shift-Control-V: eval:paste_clipboard
|
||||
URxvt.keysym.Shift-Control-C: eval:selection_to_clipboard
|
||||
|
||||
! ctrl + arrows
|
||||
URxvt.keysym.Control-Up: \033[1;5A
|
||||
URxvt.keysym.Control-Down: \033[1;5B
|
||||
URxvt.keysym.Control-Left: \033[1;5D
|
||||
URxvt.keysym.Control-Right: \033[1;5C
|
||||
|
||||
! urxvt-resize-font-git
|
||||
URxvt.keysym.C-minus: resize-font:smaller
|
||||
URxvt.keysym.C-plus: resize-font:bigger
|
||||
URxvt.keysym.C-equal: resize-font:reset
|
||||
URxvt.keysym.C-question: resize-font:show
|
|
@ -0,0 +1,371 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
# Стеганография
|
||||
# cat molot-tora.mp4 eraz.zip > data.mp4
|
||||
# unzip date.mp4
|
||||
|
||||
# git.io custom url
|
||||
# curl -i https://git.io -F "url=https://github.com/creio" -F "code=YOUR_CUSTOM_NAME"
|
||||
|
||||
alias sz="source $HOME/.zshrc"
|
||||
alias ez="$EDITOR $HOME/.zshrc"
|
||||
alias ea="$EDITOR $HOME/.alias_zsh"
|
||||
alias merge="xrdb -merge $HOME/.Xresources"
|
||||
alias xcolor="xrdb -query | grep"
|
||||
alias vga="lspci -k | grep -A 2 -E '(VGA|3D)'"
|
||||
alias upgrub="sudo grub-mkconfig -o /boot/grub/grub.cfg"
|
||||
alias iip="curl --max-time 10 -w '\n' http://ident.me"
|
||||
alias tb="nc termbin.com 9999 | xsel -b -i"
|
||||
alias speed="curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -"
|
||||
alias updir="LC_ALL=C xdg-user-dirs-update --force"
|
||||
|
||||
alias dmrun="dmenu_run -l 10 -p 'app>' -fn 'ClearSansMedium 9' -nb '#282c37' -nf '#93a1a1' -sb '#5a74ca' -sf '#fff'"
|
||||
|
||||
doiso() {
|
||||
rsync -auvCL ~/ctlosiso/out/ cretm@${dev_ctlos_ru}:~/app/dev.ctlos.ru/iso/$1
|
||||
}
|
||||
|
||||
# blur img: blur 4 .wall/wl3.jpg blur.jpg
|
||||
blur() {
|
||||
convert -filter Gaussian -blur 0x$1 $2 $3
|
||||
}
|
||||
|
||||
tbg() {
|
||||
urxvt -bg '[0]red' -b 0 -depth 32 +sb -name urxvt_bg &
|
||||
}
|
||||
|
||||
# fzf
|
||||
zzh() {
|
||||
du -a ~/ | awk '{print $2}' | fzf | xargs -r $EDITOR
|
||||
}
|
||||
zz() {
|
||||
du -a . | awk '{print $2}' | fzf | xargs -r $EDITOR
|
||||
}
|
||||
zzd() {
|
||||
du -a $1 | awk '{print $2}' | fzf | xargs -r $EDITOR
|
||||
}
|
||||
zzb() {
|
||||
find -H "/usr/bin" "$HOME/.bin" -executable -print | sed -e 's=.*/==g' | fzf | sh
|
||||
}
|
||||
|
||||
# зависимость source-highlight
|
||||
hcat () {
|
||||
/usr/bin/src-hilite-lesspipe.sh "$1" | less -m -N
|
||||
}
|
||||
|
||||
# share vbox В локальной машине mkdir vboxshare
|
||||
# в виртуалке uid={имя пользователя} git={группа}
|
||||
vboxshare () {
|
||||
mkdir vboxshare
|
||||
sudo mount -t vboxsf -o rw,uid=1000,gid=1000 vboxshare vboxshare
|
||||
# sudo mount -t vboxsf -o rw,uid=st,gid=users vboxshare vboxshare
|
||||
}
|
||||
# shre qemu
|
||||
vmshare () {
|
||||
mkdir vmshare
|
||||
sudo mount -t 9p -o trans=virtio,version=9p2000.L /vmshare vmshare
|
||||
}
|
||||
|
||||
# aur pkg
|
||||
amake () {
|
||||
git clone https://aur.archlinux.org/"$1".git
|
||||
# curl -fO https://aur.archlinux.org/cgit/aur.git/snapshot/"$1".tar.gz
|
||||
cd $1
|
||||
makepkg -s
|
||||
# makepkg -s --sign
|
||||
cd ..
|
||||
}
|
||||
|
||||
# aur clean chroot manager
|
||||
accm () {
|
||||
git clone https://aur.archlinux.org/"$2".git
|
||||
# curl -fO https://aur.archlinux.org/cgit/aur.git/snapshot/"$1".tar.gz
|
||||
# tar -xvf $1.tar.gz
|
||||
cd $2
|
||||
sudo ccm "$1" &&
|
||||
gpg --detach-sign "$2"-*.pkg*
|
||||
cd ..
|
||||
}
|
||||
|
||||
# pkg clean chroot manager
|
||||
lccm () {
|
||||
sudo ccm "$1" &&
|
||||
gpg --detach-sign *.pkg*
|
||||
}
|
||||
|
||||
aget () {
|
||||
git clone https://aur.archlinux.org/"$1".git
|
||||
# curl -fO https://aur.archlinux.org/cgit/aur.git/snapshot/"$1".tar.gz
|
||||
# tar -xvf $1.tar.gz
|
||||
cd $1
|
||||
}
|
||||
|
||||
# build and install pkg from aur
|
||||
abuild () {
|
||||
cd ~/.build
|
||||
git clone https://aur.archlinux.org/"$1".git
|
||||
# curl -fO https://aur.archlinux.org/cgit/aur.git/snapshot/"$1".tar.gz
|
||||
# tar -xvf $1.tar.gz
|
||||
cd $1
|
||||
makepkg -si --skipinteg
|
||||
cd ~
|
||||
# rm -rf ~/.build/$1 ~/.build/$1.tar.gz
|
||||
rm -rf ~/.build/$1
|
||||
}
|
||||
|
||||
|
||||
alias neofetch="neofetch --ascii ~/.config/neofetch/ctlos"
|
||||
alias neoa="neofetch --ascii ~/.config/neofetch/mario"
|
||||
alias neo="neofetch --w3m ~/.config/neofetch/cn.jpg"
|
||||
# alias neo="neofetch --kitty ~/.config/neofetch/cn.jpg"
|
||||
# alias neo="neofetch --w3m"
|
||||
|
||||
# Погода, не только по городу, но и по месту. Нет привязки к регистру и языку.
|
||||
# alias wtr="curl 'wttr.in/Москва?M&lang=ru'"
|
||||
# alias wtr="curl 'wttr.in/Москва?M&lang=ru' | sed -n '1,17p'"
|
||||
# alias wtr="curl 'wttr.in/?M1npQ&lang=ru'"
|
||||
wtr () {
|
||||
# curl "wttr.in/?M$1npQ&lang=ru"
|
||||
curl "wttr.in/Gomel?M$1npQ&lang=ru"
|
||||
}
|
||||
wts () {
|
||||
curl "wttr.in/$1?M&lang=ru"
|
||||
}
|
||||
alias moon="curl 'wttr.in/Moon'"
|
||||
|
||||
alias srm="sudo rm -rf"
|
||||
alias rm="rm -rf"
|
||||
|
||||
alias dir="dir --color=auto"
|
||||
alias vdir="vdir --color=auto"
|
||||
alias grep="grep --color=always"
|
||||
#alias grep="grep --color=auto"
|
||||
alias fgrep="fgrep --color=auto"
|
||||
alias egrep="egrep --color=auto"
|
||||
|
||||
alias ls="ls --color=auto"
|
||||
alias la="ls -alFh --color=auto"
|
||||
alias llp="stat -c '%A %a %n' {*,.*}"
|
||||
alias ll="ls -a --color=auto"
|
||||
alias l="ls -CF --color=auto"
|
||||
alias .l="dirs -v"
|
||||
alias lss="ls -sh | sort -h"
|
||||
alias duh="du -d 1 -h | sort -h"
|
||||
|
||||
alias mk="mkdir"
|
||||
mkj () {
|
||||
mkdir -p "$1"
|
||||
cd "$1"
|
||||
}
|
||||
|
||||
alias /="cd /"
|
||||
alias ~="cd ~"
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
# alias ....="cd ../../.."
|
||||
# alias .....="cd ../../../.."
|
||||
alias q="exit"
|
||||
alias gh="cd /media/files/github"
|
||||
alias ctliso="cd /media/files/github/ctlosiso"
|
||||
alias wiki="cd /media/files/github/wiki"
|
||||
alias ghc="cd /media/files/github/creio"
|
||||
alias dot="cd /media/files/github/creio/dots"
|
||||
|
||||
gc () {
|
||||
git clone "$1"
|
||||
}
|
||||
function gcj () {
|
||||
git clone "$1"
|
||||
cd "$2"
|
||||
# $EDITOR .
|
||||
}
|
||||
alias gi="git init"
|
||||
alias gs="git status"
|
||||
alias gl="git log --stat --pretty=oneline --graph --date=short"
|
||||
alias gg="gitg &"
|
||||
alias ga="git add --all"
|
||||
gac () {
|
||||
git add --all
|
||||
git commit -am "$1"
|
||||
}
|
||||
alias gr="git remote"
|
||||
alias gf="git fetch"
|
||||
alias gpl="git pull"
|
||||
alias gp="git push"
|
||||
alias gpm="git push origin master"
|
||||
alias ghab="$BROWSER http://github.com/ctlos &"
|
||||
# yarn global add github-search-repos-cli
|
||||
alias gsc="github-search-repos -i"
|
||||
|
||||
# tor chromium
|
||||
alias torc="$BROWSER --proxy-server='socks://127.0.0.1:9050' &"
|
||||
alias psi="$BROWSER --proxy-server='socks://127.0.0.1:1081' &"
|
||||
|
||||
# full screen flags -fs
|
||||
alias yt="straw-viewer"
|
||||
ytv () {
|
||||
straw-viewer "$1"
|
||||
}
|
||||
|
||||
# youtube-dl --ignore-errors -o '~/Видео/youtube/%(playlist)s/%(title)s.%(ext)s' https://www.youtube.com/playlist?list=PL-UzghgfytJQV-JCEtyuttutudMk7
|
||||
# Загрузка Видео ~/Videos или ~/Видео
|
||||
# Пример: dlv https://www.youtube.com/watch?v=gBAfejjUQoA
|
||||
dlv () {
|
||||
youtube-dl --ignore-errors -o '~/Videos/youtube/%(title)s.%(ext)s' "$1"
|
||||
}
|
||||
# dlp https://www.youtube.com/playlist?list=PL-UzghgfytJQV-JCEtyuttutudMk7
|
||||
dlp () {
|
||||
youtube-dl --ignore-errors -o '~/Videos/youtube/%(playlist)s/%(title)s.%(ext)s' "$1"
|
||||
}
|
||||
|
||||
# Загрузка аудио ~/Music или ~/Музыка
|
||||
# Пример: mp3 https://www.youtube.com/watch?v=gBAfejjUQoA
|
||||
mp3 () {
|
||||
youtube-dl --ignore-errors -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o '~/Music/youtube/%(title)s.%(ext)s' "$1"
|
||||
}
|
||||
# mp3p https://www.youtube.com/watch?v=-F7A24f6gNc&list=RD-F7A24f6gNc
|
||||
mp3p () {
|
||||
youtube-dl --ignore-errors -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o '~/Music/youtube/%(playlist)s/%(title)s.%(ext)s' "$1"
|
||||
}
|
||||
|
||||
alias porn="mpv 'http://www.pornhub.com/random'"
|
||||
|
||||
alias mvis="ncmpcpp -S visualizer"
|
||||
alias m="ncmpcpp"
|
||||
|
||||
pf () {
|
||||
peerflix "$1" --mpv
|
||||
}
|
||||
alias rss="newsboat"
|
||||
# download web site
|
||||
wgetw () {
|
||||
wget -rkx "$1"
|
||||
}
|
||||
iso () {
|
||||
sudo dd bs=4M if="$1" of=/dev/"$2" status=progress && sync
|
||||
}
|
||||
|
||||
alias -s {mp3,m4a,flac}="mpv"
|
||||
alias -s {png,jpg,tiff,bmp}="viewnior"
|
||||
# alias -s {conf,txt}="nvim"
|
||||
# alias {aurman,pikaur,trizen,yaourt}="yay"
|
||||
|
||||
alias mi="micro"
|
||||
alias smi="sudo micro"
|
||||
alias st="subl3"
|
||||
alias sst="sudo subl3"
|
||||
alias tm="tmux attach || tmux new -s work"
|
||||
alias tmd="tmux detach"
|
||||
alias tmk="tmux kill-server"
|
||||
alias fm="ranger"
|
||||
alias sfm="sudo ranger"
|
||||
alias th="thunar . &"
|
||||
alias sth="sudo thunar &"
|
||||
alias na="nautilus . &"
|
||||
alias sna="sudo nautilus &"
|
||||
alias h="htop"
|
||||
# alias {v,vi,vim}="nvim"
|
||||
|
||||
# LANG=C pacman -Sl | awk '/\[installed\]$/ {print $2}' > ~/.pkglist.txt
|
||||
# LANG=C pacman -Sl | awk '/\[installed\]$/ {print $1 "/" $2 "-" $3}' > ~/.pkglist.txt
|
||||
alias pkglist="pacman -Qneq > ~/.pkglist.txt"
|
||||
alias aurlist="pacman -Qmeq > ~/.aurlist.txt"
|
||||
|
||||
alias packey="sudo pacman-key --init && sudo pacman-key --populate && sudo pacman-key --refresh-keys && sudo pacman -Syy"
|
||||
alias sp="sudo pacman -S"
|
||||
alias spo="sudo pacman -S --overwrite='*'"
|
||||
alias spl="sudo pacman -S --noconfirm --needed - < ~/.pkglist.txt"
|
||||
alias spU="sudo pacman -U"
|
||||
alias spoU="sudo pacman -U --overwrite='*'"
|
||||
alias sps="sudo pacman -Ss"
|
||||
alias spc="sudo pacman -Sc"
|
||||
alias spcc="sudo pacman -Scc"
|
||||
alias spy="sudo pacman -Syy"
|
||||
alias spu="sudo pacman -Syu"
|
||||
alias spr="sudo pacman -R"
|
||||
alias pres="pacman -Qqn | sudo pacman -S -"
|
||||
|
||||
alias y="yay -S"
|
||||
alias yn="yay -S --noconfirm"
|
||||
alias yl="yay -S --noconfirm --needed - < ~/.aurlist.txt"
|
||||
alias ys="yay"
|
||||
alias ysn="yay --noconfirm"
|
||||
alias yc="yay -Sc"
|
||||
alias ycc="yay -Scc"
|
||||
alias yy="yay -Syy"
|
||||
alias yu="yay -Syu"
|
||||
alias yun="yay -Syu --noconfirm"
|
||||
alias yr="yay -R"
|
||||
alias yrs="yay -Rs"
|
||||
alias yrsn="yay -Rsn"
|
||||
alias yrsnp="yay -Rsn $(pacman -Qdtq)"
|
||||
alias yrn="yay -R --noconfirm"
|
||||
alias yskip="yay --mflags '--nocheck --skippgpcheck --noconfirm'"
|
||||
alias ynskip="yay --mflags --skipinteg --noconfirm"
|
||||
|
||||
# systemd
|
||||
alias sse="sudo systemctl enable"
|
||||
alias ssd="sudo systemctl disable"
|
||||
alias ssen="sudo systemctl enable --now"
|
||||
alias ssdn="sudo systemctl disable --now"
|
||||
alias ssr="sudo systemctl restart"
|
||||
alias ssk="sudo systemctl stop"
|
||||
alias sss="sudo systemctl status"
|
||||
|
||||
# Python
|
||||
alias ve="virtualenv ve"
|
||||
alias vea="source ve/bin/activate"
|
||||
alias ved="deactivate"
|
||||
alias pipr="pip install -r requirements.txt"
|
||||
|
||||
# распаковать архив не указывая тип распаковщика
|
||||
function ex {
|
||||
if [ -z "$1" ]; then
|
||||
# display usage if no parameters given
|
||||
echo "Использование: ex <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
|
||||
else
|
||||
if [ -f "$1" ] ; then
|
||||
NAME=${1%.*}
|
||||
#mkdir $NAME && cd $NAME
|
||||
case "$1" in
|
||||
*.tar.bz2) tar xvjf ./"$1" ;;
|
||||
*.tar.gz) tar xvzf ./"$1" ;;
|
||||
*.tar.xz) tar xvJf ./"$1" ;;
|
||||
*.lzma) unlzma ./"$1" ;;
|
||||
*.bz2) bunzip2 ./"$1" ;;
|
||||
*.rar) unrar x -ad ./"$1" ;;
|
||||
*.gz) gunzip ./"$1" ;;
|
||||
*.tar) tar xvf ./"$1" ;;
|
||||
*.tbz2) tar xvjf ./"$1" ;;
|
||||
*.tgz) tar xvzf ./"$1" ;;
|
||||
*.zip) unzip ./"$1" ;;
|
||||
*.Z) uncompress ./"$1" ;;
|
||||
*.7z) 7z x ./"$1" ;;
|
||||
*.xz) unxz ./"$1" ;;
|
||||
*.exe) cabextract ./"$1" ;;
|
||||
*) echo "ex: '$1' - Не может быть распакован" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' - не является допустимым файлом"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Упаковка в архив командой pk 7z /что/мы/пакуем имя_файла.7z
|
||||
function pk () {
|
||||
if [ $1 ] ; then
|
||||
case $1 in
|
||||
tbz) tar cjvf $2.tar.bz2 $2 ;;
|
||||
tgz) tar czvf $2.tar.gz $2 ;;
|
||||
txz) tar -caf $2.tar.xz $2 ;;
|
||||
tar) tar cpvf $2.tar $2 ;;
|
||||
bz2) bzip $2 ;;
|
||||
gz) gzip -c -9 -n $2 > $2.gz ;;
|
||||
zip) zip -r $2.zip $2 ;;
|
||||
7z) 7z a $2.7z $2 ;;
|
||||
*) echo "'$1' не может быть упакован с помощью pk()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' не является допустимым файлом"
|
||||
fi
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
blackarch-keyring
|
||||
caffeine-ng
|
||||
clean-chroot-manager
|
||||
colorpicker
|
||||
cornora-git
|
||||
downgrade
|
||||
grub2-theme-preview
|
||||
hardcode-tray-git
|
||||
ifuse
|
||||
imgur.sh
|
||||
jdk
|
||||
lib32-opencl-nvidia-390xx
|
||||
libxnvctrl-390xx
|
||||
megasync
|
||||
modprobed-db
|
||||
n30f-git
|
||||
netwmpager
|
||||
ngrok
|
||||
noip
|
||||
nvidia-390xx
|
||||
nvidia-390xx-settings
|
||||
nvidia-390xx-utils
|
||||
ob-yml-menu
|
||||
opencl-nvidia-390xx
|
||||
picom-tryone-git
|
||||
pscircle-git
|
||||
rxvt-unicode-pixbuf
|
||||
shantz-xwinwrap-bzr
|
||||
sia-ui
|
||||
skypeforlinux-preview-bin
|
||||
sublime-text-dev
|
||||
toilet
|
||||
torrserver-bin
|
||||
ttf-symbola
|
||||
ttf-weather-icons
|
||||
urxvt-resize-font-git
|
||||
ventoy-bin
|
|
@ -0,0 +1 @@
|
|||
alias | awk -F'[ =]' '{print $1}'
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
looping=$1
|
||||
|
||||
if [ -z $looping ]
|
||||
then
|
||||
looping=~/.wall/hhh.gif
|
||||
fi
|
||||
|
||||
#### 20% cpu gif, best result, convert mp4 -> gif:
|
||||
## ffmpeg -i input.webm -pix_fmt rgb24 output.gif
|
||||
## ffmpeg -i .wall/heart.mp4 .wall/heart.gif
|
||||
xwinwrap -b -sp -fs -ov -ni -nf -- mpv -wid WID --no-config --keepaspect=no --loop --no-border --x11-bypass-compositor=no --aid=no --hwdec=auto --really-quiet $looping
|
||||
|
||||
#### 40% cpu mp4
|
||||
# xwinwrap -b -sp -fs -ov -ni -nf -- mpv -wid WID --no-config --keepaspect=no --loop --no-border --vd-lavc-fast --x11-bypass-compositor=no --aid=no --vo=xv --hwdec=auto --really-quiet $looping
|
||||
|
||||
#### 60% cpu gif
|
||||
## gifsicle --resize 1366x768 wl7.gif -o bg.gif
|
||||
## gifsicle -i .wall/gg.gif --optimize=3 -o ~/.wall/ggo.gif
|
||||
# xwinwrap -b -sp -fs -ov -ni -nf -- gifview -w WID $looping -a
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
# Install script aur pkg
|
||||
# autor: Alex Creio https://cvc.hashbase.io/
|
||||
|
||||
pack="oh-my-zsh-git zsh-autosuggestions \
|
||||
ttf-clear-sans ttf-roboto-mono capitaine-cursors clipit-gtk3 \
|
||||
caffeine-ng python-ewmh \
|
||||
sublime-text-dev timeshift engrampa-thunar-gtk2 fsearch-git \
|
||||
obmenu-generator perl-linux-desktopfiles \
|
||||
xsettingsd qgnomeplatform-git skippy-xd-git betterlockscreen xfce-polkit-git \
|
||||
obkey-git tint2-git"
|
||||
|
||||
yay -Sy --noconfirm --needed $pack
|
||||
|
||||
echo "Aur pkg install Complete"
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
[ "$#" -lt "1" ] || [ "$#" -gt "2" ] && { echo -e "ERROR : args number invalid \n $0 speed /path/name.gif" ; echo "try 0.010 as speed" ; exit 1 ; }
|
||||
dir=/tmp/back4
|
||||
#example of speed : 0.010
|
||||
speed=$1
|
||||
name=$2
|
||||
|
||||
|
||||
[[ "$name" == "" ]] && { name=$speed ; speed=${name##*-} ; }
|
||||
|
||||
hash=`md5sum $name | cut -f1 -d" "`
|
||||
|
||||
[[ ! -d $dir ]] && mkdir $dir
|
||||
|
||||
[[ ! -d $dir/$hash ]] && { mkdir $dir/$hash ; echo "spliting .." ; convert -coalesce $name $dir/$hash/$hash.png ; echo ok ; }
|
||||
|
||||
while : ; do for i in ` ls $dir/$hash -v ` ; do xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorVGA-0/workspace0/last-image -s $dir/$hash/$i ; sleep $speed ; done ; done
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -z $1 ]; then
|
||||
echo "Usage: brighntess BRIGHTNESS"
|
||||
echo "BRIGHTNESS is a float (0.0-1.0)"
|
||||
else
|
||||
xrandr --listmonitors | grep "^ " | cut -f 6 -d' ' | \
|
||||
xargs --replace=MONITOR xrandr --output MONITOR --brightness $1 --gamma $2
|
||||
fi
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import json,sys,urllib.request,time
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print("Usage: btc usd,eur,btc nok")
|
||||
sys.exit()
|
||||
|
||||
currencies = sys.argv[1]
|
||||
basecurrency = sys.argv[2]
|
||||
|
||||
currencyurl = "http://freecurrencyrates.com/api/action.php?do=cvals&iso=" + currencies.replace(',','') + "&f=" + basecurrency + "&v=1&s=cbr"
|
||||
f = urllib.request.urlopen(currencyurl)
|
||||
obj = json.loads(f.read())
|
||||
res="";
|
||||
for c in currencies.split(','):
|
||||
res += c.upper() + ":{:,.2f}".format(1/obj[c.upper()]).replace(',',' ')
|
||||
|
||||
# some unicode currency code replacement (optional)
|
||||
res = res.replace("USD", "$")
|
||||
res = res.replace("EUR", "€")
|
||||
res = res.replace("BTC", "")
|
||||
|
||||
print(res);
|
|
@ -0,0 +1,112 @@
|
|||
#!/bin/sh -f
|
||||
#
|
||||
# pywalesque posix sh alternative.
|
||||
|
||||
img() {
|
||||
[ -d "$1" ] && {
|
||||
set +f
|
||||
set -f -- "$1/"*
|
||||
shift "$(shuf -i "1-$#" -n 1)"
|
||||
}
|
||||
|
||||
[ -f "${img:=$1}" ] || exit 1
|
||||
|
||||
printf '%s\n' "$img"
|
||||
}
|
||||
|
||||
hex2rgb() {
|
||||
set -- "${1##\#}"
|
||||
|
||||
r=${1%%????}
|
||||
g=${1##??}
|
||||
g=${g%%??}
|
||||
b=${1##????}
|
||||
|
||||
r=$((0x$r))
|
||||
g=$((0x$g))
|
||||
b=$((0x$b))
|
||||
}
|
||||
|
||||
mod() {
|
||||
hex2rgb "$2"
|
||||
|
||||
# The operator is stored in a variable
|
||||
# which makes shellcheck freak out.
|
||||
# shellcheck disable=1102,2086
|
||||
{
|
||||
r=$((r $3 $4))
|
||||
g=$((g $3 $4))
|
||||
b=$((b $3 $4))
|
||||
}
|
||||
|
||||
r=$((r > 255 ? 255 : r < 0 ? 0 : r))
|
||||
g=$((g > 255 ? 255 : g < 0 ? 0 : g))
|
||||
b=$((b > 255 ? 255 : b < 0 ? 0 : b))
|
||||
|
||||
export "$1=$(printf '%02x%02x%02x' "$r" "$g" "$b")"
|
||||
}
|
||||
|
||||
col() {
|
||||
cache_file=$(printf %s "$img" | base64)
|
||||
|
||||
# Backticks need to be used here to fix bugs in
|
||||
# some specific POSIX shells.
|
||||
#
|
||||
# Word splitting is also intentional and safe here.
|
||||
# shellcheck disable=2046,2006
|
||||
if [ -f "$cache_dir/$cache_file" ]; then
|
||||
paleta < "$cache_dir/$cache_file" &
|
||||
|
||||
else
|
||||
set -- `\
|
||||
convert "$img" \
|
||||
-alpha off \
|
||||
-resize 64x64 \
|
||||
-posterize 16 \
|
||||
-fill white \
|
||||
-colorize 30% \
|
||||
-modulate 125,175,100 \
|
||||
-unique-colors \
|
||||
txt:- |
|
||||
|
||||
while IFS='# ' read -r _ _ col _; do
|
||||
i=$((i+1))
|
||||
|
||||
[ "$i" -lt 11 ] && continue
|
||||
[ "$i" -gt 16 ] && continue
|
||||
|
||||
printf '%s\n' "$col"
|
||||
done
|
||||
`
|
||||
|
||||
# These variables are dynamically defined,
|
||||
# ignore undeclared variable warnings.
|
||||
# shellcheck disable=2154
|
||||
{
|
||||
mod bg "$2" / 4
|
||||
mod fg "$2" + 150
|
||||
mod co "$bg" + 125
|
||||
|
||||
set -- "$bg" "$@" "$fg" "$co" "$@" "$fg"
|
||||
}
|
||||
|
||||
printf '%s\n' "$@" | paleta &
|
||||
printf '%s\n' "$@" > "$cache_dir/$cache_file"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
mkdir -p "${cache_dir:=${XDG_CACHE_HOME:=${HOME}/.cache}/bud}"
|
||||
|
||||
img "$1"
|
||||
|
||||
display \
|
||||
-page 3200x \
|
||||
-sample 3200x \
|
||||
-window root \
|
||||
"$img" &
|
||||
|
||||
col &
|
||||
}
|
||||
|
||||
main "$1"
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# fc-cache -vf
|
||||
sudo pacman -Scc --noconfirm && sudo pacman -Rsn $(pacman -Qdtq) --noconfirm
|
||||
rm -rf ~/.cache/thumbnails/*
|
||||
rm -rf ~/.build/*
|
||||
rm -rf ~/.cache/telegram/*
|
|
@ -0,0 +1,42 @@
|
|||
#! /bin/bash
|
||||
|
||||
sudo nvidia-settings --assign="0/AllowFlipping=0" &>/dev/null
|
||||
|
||||
RES=$(xdpyinfo | grep dimensions | awk '{print $2;}')
|
||||
ALSA_OUT="alsa_output.pci-0000_00_14.2.analog-stereo.monitor"
|
||||
|
||||
if [ "$1" = "-m" ]; then
|
||||
ffmpeg \
|
||||
-f x11grab -s $RES -i :0.0 \
|
||||
-f alsa -i default \
|
||||
-c:v libx264 -pix_fmt yuv420p -r 30 -crf 23 -preset superfast -threads 0 \
|
||||
-c:a aac \
|
||||
-y ~/Videos/output.mkv
|
||||
elif [ "$1" = "-n" ]; then
|
||||
ffmpeg \
|
||||
-f x11grab -s $RES -i :0.0 \
|
||||
-c:v libx264 -pix_fmt yuv420p -r 30 -preset superfast -qp 0 \
|
||||
-y ~/Videos/output.mp4
|
||||
elif [ "$1" = "-s" ]; then
|
||||
slop=$(slop -f "%x %y %w %h %g %i") || exit 1
|
||||
read -r X Y W H G ID < <(echo $slop)
|
||||
ffmpeg \
|
||||
-f x11grab -s "$W"x"$H" -i :0.0+$X,$Y \
|
||||
-f pulse -i $ALSA_OUT \
|
||||
-c:v libx264 -pix_fmt yuv420p -r 30 -crf 23 -preset superfast -qp 0 \
|
||||
-y ~/Videos/output.mp4
|
||||
# elif [ "$1" = "-g" ]; then
|
||||
# slop=$(slop -f "%x %y %w %h %g %i") || exit 1
|
||||
# read -r X Y W H G ID < <(echo $slop)
|
||||
# ffmpeg \
|
||||
# -f x11grab -s "$W"x"$H" -i :0.0+$X,$Y \
|
||||
# -c:v gif \
|
||||
# -y ~/Videos/output.gif
|
||||
else
|
||||
ffmpeg \
|
||||
-f x11grab -video_size $RES -i :0.0 \
|
||||
-f pulse -i $ALSA_OUT \
|
||||
-c:a libvorbis -b:a 128k \
|
||||
-c:v libx264 -pix_fmt yuv420p -crf 23 -preset superfast -s 1920x1080 -r 30 \
|
||||
-y ~/Videos/output.mp4
|
||||
fi
|
|
@ -0,0 +1,15 @@
|
|||
#! /bin/bash
|
||||
#
|
||||
|
||||
nvidia-settings --assign="0/AllowFlipping=0" &>/dev/null
|
||||
|
||||
# For Pulseaudio with ALSA:
|
||||
ffmpeg -y \
|
||||
-f x11grab \
|
||||
-framerate 30 \
|
||||
-s $(xdpyinfo | grep dimensions | awk '{print $2;}') \
|
||||
-i :0.0 \
|
||||
-f alsa -ar 44100 -i default \
|
||||
-r 30 \
|
||||
-c:v libx264rgb -crf 23 -preset ultrafast -c:a aac \
|
||||
-y ~/Videos/output.mkv
|
|
@ -0,0 +1,771 @@
|
|||
#!/bin/bash
|
||||
# shellcheck disable=SC1117,SC2001
|
||||
#
|
||||
# [X] open section
|
||||
# [X] one shot mode
|
||||
# [X] usage info
|
||||
# [X] dependencies check
|
||||
# [X] help
|
||||
# [X] yank/y/copy/c
|
||||
# [X] Y/C
|
||||
# [X] eof problem
|
||||
# [X] more
|
||||
# [X] stealth mode
|
||||
#
|
||||
# here are several examples for the stealth mode:
|
||||
#
|
||||
# zip lists
|
||||
# list permutation
|
||||
# random list element
|
||||
# reverse a list
|
||||
# read json from file
|
||||
# append string to a file
|
||||
# run process in background
|
||||
# count words in text counter
|
||||
# group elements list
|
||||
|
||||
__CHTSH_VERSION=6
|
||||
__CHTSH_DATETIME="2019-06-05 18:00:46 +0200"
|
||||
|
||||
# cht.sh configuration loading
|
||||
#
|
||||
# configuration is stored in ~/.cht.sh/ (can be overridden by CHTSH_HOME)
|
||||
#
|
||||
CHTSH_HOME=${CHTSH:-"$HOME"/.cht.sh}
|
||||
[ -z "$CHTSH_CONF" ] && CHTSH_CONF=$CHTSH_HOME/cht.sh.conf
|
||||
# shellcheck disable=SC1090,SC2002
|
||||
[ -e "$CHTSH_CONF" ] && source "$CHTSH_CONF"
|
||||
[ -z "$CHTSH_URL" ] && CHTSH_URL=https://cht.sh
|
||||
|
||||
# currently we support only two modes:
|
||||
# * lite = access the server using curl
|
||||
# * auto = try standalone usage first
|
||||
CHTSH_MODE="$(cat "$CHTSH_HOME"/mode 2> /dev/null)"
|
||||
[ "$CHTSH_MODE" != lite ] && CHTSH_MODE=auto
|
||||
CHEATSH_INSTALLATION="$(cat "$CHTSH_HOME/standalone" 2> /dev/null)"
|
||||
|
||||
|
||||
export LESSSECURE=1
|
||||
STEALTH_MAX_SELECTION_LENGTH=5
|
||||
|
||||
case "$(uname -s)" in
|
||||
Darwin) is_macos=yes ;;
|
||||
*) is_macos=no ;;
|
||||
esac
|
||||
|
||||
# for KSH93
|
||||
# shellcheck disable=SC2034,SC2039,SC2168
|
||||
if echo "$KSH_VERSION" | grep -q ' 93' && ! local foo 2>/dev/null; then
|
||||
alias local=typeset
|
||||
fi
|
||||
|
||||
fatal()
|
||||
{
|
||||
echo "ERROR: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
_say_what_i_do()
|
||||
{
|
||||
[ -n "$LOG" ] && echo "$(date '+[%Y-%m-%d %H:%M%S]') $*" >> "$LOG"
|
||||
|
||||
local this_prompt="\033[0;1;4;32m>>\033[0m"
|
||||
printf "\n${this_prompt}%s\033[0m\n" " $* "
|
||||
}
|
||||
|
||||
cheatsh_standalone_install()
|
||||
{
|
||||
# the function installs cheat.sh with the upstream repositories
|
||||
# in the standalone mode
|
||||
local installdir; installdir="$1"
|
||||
local default_installdir="$HOME/.cheat.sh"
|
||||
|
||||
if [ "$installdir" = help ]; then
|
||||
cat <<EOF
|
||||
Install cheat.sh in the standalone mode.
|
||||
|
||||
After the installation, cheat.sh can be used locally, without accessing
|
||||
the public cheat.sh service, or it can be used in the server mode,
|
||||
where the newly installed server could be accessed by external clients
|
||||
in the same fashion as the public cheat.sh server.
|
||||
|
||||
During the installation, cheat.sh code as well as the cheat.sh upstream
|
||||
cheat sheets repositories will be fetched.
|
||||
|
||||
It takes approximately 1G of the disk space.
|
||||
|
||||
Default installation location: ~/.cheat.sh/
|
||||
It can be overridden by a command line parameter to this script:
|
||||
|
||||
${0##*/} --standalone-install DIR
|
||||
|
||||
See cheat.sh/:standalone or https://github.com/chubin/cheat.sh/README.md
|
||||
for more information:
|
||||
|
||||
cht.sh :standalone
|
||||
curl cheat.sh/:standalone
|
||||
|
||||
After the installation is finished, the cht.sh shell client is switched
|
||||
to the auto mode, where it uses the local cheat.sh installation if possible.
|
||||
You can switch the mode with the --mode switch:
|
||||
|
||||
cht.sh --mode lite # use https://cheat.sh/ only
|
||||
cht.sh --mode auto # use local installation
|
||||
|
||||
For intallation and standalone usage, you need \`git\`, \`python\`,
|
||||
and \`virtualenv\` to be installed locally.
|
||||
EOF
|
||||
return
|
||||
fi
|
||||
|
||||
local _exit_code=0
|
||||
|
||||
local dependencies=(python git virtualenv)
|
||||
for dep in "${dependencies[@]}"; do
|
||||
command -v "$dep" >/dev/null || \
|
||||
{ echo "DEPENDENCY: \"$dep\" is needed to install cheat.sh in the standalone mode" >&2; _exit_code=1; }
|
||||
done
|
||||
[ "$_exit_code" -ne 0 ] && return "$_exit_code"
|
||||
|
||||
while true; do
|
||||
echo -n "Where should cheat.sh be installed [$default_installdir]? "; read -r installdir
|
||||
[ -n "$installdir" ] || installdir="$default_installdir"
|
||||
|
||||
if [ "$installdir" = y ] \
|
||||
|| [ "$installdir" = Y ] \
|
||||
|| [ "$(echo "$installdir" | tr "[:upper:]" "[:lower:]")" = yes ]
|
||||
then
|
||||
echo Please enter the directory name
|
||||
echo If it was the directory name already, please prepend it with \"./\": "./$installdir"
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -e "$installdir" ]; then
|
||||
echo "ERROR: Installation directory [$installdir] exists already"
|
||||
echo "Please remove it first before continuing"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! mkdir -p "$installdir"; then
|
||||
echo "ERROR: Could not create the installation directory \"$installdir\""
|
||||
echo "ERROR: Please check the permissions and start the script again"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local space_needed=700
|
||||
local space_available; space_available=$(($(df -k "$installdir" | awk '{print $4}' | tail -1)/1024))
|
||||
|
||||
if [ "$space_available" -lt "$space_needed" ]; then
|
||||
echo "ERROR: Installation directory has no enough space (needed: ${space_needed}M, available: ${space_available}M"
|
||||
echo "ERROR: Please clean up and start the script again"
|
||||
rmdir "$installdir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
_say_what_i_do Cloning cheat.sh locally
|
||||
local url=https://github.com/chubin/cheat.sh
|
||||
rmdir "$installdir"
|
||||
git clone "$url" "$installdir" || fatal Could not clone "$url" with git into "$installdir"
|
||||
cd "$installdir" || fatal "Cannot cd into $installdir"
|
||||
|
||||
# after the repository cloned, we may have the log directory
|
||||
# and we can write our installation log into it
|
||||
mkdir -p "$installdir/log/"
|
||||
LOG="$installdir/log/install.log"
|
||||
|
||||
# we use tee everywhere so we should set -o pipefail
|
||||
set -o pipefail
|
||||
|
||||
# currently the script uses python 2,
|
||||
# but cheat.sh supports python 3 too
|
||||
# if you want to switch it to python 3
|
||||
# set PYTHON2 to NO:
|
||||
# PYTHON2=NO
|
||||
#
|
||||
PYTHON2=YES
|
||||
if [[ $PYTHON2 = YES ]]; then
|
||||
python="python2"
|
||||
pip="pip"
|
||||
virtualenv_python3_option=()
|
||||
else
|
||||
python="python3"
|
||||
pip="pip3"
|
||||
virtualenv_python3_option=(-p python3)
|
||||
fi
|
||||
|
||||
_say_what_i_do Creating virtual environment
|
||||
"$python" "$(command -v virtualenv)" "${virtualenv_python3_option[@]}" ve \
|
||||
|| fatal Could not create virtual environment with "python2 $(command -v virtualenv) ve"
|
||||
|
||||
# rapidfuzz does not support Python 2,
|
||||
# so if we are using Python 2, install fuzzywuzzy instead
|
||||
if [[ $PYTHON2 = YES ]]; then
|
||||
sed -i s/rapidfuzz/fuzzywuzzy/ requirements.txt
|
||||
echo "python-Levenshtein" >> requirements.txt
|
||||
fi
|
||||
|
||||
_say_what_i_do Installing python requirements into the virtual environment
|
||||
ve/bin/"$pip" install -r requirements.txt > "$LOG" \
|
||||
|| {
|
||||
|
||||
echo "ERROR:"
|
||||
echo "---"
|
||||
tail -n 10 "$LOG"
|
||||
echo "---"
|
||||
echo "See $LOG for more"
|
||||
fatal Could not install python dependencies into the virtual environment
|
||||
}
|
||||
echo "$(ve/bin/"$pip" freeze | wc -l) dependencies were successfully installed"
|
||||
|
||||
_say_what_i_do Fetching the upstream cheat sheets repositories
|
||||
ve/bin/python lib/fetch.py fetch-all | tee -a "$LOG"
|
||||
|
||||
_say_what_i_do Running self-tests
|
||||
(
|
||||
cd tests || exit
|
||||
|
||||
if CHEATSH_TEST_STANDALONE=YES \
|
||||
CHEATSH_TEST_SKIP_ONLINE=NO \
|
||||
CHEATSH_TEST_SHOW_DETAILS=NO \
|
||||
PYTHON=../ve/bin/python bash run-tests.sh | tee -a "$LOG"
|
||||
then
|
||||
printf "\033[0;32m%s\033[0m\n" "SUCCESS"
|
||||
else
|
||||
printf "\033[0;31m%s\033[0m\n" "FAILED"
|
||||
echo "Some tests were failed. Run the tests manually for further investigation:"
|
||||
echo " cd $PWD; bash run-tests.sh)"
|
||||
fi
|
||||
)
|
||||
|
||||
mkdir -p "$CHTSH_HOME"
|
||||
echo "$installdir" > "$CHTSH_HOME/standalone"
|
||||
echo auto > "$CHTSH_HOME/mode"
|
||||
|
||||
_say_what_i_do Done
|
||||
|
||||
local v1; v1=$(printf "\033[0;1;32m")
|
||||
local v2; v2=$(printf "\033[0m")
|
||||
|
||||
cat <<EOF | sed "s/{/$v1/; s/}/$v2/"
|
||||
|
||||
{ _ }
|
||||
{ \\ \\ } The installation is successfully finished.
|
||||
{ \\ \\ }
|
||||
{ / / } Now you can use cheat.sh in the standalone mode,
|
||||
{ /_/ } or you can start your own cheat.sh server.
|
||||
|
||||
|
||||
Now the cht.sh shell client is switched to the auto mode, where it uses
|
||||
the local cheat.sh installation if possible.
|
||||
You can switch the mode with the --mode switch:
|
||||
|
||||
cht.sh --mode lite # use https://cheat.sh/ only
|
||||
cht.sh --mode auto # use local installation
|
||||
|
||||
You can add your own cheat sheets repository (config is in \`etc/config.yaml\`),
|
||||
or create new cheat sheets adapters (in \`lib/adapters\`).
|
||||
|
||||
To update local copies of cheat sheets repositores on a regular basis,
|
||||
add the following line to your user crontab (crontab -e):
|
||||
|
||||
10 * * * * $installdir/ve/bin/python $installdir/lib/fetch.py update-all
|
||||
|
||||
All cheat sheets will be automatically actualized each hour.
|
||||
|
||||
If you are running a server reachable from the Internet, it can be instantly
|
||||
notified via a HTTP request about any cheat sheets changes. For that, please
|
||||
open an issue on the cheat.sh project repository [github.com/chubin/cheat.sh]
|
||||
with the ENTRY-POINT from the URL https://ENTRY-POINT/:actualize specified
|
||||
EOF
|
||||
}
|
||||
|
||||
chtsh_mode()
|
||||
{
|
||||
local mode="$1"
|
||||
|
||||
local text; text=$(
|
||||
echo " auto use the standalone installation first"
|
||||
echo " lite use the cheat sheets server directly"
|
||||
)
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
echo "current mode: $CHTSH_MODE ($(printf "%s" "$text" | grep "$CHTSH_MODE" | sed "s/$CHTSH_MODE//; s/^ *//; s/ \+/ /"))"
|
||||
if [ -d "$CHEATSH_INSTALLATION" ]; then
|
||||
echo "cheat.sh standalone installation: $CHEATSH_INSTALLATION"
|
||||
else
|
||||
echo 'cheat.sh standalone installation not found; falling back to the "lite" mode'
|
||||
fi
|
||||
elif [ "$mode" = auto ] || [ "$mode" = lite ]; then
|
||||
if [ "$mode" = "$CHTSH_MODE" ]; then
|
||||
echo "The configured mode was \"$CHTSH_MODE\"; nothing changed"
|
||||
else
|
||||
mkdir -p "$CHTSH_HOME"
|
||||
echo "$mode" > "$CHTSH_HOME/mode"
|
||||
echo "Configured mode: $mode"
|
||||
fi
|
||||
else
|
||||
echo "Unknown mode: $mode"
|
||||
echo Supported modes:
|
||||
echo " auto use the standalone installation first"
|
||||
echo " lite use the cheat sheets server directly"
|
||||
fi
|
||||
}
|
||||
|
||||
get_query_options()
|
||||
{
|
||||
local query="$*"
|
||||
if [ -n "$CHTSH_QUERY_OPTIONS" ]; then
|
||||
case $query in
|
||||
*\?*) query="$query&${CHTSH_QUERY_OPTIONS}";;
|
||||
*) query="$query?${CHTSH_QUERY_OPTIONS}";;
|
||||
esac
|
||||
fi
|
||||
printf "%s" "$query"
|
||||
}
|
||||
|
||||
do_query()
|
||||
{
|
||||
local query="$*"
|
||||
local b_opts=
|
||||
local uri="${CHTSH_URL}/\"\$(get_query_options $query)\""
|
||||
|
||||
if [ -e "$HOME/.cht.sh/id" ]; then
|
||||
b_opts="-b \"\$HOME/.cht.sh/id\""
|
||||
fi
|
||||
|
||||
eval curl "$b_opts" -s "$uri" > "$TMP1"
|
||||
|
||||
if [ -z "$lines" ] || [ "$(wc -l "$TMP1" | awk '{print $1}')" -lt "$lines" ]; then
|
||||
cat "$TMP1"
|
||||
else
|
||||
${PAGER:-$defpager} "$TMP1"
|
||||
fi
|
||||
}
|
||||
|
||||
prepare_query()
|
||||
{
|
||||
local section="$1"; shift
|
||||
local input="$1"; shift
|
||||
local arguments="$1"
|
||||
|
||||
local query
|
||||
if [ -z "$section" ] || [ x"${input}" != x"${input#/}" ]; then
|
||||
query=$(printf %s "$input" | sed 's@ @/@; s@ @+@g')
|
||||
else
|
||||
query=$(printf %s "$section/$input" | sed 's@ @+@g')
|
||||
fi
|
||||
|
||||
[ -n "$arguments" ] && arguments="?$arguments"
|
||||
printf %s "$query$arguments"
|
||||
}
|
||||
|
||||
get_list_of_sections()
|
||||
{
|
||||
curl -s "${CHTSH_URL}"/:list | grep -v '/.*/' | grep '/$' | xargs
|
||||
}
|
||||
|
||||
gen_random_str()
|
||||
(
|
||||
len=$1
|
||||
if command -v openssl >/dev/null; then
|
||||
openssl rand -base64 $((len*3/4)) | awk -v ORS='' //
|
||||
else
|
||||
rdev=/dev/urandom
|
||||
for d in /dev/{srandom,random,arandom}; do
|
||||
test -r "$d" && rdev=$d
|
||||
done
|
||||
if command -v hexdump >/dev/null; then
|
||||
hexdump -vn $((len/2)) -e '1/1 "%02X" 1 ""' "$rdev"
|
||||
elif command -v xxd >/dev/null; then
|
||||
xxd -l $((len/2)) -ps "$rdev" | awk -v ORS='' //
|
||||
else
|
||||
cd /tmp || { echo Cannot cd into /tmp >&2; exit 1; }
|
||||
s=
|
||||
# shellcheck disable=SC2000
|
||||
while [ "$(echo "$s" | wc -c)" -lt "$len" ]; do
|
||||
s="$s$(mktemp -u XXXXXXXXXX)"
|
||||
done
|
||||
printf "%.${len}s" "$s"
|
||||
fi
|
||||
fi
|
||||
)
|
||||
|
||||
if [ "$CHTSH_MODE" = auto ] && [ -d "$CHEATSH_INSTALLATION" ]; then
|
||||
curl() {
|
||||
# ignoring all options
|
||||
# currently the standalone.py does not support them anyway
|
||||
local opt
|
||||
while getopts "b:s" opt; do
|
||||
:
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
local url; url="$1"; shift
|
||||
PYTHONIOENCODING=UTF-8 "$CHEATSH_INSTALLATION/ve/bin/python" "$CHEATSH_INSTALLATION/lib/standalone.py" "${url#"$CHTSH_URL"}" "$@"
|
||||
}
|
||||
elif [ "$(uname -s)" = OpenBSD ] && [ -x /usr/bin/ftp ]; then
|
||||
# any better test not involving either OS matching or actual query?
|
||||
curl() {
|
||||
local opt args="-o -"
|
||||
while getopts "b:s" opt; do
|
||||
case $opt in
|
||||
b) args="$args -c $OPTARG";;
|
||||
s) args="$args -M -V";;
|
||||
*) echo "internal error: unsupported cURL option '$opt'" >&2; exit 1;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
/usr/bin/ftp "$args" "$@"
|
||||
}
|
||||
else
|
||||
command -v curl >/dev/null || { echo 'DEPENDENCY: install "curl" to use cht.sh' >&2; exit 1; }
|
||||
_CURL=$(command -v curl)
|
||||
if [ x"$CHTSH_CURL_OPTIONS" != x ]; then
|
||||
curl() {
|
||||
$_CURL "${CHTSH_CURL_OPTIONS}" "$@"
|
||||
}
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = --read ]; then
|
||||
read -r a || a="exit"
|
||||
printf "%s\n" "$a"
|
||||
exit 0
|
||||
elif [ x"$1" = x--help ] || [ -z "$1" ]; then
|
||||
|
||||
n=${0##*/}
|
||||
s=$(echo "$n" | sed "s/./ /"g)
|
||||
|
||||
cat <<EOF
|
||||
Usage:
|
||||
|
||||
$n [OPTIONS|QUERY]
|
||||
|
||||
Options:
|
||||
|
||||
QUERY process QUERY and exit
|
||||
|
||||
--help show this help
|
||||
--shell [LANG] shell mode (open LANG if specified)
|
||||
|
||||
--standalone-install [DIR|help]
|
||||
install cheat.sh in the standalone mode
|
||||
(by default, into ~/.cheat.sh/)
|
||||
|
||||
--mode [auto|lite] set (or display) mode of operation
|
||||
* auto - prefer the local installation
|
||||
* lite - use the cheat sheet server
|
||||
|
||||
EOF
|
||||
exit 0
|
||||
elif [ x"$1" = x--shell ]; then
|
||||
shell_mode=yes
|
||||
shift
|
||||
elif [ x"$1" = x--standalone-install ]; then
|
||||
shift
|
||||
cheatsh_standalone_install "$@"
|
||||
exit "$?"
|
||||
elif [ x"$1" = x--mode ]; then
|
||||
shift
|
||||
chtsh_mode "$@"
|
||||
exit "$?"
|
||||
fi
|
||||
|
||||
prompt="cht.sh"
|
||||
opts=""
|
||||
input=""
|
||||
for o; do
|
||||
if [ x"$o" != x"${o#-}" ]; then
|
||||
opts="${opts}${o#-}"
|
||||
else
|
||||
input="$input $o"
|
||||
fi
|
||||
done
|
||||
query=$(echo "$input" | sed 's@ *$@@; s@^ *@@; s@ @/@; s@ @+@g')
|
||||
|
||||
if [ "$shell_mode" != yes ]; then
|
||||
curl -s "${CHTSH_URL}"/"$(get_query_options "$query")"
|
||||
exit 0
|
||||
else
|
||||
new_section="$1"
|
||||
valid_sections=$(get_list_of_sections)
|
||||
valid=no; for q in $valid_sections; do [ "$q" = "$new_section/" ] && { valid=yes; break; }; done
|
||||
|
||||
if [ "$valid" = yes ]; then
|
||||
section="$new_section"
|
||||
# shellcheck disable=SC2001
|
||||
this_query="$(echo "$input" | sed 's@ *[^ ]* *@@')"
|
||||
this_prompt="\033[0;32mcht.sh/$section>\033[0m "
|
||||
else
|
||||
this_query="$input"
|
||||
this_prompt="\033[0;32mcht.sh>\033[0m "
|
||||
fi
|
||||
if [ -n "$this_query" ] && [ -z "$CHEATSH_RESTART" ]; then
|
||||
printf "$this_prompt$this_query\n"
|
||||
curl -s "${CHTSH_URL}"/"$(get_query_options "$query")"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$is_macos" != yes ]; then
|
||||
command -v xsel >/dev/null || echo 'DEPENDENCY: please install "xsel" for "copy"' >&2
|
||||
fi
|
||||
command -v rlwrap >/dev/null || { echo 'DEPENDENCY: install "rlwrap" to use cht.sh in the shell mode' >&2; exit 1; }
|
||||
|
||||
mkdir -p "$HOME/.cht.sh/"
|
||||
lines=$(tput lines)
|
||||
|
||||
if command -v less >/dev/null; then
|
||||
defpager="less -R"
|
||||
elif command -v more >/dev/null; then
|
||||
defpager="more"
|
||||
else
|
||||
defpager="cat"
|
||||
fi
|
||||
|
||||
cmd_cd() {
|
||||
if [ $# -eq 0 ]; then
|
||||
section=""
|
||||
else
|
||||
new_section=$(echo "$input" | sed 's/cd *//; s@/*$@@; s@^/*@@')
|
||||
if [ -z "$new_section" ] || [ ".." = "$new_section" ]; then
|
||||
section=""
|
||||
else
|
||||
valid_sections=$(get_list_of_sections)
|
||||
valid=no; for q in $valid_sections; do [ "$q" = "$new_section/" ] && { valid=yes; break; }; done
|
||||
if [ "$valid" = no ]; then
|
||||
echo "Invalid section: $new_section"
|
||||
echo "Valid sections:"
|
||||
echo "$valid_sections" \
|
||||
| xargs printf "%-10s\n" \
|
||||
| tr ' ' . \
|
||||
| xargs -n 10 \
|
||||
| sed 's/\./ /g; s/^/ /'
|
||||
else
|
||||
section="$new_section"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
cmd_copy() {
|
||||
if [ -z "$DISPLAY" ]; then
|
||||
echo copy: supported only in the Desktop version
|
||||
elif [ -z "$input" ]; then
|
||||
echo copy: Make at least one query first.
|
||||
else
|
||||
curl -s "${CHTSH_URL}"/"$(get_query_options "$query"?T)" > "$TMP1"
|
||||
if [ "$is_macos" != yes ]; then
|
||||
xsel -bi < "$TMP1"
|
||||
else
|
||||
pbcopy < "$TMP1"
|
||||
fi
|
||||
echo "copy: $(wc -l "$TMP1" | awk '{print $1}') lines copied to the selection"
|
||||
fi
|
||||
}
|
||||
|
||||
cmd_ccopy() {
|
||||
if [ -z "$DISPLAY" ]; then
|
||||
echo copy: supported only in the Desktop version
|
||||
elif [ -z "$input" ]; then
|
||||
echo copy: Make at least one query first.
|
||||
else
|
||||
curl -s "${CHTSH_URL}"/"$(get_query_options "$query"?TQ)" > "$TMP1"
|
||||
if [ "$is_macos" != yes ]; then
|
||||
xsel -bi < "$TMP1"
|
||||
else
|
||||
pbcopy < "$TMP1"
|
||||
fi
|
||||
echo "copy: $(wc -l "$TMP1" | awk '{print $1}') lines copied to the selection"
|
||||
fi
|
||||
}
|
||||
|
||||
cmd_exit() {
|
||||
exit 0
|
||||
}
|
||||
|
||||
cmd_help() {
|
||||
cat <<EOF
|
||||
help - show this help
|
||||
hush - do not show the 'help' string at start anymore
|
||||
cd LANG - change the language context
|
||||
copy - copy the last answer in the clipboard (aliases: yank, y, c)
|
||||
ccopy - copy the last answer w/o comments (cut comments; aliases: cc, Y, C)
|
||||
exit - exit the cheat shell (aliases: quit, ^D)
|
||||
id [ID] - set/show an unique session id ("reset" to reset, "remove" to remove)
|
||||
stealth - stealth mode (automatic queries for selected text)
|
||||
update - self update (only if the scriptfile is writeable)
|
||||
version - show current cht.sh version
|
||||
/:help - service help
|
||||
QUERY - space separated query staring (examples are below)
|
||||
cht.sh> python zip list
|
||||
cht.sh/python> zip list
|
||||
cht.sh/go> /python zip list
|
||||
EOF
|
||||
}
|
||||
|
||||
cmd_hush() {
|
||||
mkdir -p "$HOME/.cht.sh/" && touch "$HOME/.cht.sh/.hushlogin" && echo "Initial 'use help' message was disabled"
|
||||
}
|
||||
|
||||
cmd_id() {
|
||||
id_file="$HOME/.cht.sh/id"
|
||||
|
||||
if [ id = "$input" ]; then
|
||||
new_id=""
|
||||
else
|
||||
new_id=$(echo "$input" | sed 's/id *//; s/ *$//; s/ /+/g')
|
||||
fi
|
||||
if [ "$new_id" = remove ]; then
|
||||
if [ -e "$id_file" ]; then
|
||||
rm -f -- "$id_file" && echo "id is removed"
|
||||
else
|
||||
echo "id was not set, so you can't remove it"
|
||||
fi
|
||||
return
|
||||
fi
|
||||
if [ -n "$new_id" ] && [ reset != "$new_id" ] && [ "$(/bin/echo -n "$new_id" | wc -c)" -lt 16 ]; then
|
||||
echo "ERROR: $new_id: Too short id. Minimal id length is 16. Use 'id reset' for a random id"
|
||||
return
|
||||
fi
|
||||
if [ -z "$new_id" ]; then
|
||||
# if new_id is not specified check if we have some id already
|
||||
# if yes, just show it
|
||||
# if not, generate a new id
|
||||
if [ -e "$id_file" ]; then
|
||||
awk '$6 == "id" {print $NF}' <"$id_file" | tail -n 1
|
||||
return
|
||||
else
|
||||
new_id=reset
|
||||
fi
|
||||
fi
|
||||
if [ "$new_id" = reset ]; then
|
||||
new_id=$(gen_random_str 12)
|
||||
else
|
||||
echo WARNING: if someone gueses your id, he can read your cht.sh search history
|
||||
fi
|
||||
if [ -e "$id_file" ] && grep -q '\tid\t[^\t][^\t]*$' "$id_file" 2> /dev/null; then
|
||||
sed -i 's/\tid\t[^\t][^\t]*$/ id '"$new_id"'/' "$id_file"
|
||||
else
|
||||
if ! [ -e "$id_file" ]; then
|
||||
printf '#\n\n' > "$id_file"
|
||||
fi
|
||||
printf ".cht.sh\tTRUE\t/\tTRUE\t0\tid\t$new_id\n" >> "$id_file"
|
||||
fi
|
||||
echo "$new_id"
|
||||
}
|
||||
|
||||
cmd_query() {
|
||||
query=$(prepare_query "$section" "$input")
|
||||
do_query "$query"
|
||||
}
|
||||
|
||||
cmd_stealth() {
|
||||
if [ "$input" != stealth ]; then
|
||||
arguments=$(echo "$input" | sed 's/stealth //; s/ /\&/')
|
||||
fi
|
||||
trap break INT
|
||||
if [ "$is_macos" = yes ]; then
|
||||
past=$(pbpaste)
|
||||
else
|
||||
past=$(xsel -o)
|
||||
fi
|
||||
printf "\033[0;31mstealth:\033[0m you are in the stealth mode; select any text in any window for a query\n"
|
||||
printf "\033[0;31mstealth:\033[0m selections longer than $STEALTH_MAX_SELECTION_LENGTH words are ignored\n"
|
||||
if [ -n "$arguments" ]; then
|
||||
printf "\033[0;31mstealth:\033[0m query arguments: ?$arguments\n"
|
||||
fi
|
||||
printf "\033[0;31mstealth:\033[0m use ^C to leave this mode\n"
|
||||
while true; do
|
||||
if [ "$is_macos" = yes ]; then
|
||||
current=$(pbpaste)
|
||||
else
|
||||
current=$(xsel -o)
|
||||
fi
|
||||
if [ "$past" != "$current" ]; then
|
||||
past=$current
|
||||
current_text="$(echo $current | tr -c '[a-zA-Z0-9]' ' ')"
|
||||
if [ "$(echo "$current_text" | wc -w)" -gt "$STEALTH_MAX_SELECTION_LENGTH" ]; then
|
||||
echo "\033[0;31mstealth:\033[0m selection length is longer than $STEALTH_MAX_SELECTION_LENGTH words; ignoring"
|
||||
continue
|
||||
else
|
||||
printf "\n\033[0;31mstealth: \033[7m $current_text\033[0m\n"
|
||||
query=$(prepare_query "$section" "$current_text" "$arguments")
|
||||
do_query "$query"
|
||||
fi
|
||||
fi
|
||||
sleep 1;
|
||||
done
|
||||
trap - INT
|
||||
}
|
||||
|
||||
cmd_update() {
|
||||
[ -w "$0" ] || { echo "The script is readonly; please update manually: curl -s ${CHTSH_URL}/:cht.sh | sudo tee $0"; return; }
|
||||
TMP2=$(mktemp /tmp/cht.sh.XXXXXXXXXXXXX)
|
||||
curl -s "${CHTSH_URL}"/:cht.sh > "$TMP2"
|
||||
if ! cmp "$0" "$TMP2" > /dev/null 2>&1; then
|
||||
if grep -q ^__CHTSH_VERSION= "$TMP2"; then
|
||||
# section was vaildated by us already
|
||||
args=(--shell "$section")
|
||||
cp "$TMP2" "$0" && echo "Updated. Restarting..." && rm "$TMP2" && CHEATSH_RESTART=1 exec "$0" "${args[@]}"
|
||||
else
|
||||
echo "Something went wrong. Please update manually"
|
||||
fi
|
||||
else
|
||||
echo "cht.sh is up to date. No update needed"
|
||||
fi
|
||||
rm -f "$TMP2" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
cmd_version() {
|
||||
insttime=$(ls -l -- "$0" | sed 's/ */ /g' | cut -d ' ' -f 6-8)
|
||||
echo "cht.sh version $__CHTSH_VERSION of $__CHTSH_DATETIME; installed at: $insttime"
|
||||
TMP2=$(mktemp /tmp/cht.sh.XXXXXXXXXXXXX)
|
||||
if curl -s "${CHTSH_URL}"/:cht.sh > "$TMP2"; then
|
||||
if ! cmp "$0" "$TMP2" > /dev/null 2>&1; then
|
||||
echo "Update needed (type 'update' for that)".
|
||||
else
|
||||
echo "Up to date. No update needed"
|
||||
fi
|
||||
fi
|
||||
rm -f "$TMP2" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
TMP1=$(mktemp /tmp/cht.sh.XXXXXXXXXXXXX)
|
||||
trap 'rm -f $TMP1 $TMP2' EXIT
|
||||
trap 'true' INT
|
||||
|
||||
if ! [ -e "$HOME/.cht.sh/.hushlogin" ] && [ -z "$this_query" ]; then
|
||||
echo "type 'help' for the cht.sh shell help"
|
||||
fi
|
||||
|
||||
while true; do
|
||||
if [ "$section" != "" ]; then
|
||||
full_prompt="$prompt/$section> "
|
||||
else
|
||||
full_prompt="$prompt> "
|
||||
fi
|
||||
|
||||
input=$(
|
||||
rlwrap -H "$HOME/.cht.sh/history" -pgreen -C cht.sh -S "$full_prompt" bash "$0" --read | sed 's/ *#.*//'
|
||||
)
|
||||
|
||||
cmd_name=${input%% *}
|
||||
cmd_args=${input#* }
|
||||
case $cmd_name in
|
||||
"") continue;; # skip empty input lines
|
||||
'?'|h|help) cmd_name=help;;
|
||||
hush) cmd_name=hush;;
|
||||
cd) cmd_name="cd";;
|
||||
exit|quit) cmd_name="exit";;
|
||||
copy|yank|c|y) cmd_name=copy;;
|
||||
ccopy|cc|C|Y) cmd_name=ccopy;;
|
||||
id) cmd_name=id;;
|
||||
stealth) cmd_name=stealth;;
|
||||
update) cmd_name=update;;
|
||||
version) cmd_name=version;;
|
||||
*) cmd_name="query"; cmd_args="$input";;
|
||||
esac
|
||||
"cmd_$cmd_name" $cmd_args
|
||||
done
|
|
@ -0,0 +1,70 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import shutil
|
||||
|
||||
CLEAN_FILES = [
|
||||
'~/hostr/',
|
||||
'~/.bzr.log',
|
||||
'~/.cache/babl/',
|
||||
'~/.cache/gegl-0.2/',
|
||||
'~/.cache/google-chrome/',
|
||||
'~/.cache/gstreamer-1.0/',
|
||||
'~/.cache/menu/',
|
||||
'~/.cache/thumbnails/',
|
||||
'~/.local/share/gegl-0.2/',
|
||||
'~/.local/share/recently-used.xbel',
|
||||
'~/.local/share/Trash/',
|
||||
'~/.ncmpcpp/error.log',
|
||||
# '~/.npm/',
|
||||
# '~/.nv/',
|
||||
'~/.pki/',
|
||||
'~/.pylint.d/',
|
||||
'~/.recently-used',
|
||||
'~/.thumbnails/',
|
||||
'~/.w3m/',
|
||||
'~/.xsession-errors.old'
|
||||
]
|
||||
|
||||
|
||||
def answer(question, default="n"):
|
||||
prompt = "%s (y/[n]) " % question
|
||||
ans = input(prompt).strip().lower()
|
||||
|
||||
if not ans:
|
||||
ans = default
|
||||
|
||||
if ans == "y":
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def remove_clean():
|
||||
found = []
|
||||
|
||||
print("\n")
|
||||
for jfile in CLEAN_FILES:
|
||||
extra = os.path.expanduser(jfile)
|
||||
if os.path.exists(extra):
|
||||
found.append(extra)
|
||||
print(" %s" % jfile)
|
||||
total = len(found)
|
||||
|
||||
if total == 0:
|
||||
print("No clean files found :)\n")
|
||||
return
|
||||
|
||||
if answer("\nRemove all?", default="n"):
|
||||
for jfile in found:
|
||||
if os.path.isfile(jfile):
|
||||
os.remove(jfile)
|
||||
else:
|
||||
shutil.rmtree(jfile)
|
||||
print("\nAll clean cleaned")
|
||||
|
||||
else:
|
||||
print("\nNo files removed")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
remove_clean()
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Author: Twily 2014
|
||||
#
|
||||
|
||||
unhide_cursor() { printf "\e[?25h"; }
|
||||
trap unhide_cursor EXIT
|
||||
|
||||
STRW=`expr 6 \* 3 + 2` # String length "00:00:00" in character blocks produced by toilet font
|
||||
STRH=3 # String height "00:00:00" in character blocks produced by toilet font
|
||||
SPACEW=3 # "Space" length in character block produced by toilet font
|
||||
|
||||
# This will center the clock, but resizing will leave artifacts
|
||||
function center {
|
||||
TW=`tput -S <<< cols`
|
||||
TH=`tput -S <<< lines`
|
||||
|
||||
A1=`expr $TH - $STRH`
|
||||
A1=`expr $A1 / 2`
|
||||
A2=`expr $TW - $STRW`
|
||||
A2=`expr $A2 / 2`
|
||||
A2=`expr $A2 / $SPACEW`
|
||||
}
|
||||
|
||||
clear
|
||||
center
|
||||
printf "\e[?25l"
|
||||
while true; do
|
||||
printf "\033[;H"
|
||||
|
||||
B2=""
|
||||
for i in `seq 1 $A1`; do echo ""; done
|
||||
for i in `seq 1 $A2`; do B2="$B2 "; done
|
||||
|
||||
toilet -f future -t --g <<< "$B2`date +'%H:%M:%S'`"
|
||||
sleep .1
|
||||
done
|
|
@ -0,0 +1,90 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# ANSI Color -- use these variables to easily have different color
|
||||
# and format output. Make sure to output the reset sequence after
|
||||
# colors (f = foreground, b = background), and use the 'off'
|
||||
# feature for anything you turn on.
|
||||
|
||||
initializeANSI()
|
||||
{
|
||||
esc=""
|
||||
|
||||
blackf="${esc}[30m"; redf="${esc}[31m"; greenf="${esc}[32m"
|
||||
yellowf="${esc}[33m" bluef="${esc}[34m"; purplef="${esc}[35m"
|
||||
cyanf="${esc}[36m"; whitef="${esc}[37m"
|
||||
|
||||
blackb="${esc}[1;30m"; redb="${esc}[1;31m"; greenb="${esc}[1;32m"
|
||||
yellowb="${esc}[1;33m" blueb="${esc}[1;34m"; purpleb="${esc}[1;35m"
|
||||
cyanb="${esc}[1;36m"; whiteb="${esc}[1;37m"
|
||||
|
||||
boldon="${esc}[1m"; boldoff="${esc}[22m"
|
||||
italicson="${esc}[3m"; italicsoff="${esc}[23m"
|
||||
ulon="${esc}[4m"; uloff="${esc}[24m"
|
||||
invon="${esc}[7m"; invoff="${esc}[27m"
|
||||
|
||||
reset="${esc}[0m"
|
||||
}
|
||||
|
||||
color0=$(xrdb -query | egrep -m1 '^\*\.?color0:' | awk '{print $NF}')
|
||||
color1=$(xrdb -query | egrep -m1 '^\*\.?color1:' | awk '{print $NF}')
|
||||
color2=$(xrdb -query | egrep -m1 '^\*\.?color2:' | awk '{print $NF}')
|
||||
color3=$(xrdb -query | egrep -m1 '^\*\.?color3:' | awk '{print $NF}')
|
||||
color4=$(xrdb -query | egrep -m1 '^\*\.?color4:' | awk '{print $NF}')
|
||||
color5=$(xrdb -query | egrep -m1 '^\*\.?color5:' | awk '{print $NF}')
|
||||
color6=$(xrdb -query | egrep -m1 '^\*\.?color6:' | awk '{print $NF}')
|
||||
color7=$(xrdb -query | egrep -m1 '^\*\.?color7:' | awk '{print $NF}')
|
||||
|
||||
color8=$(xrdb -query | egrep -m1 '^\*\.?color8:' | awk '{print $NF}')
|
||||
color9=$(xrdb -query | egrep -m1 '^\*\.?color9:' | awk '{print $NF}')
|
||||
color10=$(xrdb -query | egrep -m1 '^\*\.?color10:' | awk '{print $NF}')
|
||||
color11=$(xrdb -query | egrep -m1 '^\*\.?color11:' | awk '{print $NF}')
|
||||
color12=$(xrdb -query | egrep -m1 '^\*\.?color12:' | awk '{print $NF}')
|
||||
color13=$(xrdb -query | egrep -m1 '^\*\.?color13:' | awk '{print $NF}')
|
||||
color14=$(xrdb -query | egrep -m1 '^\*\.?color14:' | awk '{print $NF}')
|
||||
color15=$(xrdb -query | egrep -m1 '^\*\.?color15:' | awk '{print $NF}')
|
||||
# note in this first use that switching colors doesn't require a reset
|
||||
# first - the new color overrides the old one.
|
||||
|
||||
|
||||
|
||||
numbers (){
|
||||
echo -en "${blackf} ${color0} ${reset}"
|
||||
echo -en "${redf} ${color1} ${reset}"
|
||||
echo -en "${greenf} ${color2} ${reset}"
|
||||
echo -en "${yellowf} ${color3} ${reset}"
|
||||
echo -en "${bluef} ${color4} ${reset}"
|
||||
echo -en "${purplef} ${color5} ${reset}"
|
||||
echo -en "${cyanf} ${color6} ${reset}"
|
||||
echo -en "${whiteb} ${color7} ${reset}"
|
||||
echo -e "\n"
|
||||
echo -en "${blackf} ${color8} ${reset}"
|
||||
echo -en "${redf} ${color9} ${reset}"
|
||||
echo -en "${greenf} ${color10} ${reset}"
|
||||
echo -en "${yellowf} ${color11} ${reset}"
|
||||
echo -en "${bluef} ${color12} ${reset}"
|
||||
echo -en "${purplef} ${color13} ${reset}"
|
||||
echo -en "${cyanf} ${color14} ${reset}"
|
||||
echo -en "${whiteb} ${color15} ${reset}"
|
||||
echo -e "\n"
|
||||
}
|
||||
|
||||
blocks (){
|
||||
|
||||
initializeANSI
|
||||
|
||||
cat << EOF
|
||||
|
||||
${blackf}████${reset}${blackb}████${reset} ${redf}████${reset}${redb}████${reset} ${greenf}████${reset}${greenb}████${reset} ${yellowf}████${reset}${yellowb}████${reset} ${bluef}████${reset}${blueb}████${reset} ${purplef}████${reset}${purpleb}████${reset} ${cyanf}████${reset}${cyanb}████${reset} ${whitef}████${reset}${whiteb}████${reset}
|
||||
${blackf}████${reset}${blackb}████${reset} ${redf}████${reset}${redb}████${reset} ${greenf}████${reset}${greenb}████${reset} ${yellowf}████${reset}${yellowb}████${reset} ${bluef}████${reset}${blueb}████${reset} ${purplef}████${reset}${purpleb}████${reset} ${cyanf}████${reset}${cyanb}████${reset} ${whitef}████${reset}${whiteb}████${reset}
|
||||
${blackf}████${reset}${blackb}████${reset} ${redf}████${reset}${redb}████${reset} ${greenf}████${reset}${greenb}████${reset} ${yellowf}████${reset}${yellowb}████${reset} ${bluef}████${reset}${blueb}████${reset} ${purplef}████${reset}${purpleb}████${reset} ${cyanf}████${reset}${cyanb}████${reset} ${whitef}████${reset}${whiteb}████${reset}
|
||||
|
||||
EOF
|
||||
|
||||
}
|
||||
|
||||
case $1 in
|
||||
b) blocks;;
|
||||
n) numbers;;
|
||||
a) blocks && numbers;;
|
||||
*) blocks && numbers;;
|
||||
esac
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
while true
|
||||
do
|
||||
sleep 3s
|
||||
notify-send "$(fortune)"
|
||||
sleep 5m
|
||||
done
|
|
@ -0,0 +1,460 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Corona Virus (Covid-19) statistics cli,
|
||||
#
|
||||
# MIT License
|
||||
# Copyright (c) 2020 Garry Lachman
|
||||
# https://github.com/garrylachman/covid19-cli
|
||||
|
||||
VERSION="0.2.0"
|
||||
|
||||
BASE_API="https://corona.lmao.ninja"
|
||||
API_TOTAL_ENDPOINT="$BASE_API/all"
|
||||
API_ALL_COUNTRIES_ENDPOINT="$BASE_API/countries"
|
||||
API_HISTORICAL_COUNTRIES_ENDPOINT="$BASE_API/historical"
|
||||
|
||||
# https://github.com/gdbtek/linux-cookbooks/blob/master/libraries/util.bash
|
||||
|
||||
function printTable()
|
||||
{
|
||||
local -r delimiter="${1}"
|
||||
local -r tableData="$(removeEmptyLines "${2}")"
|
||||
local -r colorHeader="${3}"
|
||||
local -r displayTotalCount="${4}"
|
||||
|
||||
if [[ "${delimiter}" != '' && "$(isEmptyString "${tableData}")" = 'false' ]]
|
||||
then
|
||||
local -r numberOfLines="$(trimString "$(wc -l <<< "${tableData}")")"
|
||||
|
||||
if [[ "${numberOfLines}" -gt '0' ]]
|
||||
then
|
||||
local table=''
|
||||
local i=1
|
||||
|
||||
for ((i = 1; i <= "${numberOfLines}"; i = i + 1))
|
||||
do
|
||||
ProgressBar ${i} ${numberOfLines}
|
||||
local line=''
|
||||
line="$(sed "${i}q;d" <<< "${tableData}")"
|
||||
|
||||
local numberOfColumns=0
|
||||
numberOfColumns="$(awk -F "${delimiter}" '{print NF}' <<< "${line}")"
|
||||
|
||||
# Add Line Delimiter
|
||||
|
||||
if [[ "${i}" -eq '1' ]]
|
||||
then
|
||||
table="${table}$(printf '%s#+' "$(repeatString '#+' "${numberOfColumns}")")"
|
||||
fi
|
||||
|
||||
# Add Header Or Body
|
||||
|
||||
table="${table}\n"
|
||||
|
||||
local j=1
|
||||
|
||||
for ((j = 1; j <= "${numberOfColumns}"; j = j + 1))
|
||||
do
|
||||
table="${table}$(printf '#| %s' "$(cut -d "${delimiter}" -f "${j}" <<< "${line}")")"
|
||||
done
|
||||
|
||||
table="${table}#|\n"
|
||||
|
||||
# Add Line Delimiter
|
||||
|
||||
if [[ "${i}" -eq '1' ]] || [[ "${numberOfLines}" -gt '1' && "${i}" -eq "${numberOfLines}" ]]
|
||||
then
|
||||
table="${table}$(printf '%s#+' "$(repeatString '#+' "${numberOfColumns}")")"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$(isEmptyString "${table}")" = 'false' ]]
|
||||
then
|
||||
local output=''
|
||||
output="$(echo -e "${table}" | column -s '#' -t | awk '/^\+/{gsub(" ", "-", $0)}1')"
|
||||
|
||||
if [[ "${colorHeader}" = 'true' ]]
|
||||
then
|
||||
echo -e "\033[1;32m$(head -n 3 <<< "${output}")\033[0m"
|
||||
tail -n +4 <<< "${output}"
|
||||
else
|
||||
echo "${output}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "${displayTotalCount}" = 'true' && "${numberOfLines}" -ge '0' ]]
|
||||
then
|
||||
echo -e "\n\033[1;36mTOTAL ROWS : $((numberOfLines - 1))\033[0m"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function isEmptyString()
|
||||
{
|
||||
local -r string="${1}"
|
||||
|
||||
if [[ "$(trimString "${string}")" = '' ]]
|
||||
then
|
||||
echo 'true' && return 0
|
||||
fi
|
||||
|
||||
echo 'false' && return 1
|
||||
}
|
||||
|
||||
function removeEmptyLines()
|
||||
{
|
||||
local -r content="${1}"
|
||||
|
||||
echo -e "${content}" | sed '/^\s*$/d'
|
||||
}
|
||||
|
||||
function trimString()
|
||||
{
|
||||
local -r string="${1}"
|
||||
|
||||
sed 's,^[[:blank:]]*,,' <<< "${string}" | sed 's,[[:blank:]]*$,,'
|
||||
}
|
||||
|
||||
function repeatString()
|
||||
{
|
||||
local -r string="${1}"
|
||||
local -r numberToRepeat="${2}"
|
||||
|
||||
if [[ "${string}" != '' && "$(isPositiveInteger "${numberToRepeat}")" = 'true' ]]
|
||||
then
|
||||
local -r result="$(printf "%${numberToRepeat}s")"
|
||||
echo -e "${result// /${string}}"
|
||||
fi
|
||||
}
|
||||
|
||||
function isPositiveInteger()
|
||||
{
|
||||
local -r string="${1}"
|
||||
|
||||
if [[ "${string}" =~ ^[1-9][0-9]*$ ]]
|
||||
then
|
||||
echo 'true' && return 0
|
||||
fi
|
||||
|
||||
echo 'false' && return 1
|
||||
}
|
||||
function ProgressBar {
|
||||
let _progress=(${1}*100/${2}*100)/100
|
||||
let _done=(${_progress}*4)/10
|
||||
let _left=40-$_done
|
||||
_color=$green
|
||||
_fill=$(printf "%${_done}s")
|
||||
_empty=$(printf "%${_left}s")
|
||||
if [ "$_progress" -gt 0 ]; then
|
||||
_color="${green}"
|
||||
fi
|
||||
if [ "$_progress" -gt 33 ]; then
|
||||
_color="${yellow}"
|
||||
fi
|
||||
if [ "$_progress" -gt 80 ]; then
|
||||
_color="${red}"
|
||||
fi
|
||||
printf "\rProgress : ${_color}[${_fill// /#}${_empty// /-}] ${_progress}%%\r${no_color}"
|
||||
}
|
||||
# https://github.com/holman/spark
|
||||
_echoSP()
|
||||
{
|
||||
if [ "X$1" = "X-n" ]; then
|
||||
shift
|
||||
printf "%s" "$*"
|
||||
else
|
||||
printf "%s\n" "$*"
|
||||
fi
|
||||
}
|
||||
|
||||
spark()
|
||||
{
|
||||
local n numbers=
|
||||
|
||||
# find min/max values
|
||||
local min=0xffffffff max=0
|
||||
|
||||
for n in ${@//,/ }
|
||||
do
|
||||
# on Linux (or with bash4) we could use `printf %.0f $n` here to
|
||||
# round the number but that doesn't work on OS X (bash3) nor does
|
||||
# `awk '{printf "%.0f",$1}' <<< $n` work, so just cut it off
|
||||
n=${n%.*}
|
||||
(( n < min )) && min=$n
|
||||
(( n > max )) && max=$n
|
||||
numbers=$numbers${numbers:+ }$n
|
||||
done
|
||||
|
||||
# print ticks
|
||||
local ticks=(▁ ▂ ▃ ▄ ▅ ▆ ▇ █)
|
||||
|
||||
# use a high tick if data is constant
|
||||
(( min == max )) && ticks=(▅ ▆)
|
||||
|
||||
local f=$(( (($max-$min)<<8)/(${#ticks[@]}-1) ))
|
||||
(( f < 1 )) && f=1
|
||||
|
||||
for n in $numbers
|
||||
do
|
||||
_echoSP -n ${ticks[$(( ((($n-$min)<<8)/$f) ))]}
|
||||
done
|
||||
_echoSP
|
||||
}
|
||||
|
||||
# Detect whether output is piped or not.
|
||||
[[ -t 1 ]] && piped=0 || piped=1
|
||||
|
||||
# Defaults
|
||||
args=()
|
||||
|
||||
out() {
|
||||
((quiet)) && return
|
||||
|
||||
local message="$@"
|
||||
if ((piped)); then
|
||||
message=$(echo $message | sed '
|
||||
s/\\[0-9]\{3\}\[[0-9]\(;[0-9]\{2\}\)\?m//g;
|
||||
s/✖/Error:/g;
|
||||
s/✔/Success:/g;
|
||||
')
|
||||
fi
|
||||
printf '%b\n' "$message";
|
||||
}
|
||||
die() { out "$@"; exit 1; } >&2
|
||||
err() { out " \033[1;31m✖\033[0m $@"; } >&2
|
||||
success() { out " \033[1;32m✔\033[0m $@"; }
|
||||
|
||||
bold=$(tput bold)
|
||||
normal=$(tput sgr0)
|
||||
|
||||
# colours
|
||||
green=$(tput setaf 2)
|
||||
no_color='\033[0m'
|
||||
red=$(tput setaf 1)
|
||||
yellow=$(tput setaf 3)
|
||||
|
||||
# Notify on function success
|
||||
notify() { [[ $? == 0 ]] && success "$@" || err "$@"; }
|
||||
|
||||
# Escape a string
|
||||
escape() { echo $@ | sed 's/\//\\\//g'; }
|
||||
|
||||
version="v${VERSION}"
|
||||
|
||||
check_dependencies() {
|
||||
if ! [ -x "$(command -v jq)" ]; then
|
||||
err 'Error: jq is not installed.\nhttps://stedolan.github.io/jq/' >&2
|
||||
die
|
||||
fi
|
||||
if ! [ -x "$(command -v curl)" ]; then
|
||||
err 'Error: curl is not installed.\nhttps://github.com/curl/curl' >&2
|
||||
die
|
||||
fi
|
||||
}
|
||||
|
||||
# Print usage
|
||||
usage() {
|
||||
banner
|
||||
echo "$(basename $0) [OPTION]...
|
||||
|
||||
Corona Virus (Covid-19) statistics cli.
|
||||
|
||||
MIT License
|
||||
Copyright (c) 2020 Garry Lachman
|
||||
https://github.com/garrylachman/covid19-cli
|
||||
|
||||
Options:
|
||||
-c, --country Specific Country (actual data + historical)
|
||||
-l, --list-all List all countries
|
||||
-s, --sort Sort countries list by key (country|cases|active|critical|deaths|recovered|todayCases|todayDeaths|casesPerOneMillion)
|
||||
-i, --historical List all countries historical trend chart
|
||||
-h, --help Display this help and exit
|
||||
-n, --no-banner Hides \"Covid19-CLI\" banner
|
||||
--version Output version information and exit
|
||||
"
|
||||
}
|
||||
|
||||
banner() {
|
||||
if [[ "$nobanner" != true ]]; then
|
||||
echo "
|
||||
${green}_________ .__ ._______ ________ _________ .____ .___
|
||||
\_ ___ \ _______ _|__| __| _/_ / __ \ \_ ___ \| | | |
|
||||
${yellow}/ \ \/ / _ \ \/ / |/ __ | | \____ / ______ / \ \/| | | |
|
||||
\ \___( <_> ) /| / /_/ | | | / / /_____/ \ \___| |___| |
|
||||
${red}\______ /\____/ \_/ |__\____ | |___| /____/ \______ /_______ \___|
|
||||
\/ \/ \/ \/
|
||||
"
|
||||
printf "${no_color}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function join_by { local d=$1; shift; echo -n "$1"; shift; printf "%s" "${@/#/$d}"; }
|
||||
|
||||
|
||||
main() {
|
||||
check_dependencies
|
||||
banner
|
||||
if [[ -n "$country" && "$list_all" == 1 ]]; then
|
||||
err "--country (-c) and --list-all (-l) cannot be mixed together"
|
||||
die
|
||||
fi;
|
||||
|
||||
if [ "$list_all" == 1 ]; then
|
||||
# The part can be re-factored in better way...
|
||||
success "List all Countries"
|
||||
if [ -n "$sort_by" ]; then
|
||||
success "Sory by key: $sort_by"
|
||||
fi
|
||||
success "Please wait while we: "
|
||||
success "- Retrieve & preparing the data..."
|
||||
result=$(curl -s "$API_ALL_COUNTRIES_ENDPOINT/?sort=$sort_by")
|
||||
cols=(country cases active critical deaths recovered todayCases todayDeaths casesPerOneMillion)
|
||||
titles=(Country Cases Active Critical Deaths Recovered Today-Cases Today-Deaths Cases-Per-One-Million)
|
||||
lines=()
|
||||
lines+=($(join_by , "${titles[@]}"))
|
||||
cnt=0
|
||||
_start=1
|
||||
_end=$(echo "${result}" | jq -r 'length')
|
||||
((_end=_end-1))
|
||||
for row in $(echo "${result}" | jq -r '.[] | @base64'); do
|
||||
ProgressBar ${cnt} ${_end}
|
||||
plainRow=$(echo "${row}" | base64 --decode)
|
||||
line=()
|
||||
for k in "${cols[@]}"; do
|
||||
val=$(echo $plainRow | jq -r ".${k}")
|
||||
line+=("$val")
|
||||
done
|
||||
line=$(join_by , "${line[@]}")
|
||||
lines+=("$line")
|
||||
((cnt=cnt+1))
|
||||
done
|
||||
resultStr=$(join_by "\n" "${lines[@]}")
|
||||
echo ""
|
||||
success "- Bulding data tables"
|
||||
printTable "," "$resultStr"
|
||||
|
||||
elif [ -n "$historical_all" ]; then
|
||||
echo "historical_all"
|
||||
success "Historical"
|
||||
result=$(curl -s $API_HISTORICAL_COUNTRIES_ENDPOINT)
|
||||
|
||||
for row in $(echo "${result}" | jq -r '.[] | @base64'); do
|
||||
plainRow=$(echo "${row}" | base64 --decode)
|
||||
#echo $plainRow | jq '. | "\(.country)-\(.province)"'
|
||||
country=$(echo $plainRow | jq -r ".country")
|
||||
province=$(echo $plainRow | jq -r ".province")
|
||||
|
||||
printf "${bold}${country}"
|
||||
if [ "$province" != "null" ]; then
|
||||
printf " (${province})"
|
||||
fi
|
||||
printf "${no_color}\n"
|
||||
|
||||
casesHistorical=$(echo $plainRow | jq -r '.timeline .cases | map(.|tostring) | join(",")')
|
||||
deathsHistorical=$(echo $plainRow | jq -r '.timeline .deaths | map(.|tostring) | join(",")')
|
||||
recoveredHistorical=$(echo $plainRow | jq -r '.timeline .recovered | map(.|tostring) | join(",")')
|
||||
|
||||
printf "${bold}Cases:\t\t${yellow}$(spark ${casesHistorical})${no_color}\n"
|
||||
printf "${bold}Deaths:\t\t${red}$(spark ${deathsHistorical})${no_color}\n"
|
||||
printf "${bold}Recovered:\t${green}$(spark ${recoveredHistorical})${no_color}\n"
|
||||
|
||||
printf "\n"
|
||||
done
|
||||
|
||||
|
||||
|
||||
elif [[ -n "$country" && !"$historical_all" ]]; then
|
||||
success "Country: $country"
|
||||
result=$(curl -s $API_ALL_COUNTRIES_ENDPOINT/$country)
|
||||
historicalResult=$(curl -s $API_HISTORICAL_COUNTRIES_ENDPOINT/$country)
|
||||
|
||||
cases=$(echo $result | jq ".cases")
|
||||
deaths=$(echo $result | jq ".deaths")
|
||||
recovered=$(echo $result | jq ".recovered")
|
||||
|
||||
casesHistorical=$(echo $historicalResult | jq -r '.timeline .cases | map(.|tostring) | join(",")')
|
||||
deathsHistorical=$(echo $historicalResult | jq -r '.timeline .deaths | map(.|tostring) | join(",")')
|
||||
recoveredHistorical=$(echo $historicalResult | jq -r '.timeline .recovered | map(.|tostring) | join(",")')
|
||||
|
||||
printf "\n"
|
||||
printf "${bold}Cases:\t\t${normal}${yellow}${cases}\t$(spark ${casesHistorical})${no_color}\n"
|
||||
printf "${bold}Deaths:\t\t${normal}${red}${deaths}\t$(spark ${deathsHistorical})${no_color}\n"
|
||||
printf "${bold}Recovered:\t${normal}${green}${recovered}\t$(spark ${recoveredHistorical})${no_color}\n"
|
||||
|
||||
else
|
||||
success "Global Statistics"
|
||||
result=$(curl -s $API_TOTAL_ENDPOINT)
|
||||
cases=$(echo $result | jq ".cases")
|
||||
deaths=$(echo $result | jq ".deaths")
|
||||
recovered=$(echo $result | jq ".recovered")
|
||||
|
||||
printf "\n"
|
||||
printf "${bold}Cases:\t\t${normal}${yellow}${cases}${no_color}\n"
|
||||
printf "${bold}Deaths:\t\t${normal}${red}${deaths}${no_color}\n"
|
||||
printf "${bold}Recovered:\t${normal}${green}${recovered}${no_color}\n"
|
||||
fi;
|
||||
|
||||
}
|
||||
|
||||
optstring=h
|
||||
unset options
|
||||
while (($#)); do
|
||||
case $1 in
|
||||
# If option is of type -ab
|
||||
-[!-]?*)
|
||||
# Loop over each character starting with the second
|
||||
for ((i=1; i < ${#1}; i++)); do
|
||||
c=${1:i:1}
|
||||
|
||||
# Add current char to options
|
||||
options+=("-$c")
|
||||
|
||||
# If option takes a required argument, and it's not the last char make
|
||||
# the rest of the string its argument
|
||||
if [[ $optstring = *"$c:"* && ${1:i+1} ]]; then
|
||||
options+=("${1:i+1}")
|
||||
break
|
||||
fi
|
||||
done
|
||||
;;
|
||||
# If option is of type --foo=bar
|
||||
--?*=*) options+=("${1%%=*}" "${1#*=}") ;;
|
||||
# add --endopts for --
|
||||
--) options+=(--endopts) ;;
|
||||
# Otherwise, nothing special
|
||||
*) options+=("$1") ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
set -- "${options[@]}"
|
||||
unset options
|
||||
|
||||
|
||||
# A non-destructive exit for when the script exits naturally.
|
||||
safe_exit() {
|
||||
trap - INT TERM EXIT
|
||||
exit
|
||||
}
|
||||
|
||||
while [[ $1 = -?* ]]; do
|
||||
case $1 in
|
||||
-n|--no-banner) nobanner=true;;
|
||||
-h|--help) usage >&2; safe_exit ;;
|
||||
--version) out "$(basename $0) $version"; safe_exit ;;
|
||||
-c|--country) country=$2; shift ;;
|
||||
-l|--list-all) list_all=1 ;;
|
||||
-s|--sort) sort_by=$2 ;;
|
||||
-i|--historical) historical_all=1 ;;
|
||||
--endopts) shift; break ;;
|
||||
*) die "invalid option: $1" ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
args+=("$@")
|
||||
|
||||
main
|
||||
|
||||
safe_exit
|
|
@ -0,0 +1,84 @@
|
|||
#!/usr/bin/env bash
|
||||
# Install script for Arch Linux
|
||||
# https://raw.githubusercontent.com/creio/dots/master/.bin/creio.sh
|
||||
|
||||
# wget git.io/creio.sh && wget git.io/creio2.sh
|
||||
# nano creio.sh
|
||||
# nano creio2.sh
|
||||
# sh creio.sh
|
||||
|
||||
Check for root
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "This script must be run as root." >&2
|
||||
echo "Try 'sudo sh'"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
R_DISK="sda6"
|
||||
B_DISK="sda2"
|
||||
# H_DISK="sdb3"
|
||||
S_DISK="sda3"
|
||||
|
||||
loadkeys ru
|
||||
setfont cyr-sun16
|
||||
|
||||
timedatectl set-ntp true
|
||||
|
||||
|
||||
### ////// btrfs mbr ///////
|
||||
mkfs.btrfs -f -L "root" /dev/$R_DISK
|
||||
mkfs.ext2 /dev/$B_DISK -L boot
|
||||
mkswap -L "swap" /dev/$S_DISK
|
||||
|
||||
mount /dev/$R_DISK /mnt
|
||||
btrfs subvolume create /mnt/@
|
||||
btrfs subvolume create /mnt/@home
|
||||
umount /mnt
|
||||
|
||||
mount -o subvol=@,compress=lzo,relatime,space_cache,autodefrag /dev/$R_DISK /mnt
|
||||
mkdir /mnt/{boot,home}
|
||||
mount /dev/$B_DISK /mnt/boot
|
||||
mount -o subvol=@home,compress=lzo,relatime,space_cache,autodefrag /dev/$R_DISK /mnt/home
|
||||
# // ssd trim
|
||||
# mount -o subvol=@,compress=lzo,ssd,discard,relatime,space_cache,autodefrag /dev/$R_DISK /mnt
|
||||
# mount -o subvol=@home,compress=lzo,ssd,discard,relatime,space_cache,autodefrag /dev/$R_DISK /mnt/home
|
||||
swapon /dev/$S_DISK
|
||||
### ////// end btrfs mbr ///////
|
||||
|
||||
|
||||
### ////// ext4 mbr & efi ///////
|
||||
# mkfs.ext4 /dev/$R_DISK -L root
|
||||
|
||||
# mkfs.ext2 /dev/$B_DISK -L boot
|
||||
# mkfs.fat -F32 /dev/$B_DISK -L boot
|
||||
|
||||
# mkfs.ext4 /dev/$H_DISK -L home
|
||||
# mkswap /dev/$S_DISK -L swap
|
||||
|
||||
# mount /dev/$R_DISK /mnt
|
||||
|
||||
# mkdir /mnt/{boot,home}
|
||||
# mkdir -p /mnt/{boot/efi,home}
|
||||
|
||||
# mount /dev/$B_DISK /mnt/boot
|
||||
# mount /dev/$B_DISK /mnt/boot/efi
|
||||
|
||||
# mount /dev/$H_DISK /mnt/home
|
||||
# swapon /dev/$S_DISK
|
||||
### ////// end ext4 mbr & efi ///////
|
||||
|
||||
|
||||
|
||||
pacman -Sy --noconfirm --needed reflector
|
||||
reflector -c "Russia" -c "Belarus" -c "Ukraine" -c "Poland" -f 20 -l 20 -p https -p http -n 20 --save /etc/pacman.d/mirrorlist --sort rate
|
||||
|
||||
pacstrap /mnt base base-devel linux linux-headers nano
|
||||
|
||||
cp creio2.sh /mnt/creio2.sh
|
||||
chmod u+x /mnt/creio2.sh
|
||||
|
||||
genfstab -pU /mnt >> /mnt/etc/fstab
|
||||
|
||||
# arch-chroot /mnt sh -c "$(curl -fsSL git.io/creio2.sh)"
|
||||
arch-chroot /mnt ./creio2.sh
|
|
@ -0,0 +1,85 @@
|
|||
#!/usr/bin/env bash
|
||||
# Install script for Arch Linux
|
||||
# https://raw.githubusercontent.com/creio/dots/master/.bin/creio2.sh
|
||||
|
||||
# wget git.io/creio2.sh
|
||||
# nano creio2.sh
|
||||
|
||||
DISK="sda"
|
||||
|
||||
sed -i "/\[multilib\]/,/Include/"'s/^#//' /etc/pacman.conf
|
||||
|
||||
pacman -Sy --noconfirm --needed reflector
|
||||
reflector -c "Russia" -c "Belarus" -c "Ukraine" -c "Poland" -f 20 -l 20 -p https -p http -n 20 --save /etc/pacman.d/mirrorlist --sort rate
|
||||
|
||||
echo "Arch Linux Virtualbox?"
|
||||
read -p "yes, no: " virtualbox_setting
|
||||
if [[ $virtualbox_setting == no ]]; then
|
||||
virtualbox_install=""
|
||||
elif [[ $virtualbox_setting == yes ]]; then
|
||||
virtualbox_install="virtualbox-guest-modules-arch virtualbox-guest-utils"
|
||||
fi
|
||||
echo
|
||||
pacman -S --noconfirm --needed $virtualbox_install
|
||||
|
||||
pack="networkmanager bash-completion \
|
||||
reflector htop openssh tmux btrfs-progs \
|
||||
curl wget git rsync unzip unrar p7zip gnu-netcat pv"
|
||||
|
||||
pacman -S --noconfirm --needed $pack
|
||||
|
||||
# Root password
|
||||
passwd
|
||||
|
||||
# user add & password
|
||||
while true; do
|
||||
clear
|
||||
echo -e "add new user"
|
||||
|
||||
printf "\n\nUsername: "
|
||||
read -r USER
|
||||
|
||||
printf "New user %s. Continue? [y/N]: " "$USER"
|
||||
read -r answer
|
||||
|
||||
case $answer in
|
||||
y*|Y*) break
|
||||
esac
|
||||
done
|
||||
|
||||
useradd -m -g users -G "adm,audio,log,network,rfkill,scanner,storage,optical,power,wheel" -s /bin/bash "$USER"
|
||||
passwd "$USER"
|
||||
echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers
|
||||
|
||||
echo "ctlos" > /etc/hostname
|
||||
|
||||
ln -svf /usr/share/zoneinfo/Europe/Moscow /etc/localtime
|
||||
|
||||
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
|
||||
echo "ru_RU.UTF-8 UTF-8" >> /etc/locale.gen
|
||||
locale-gen
|
||||
|
||||
echo "LANG=ru_RU.UTF-8" > /etc/locale.conf
|
||||
echo "KEYMAP=ru" >> /etc/vconsole.conf
|
||||
echo "FONT=cyr-sun16" >> /etc/vconsole.conf
|
||||
|
||||
### rm fsck btrfs
|
||||
### add keyboard keymap
|
||||
# HOOKS=(base udev autodetect modconf block filesystems keyboard keymap fsck)
|
||||
# HOOKS=(base udev autodetect modconf block filesystems keyboard keymap)
|
||||
nano /etc/mkinitcpio.conf
|
||||
|
||||
mkinitcpio -p linux
|
||||
|
||||
pacman -S --noconfirm --needed grub
|
||||
# pacman -S --noconfirm --needed grub efibootmgr
|
||||
|
||||
grub-install /dev/$DISK
|
||||
# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Arch --force
|
||||
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
|
||||
systemctl enable NetworkManager
|
||||
systemctl enable sshd
|
||||
|
||||
echo "System Setup Complete"
|
|
@ -0,0 +1,57 @@
|
|||
#!/bin/bash
|
||||
|
||||
APPS=(
|
||||
'conky1'
|
||||
'conky2'
|
||||
)
|
||||
|
||||
APP_conky1_cmd="conky -c $HOME/.conkyrc1"
|
||||
APP_conky2_cmd="conky -c $HOME/.conkyrc2"
|
||||
|
||||
|
||||
|
||||
desktop=`$HOME/bin/show_desktop -q`
|
||||
[ $? -eq 0 ] || exit 1
|
||||
|
||||
start() {
|
||||
echo "Starting: $1"
|
||||
eval "cmd=\$APP_${1}_cmd"
|
||||
$cmd &
|
||||
|
||||
if [ -n $! ]; then
|
||||
# Re-position window?
|
||||
eval "x=\$APP_${1}_winx"
|
||||
eval "y=\$APP_${1}_winy"
|
||||
if [ -n "$x" -a -n "$y" ]; then
|
||||
eval "title=\$APP_${1}_wintitle"
|
||||
# the sleep gives the window time to show up
|
||||
$(sleep 1; wmctrl -r $title -e "0,$x,$y,-1,-1") &
|
||||
|
||||
# alternate method which doesn't require the window title
|
||||
#xdotool getactivewindow windowmove $x $y
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
stop() {
|
||||
eval "cmd=\$APP_${1}_cmd"
|
||||
pid=`pgrep -f "$cmd"`
|
||||
if [ -n "$pid" ]; then
|
||||
echo "Killing pid: $pid ($cmd)"
|
||||
kill $pid
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$desktop" == "visible" ]; then
|
||||
# Fire up our widget apps
|
||||
for app in "${APPS[@]}"; do
|
||||
start "$app"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$desktop" == "hidden" ]; then
|
||||
# Kill our widget apps
|
||||
for app in "${APPS[@]}"; do
|
||||
stop "$app"
|
||||
done
|
||||
fi
|
|
@ -0,0 +1,80 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import shutil
|
||||
|
||||
CLEAN_FILES = [
|
||||
#'~/hostr/',
|
||||
#'~/.bzr.log',
|
||||
#'~/.cache/babl/',
|
||||
#'~/.cache/gegl-0.2/',
|
||||
#'~/.cache/google-chrome/',
|
||||
#'~/.cache/gstreamer-1.0/',
|
||||
#'~/.cache/menu/',
|
||||
#'~/.cache/thumbnails/',
|
||||
#'~/.local/share/gegl-0.2/',
|
||||
#'~/.local/share/recently-used.xbel',
|
||||
#'~/.local/share/Trash/',
|
||||
#'~/.ncmpcpp/error.log',
|
||||
# '~/.npm/',
|
||||
# '~/.nv/',
|
||||
#'~/.pki/',
|
||||
#'~/.pylint.d/',
|
||||
#'~/.recently-used',
|
||||
#'~/.thumbnails/',
|
||||
#'~/.w3m/',
|
||||
#'~/.xsession-errors.old'
|
||||
'/home/denis/test/2/',
|
||||
'/home/denis/test/3/'
|
||||
]
|
||||
|
||||
def answer(question, default="n"):
|
||||
prompt = "%s (y/[n]) " % question
|
||||
ans = input(prompt).strip().lower()
|
||||
|
||||
if not ans:
|
||||
ans = default
|
||||
|
||||
if ans == "y":
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def remove_clean():
|
||||
found = []
|
||||
|
||||
print("\n")
|
||||
for jfile in CLEAN_FILES:
|
||||
extra = os.path.expanduser(jfile)
|
||||
if os.path.exists(extra):
|
||||
found.append(extra)
|
||||
print(" %s" % jfile)
|
||||
total = len(found)
|
||||
|
||||
if total == 0:
|
||||
print("No clean files found :)\n")
|
||||
return
|
||||
|
||||
if answer("\nRemove all?", default="n"):
|
||||
list_paths = (CLEAN_FILES)
|
||||
print ('Список путей - {}'.format(list_paths))
|
||||
for path in list_paths:
|
||||
print (path)
|
||||
for the_file in os.listdir(path): # Смотрим в каждом указанном пути наличие файлов.
|
||||
file_path = os.path.join(path, the_file)
|
||||
print(file_path)
|
||||
try:
|
||||
if os.path.isfile(file_path):
|
||||
os.unlink(file_path)
|
||||
elif os.path.isdir(file_path): shutil.rmtree(file_path)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
print("\nAll clean cleaned")
|
||||
|
||||
else:
|
||||
print("\nNo files removed")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
remove_clean()
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# Font
|
||||
FN='ClearSansMedium:size=11'
|
||||
# Background Commands
|
||||
NB='#111113'
|
||||
# Foreground Commands
|
||||
NF='#FFF'
|
||||
# Background Prompt
|
||||
SB='#5A74CA'
|
||||
# Foreground Prompt
|
||||
SF='#FFF'
|
||||
|
||||
# URL='https://www.startpage.com/do/search?hl=pt&q='
|
||||
URL='https://duckduckgo.com/?q='
|
||||
QUERY=$(echo '' | dmenu -fn $FN -i -p "Search: " -nb $NB -nf $NF -sb $SB -sf $SF)
|
||||
|
||||
if [ -n "$QUERY" ]; then
|
||||
xdg-open "${URL}${QUERY}" 2> /dev/null
|
||||
fi
|
|
@ -0,0 +1,317 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Ctlos Linux https://ctlos.github.io
|
||||
#
|
||||
# Dot file management script using git & rsync
|
||||
# Written by Nathaniel Maia, November 2017 - March 2018
|
||||
|
||||
# Config ~/.dotsrc
|
||||
# Ignore github ~/.gitignore
|
||||
# git.io/ctldotsrc
|
||||
# wget git.io/ctldots
|
||||
|
||||
# immutable values
|
||||
readonly NAME=$(basename "$0")
|
||||
readonly CFG="$HOME/.${NAME}rc"
|
||||
|
||||
readonly B='\E[1;34m'
|
||||
readonly R='\E[1;31m'
|
||||
readonly G='\E[1;32m'
|
||||
readonly N='\E[0m'
|
||||
readonly BLD='\E[1m'
|
||||
|
||||
readonly WRN="${R}[WARN]${N}:"
|
||||
readonly INF="${B}[INFO]${N}:"
|
||||
readonly YN="${B}[${R}y${B}/${R}${BLD}N${N}${B}]${N}: "
|
||||
|
||||
readonly MENUTXT="\n Enter number or letter and press [Enter]. 0/q to cancel\n\n> "
|
||||
|
||||
readonly MENU="
|
||||
\n\t ${R}1 ${N}| ${R}${BLD}b${N}ackup\t\t-> Backup Files
|
||||
\t${B}------------------------------------------${N}
|
||||
\n\t ${R}2 ${N}| ${R}${BLD}r${N}estore\t\t-> Restore Files
|
||||
\t${B}------------------------------------------${N}"
|
||||
|
||||
|
||||
main_menu() {
|
||||
local choice
|
||||
|
||||
clear
|
||||
echo -e "$MENU"
|
||||
draw_box 12
|
||||
printf "$MENUTXT"
|
||||
read -e -r choice
|
||||
clear
|
||||
|
||||
[[ $choice =~ (v|V) ]] && V="v"
|
||||
|
||||
case "$choice" in
|
||||
0|[Qq]|quit) exit 0 ;;
|
||||
1*|[Bb]*|backup*) [[ $BASE_DIR ]] && { backup_files; exit 0; } || edit_config ;;
|
||||
2*|[Rr]*|restore*) restore_files && exit 0
|
||||
esac
|
||||
|
||||
src_cfg
|
||||
main_menu
|
||||
}
|
||||
|
||||
draw_box() {
|
||||
local h=${1:-12} # $1 Box Height
|
||||
local w=${2:-57} # $2 Box Width
|
||||
local row=${3:-1} # $3 Starting Row
|
||||
local col=${4:-2} # $4 Starting Column
|
||||
local co=${5:-1} # $5 Box Color, 1-7
|
||||
((h--)) # account for corner
|
||||
((w--)) # account for corner
|
||||
local endrow=$((row + h)) # end row
|
||||
local endcol=$((col + w)) # end column
|
||||
echo -ne "\E[3${co}m" # foreground colour
|
||||
|
||||
local hz="-" vt="|" cn="+" # horizontal, vertical, and corner chars
|
||||
|
||||
plot_char() {
|
||||
echo -e "\E[${1};${2}H""$3"
|
||||
}
|
||||
|
||||
local i=0
|
||||
for ((r=row; i<h; r++)); do
|
||||
plot_char "$r" "$col" "$vt" # left side
|
||||
((i++))
|
||||
done
|
||||
i=0
|
||||
for ((r=row; i<h; r++)); do
|
||||
plot_char "$r" "$endcol" "$vt" # right side
|
||||
((i++))
|
||||
done
|
||||
i=0
|
||||
for ((c=col; i<w; c++)); do
|
||||
plot_char "$row" "$c" "$hz" # top side
|
||||
((i++))
|
||||
done
|
||||
i=0
|
||||
for ((c=col; i<w; c++)); do
|
||||
plot_char "$endrow" "$c" "$hz" # bottom side
|
||||
((i++))
|
||||
done
|
||||
|
||||
plot_char "$row" "$col" "$cn" # left-top corner
|
||||
plot_char "$row" "$endcol" "$cn" # right-top corner
|
||||
plot_char "$endrow" "$col" "$cn" # left-bottom corner
|
||||
plot_char "$endrow" "$endcol" "$cn" # right-bottom corner
|
||||
tput sgr0 # Reset colours
|
||||
}
|
||||
|
||||
check_reqs() {
|
||||
if ! hash git rsync &>/dev/null && hash pacman &>/dev/null; then
|
||||
echo -e "\n\n\n\tInstalling:\n\t\tgit\n\t\trsync\n\n\tPlease Wait.."
|
||||
draw_box 8
|
||||
sleep 1
|
||||
clear
|
||||
sudo pacman -S git rsync --noconfirm --needed
|
||||
fi
|
||||
}
|
||||
|
||||
prep_directory() {
|
||||
if [[ $REQ != "True" ]]; then
|
||||
check_reqs
|
||||
if [[ $BASE_DIR ]]; then # is set in config but might not exist yet
|
||||
if [[ ! -d $BASE_DIR ]]; then # is not an existing dir
|
||||
|
||||
if [[ $REPO ]] && grep -wq '^https://.*/.*/.*$' <<< "$REPO"; then # is REPO actually and address
|
||||
git clone "$REPO" "$BASE_DIR"
|
||||
else
|
||||
mkdir -p$V "$BASE_DIR" # local backup
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ -d $BASE_DIR ]] && REQ="True"
|
||||
else
|
||||
echo -e "$WRN BASE_DIR must be set in config to continue. $EXITING"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
clean_backup_dirs() {
|
||||
if [[ ${PREV_BACKUPS[*]} ]] && sub_choice "Perform clean backup (wipe BASE_DIR)" "${R}$BASE_DIR${N}"; then
|
||||
for dir in "${PREV_BACKUPS[@]}"; do
|
||||
if [[ -d $dir ]] && sub_choice "Wipe all files in /$(basename "$dir")" "${R}$dir${N}"; then
|
||||
rm -rf$V "$dir"
|
||||
[[ $V ]] && sleep 0.5
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
commit_changes() {
|
||||
if grep -q 'https://' <<< "$REPO"; then
|
||||
if sub_choice "Commit and push changes to REPO" "${R}$REPO${N}"; then
|
||||
|
||||
printf "\nEnter commit message below, an example has been provided\n\n> "
|
||||
read -e -i "$(date +%Y.%m.%d) Update " -r comment
|
||||
|
||||
if grep -wq '[a-zA-Z0-9]*' <<< "$comment"; then
|
||||
cd "$BASE_DIR/" || return 1
|
||||
git add .
|
||||
git commit -m "$comment"
|
||||
git push origin "${BRANCH:-HEAD}"
|
||||
else
|
||||
echo "Bad commit message"
|
||||
sleep 1
|
||||
commit_changes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
backup_files() {
|
||||
prep_directory
|
||||
clean_backup_dirs
|
||||
|
||||
if [[ ${USER_PATHS[*]} || ${ROOT_PATHS[*]} ]]; then
|
||||
|
||||
echo -e "$INF ${B}Copying files, please wait..$N\n"
|
||||
sed -i -e "s/Date:.*/Date: $(date '+%d.%m.%Y,%H:%M:%S')/g" $HOME/README.md
|
||||
cp $HOME/README.md $HOME/docs/README.md
|
||||
for f in "${USER_PATHS[@]}"; do
|
||||
[[ -e $f ]] && rsync -aR$V $f "$BASE_DIR/$USER_DIR/"
|
||||
[[ $V ]] && sleep 0.5
|
||||
done
|
||||
|
||||
for f in "${ROOT_PATHS[@]}"; do
|
||||
[[ -e $f ]] && rsync -aR$V $f "$BASE_DIR/$ROOT_DIR/"
|
||||
[[ $V ]] && sleep 0.5
|
||||
done
|
||||
|
||||
echo -e "$INF ${G}Backup complete$N"
|
||||
sleep 1
|
||||
else
|
||||
echo -e "$WRN No valid file paths were found.."
|
||||
sleep 2
|
||||
fi
|
||||
commit_changes
|
||||
}
|
||||
|
||||
restore_files() {
|
||||
prep_directory
|
||||
if [[ ${PREV_BACKUPS[*]} ]]; then
|
||||
local msg=""
|
||||
|
||||
for x in "${PREV_BACKUPS[@]}"; do
|
||||
if [[ -e $x ]] && sub_choice "Restore everything from /$(basename "$x")" "${R}$x${N}"; then
|
||||
if grep -q "$BASE_DIR/$USER_DIR" <<< "$x"; then
|
||||
rsync -avPC --filter="exclude $ROOT_DIR" "$BASE_DIR/$USER_DIR/" "$HOME/"
|
||||
elif grep -q "$BASE_DIR/$ROOT_DIR" <<< "$x"; then
|
||||
sudo rsync -avn "$BASE_DIR/$ROOT_DIR/" /
|
||||
else
|
||||
echo -e "\n\n\n\t$WRN Unable to restore\n\n\t$x"
|
||||
draw_box 9
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
[[ $V ]] && sleep 0.5
|
||||
done
|
||||
|
||||
else
|
||||
echo -e "\n\n\n\t$INF ${R}No Existing backups to restore${N}"
|
||||
draw_box 9
|
||||
sleep 1
|
||||
fi
|
||||
}
|
||||
|
||||
mk_cfg() {
|
||||
[[ $1 == "new" ]] && edit_config
|
||||
|
||||
for f in "${USER_PATHS[@]}"; do
|
||||
if [[ -e $f ]] && ! grep "$f" <<< "$u_paths"; then
|
||||
u_paths="$u_paths\"$f\"\n"
|
||||
fi
|
||||
done
|
||||
|
||||
for f in "${ROOT_PATHS[@]}"; do
|
||||
if [[ -e $f ]] && ! grep "$f" <<< "$r_paths"; then
|
||||
r_paths="$r_paths\"$f\"\n"
|
||||
fi
|
||||
done
|
||||
|
||||
local cfg="# config file for dfm (dotfile manager)
|
||||
\n# repo https address for cloning & pushing (empty for local backup)
|
||||
REPO=\"$REPO\"
|
||||
\n# branch, defaults to current branch (HEAD)
|
||||
BRANCH=\"$BRANCH\"
|
||||
\n# location where backup folder or repo will be created or cloned
|
||||
BASE_DIR=\"$BASE_DIR\"
|
||||
\n# names for storage directories within BASE_DIR.
|
||||
# created only if needed, stores files from below arrays
|
||||
USER_DIR=\"${USER_DIR}\"
|
||||
ROOT_DIR=\"${ROOT_DIR:-root}\"
|
||||
\n# file paths which will be backed up into the directories above
|
||||
USER_PATHS=(\n$u_paths)
|
||||
\nROOT_PATHS=(\n$r_paths)"
|
||||
|
||||
echo -e "$cfg" > "$CFG" && clear
|
||||
src_cfg
|
||||
}
|
||||
|
||||
edit_config() {
|
||||
$EDITOR "$CFG"
|
||||
src_cfg
|
||||
}
|
||||
|
||||
src_cfg() {
|
||||
PREV_BACKUPS=()
|
||||
! . "$CFG" 2>/dev/null && mk_cfg "new"
|
||||
[[ -d $BASE_DIR/$USER_DIR ]] && PREV_BACKUPS+=("$BASE_DIR/$USER_DIR")
|
||||
[[ -d $BASE_DIR/$ROOT_DIR ]] && PREV_BACKUPS+=("$BASE_DIR/$ROOT_DIR")
|
||||
}
|
||||
|
||||
sub_choice() {
|
||||
local choice
|
||||
|
||||
clear
|
||||
printf "\n\n\n\t$1? $YN\n\n\t$2"
|
||||
draw_box 9
|
||||
tput cup 3 $((${#1} + 17))
|
||||
read -r choice
|
||||
clear
|
||||
|
||||
grep -q '[yY]' <<< "$choice" && return 0 || return 1
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
|
||||
USAGE:
|
||||
$NAME [OPTIONS..]
|
||||
|
||||
OPTIONS:
|
||||
|
||||
-h,--help Print this usage message
|
||||
-v,--verbose More information output
|
||||
|
||||
Without any options the main dialog menu opens.
|
||||
|
||||
INFO:
|
||||
Configuration is done in: '$CFG'
|
||||
|
||||
A default config will be created if one is not found,
|
||||
followed by opening it in $EDITOR for you to configure.
|
||||
|
||||
Alternatively open your favorite editor and edit it manually.
|
||||
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
-v|--verbose) V="v" ;;
|
||||
-h|--help) usage ;;
|
||||
esac
|
||||
done
|
||||
|
||||
src_cfg
|
||||
main_menu
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
cmd="git --git-dir=$HOME/.dots/ --work-tree=$HOME"
|
||||
|
||||
case $1 in
|
||||
update)
|
||||
$cmd commit -m "Update dotfiles"; exit ;;
|
||||
lock)
|
||||
shift; cmd="$cmd update-index --assume-unchanged" ;;
|
||||
unlock)
|
||||
shift; cmd="$cmd update-index --no-assume-unchanged" ;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
$cmd "$@"
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Draw a floating URxvt
|
||||
# Inspired by u/f0x52
|
||||
|
||||
# Draw a rectangle using slop then read the geometry value
|
||||
read -r X Y W H < <(slop -f "%x %y %w %h" -b 4 -t 0 -q)
|
||||
|
||||
# Depends on font width & height
|
||||
(( W /= 7 ))
|
||||
(( H /= 15 ))
|
||||
|
||||
# Create a variable to be used for URxvt flag option
|
||||
g=${W}x${H}+${X}+${Y}
|
||||
|
||||
# Remove current URxvt rules
|
||||
# bspc rule -r URxvt
|
||||
|
||||
# Draw with floating rule
|
||||
# bspc rule -a URxvt -o state=floating follow=on focus=on
|
||||
urxvtc -name Float -g $g &
|
||||
|
||||
# Restore the rule
|
||||
# bspc rule -a URxvt:Draw state=floating follow=on focus=on
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
# requires urxvt, slop, xdotool and wmctrl.
|
||||
|
||||
# vars
|
||||
border="2"
|
||||
color="255 255 255 0"
|
||||
format="%w %h %x %y"
|
||||
|
||||
|
||||
# exec
|
||||
urxvt -iconic -name "drawterm" &
|
||||
read "width" "height" "xpos" "ypos" < <(slop -l -f "$format" -b "$border" -c "$color")
|
||||
|
||||
if [ "$width" ] ; then
|
||||
:
|
||||
else
|
||||
pkill -n -f "urxvt -iconic -name drawterm"
|
||||
exit "1"
|
||||
fi
|
||||
|
||||
# adapt to the border width of your windows
|
||||
((width -= 0))
|
||||
((height -= 0))
|
||||
|
||||
active="$(xdotool search --sync --classname drawterm | tail -n1)"
|
||||
|
||||
xdotool "windowmove" "$active" "$xpos" "$ypos"
|
||||
xdotool "windowsize" "$active" "$width" "$height"
|
||||
wmctrl -ia "$active"
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
# vars
|
||||
# pid="$(pidof dunst)"
|
||||
pid="$(ps aux | grep dunstrc | grep -v grep | awk -n '{print $2}')"
|
||||
|
||||
|
||||
# exec
|
||||
if test "$pid"; then
|
||||
# killall "dunst"
|
||||
kill -9 "$pid"
|
||||
dunst -conf $HOME/.config/dunst/dunstnorc &
|
||||
notify-send "dunst notify No"
|
||||
else
|
||||
killall "dunst"
|
||||
dunst -conf $HOME/.config/dunst/dunstrc &
|
||||
notify-send "dunst notify Yes"
|
||||
fi
|
|
@ -0,0 +1,140 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# extremely simple system info script
|
||||
# requires: awk, grep, and bash v4+
|
||||
# written by Nathaniel Maia, 2017-2018
|
||||
|
||||
# fallback
|
||||
FB="unknown"
|
||||
|
||||
# colours
|
||||
FG=$'\e[0m'
|
||||
for n in {0..7}; do
|
||||
printf -v FG${n} "%b" "\e[3${n}m"
|
||||
done
|
||||
|
||||
# distro name
|
||||
if [[ -e /etc/os-release ]] && . /etc/os-release 2>/dev/null; then
|
||||
DIST="${ID,,}"
|
||||
elif [[ -e /etc/lsb-release ]] && . /etc/lsb-release 2>/dev/null; then
|
||||
DIST="${DISTRIB_ID,,}"
|
||||
fi
|
||||
|
||||
# system uptime
|
||||
# UPT="$(uptime -p)"
|
||||
# UPT="${UPT/up /}"
|
||||
# UPT="${UPT/ day?/d}"
|
||||
# UPT="${UPT/ hour?/h}"
|
||||
# UPT="${UPT/ minute?/m}"
|
||||
|
||||
# Root /
|
||||
ROOT=$(df -h / | awk '/[0-9]%/{print $(NF-1)" | "$(NF-2)}')
|
||||
|
||||
# Home /home
|
||||
HOME=$(df -h /home | awk '/[0-9]%/{print $(NF-1)" | "$(NF-2)}')
|
||||
|
||||
# Home /media
|
||||
FILES=$(df -h /media/files | awk '/[0-9]%/{print $(NF-1)" | "$(NF-2)}')
|
||||
|
||||
# install date
|
||||
if [[ -e /var/log/pacman.log ]]; then
|
||||
INST="$(head -n1 /var/log/pacman.log)"
|
||||
INST="${INST/ */}"
|
||||
INST="${INST/\[/}"
|
||||
INST="${INST//\-/ }"
|
||||
INST="${INST/\]/}"
|
||||
INST="${INST/\T/ }"
|
||||
fi
|
||||
|
||||
# check if root user
|
||||
[[ $(whoami) != 'root' ]] && USR="${FG4}${USER}" || USR="${FG1}root"
|
||||
|
||||
# login shell
|
||||
SHLL="$(basename $SHELL)"
|
||||
|
||||
# terminal name
|
||||
TRM="${TERM/-256color/}"
|
||||
|
||||
# hostname
|
||||
HOST="${HOST:-$(hostname)}"
|
||||
|
||||
# kernel version
|
||||
KERN="${KERN:-$(uname -r)}"
|
||||
KERN="${KERN/-*/}"
|
||||
|
||||
# MEM = used / total
|
||||
FREE="$(free --mega)"
|
||||
MB=$(awk 'NR==2 {print $3}' <<< "$FREE")
|
||||
GB=$(awk 'NR==2 {print $3 / 1000}' <<< "$FREE")
|
||||
TOT=$(awk 'NR==2 {print $2 / 1000}' <<< "$FREE")
|
||||
(( MB > 1000 )) && MEM="${GB:0:5}gb / ${TOT/\.*}gb" || MEM="${MB}mb / ${TOT/\.*}gb"
|
||||
|
||||
# C = number of cores
|
||||
C=$(grep -c "^processor" /proc/cpuinfo)
|
||||
C=${C:-$(grep -c "^core" /proc/cpuinfo)}
|
||||
C=${C:-1}
|
||||
|
||||
# CPU = usage / cores
|
||||
CPU=$(ps aux | awk 'BEGIN {sum = 0} {sum += $3}; END {print sum}')
|
||||
CPU=${CPU/\.*}
|
||||
|
||||
# wtr
|
||||
# WTR=$(curl wttr.in?format=1)
|
||||
|
||||
# art
|
||||
# ART=$(curl -L git.io/unix)
|
||||
# ART=$(curl -L git.io/coffee)
|
||||
|
||||
# For multi core/thread, CPU needs to be divided by # of cores for average
|
||||
(( C > 1 )) && CPU=$((CPU / C))
|
||||
(( CPU > 100 )) && CPU="$C cores @ 100% avg" || CPU="$C cores @ $CPU% avg"
|
||||
|
||||
rep_char() {
|
||||
local str char num
|
||||
char="${1:-=}"
|
||||
num="${2:-$((${#USR} + 6 + ${#HOST}))}"
|
||||
str="$(printf "%${num}s")"
|
||||
echo "${str// /$char}"
|
||||
}
|
||||
|
||||
pkg_cnt() {
|
||||
pacman -Qq 2>/dev/null | wc -l
|
||||
}
|
||||
|
||||
cur_wm() {
|
||||
if [[ $DISPLAY && ! $WM ]]; then
|
||||
ID="$(xprop -root -notype _NET_SUPPORTING_WM_CHECK)"
|
||||
WM="$(xprop -id ${ID##* } -notype -len 100 -f _NET_WM_NAME 8t)"
|
||||
WM=${WM/*WM_NAME = } WM=${WM/\"} WM=${WM/\"*} WM=${WM,,}
|
||||
echo "${WM:-$FB}"
|
||||
else
|
||||
echo "${WM:-tty$XDG_VTNR}"
|
||||
fi
|
||||
}
|
||||
|
||||
clear
|
||||
|
||||
# ${ART}
|
||||
|
||||
# ${FG6}->$FG uptime$FG1: ${FG4}${UPT:-$FB}
|
||||
# ${FG6}->$FG cpu$FG1: ${FG4}${CPU:-$FB}
|
||||
# ${FG6}->$FG wtr$FG1: ${FG4}${WTR:-$FB}
|
||||
cat <<- EOF
|
||||
|
||||
${FG5}===$FG ${USR}${FG2}@${FG6}${HOST:-$FB}
|
||||
${FG5}$(rep_char '=')
|
||||
${FG6}->$FG install$FG1: ${FG4}${INST:-$FB}
|
||||
${FG6}->$FG distro$FG1: ${FG4}${DIST:-$FB}
|
||||
${FG6}->$FG kernel$FG1: ${FG4}${KERN:-$FB}
|
||||
${FG6}->$FG shell$FG1: ${FG4}${SHLL:-$FB}
|
||||
${FG6}->$FG pkgs$FG1: ${FG4}$(pkg_cnt)
|
||||
${FG6}->$FG wm$FG1: ${FG4}$(cur_wm)
|
||||
${FG6}->$FG term$FG1: ${FG4}${TRM:-$FB}
|
||||
${FG6}->$FG /$FG1: ${FG4}${ROOT:-$FB}
|
||||
${FG6}->$FG /home$FG1: ${FG4}${HOME:-$FB}
|
||||
${FG6}->$FG /m/files$FG1: ${FG4}${FILES:-$FB}
|
||||
${FG6}->$FG ram$FG1: ${FG4}${MEM:-$FB}
|
||||
|
||||
${FG1}████${FG2}████${FG3}████${FG4}████${FG5}████${FG6}████${FG7}████${FG}
|
||||
|
||||
EOF
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
WMCTRL=`which wmctrl`;
|
||||
GREP=`which grep`;
|
||||
APPLICATION=$1;
|
||||
BASENAME=`basename $APPLICATION | tr "[:upper:]" "[:lower:]"`
|
||||
FOUND=0;
|
||||
|
||||
function findwindow {
|
||||
IFS=$'\n';
|
||||
MAX_MATCHES=0;
|
||||
for RUNNING in `$2 -l -x | awk '{print $1, $3}' | tac`; do
|
||||
MATCH_COUNT=`echo $RUNNING | tr "[:upper:]" "[:lower:]" | $3 -o $1 | wc -l`
|
||||
if [ $MATCH_COUNT -gt $MAX_MATCHES ]; then
|
||||
MAX_MATCHES=$MATCH_COUNT
|
||||
WINDOW_ID=`echo $RUNNING | cut -c1-11`
|
||||
FOUND=1;
|
||||
fi;
|
||||
done
|
||||
}
|
||||
|
||||
findwindow $BASENAME $WMCTRL $GREP;
|
||||
if [ $FOUND -eq 0 ]; then
|
||||
$APPLICATION &
|
||||
else
|
||||
$WMCTRL -i -a $WINDOW_ID
|
||||
fi
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#PUT THIS FILE IN ~/.local/share/rofi/finder.sh
|
||||
#USE: rofi -show find -modi find:~/.local/share/rofi/finder.sh
|
||||
if [ ! -z "$@" ]
|
||||
then
|
||||
QUERY=$@
|
||||
if [[ "$@" == /* ]]
|
||||
then
|
||||
if [[ "$@" == *\?\? ]]
|
||||
then
|
||||
coproc ( exo-open "${QUERY%\/* \?\?}" > /dev/null 2>&1 )
|
||||
exec 1>&-
|
||||
exit;
|
||||
else
|
||||
coproc ( exo-open "$@" > /dev/null 2>&1 )
|
||||
exec 1>&-
|
||||
exit;
|
||||
fi
|
||||
elif [[ "$@" == \!\!* ]]
|
||||
then
|
||||
echo "!!-- Type your search query to find files"
|
||||
echo "!!-- To seach again type !<search_query>"
|
||||
echo "!!-- To seach parent directories type ?<search_query>"
|
||||
echo "!!-- You can print this help by typing !!"
|
||||
elif [[ "$@" == \?* ]]
|
||||
then
|
||||
while read -r line; do
|
||||
echo "$line" \?\?
|
||||
done <<< $(find / -iname *"${QUERY#\?}"* 2>&1 | grep -v 'Permission denied\|Input/output error')
|
||||
else
|
||||
find / -iname *"${QUERY#!}"* 2>&1 | grep -v 'Permission denied\|Input/output error'
|
||||
fi
|
||||
else
|
||||
echo "!!-- Type your search query to find files"
|
||||
echo "!!-- To seach again type !<search_query>"
|
||||
echo "!!-- To seach parent directories type ?<search_query>"
|
||||
echo "!!-- You can print this help by typing !!"
|
||||
fi
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
# autor Alex Creio
|
||||
|
||||
SCREEN_DIR=$(xdg-user-dir PICTURES)/screen
|
||||
|
||||
[[ ! -d $SCREEN_DIR ]] && mkdir -p $SCREEN_DIR
|
||||
|
||||
if [ "$1" = "-c" ]; then
|
||||
flameshot full -c -p $SCREEN_DIR
|
||||
elif [ "$1" = "-d" ]; then
|
||||
flameshot full -c -d "$2" -p $SCREEN_DIR
|
||||
else
|
||||
flameshot gui
|
||||
fi
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
(sleep 20;notify-send --icon="/usr/share/icons/Papirus/48x48/apps/urxvt.svg" "$(fortune)")
|
|
@ -0,0 +1,91 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# fro: an xmas ascii banner generator for my bro
|
||||
# MMXV xero (http://xero.nu)
|
||||
|
||||
usage() {
|
||||
printf "usage: `basename $0` \n\
|
||||
[-n --normal normal] \n\
|
||||
[-d --dots dots] \n\
|
||||
[-c --color color] \n\
|
||||
[-h --help help]\n"
|
||||
}
|
||||
|
||||
dots() {
|
||||
cat << FRO
|
||||
|
||||
.........................................
|
||||
.........................................
|
||||
........ _________ ......................
|
||||
........ \_ \______ .. ______ .....
|
||||
......... / \ / \ ....
|
||||
........ / ___ / / /\/ _ /\ ...
|
||||
....... / / \/ _/ _/ / / / \ ..
|
||||
...... / /__ / \ \ / / / / ..
|
||||
..... / _ // // // / / / ...
|
||||
.... / / \// /_ // / / / ....
|
||||
.. _/ / /_____/ \ / / .....
|
||||
.. \___/ /\ /_____/\_____/ / ......
|
||||
... \ /..\___\ \ / .......
|
||||
.... \__/ ...... \______/\_____/ ........
|
||||
.........................................
|
||||
.........................................
|
||||
|
||||
FRO
|
||||
}
|
||||
|
||||
normal() {
|
||||
cat << FRO
|
||||
_________
|
||||
\_ \______ ______
|
||||
/ \ / \
|
||||
/ ___ / / /\/ _ /\
|
||||
/ / \/ _/ _/ / / / \
|
||||
/ /__ / \ \ / / / /
|
||||
/ _ // // // / / /
|
||||
/ / \// /_ // / / /
|
||||
_/ / /_____/ \ / /
|
||||
\___/ /\ /_____/\_____/ /
|
||||
\ / \___\ \ /
|
||||
\__/ \______/\_____/
|
||||
FRO
|
||||
}
|
||||
|
||||
color() {
|
||||
cat << FRO
|
||||
|
||||
[1;33m.........................................
|
||||
[1;33m.........................................
|
||||
[1;33m........ [1;34m_________ [1;33m......................
|
||||
[1;33m........ [1;34m\_ \______ [1;33m.. [1;34m______ [1;33m.....
|
||||
[1;33m......... [1;34m/ \ / \ [1;33m....
|
||||
[1;33m........ [1;34m/ ___ / / /[1;35m\[1;34m/ _ /[1;35m\ [1;33m...
|
||||
[1;33m....... [1;34m/ / \/ _/ _/ / / / [1;35m\ [1;33m..
|
||||
[1;33m...... [1;34m/ /__ / \ \ / / / [1;35m/ [1;33m..
|
||||
[1;33m..... [1;34m/ _ // // // / / [1;35m/ [1;33m...
|
||||
[1;33m.... [1;34m/ / \// /_ // / / [1;35m/ [1;33m....
|
||||
[1;33m.. [1;34m_/ / /_____/ \ / [1;35m/ [1;33m.....
|
||||
[1;33m.. [1;34m\___/ [1;35m/\ [1;34m/_____/\_____/ [1;35m/ [1;33m......
|
||||
[1;33m... [1;35m\ /[1;33m..[1;35m\___\ \ / [1;33m.......
|
||||
[1;33m.... [1;35m\__/ [1;33m...... [1;35m\______/\_____/ [1;33m........
|
||||
[1;33m.........................................
|
||||
[1;33m.........................................
|
||||
|
||||
FRO
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
*-d|--dots|dots*)
|
||||
dots
|
||||
;;
|
||||
*-c|--color|color*)
|
||||
color
|
||||
;;
|
||||
*-n|--normal|normal)
|
||||
normal
|
||||
;;
|
||||
*)
|
||||
normal
|
||||
usage
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
git add .
|
||||
echo "Write your commit comment! $(date +%d.%m.%Y) Update:"
|
||||
read input
|
||||
git commit -a -m "$(date +%d.%m.%Y) Update $input"
|
||||
git push
|
||||
echo "Git Push Done!"
|
|
@ -0,0 +1,102 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Uses animated files as wallpapers.
|
||||
# Requires: mpv(1) and convert(1)
|
||||
|
||||
set -e
|
||||
|
||||
: "${_ext=gif}"
|
||||
|
||||
__usage () {
|
||||
cat << EOH
|
||||
$0 path
|
||||
$0 -h
|
||||
|
||||
$0 will use animated files in "path" and use them as looping wallpapers
|
||||
$0 -h displays this help text
|
||||
|
||||
We look for files ending in $_ext .
|
||||
You might set \$_ext to change this behavior.
|
||||
Use SIGUSR1 to use another random wallpaper (might be the same!)
|
||||
Use SIGUSR2 to generate the file list again
|
||||
EOH
|
||||
}
|
||||
|
||||
# parsing options
|
||||
case "$1" in
|
||||
-h|help) __usage ; exit 0 ;;
|
||||
"") __usage >&2 ; exit 1 ;;
|
||||
*) _path="$1" ;;
|
||||
esac
|
||||
|
||||
# simple, stupid check
|
||||
ls "$_path" >/dev/null
|
||||
|
||||
# We work in a temporary dir
|
||||
_tmp="$(mktemp -dt "$(basename "$0").XXXX")"
|
||||
|
||||
__cleanup () {
|
||||
[ -d "$_tmp" ] && rm -rf "${_tmp:?}"
|
||||
}
|
||||
|
||||
trap __cleanup INT TERM
|
||||
|
||||
__create_list () {
|
||||
# We list the files and store that have the good extension
|
||||
: > "$_tmp/list"
|
||||
for _e in $_ext; do
|
||||
find "$_path" -name '*.'$_e >> "$_tmp/list"
|
||||
done
|
||||
}
|
||||
|
||||
__create_list
|
||||
|
||||
trap __create_list USR2
|
||||
|
||||
__pick_one () {
|
||||
# We randomly pick one file and return its path
|
||||
shuf "$_tmp/list" | head -n 1
|
||||
}
|
||||
|
||||
__bg () {
|
||||
# Select bg color:
|
||||
# convert(1) to extract the single top-left pixel and extract its color
|
||||
# throughout the .gif; then grep for its only values that are NOT transparent
|
||||
# and then take the first one
|
||||
_solid_color="$(convert "$1" -crop 1x1+0+0 -depth 8 txt: | grep -Eo \
|
||||
'#[A-F0-9]{6}(FF|)' | sort -u | head -n 1)"
|
||||
|
||||
# Now $_solid_color contains either #RRGGBB or #RRGGBBAA and we need to
|
||||
# discard the 'AA' part (where AA = FF anyway, because we used grep earlier),
|
||||
# hence the '%%FF'
|
||||
_solid_color="${_solid_color%%FF}"
|
||||
|
||||
printf '%s\n' "${_solid_color}"
|
||||
}
|
||||
|
||||
__run_mpv () {
|
||||
mpv --border --video-unscaled --background="$2" --wid=0 "$1" --loop-file=inf --speed=1.0 >/dev/null 2>&1 &
|
||||
}
|
||||
|
||||
__kill () {
|
||||
kill "$(pgrep -P "$$" "$1")" 2>/dev/null || :
|
||||
}
|
||||
|
||||
__set_a_wp () {
|
||||
_gif="$(__pick_one)"
|
||||
_bg="$(__bg "$_gif")"
|
||||
__kill mpv
|
||||
__run_mpv "$_gif" "$_bg"
|
||||
}
|
||||
|
||||
__set_a_wp
|
||||
|
||||
trap __set_a_wp USR1
|
||||
trap '__kill mpv; __cleanup' INT TERM
|
||||
|
||||
mkfifo "$_tmp/fifo" || exit
|
||||
chmod 600 "$_tmp/fifo"
|
||||
read < "$_tmp/fifo" 2>/dev/null
|
||||
|
||||
__cleanup
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
tag_name="v$1"
|
||||
target_name="$2"
|
||||
asset_dir="./out"
|
||||
cr_date=$(date +%Y%m%d)
|
||||
|
||||
assets=()
|
||||
for f in "$asset_dir"/*; do [ -f "$f" ] && assets+=(-a "$f"); done
|
||||
|
||||
hub release create "${assets[@]}" -m "Release $tag_name $cr_date" -t "$target_name" "$tag_name"
|
|
@ -0,0 +1,686 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Automagically hide/show a window by its name when the cursor is
|
||||
# within a defined region or you mouse over it.
|
||||
#
|
||||
# This script was initially written to imitate gnome-shell's systray
|
||||
# but should be generic enough to do other things as well.
|
||||
#
|
||||
# Requirements:
|
||||
# bash, xdotool, xwininfo, xev
|
||||
#
|
||||
|
||||
# Global variables used throughout the script
|
||||
WIN_ID=""
|
||||
WIN_NAME=""
|
||||
WIN_CLASS=""
|
||||
WIN_INSTANCE=""
|
||||
WAIT=1
|
||||
|
||||
WIN_WIDTH=""
|
||||
WIN_HEIGHT=""
|
||||
WIN_POSX=""
|
||||
WIN_POSY=""
|
||||
|
||||
SCREEN_WIDTH=""
|
||||
SCREEN_HEIGHT=""
|
||||
|
||||
MINX=""
|
||||
MINY=""
|
||||
MAXX=""
|
||||
MAXY=""
|
||||
|
||||
HOVER=1
|
||||
SIGNAL=1
|
||||
INTERVAL=1
|
||||
PEEK=3
|
||||
DIRECTION="left"
|
||||
STEPS=3
|
||||
NO_TRANS=1
|
||||
TOGGLE=1
|
||||
TOGGLE_PEEK=1
|
||||
|
||||
_IS_HIDDEN=1
|
||||
_DOES_PEEK=0
|
||||
_HAS_REGION=1
|
||||
_WAIT_PID=""
|
||||
_PID_FILE=""
|
||||
|
||||
|
||||
usage() {
|
||||
# Print usage
|
||||
printf "usage: $0 [options]\n"
|
||||
printf "\n"
|
||||
printf "Required (At least on):\n"
|
||||
printf " -N, --name [pattern]\n"
|
||||
printf " Match against the window name.\n"
|
||||
printf " This is the same string that is displayed in the window titlebar.\n"
|
||||
printf "\n"
|
||||
printf " -C, --class [pattern]\n"
|
||||
printf " Match against the window class.\n"
|
||||
printf "\n"
|
||||
printf " -I, --instance [pattern]\n"
|
||||
printf " Match against the window instance.\n"
|
||||
printf "\n"
|
||||
printf " --id [window-id]\n"
|
||||
printf " Explicitly specify a window id rather than searching for one.\n"
|
||||
printf "\n"
|
||||
printf "Optional:\n"
|
||||
printf " -w, --wait\n"
|
||||
printf " Wait until a matching window was found.\n"
|
||||
printf " This will check once every second.\n"
|
||||
printf "\n"
|
||||
printf " -r, --region [posXxposY+offsetX+offsetY]\n"
|
||||
printf " Cursor region at which to trigger.\n"
|
||||
printf " Examples:\n"
|
||||
printf " --region 0x1080+10+-10 (Bottom left incl. a 10 pixel offset)\n"
|
||||
printf " --region 1920x1080+0+0 (Bottom right without offset)\n"
|
||||
printf "\n"
|
||||
printf " -H, --hover\n"
|
||||
printf " Show the window when hovering over it.\n"
|
||||
printf " If --region was defined, --hover will be ignored!\n"
|
||||
printf " This will only work if --peek is greater 0.\n"
|
||||
printf " By default, hover is off.\n"
|
||||
printf "\n"
|
||||
printf " -S, --signal\n"
|
||||
printf " Toggle the visibility by sending a 'SIGUSR1' signal.\n"
|
||||
printf " Both --region and --hover will be ignored.\n"
|
||||
printf "\n"
|
||||
printf " -i, --interval [interval]\n"
|
||||
printf " Interval in seconds to check the cursors location.\n"
|
||||
printf " Defaults to 1.\n"
|
||||
printf "\n"
|
||||
printf " -p, --peek [amount]\n"
|
||||
printf " When hidden, peek 'amount' of pixels to indicate the window.\n"
|
||||
printf " Required if --hover is used."
|
||||
printf " Defaults to 3.\n"
|
||||
printf "\n"
|
||||
printf " -d, --direction [left|right|top|bottom]\n"
|
||||
printf " direction in which to move the window.\n"
|
||||
printf " Defaults to left.\n"
|
||||
printf "\n"
|
||||
printf " -s, --steps [amount]\n"
|
||||
printf " steps in pixel used to move the window. The higher the value,\n"
|
||||
printf " the faster it will move at the cost of smoothness.\n"
|
||||
printf " Defaults to 3.\n"
|
||||
printf "\n"
|
||||
printf " -T, --no-trans\n"
|
||||
printf " Turn of the transition effect.\n"
|
||||
printf "\n"
|
||||
printf " -t, --toggle\n"
|
||||
printf " Send a SIGUSR1 signal to the process matching the same window.\n"
|
||||
printf " This will toggle the visibility of the window."
|
||||
printf "\n\n"
|
||||
printf " -P, --toggle-peek\n"
|
||||
printf " Send a SIGUSR2 signal to the process matching the same window.\n"
|
||||
printf " This will toggle the hidden state of the window if --peek is greater 0."
|
||||
printf "\n\n"
|
||||
printf "Examples:\n"
|
||||
printf " Dropdown Terminal:\n"
|
||||
printf " # Start a terminal with a unique name\n"
|
||||
printf " # (Make sure yourself it is positioned correctly)\n"
|
||||
printf " $ termite --title=dropdown-terminal &\n"
|
||||
printf "\n"
|
||||
printf " # Hide it and wait for a SIGUSR1 signal\n"
|
||||
printf " $ hideIt.sh --name '^dropdown-terminal$' --direction top --steps 5 --signal\n"
|
||||
printf "\n"
|
||||
printf " # Send a SIGUSR1 signal (This could be mapped to a keyboard shortcut)\n"
|
||||
printf " $ hideIt.sh --name '^dropdown-terminal$' --toggle\n"
|
||||
}
|
||||
|
||||
|
||||
argparse() {
|
||||
# Parse system args
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
"-N"|"--name")
|
||||
WIN_NAME="$2"
|
||||
shift
|
||||
;;
|
||||
"-C"|"--class")
|
||||
WIN_CLASS="$2"
|
||||
shift
|
||||
;;
|
||||
"-I"|"--instance")
|
||||
WIN_INSTANCE="$2"
|
||||
shift
|
||||
;;
|
||||
"--id")
|
||||
if [[ ! $2 =~ [0-9]+ ]]; then
|
||||
printf "Invalid window id. Should be a number.\n" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WIN_ID="$2"
|
||||
shift
|
||||
;;
|
||||
"-w"|"--wait")
|
||||
WAIT=0
|
||||
;;
|
||||
"-H"|"--hover")
|
||||
HOVER=0
|
||||
;;
|
||||
"-S"|"--signal")
|
||||
SIGNAL=0
|
||||
;;
|
||||
"-r"|"--region")
|
||||
local posX posY offsetX offsetY
|
||||
read posX posY offsetX offsetY <<<$(echo "$2" | \
|
||||
sed -rn 's/^([0-9]+)x([0-9]+)\+(-?[0-9]+)\+(-?[0-9]+)/\1 \2 \3 \4/p')
|
||||
|
||||
# Test if we have proper values by trying
|
||||
# to add them all together
|
||||
expr $posX + $posY + $offsetX + $offsetY > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
printf "Invalid region. See --help for usage.\n" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MINX=$posX
|
||||
MAXX=$((${MINX} + ${offsetX}))
|
||||
if [ $MINX -gt $MAXX ]; then
|
||||
read MINX MAXX <<< "$MAXX $MINX"
|
||||
fi
|
||||
|
||||
MINY=$posY
|
||||
MAXY=$((${MINY} + ${offsetY}))
|
||||
if [ $MINY -gt $MAXY ]; then
|
||||
read MINY MAXY <<< "$MAXY $MINY"
|
||||
fi
|
||||
|
||||
if [[ ! $MINX =~ [0-9]+ ]] || [[ ! $MINY =~ [0-9]+ ]] \
|
||||
|| [[ ! $MAXY =~ [0-9]+ ]] || [[ ! $MAXY =~ [0-9]+ ]]; then
|
||||
printf "Missing or invalid region. See --help for usage.\n" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
_HAS_REGION=0
|
||||
shift
|
||||
;;
|
||||
"-i"|"--interval")
|
||||
INTERVAL="$2"
|
||||
if [[ ! $INTERVAL =~ [0-9]+ ]]; then
|
||||
printf "Interval should be a number. " 1>&2
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
"-p"|"--peek")
|
||||
PEEK="$2"
|
||||
if [[ ! $PEEK =~ [0-9]+ ]]; then
|
||||
printf "Peek should be a number. " 1>&2
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
"-d"|"--direction")
|
||||
DIRECTION="$2"
|
||||
if [[ ! "$DIRECTION" =~ ^(left|right|top|bottom)$ ]]; then
|
||||
printf "Invalid direction. See --help for usage.\n" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
"-s"|"--steps")
|
||||
STEPS="$2"
|
||||
if [[ ! $STEPS =~ [0-9]+ ]]; then
|
||||
printf "Steps should be a number. " 1>&2
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
"-T"|"--no-trans")
|
||||
NO_TRANS=0
|
||||
;;
|
||||
"-t"|"--toggle")
|
||||
TOGGLE=0
|
||||
;;
|
||||
"-P"|"--toggle-peek")
|
||||
TOGGLE_PEEK=0
|
||||
;;
|
||||
"-h"|"--help")
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
**)
|
||||
printf "Didn't understand '$1'\n" 1>&2
|
||||
printf "See --help for usage.\n"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Check required arguments
|
||||
local _names="${WIN_ID}${WIN_NAME}${WIN_CLASS}${WIN_INSTANCE}"
|
||||
if [ -z "$_names" ] && [ -z "$WIN_ID" ]; then
|
||||
printf "At least one of --name, --class, --instance or --id" 1>&2
|
||||
printf " is required!\n" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $TOGGLE -ne 0 ] && [ $TOGGLE_PEEK -ne 0 ] && [ $SIGNAL -ne 0 ] \
|
||||
&& [ $_HAS_REGION -ne 0 ] && [ $HOVER -ne 0 ]; then
|
||||
printf "At least one of --toggle, --signal, --hover or" 1>&2
|
||||
printf " --region is required!\n" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function fetch_window_id() {
|
||||
# Sets the values for the following global
|
||||
# WIN_ID
|
||||
|
||||
# We already have a window id
|
||||
if [ ! -z "$WIN_ID" ]; then
|
||||
_PID_FILE="/tmp/hideIt-${WIN_ID}.pid"
|
||||
return
|
||||
fi
|
||||
|
||||
local _id=-1
|
||||
|
||||
# Search all windows matching the provided class
|
||||
local _tmp1=()
|
||||
if [ ! -z "$WIN_CLASS" ]; then
|
||||
_tmp1=($(xdotool search --class "$WIN_CLASS"))
|
||||
_tmp1=${_tmp1:--1}
|
||||
fi
|
||||
|
||||
# Search all windows matching the provided instance
|
||||
local _tmp2=()
|
||||
if [ ! -z "$WIN_INSTANCE" ]; then
|
||||
_tmp2=($(xdotool search --classname "$WIN_INSTANCE"))
|
||||
_tmp2=${_tmp2:--1}
|
||||
fi
|
||||
|
||||
# Search all windows matching the provided name (title)
|
||||
local _tmp3=()
|
||||
if [ ! -z "$WIN_NAME" ]; then
|
||||
_tmp3=($(xdotool search --name "$WIN_NAME"))
|
||||
_tmp3=${_tmp3:--1}
|
||||
fi
|
||||
|
||||
# Shift values upwards
|
||||
for i in {1..2}; do
|
||||
if [ -z $_tmp1 ]; then
|
||||
_tmp1=(${_tmp2[@]})
|
||||
_tmp2=()
|
||||
fi
|
||||
|
||||
if [ -z $_tmp2 ]; then
|
||||
_tmp2=(${_tmp3[@]})
|
||||
_tmp3=()
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z $_tmp2 ]; then
|
||||
# We only have one list of ids so we pick the first one from it
|
||||
_id=${_tmp1[0]}
|
||||
else
|
||||
# We have multiple lists so we have to find the id that appears
|
||||
# in all of them
|
||||
local _oldIFS=$IFS
|
||||
IFS=$'\n\t'
|
||||
|
||||
local _ids=($(comm -12 \
|
||||
<(echo "${_tmp1[*]}" | sort) \
|
||||
<(echo "${_tmp2[*]}" | sort)))
|
||||
|
||||
if [ ! -z $_tmp3 ]; then
|
||||
_ids=($(comm -12 \
|
||||
<(echo "${_tmp3[*]}" | sort) \
|
||||
<(echo "${_ids[*]}" | sort)))
|
||||
fi
|
||||
IFS=$_oldIFS
|
||||
|
||||
_id=${_ids[0]}
|
||||
fi
|
||||
|
||||
if [[ $_id =~ [0-9]+ ]] && [ $_id -gt 0 ]; then
|
||||
WIN_ID=$_id
|
||||
_PID_FILE="/tmp/hideIt-${WIN_ID}.pid"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function fetch_screen_dimensions() {
|
||||
# Sets the values for the following globals
|
||||
# SCREEN_WIDTH, SCREEN_HEIGHT
|
||||
|
||||
local win_info=$(xwininfo -root)
|
||||
SCREEN_WIDTH=$(echo "$win_info" | sed -rn 's/.*Width: +([0-9]+)/\1/p')
|
||||
SCREEN_HEIGHT=$(echo "$win_info" | sed -rn 's/.*Height: +([0-9]+)/\1/p')
|
||||
}
|
||||
|
||||
|
||||
function fetch_window_dimensions() {
|
||||
# Sets the values for the following globals unless no WIN_ID exists
|
||||
# WIN_WIDTH, WIN_HEIGHT, WIN_POSX, WIN_POSY
|
||||
|
||||
if [[ ! $WIN_ID =~ [0-9]+ ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local win_info=$(xwininfo -id $WIN_ID)
|
||||
|
||||
WIN_WIDTH=$(echo "$win_info" | sed -rn 's/.*Width: +([0-9]+)/\1/p')
|
||||
WIN_HEIGHT=$(echo "$win_info" | sed -rn 's/.*Height: +([0-9]+)/\1/p')
|
||||
|
||||
if [ ! -z "$1" ] && [ $1 -eq 0 ]; then
|
||||
WIN_POSX=$(echo "$win_info" | \
|
||||
sed -rn 's/.*Absolute upper-left X: +(-?[0-9]+)/\1/p')
|
||||
WIN_POSY=$(echo "$win_info" | \
|
||||
sed -rn 's/.*Absolute upper-left Y: +(-?[0-9]+)/\1/p')
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function send_signal() {
|
||||
# Send a SIGUSR1 to an active hideIt.sh instance
|
||||
# if a pid file was found.
|
||||
local signal=$1
|
||||
if [ ! -f "$_PID_FILE" ]; then
|
||||
printf "Pid file at \"${_PID_FILE}\" doesn't exist!\n" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local _pid=`cat $_PID_FILE`
|
||||
printf "Sending ${signal} to instance...\n"
|
||||
|
||||
if [[ $_pid =~ [0-9]+ ]]; then
|
||||
kill -${signal} $_pid
|
||||
exit 0
|
||||
else
|
||||
printf "Invalid pid in \"${_PID_FILE}\".\n" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function hide_window() {
|
||||
# Move the window in or out
|
||||
# Args:
|
||||
# hide: 0 to hide, 1 to show
|
||||
|
||||
local hide=$1
|
||||
|
||||
# Make sure window still exists and exit if not.
|
||||
xwininfo -id $WIN_ID &> /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
printf "Window doesn't exist anymore, exiting!\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
_IS_HIDDEN=$hide
|
||||
|
||||
# Update WIN_WIDTH, WIN_HEIGHT in case they changed
|
||||
fetch_window_dimensions
|
||||
|
||||
# Activate the window.
|
||||
# Should bring it to the front, change workspace etc.
|
||||
if [ $hide -ne 0 ]; then
|
||||
xdotool windowactivate $WIN_ID > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
# Generate the sequence used to move the window
|
||||
local to=()
|
||||
local sequence=()
|
||||
if [ "$DIRECTION" == "left" ]; then
|
||||
to=-$(($WIN_WIDTH - $PEEK))
|
||||
if [ $hide -eq 0 ]; then
|
||||
sequence=($(seq $WIN_POSX -$STEPS $to))
|
||||
sequence+=($to)
|
||||
else
|
||||
sequence=($(seq $to $STEPS $WIN_POSX))
|
||||
sequence+=($WIN_POSX)
|
||||
fi
|
||||
|
||||
elif [ "$DIRECTION" == "right" ]; then
|
||||
to=$(($SCREEN_WIDTH - $PEEK))
|
||||
if [ $hide -eq 0 ]; then
|
||||
sequence=($(seq $WIN_POSX $STEPS $to))
|
||||
sequence+=($to)
|
||||
else
|
||||
sequence=($(seq $to -$STEPS $WIN_POSX))
|
||||
sequence+=($WIN_POSX)
|
||||
fi
|
||||
|
||||
elif [ "$DIRECTION" == "bottom" ]; then
|
||||
to=$(($SCREEN_HEIGHT - $PEEK))
|
||||
if [ $hide -eq 0 ]; then
|
||||
sequence=($(seq $WIN_POSY $STEPS $to))
|
||||
sequence+=($to)
|
||||
else
|
||||
sequence=($(seq $to -$STEPS $WIN_POSY))
|
||||
sequence+=($WIN_POSY)
|
||||
fi
|
||||
|
||||
elif [ "$DIRECTION" == "top" ]; then
|
||||
to=-$(($WIN_HEIGHT - $PEEK))
|
||||
if [ $hide -eq 0 ]; then
|
||||
sequence=($(seq $WIN_POSY -$STEPS $to))
|
||||
sequence+=($to)
|
||||
else
|
||||
sequence=($(seq $to $STEPS $WIN_POSY))
|
||||
sequence+=($WIN_POSY)
|
||||
fi
|
||||
fi
|
||||
|
||||
# Actually move the window
|
||||
if [ $NO_TRANS -ne 0 ]; then
|
||||
for pos in ${sequence[@]}; do
|
||||
if [[ "$DIRECTION" =~ ^(left|right)$ ]]; then
|
||||
xdotool windowmove $WIN_ID $pos $WIN_POSY
|
||||
elif [[ "$DIRECTION" =~ ^(top|bottom)$ ]]; then
|
||||
xdotool windowmove $WIN_ID $WIN_POSX $pos
|
||||
fi
|
||||
done
|
||||
else
|
||||
pos=${sequence[-1]}
|
||||
if [[ "$DIRECTION" =~ ^(left|right)$ ]]; then
|
||||
xdotool windowmove $WIN_ID $pos $WIN_POSY
|
||||
elif [[ "$DIRECTION" =~ ^(top|bottom)$ ]]; then
|
||||
xdotool windowmove $WIN_ID $WIN_POSX $pos
|
||||
fi
|
||||
fi
|
||||
|
||||
# In case we hid the window, try to give focus to whatever is
|
||||
# underneath the cursor.
|
||||
if [ $hide -eq 0 ]; then
|
||||
eval $(xdotool getmouselocation --shell)
|
||||
xdotool windowactivate $WINDOW > /dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function toggle() {
|
||||
# Toggle the hidden state of the window
|
||||
|
||||
if [ $_IS_HIDDEN -eq 0 ]; then
|
||||
hide_window 1
|
||||
else
|
||||
hide_window 0
|
||||
fi
|
||||
}
|
||||
|
||||
function toggle_peek() {
|
||||
# Completely hide/unhide the window in case PEEK is greater 0
|
||||
|
||||
if [ $PEEK -eq 0 ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local _peek=$PEEK
|
||||
local _win_posx=$WIN_POSX
|
||||
local _win_posy=$WIN_POSY
|
||||
|
||||
fetch_window_dimensions 0
|
||||
|
||||
if [ $_DOES_PEEK -eq 0 ]; then
|
||||
_DOES_PEEK=1
|
||||
PEEK=0
|
||||
else
|
||||
_DOES_PEEK=0
|
||||
fi
|
||||
|
||||
hide_window 0
|
||||
|
||||
PEEK=$_peek
|
||||
WIN_POSX=$_win_posx
|
||||
WIN_POSY=$_win_posy
|
||||
}
|
||||
|
||||
function serve_region() {
|
||||
# Check the cursors location and act accordingly
|
||||
|
||||
local _hide=0
|
||||
while true; do
|
||||
if [ $_DOES_PEEK -eq 0 ]; then
|
||||
# Get cursor x, y position and active window
|
||||
eval $(xdotool getmouselocation --shell)
|
||||
|
||||
# Test if the cursor is within the region
|
||||
if [ $X -ge $MINX -a $X -le $MAXX ] \
|
||||
&& [ $Y -ge $MINY -a $Y -le $MAXY ]; then
|
||||
_hide=1
|
||||
else
|
||||
_hide=0
|
||||
fi
|
||||
|
||||
# Don't hide if the cursor is still above the window
|
||||
if [ $_IS_HIDDEN -ne 0 ] \
|
||||
&& [ $_hide -eq 0 ] \
|
||||
&& [ $WINDOW -eq $WIN_ID ]; then
|
||||
_hide=1
|
||||
fi
|
||||
|
||||
# Only do something if necessary
|
||||
if [ $_IS_HIDDEN -ne $_hide ]; then
|
||||
hide_window $_hide
|
||||
fi
|
||||
fi
|
||||
|
||||
# Cut some slack
|
||||
sleep $INTERVAL
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
function serve_xev() {
|
||||
# Wait for cursor "Enter" and "Leave" events reported by
|
||||
# xev and act accordingly
|
||||
|
||||
xev -id $WIN_ID -event mouse | while read line; do
|
||||
if [[ "$line" =~ ^EnterNotify.* ]]; then
|
||||
hide_window 1
|
||||
elif [[ "$line" =~ ^LeaveNotify.* ]]; then
|
||||
hide_window 0
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
function restore() {
|
||||
# Called by trap once we receive an EXIT
|
||||
|
||||
if [ -n "$_WAIT_PID" ]; then
|
||||
kill -- "-${_WAIT_PID}"
|
||||
fi
|
||||
|
||||
if [ -f "$_PID_FILE" ]; then
|
||||
rm "$_PID_FILE"
|
||||
fi
|
||||
|
||||
if [ $_IS_HIDDEN -eq 0 ]; then
|
||||
printf "Restoring original window position...\n"
|
||||
hide_window 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
function main() {
|
||||
# Entry point for hideIt
|
||||
|
||||
# Parse all the args!
|
||||
argparse "$@"
|
||||
|
||||
printf "Searching window...\n"
|
||||
fetch_window_id
|
||||
|
||||
# If enabled, wait until a window was found.
|
||||
if [ $WAIT -eq 0 ] && [[ ! $WIN_ID =~ [0-9]+ ]]; then
|
||||
printf "Waiting for window"
|
||||
while [[ ! $WIN_ID =~ [0-9]+ ]]; do
|
||||
printf "."
|
||||
fetch_window_id
|
||||
sleep 1
|
||||
done
|
||||
printf "\n"
|
||||
fi
|
||||
|
||||
if [[ ! $WIN_ID =~ [0-9]+ ]]; then
|
||||
printf "No window found!\n" 1>&2
|
||||
exit 1
|
||||
else
|
||||
printf "Found window with id: $WIN_ID\n"
|
||||
fi
|
||||
|
||||
if [ $TOGGLE -eq 0 ]; then
|
||||
send_signal SIGUSR1
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ $TOGGLE_PEEK -eq 0 ]; then
|
||||
send_signal SIGUSR2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
printf "Fetching window dimensions...\n"
|
||||
fetch_window_dimensions 0
|
||||
|
||||
printf "Fetching screen dimensions...\n"
|
||||
fetch_screen_dimensions
|
||||
|
||||
trap restore EXIT
|
||||
|
||||
printf "Initially hiding window...\n"
|
||||
hide_window 0
|
||||
|
||||
# Save our pid into a file
|
||||
echo "$$" > /tmp/hideIt-${WIN_ID}.pid
|
||||
trap toggle_peek SIGUSR2
|
||||
|
||||
# Start observing
|
||||
if [ $_HAS_REGION -eq 0 ]; then
|
||||
printf "Defined region:\n"
|
||||
printf " X: $MINX $MAXX\n"
|
||||
printf " Y: $MINY $MAXY\n"
|
||||
printf "\n"
|
||||
printf "Waiting for region...\n"
|
||||
serve_region &
|
||||
_WAIT_PID=$!
|
||||
elif [ $SIGNAL -eq 0 ]; then
|
||||
printf "Waiting for SIGUSR1...\n"
|
||||
trap toggle SIGUSR1
|
||||
sleep infinity &
|
||||
_WAIT_PID=$!
|
||||
elif [ $HOVER -eq 0 ]; then
|
||||
printf "Waiting for HOVER...\n"
|
||||
serve_xev &
|
||||
_WAIT_PID=$!
|
||||
fi
|
||||
|
||||
if [ -n "$_WAIT_PID" ]; then
|
||||
while true; do
|
||||
wait "$_WAIT_PID"
|
||||
printf "Received signal...\n"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# Lets do disss!
|
||||
set -m
|
||||
main "$@"
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
DIALOG_RESULT=$(echo -e 'exit i3\nsuspend\nhibernate\nreboot\npoweroff\nexit' | rofi -dmenu -i -p "[SYSTEM]" -hide-scrollbar -tokenize -lines 6 -eh 1 -width 25 -location 0 -xoffset 0 -yoffset 0 -padding 20 -disable-history -font "ClearSansMedium 14")
|
||||
|
||||
echo "This result is : $DIALOG_RESULT"
|
||||
sleep 1;
|
||||
|
||||
if [ "$DIALOG_RESULT" = "exit i3" ];
|
||||
then
|
||||
i3-msg 'exit'
|
||||
elif [ "$DIALOG_RESULT" = "suspend" ];
|
||||
then
|
||||
exec systemctl suspend
|
||||
elif [ "$DIALOG_RESULT" = "hibernate" ];
|
||||
then
|
||||
exec systemctl hibernate
|
||||
elif [ "$DIALOG_RESULT" = "reboot" ];
|
||||
then
|
||||
exec systemctl reboot
|
||||
elif [ "$DIALOG_RESULT" = "poweroff" ];
|
||||
then
|
||||
exec systemctl poweroff
|
||||
elif [ "$DIALOG_RESULT" = "exit" ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
MAX_DESKTOPS=20
|
||||
|
||||
WORKSPACES=$(seq -s '\n' 1 1 ${MAX_DESKTOPS})
|
||||
|
||||
EMPTY_WORKSPACE=$( (i3-msg -t get_workspaces | tr ',' '\n' | grep num | awk -F: '{print int($2)}' ; \
|
||||
echo -e ${WORKSPACES} ) | sort -n | uniq -u | head -n 1)
|
||||
|
||||
i3-msg workspace ${EMPTY_WORKSPACE}
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
function gen_workspaces()
|
||||
{
|
||||
i3-msg -t get_workspaces | tr ',' '\n' | grep "name" | sed 's/"name":"\(.*\)"/\1/g' | sort -n
|
||||
}
|
||||
|
||||
|
||||
WORKSPACE=$( (echo Hiden; gen_workspaces) | rofi -dmenu -p "Select workspace")
|
||||
|
||||
if [ x"Hiden" = x"${WORKSPACE}" ]
|
||||
then
|
||||
$HOME/.bin/i3_empty_workspace.sh
|
||||
elif [ -n "${WORKSPACE}" ]
|
||||
then
|
||||
i3-msg workspace "${WORKSPACE}"
|
||||
fi
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Create and configure repository
|
||||
git init --bare $HOME/.dots || return 1
|
||||
dots config --local status.showUntrackedFiles no
|
||||
|
||||
# Create gitignore and initial commit
|
||||
echo .dots >> $HOME/.gitignore
|
||||
dots add $HOME/.gitignore
|
||||
dots commit -m "Initialize dotfiles repo"
|
|
@ -0,0 +1,248 @@
|
|||
#!/usr/bin/env bash
|
||||
# ┬┌─┬ ┬┌┐┌┌─┐┌┬┐
|
||||
# ├┴┐│ ││││└─┐ │
|
||||
# ┴ ┴└─┘┘└┘└─┘ ┴
|
||||
# Created by Siddharth Dushantha
|
||||
#
|
||||
# Dependencies: sxiv, imagemagick, bash, ffmpeg, mpc, jq
|
||||
|
||||
|
||||
VERSION=1.2.3
|
||||
COVER=/tmp/kunst.png
|
||||
MUSIC_DIR=~/Music/
|
||||
SIZE=250x250
|
||||
X=50
|
||||
Y=50
|
||||
|
||||
|
||||
show_help() {
|
||||
echo "usage: kunst [-h] [--size "px"] [--music_dir "path/to/dir"] [--silent] [--version]"
|
||||
echo " "
|
||||
echo "┬┌─┬ ┬┌┐┌┌─┐┌┬┐"
|
||||
echo "├┴┐│ ││││└─┐ │"
|
||||
echo "┴ ┴└─┘┘└┘└─┘ ┴"
|
||||
echo "Download and display album art or display embedded album art"
|
||||
echo " "
|
||||
echo "optional arguments:"
|
||||
echo " -h, --help show this help message and exit"
|
||||
echo " --size what size to display the album art in"
|
||||
echo " --x X"
|
||||
echo " --y Y"
|
||||
echo " --music_dir the music directory which MPD plays from"
|
||||
echo " --silent dont show the output"
|
||||
echo " --version show the version of kunst you are using"
|
||||
}
|
||||
|
||||
|
||||
# Parse the arguments
|
||||
options=$(getopt -o h --long size:,x:,y:,music_dir:,version,silent,help -- "$@")
|
||||
eval set -- "$options"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
--size)
|
||||
shift;
|
||||
SIZE=$1
|
||||
;;
|
||||
--x)
|
||||
shift;
|
||||
X=$1
|
||||
;;
|
||||
--y)
|
||||
shift;
|
||||
Y=$1
|
||||
;;
|
||||
--music_dir)
|
||||
shift;
|
||||
MUSIC_DIR=$1
|
||||
;;
|
||||
-h|--help)
|
||||
show_help
|
||||
exit
|
||||
;;
|
||||
--version)
|
||||
echo $VERSION
|
||||
exit
|
||||
;;
|
||||
--silent)
|
||||
SILENT=true
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# This is a base64 endcoded image which will be used if
|
||||
# the file does not have an emmbeded album art.
|
||||
# The image is an image of a music note
|
||||
read -d '' MUSIC_NOTE << EOF
|
||||
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJESURBVGhD7Zg/axRRFMVXAtpYphEVREKClnHfJI0MmReSfAC3tRejhaBgo70fwN7aD2BvEU0gfztbu5AqMxNjoVnvG87KZXy7z5m5dxLI/OCw8Pade+7M3n3Dbq+jo6OjY8RwMJhKk+hhlph3eRJ9w/LF5jCOr1PTj6jpD7mNjkjDkbDl4vFjpX87teZJlkSfSD9501zYfv5QJ1fyZHGexuJtZs12ZqMzX8NlwX4+nK3NXMutWaOm39Nd/u5rMCSUao80fjBNwY+p8Y+krNxQVaGsLsfWzFLYS2r4M30Rf5WbaCJE6OILlhIidPEFSwkRuviCpYQIXXzB1WX26bR6ky4v3OPriNCFB1YRHa079Pr6eKk/h1IFfA+WdOGBk+QeXtT0Ft3pV6e2fxf2f+AeLOnCA8tC0xv09H1xGi/cgWUi3I8lXXigEzX8u3gmWPP8JI5uYdt/w2thSRceSM0/zVfnb+CtWvB6WNJFOlC6XhDpQOl6QaQDpesFkQ6UrhdEOlC6XpA6gcPB/avumKXnxCadXHkha766tTr1GlE18CRZvEmN7nHfOMGiS5XA4mdmYg64Z5Jg06VKYHlEQoKtOVIz6zx8f0iwNUNyZt2F+3zjBFt9pGe22gWYFLb6lEckJNjGUmWEssR8ga0+0jNL9Z75fD7Rp7UOW32kZxb/1u37vFyUu+sODtjqozGzxaFADfprFM3vuD3Y3gytmf17LJPHXbgTNb5BWhe58yNan1lpWp9ZDVqdWS1am9mOjo7LRq/3B1ESKyYUVquzAAAAAElFTkSuQmCC
|
||||
EOF
|
||||
|
||||
|
||||
is_connected() {
|
||||
# Check if internet is connected. We are using api.deezer.com to test
|
||||
# if the internet is connected because if api.deezer.com is down or
|
||||
# the internet is not connected this script will work as expected
|
||||
if ping -q -c 1 -W 1 api.deezer.com >/dev/null; then
|
||||
connected=true
|
||||
else
|
||||
if [ ! $SILENT ];then
|
||||
echo "kunst: unable to check online for the album art"
|
||||
fi
|
||||
connected=false
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
get_cover_online() {
|
||||
# Check if connected to internet
|
||||
is_connected
|
||||
|
||||
if [ $connected == false ];then
|
||||
ARTLESS=true
|
||||
return
|
||||
fi
|
||||
|
||||
# Try to get the album cover online from api.deezer.com
|
||||
API_URL="http://api.deezer.com/search/autocomplete?q=$(mpc current)" && API_URL=${API_URL//' '/'%20'}
|
||||
|
||||
# Extract the albumcover from the json returned
|
||||
IMG_URL=$(curl -s "$API_URL" | jq -r '.playlists.data[0] | .picture_big')
|
||||
|
||||
if [ "$IMG_URL" = '' ] || [ "$IMG_URL" = 'null' ];then
|
||||
if [ ! $SILENT ];then
|
||||
echo "error: cover not found online"
|
||||
fi
|
||||
ARTLESS=true
|
||||
else
|
||||
if [ ! $SILENT ];then
|
||||
echo "kunst: cover found online"
|
||||
fi
|
||||
curl -o $COVER -s $IMG_URL
|
||||
ARTLESS=false
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
update_cover() {
|
||||
# Extract the album art from the mp3 file and dont show the messsy
|
||||
# output of ffmpeg
|
||||
ffmpeg -i "$MUSIC_DIR$(mpc current -f %file%)" $COVER -y &> /dev/null
|
||||
|
||||
# Get the status of the previous command
|
||||
STATUS=$?
|
||||
|
||||
killall n30f
|
||||
|
||||
# Check if the file has a embbeded album art
|
||||
if [ $STATUS -eq 0 ];then
|
||||
if [ ! $SILENT ];then
|
||||
echo "kunst: extracted album art"
|
||||
fi
|
||||
ARTLESS=false
|
||||
else
|
||||
DIR="$MUSIC_DIR$(dirname "$(mpc current -f %file%)")"
|
||||
if [ ! $SILENT ];then
|
||||
echo "kunst: inspecting $DIR"
|
||||
fi
|
||||
|
||||
# Check if there is an album cover/art in the folder.
|
||||
# Look at issue #9 for more details
|
||||
for CANDIDATE in "$DIR/cover."{png,jpg}; do
|
||||
if [ -f "$CANDIDATE" ]; then
|
||||
STATUS=0
|
||||
ARTLESS=false
|
||||
convert "$CANDIDATE" $COVER
|
||||
if [ ! $SILENT ];then
|
||||
echo "kunst: found cover.png"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ $STATUS -ne 0 ];then
|
||||
if [ ! $SILENT ];then
|
||||
echo "error: file does not have an album art"
|
||||
fi
|
||||
get_cover_online
|
||||
fi
|
||||
|
||||
# Resize the image to 250x250
|
||||
if [ $ARTLESS == false ]; then
|
||||
convert $COVER -resize $SIZE $COVER
|
||||
if [ ! $SILENT ];then
|
||||
echo "kunst: resized album art to $SIZE"
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
pre_exit() {
|
||||
# Get the proccess ID of kunst and kill it.
|
||||
# We are dumping the output of kill to /dev/null
|
||||
# because if the user quits sxiv before they
|
||||
# exit kunst, an error will be shown
|
||||
# from kill and we dont want that
|
||||
kill -9 $(cat /tmp/kunst.pid) &> /dev/null
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
# Flag to run some commands only once in the loop
|
||||
FIRST_RUN=true
|
||||
|
||||
while true; do
|
||||
|
||||
update_cover
|
||||
notify-send "Now Playing ♫" "$(mpc current)" &
|
||||
n30f -x $X -y $Y $COVER -t Kunst -c "killall n30f" &
|
||||
|
||||
if [ $ARTLESS == true ];then
|
||||
# Dhange the path to COVER because the music note
|
||||
# image is a png not jpg
|
||||
COVER=/tmp/kunst.png
|
||||
|
||||
# Decode the base64 encoded image and save it
|
||||
# to /tmp/kunst.png
|
||||
echo "$MUSIC_NOTE" | base64 --decode > $COVER
|
||||
fi
|
||||
|
||||
if [ ! $SILENT ];then
|
||||
echo "kunst: swapped album art to $(mpc current)"
|
||||
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
|
||||
fi
|
||||
|
||||
if [ $FIRST_RUN == true ]; then
|
||||
FIRST_RUN=false
|
||||
|
||||
# Display the album art using sxiv
|
||||
# sxiv -g $SIZE -b $COVER -N "Kunst" &
|
||||
|
||||
notify-send "Now Playing ♫" "$(mpc current)" &
|
||||
n30f -x $X -y $Y $COVER -t Kunst -c "killall n30f" &
|
||||
# Save the process ID so that we can kill
|
||||
# sxiv when the user exits the script
|
||||
echo $! >/tmp/kunst.pid
|
||||
fi
|
||||
|
||||
# Waiting for an event from mpd; play/pause/next/previous
|
||||
# this is lets kunst use less CPU :)
|
||||
mpc idle &> /dev/null
|
||||
if [ ! $SILENT ];then
|
||||
echo "kunst: received event from mpd"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Disable CTRL-Z because if we allowed this key press,
|
||||
# then the script would exit but, sxiv would still be
|
||||
# running
|
||||
trap "" SIGTSTP
|
||||
|
||||
trap pre_exit EXIT
|
||||
main
|
|
@ -0,0 +1,248 @@
|
|||
#!/usr/bin/env bash
|
||||
# ┬┌─┬ ┬┌┐┌┌─┐┌┬┐
|
||||
# ├┴┐│ ││││└─┐ │
|
||||
# ┴ ┴└─┘┘└┘└─┘ ┴
|
||||
# Created by Siddharth Dushantha
|
||||
#
|
||||
# Dependencies: sxiv, imagemagick, bash, ffmpeg, mpc, jq
|
||||
|
||||
|
||||
VERSION=1.2.3
|
||||
COVER=/tmp/kunst.png
|
||||
MUSIC_DIR=~/Music/
|
||||
SIZE=250x250
|
||||
X=50
|
||||
Y=50
|
||||
|
||||
|
||||
show_help() {
|
||||
echo "usage: kunst [-h] [--size "px"] [--music_dir "path/to/dir"] [--silent] [--version]"
|
||||
echo " "
|
||||
echo "┬┌─┬ ┬┌┐┌┌─┐┌┬┐"
|
||||
echo "├┴┐│ ││││└─┐ │"
|
||||
echo "┴ ┴└─┘┘└┘└─┘ ┴"
|
||||
echo "Download and display album art or display embedded album art"
|
||||
echo " "
|
||||
echo "optional arguments:"
|
||||
echo " -h, --help show this help message and exit"
|
||||
echo " --size what size to display the album art in"
|
||||
echo " --x X"
|
||||
echo " --y Y"
|
||||
echo " --music_dir the music directory which MPD plays from"
|
||||
echo " --silent dont show the output"
|
||||
echo " --version show the version of kunst you are using"
|
||||
}
|
||||
|
||||
|
||||
# Parse the arguments
|
||||
options=$(getopt -o h --long size:,x:,y:,music_dir:,version,silent,help -- "$@")
|
||||
eval set -- "$options"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
--size)
|
||||
shift;
|
||||
SIZE=$1
|
||||
;;
|
||||
--x)
|
||||
shift;
|
||||
X=$1
|
||||
;;
|
||||
--y)
|
||||
shift;
|
||||
Y=$1
|
||||
;;
|
||||
--music_dir)
|
||||
shift;
|
||||
MUSIC_DIR=$1
|
||||
;;
|
||||
-h|--help)
|
||||
show_help
|
||||
exit
|
||||
;;
|
||||
--version)
|
||||
echo $VERSION
|
||||
exit
|
||||
;;
|
||||
--silent)
|
||||
SILENT=true
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# This is a base64 endcoded image which will be used if
|
||||
# the file does not have an emmbeded album art.
|
||||
# The image is an image of a music note
|
||||
read -d '' MUSIC_NOTE << EOF
|
||||
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJESURBVGhD7Zg/axRRFMVXAtpYphEVREKClnHfJI0MmReSfAC3tRejhaBgo70fwN7aD2BvEU0gfztbu5AqMxNjoVnvG87KZXy7z5m5dxLI/OCw8Pade+7M3n3Dbq+jo6OjY8RwMJhKk+hhlph3eRJ9w/LF5jCOr1PTj6jpD7mNjkjDkbDl4vFjpX87teZJlkSfSD9501zYfv5QJ1fyZHGexuJtZs12ZqMzX8NlwX4+nK3NXMutWaOm39Nd/u5rMCSUao80fjBNwY+p8Y+krNxQVaGsLsfWzFLYS2r4M30Rf5WbaCJE6OILlhIidPEFSwkRuviCpYQIXXzB1WX26bR6ky4v3OPriNCFB1YRHa079Pr6eKk/h1IFfA+WdOGBk+QeXtT0Ft3pV6e2fxf2f+AeLOnCA8tC0xv09H1xGi/cgWUi3I8lXXigEzX8u3gmWPP8JI5uYdt/w2thSRceSM0/zVfnb+CtWvB6WNJFOlC6XhDpQOl6QaQDpesFkQ6UrhdEOlC6XpA6gcPB/avumKXnxCadXHkha766tTr1GlE18CRZvEmN7nHfOMGiS5XA4mdmYg64Z5Jg06VKYHlEQoKtOVIz6zx8f0iwNUNyZt2F+3zjBFt9pGe22gWYFLb6lEckJNjGUmWEssR8ga0+0jNL9Z75fD7Rp7UOW32kZxb/1u37vFyUu+sODtjqozGzxaFADfprFM3vuD3Y3gytmf17LJPHXbgTNb5BWhe58yNan1lpWp9ZDVqdWS1am9mOjo7LRq/3B1ESKyYUVquzAAAAAElFTkSuQmCC
|
||||
EOF
|
||||
|
||||
|
||||
is_connected() {
|
||||
# Check if internet is connected. We are using api.deezer.com to test
|
||||
# if the internet is connected because if api.deezer.com is down or
|
||||
# the internet is not connected this script will work as expected
|
||||
if ping -q -c 1 -W 1 api.deezer.com >/dev/null; then
|
||||
connected=true
|
||||
else
|
||||
if [ ! $SILENT ];then
|
||||
echo "kunst: unable to check online for the album art"
|
||||
fi
|
||||
connected=false
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
get_cover_online() {
|
||||
# Check if connected to internet
|
||||
is_connected
|
||||
|
||||
if [ $connected == false ];then
|
||||
ARTLESS=true
|
||||
return
|
||||
fi
|
||||
|
||||
# Try to get the album cover online from api.deezer.com
|
||||
API_URL="http://api.deezer.com/search/autocomplete?q=$(mpc current)" && API_URL=${API_URL//' '/'%20'}
|
||||
|
||||
# Extract the albumcover from the json returned
|
||||
IMG_URL=$(curl -s "$API_URL" | jq -r '.playlists.data[0] | .picture_big')
|
||||
|
||||
if [ "$IMG_URL" = '' ] || [ "$IMG_URL" = 'null' ];then
|
||||
if [ ! $SILENT ];then
|
||||
echo "error: cover not found online"
|
||||
fi
|
||||
ARTLESS=true
|
||||
else
|
||||
if [ ! $SILENT ];then
|
||||
echo "kunst: cover found online"
|
||||
fi
|
||||
curl -o $COVER -s $IMG_URL
|
||||
ARTLESS=false
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
update_cover() {
|
||||
# Extract the album art from the mp3 file and dont show the messsy
|
||||
# output of ffmpeg
|
||||
ffmpeg -i "$MUSIC_DIR$(mpc current -f %file%)" $COVER -y &> /dev/null
|
||||
|
||||
# Get the status of the previous command
|
||||
STATUS=$?
|
||||
|
||||
# killall n30f
|
||||
|
||||
# Check if the file has a embbeded album art
|
||||
if [ $STATUS -eq 0 ];then
|
||||
if [ ! $SILENT ];then
|
||||
echo "kunst: extracted album art"
|
||||
fi
|
||||
ARTLESS=false
|
||||
else
|
||||
DIR="$MUSIC_DIR$(dirname "$(mpc current -f %file%)")"
|
||||
if [ ! $SILENT ];then
|
||||
echo "kunst: inspecting $DIR"
|
||||
fi
|
||||
|
||||
# Check if there is an album cover/art in the folder.
|
||||
# Look at issue #9 for more details
|
||||
for CANDIDATE in "$DIR/cover."{png,jpg}; do
|
||||
if [ -f "$CANDIDATE" ]; then
|
||||
STATUS=0
|
||||
ARTLESS=false
|
||||
convert "$CANDIDATE" $COVER
|
||||
if [ ! $SILENT ];then
|
||||
echo "kunst: found cover.png"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ $STATUS -ne 0 ];then
|
||||
if [ ! $SILENT ];then
|
||||
echo "error: file does not have an album art"
|
||||
fi
|
||||
get_cover_online
|
||||
fi
|
||||
|
||||
# Resize the image to 250x250
|
||||
if [ $ARTLESS == false ]; then
|
||||
convert $COVER -resize $SIZE $COVER
|
||||
if [ ! $SILENT ];then
|
||||
echo "kunst: resized album art to $SIZE"
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
pre_exit() {
|
||||
# Get the proccess ID of kunst and kill it.
|
||||
# We are dumping the output of kill to /dev/null
|
||||
# because if the user quits sxiv before they
|
||||
# exit kunst, an error will be shown
|
||||
# from kill and we dont want that
|
||||
kill -9 $(cat /tmp/kunst.pid) &> /dev/null
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
# Flag to run some commands only once in the loop
|
||||
FIRST_RUN=true
|
||||
|
||||
while true; do
|
||||
|
||||
update_cover
|
||||
# notify-send "Now Playing ♫" "$(mpc current)" &
|
||||
n30f -x $X -y $Y $COVER -t Kunst -c "killall n30f" &
|
||||
|
||||
if [ $ARTLESS == true ];then
|
||||
# Dhange the path to COVER because the music note
|
||||
# image is a png not jpg
|
||||
COVER=/tmp/kunst.png
|
||||
|
||||
# Decode the base64 encoded image and save it
|
||||
# to /tmp/kunst.png
|
||||
echo "$MUSIC_NOTE" | base64 --decode > $COVER
|
||||
fi
|
||||
|
||||
if [ ! $SILENT ];then
|
||||
echo "kunst: swapped album art to $(mpc current)"
|
||||
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
|
||||
fi
|
||||
|
||||
if [ $FIRST_RUN == true ]; then
|
||||
FIRST_RUN=false
|
||||
|
||||
# Display the album art using sxiv
|
||||
# sxiv -g $SIZE -b $COVER -N "Kunst" &
|
||||
|
||||
# notify-send "Now Playing ♫" "$(mpc current)" &
|
||||
n30f -x $X -y $Y $COVER -t Kunst -c "killall n30f" &
|
||||
# Save the process ID so that we can kill
|
||||
# sxiv when the user exits the script
|
||||
echo $! >/tmp/kunst.pid
|
||||
fi
|
||||
|
||||
# Waiting for an event from mpd; play/pause/next/previous
|
||||
# this is lets kunst use less CPU :)
|
||||
mpc idle &> /dev/null
|
||||
if [ ! $SILENT ];then
|
||||
echo "kunst: received event from mpd"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Disable CTRL-Z because if we allowed this key press,
|
||||
# then the script would exit but, sxiv would still be
|
||||
# running
|
||||
trap "" SIGTSTP
|
||||
|
||||
trap pre_exit EXIT
|
||||
main
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
scrot /tmp/screen.png
|
||||
convert /tmp/screen.png -scale 10% -scale 1000% /tmp/screen.png
|
||||
[[ -f $1 ]] && convert /tmp/screen.png $1 -gravity center -composite -matte /tmp/screen.png
|
||||
i3lock -u -i /tmp/screen.png
|
||||
rm /tmp/screen.png
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
# pacman -S figlet lolcat
|
||||
|
||||
figlet -c -f slant "$1"|lolcat
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
|
||||
export FZF_DEFAULT_OPTS='
|
||||
--height=30%
|
||||
--layout=reverse
|
||||
--prompt="Manual: "
|
||||
--preview="echo {1} | sed -E \"s/^\((.+)\)/\1/\" | xargs -I{S} man -Pcat {S} {2} 2>/dev/null"'
|
||||
|
||||
while getopts ":s:" opt; do
|
||||
case $opt in
|
||||
s ) SECTION=$OPTARG; shift; shift;;
|
||||
\?) echo "Invalid option: -$OPTARG" >&2; exit 1;;
|
||||
: ) echo "Option -$OPTARG requires an argument" >&2; exit 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
manual=$(apropos -s ${SECTION:-''} ${@:-.} | \
|
||||
grep -v -E '^.+ \(0\)' |\
|
||||
awk '{print $2 " " $1}' | \
|
||||
sort | \
|
||||
fzf | \
|
||||
sed -E 's/^\((.+)\)/\1/')
|
||||
|
||||
[ -z "$manual" ] && exit 0
|
||||
man $manual
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
# reflector --list-countries
|
||||
|
||||
if [ "$(which curl)" != "curl not found" ]; then
|
||||
check_country=$(curl -s https://ipinfo.io/country)
|
||||
fi
|
||||
|
||||
if [ "$1" = "-lc" ]; then
|
||||
# mirrors -lc
|
||||
sudo reflector -c "$check_country" -c "RU" -c "YA" -c "PL" -c "GR" -a 12 -l 50 -f 20 -p https -p http --sort rate --save /etc/pacman.d/mirrorlist
|
||||
elif [ "$1" = "-c" ]; then
|
||||
# mirrors -c
|
||||
sudo reflector -c "$check_country" -f 20 -p https -p http --sort rate --save /etc/pacman.d/mirrorlist
|
||||
else
|
||||
# mirrors
|
||||
sudo reflector --verbose -a 12 -l 50 -f 15 -p https -p http --sort rate --save /etc/pacman.d/mirrorlist
|
||||
fi
|
||||
|
||||
sudo pacman -Syy
|
|
@ -0,0 +1,5 @@
|
|||
j=0;
|
||||
for i in ico_22_*.png;
|
||||
do let j+=1;
|
||||
mv $i ico_22_$j.png ;
|
||||
done
|
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# kunst + ncmpcpp = ♥
|
||||
# This script launches kunst and ncmpcpp
|
||||
# at the same time. Saves me from lunching
|
||||
# them separately
|
||||
|
||||
kunst --music_dir /media/files/mega/music/ --size 250x250+1100+490 --silent &
|
||||
# kunst.sh --music_dir /media/files/mega/music/ --size 250x250 --x 1100 --y 490 --silent &
|
||||
echo $! >/tmp/music.pid
|
||||
|
||||
ncmpcpp
|
||||
|
||||
kill -9 $(cat /tmp/kunst.pid) &> /dev/null
|
|
@ -0,0 +1,114 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
sublime_conf="$HOME/.config/sublime-text-3/Packages/User/Preferences.sublime-settings"
|
||||
qt_conf="$HOME/.config/qt5ct/qt5ct.conf"
|
||||
ob_rc="$HOME/.config/openbox/rc.xml"
|
||||
ob_autostart="$HOME/.config/openbox/autostart"
|
||||
xsettings_d="$HOME/.xsettingsd"
|
||||
|
||||
|
||||
# preferences for light theme mode
|
||||
OB_LIGHT_THEME="obll"
|
||||
PREF_LIGHT_THEME="ll"
|
||||
PREF_LIGHT_DECO="ll"
|
||||
PREF_LIGHT_BG="$HOME/.wall/wl1.jpg"
|
||||
PREF_LIGHT_BG_OB=".wall\\/wl1.jpg"
|
||||
PREF_LIGHT_ICO="ll-ico"
|
||||
|
||||
sublime_theme_light="gruvbox"
|
||||
sublime_colorscheme_light="Packages\\/User\\/Boxy Yesterday.tmTheme"
|
||||
|
||||
sublime_theme_dark="gruvbox"
|
||||
sublime_colorscheme_dark="Packages\\/One Dark Color Scheme\\/One Dark.tmTheme"
|
||||
|
||||
# preferences for dark theme mode
|
||||
OB_DARK_THEME="obln"
|
||||
PREF_DARK_THEME="ln"
|
||||
PREF_DARK_DECO="ln"
|
||||
PREF_DARK_BG="$HOME/.wall/wl3.jpg"
|
||||
PREF_DARK_BG_OB=".wall\\/wl3.jpg"
|
||||
PREF_DARK_ICO="ln-ico"
|
||||
|
||||
|
||||
# Xresources color theme ~/.colors
|
||||
xresources_conf="$HOME/.Xresources"
|
||||
|
||||
xresources_color_light="colors\\/ll"
|
||||
xresources_color_dark="colors\\/ln"
|
||||
|
||||
|
||||
de_theme="$(xfconf-query -c xsettings -p /Net/ThemeName)"
|
||||
|
||||
|
||||
if [[ "$de_theme" == "$PREF_LIGHT_THEME" ]]; then
|
||||
xfconf-query -c xsettings -p /Net/ThemeName -s $PREF_DARK_THEME
|
||||
# xfconf-query -c xsettings -p /Gtk/DecorationLayout -s menu:
|
||||
|
||||
gsettings set org.gnome.desktop.interface gtk-theme $PREF_DARK_THEME
|
||||
# gsettings set org.gnome.desktop.wm.preferences button-layout '"menu:"'
|
||||
|
||||
# sublime text
|
||||
sed -i -e "s/$sublime_colorscheme_light/$sublime_colorscheme_dark/g" "$sublime_conf"
|
||||
sed -i -e "s/$sublime_theme_light.sublime-theme/$sublime_theme_dark.sublime-theme/g" "$sublime_conf"
|
||||
|
||||
# ~/.xsettingsd
|
||||
sed -i -e "s/$PREF_LIGHT_THEME/$PREF_DARK_THEME/g" "$xsettings_d"
|
||||
sed -i -e "s/$PREF_LIGHT_ICO/$PREF_DARK_ICO/g" "$xsettings_d"
|
||||
killall xsettingsd
|
||||
xsettingsd &
|
||||
|
||||
# openbox theme
|
||||
sed -i -e "s/$OB_LIGHT_THEME/$OB_DARK_THEME/g" "$ob_rc"
|
||||
sed -i -e "s/$PREF_LIGHT_BG_OB/$PREF_DARK_BG_OB/g" "$ob_autostart"
|
||||
openbox --reconfigure
|
||||
|
||||
# urxvt color palet
|
||||
# sed -i -e "s/$xresources_color_light/$xresources_color_dark/g" "$xresources_conf"
|
||||
# xrdb -merge $HOME/.Xresources
|
||||
# kill -1 $(pidof urxvt)
|
||||
|
||||
# kitty
|
||||
# kitty @ set-colors -a $HOME/.config/kitty/night.conf
|
||||
|
||||
# qt5ct
|
||||
sed -i -e "s/icon_theme=$PREF_LIGHT_ICO/icon_theme=$PREF_DARK_ICO/g" "$qt_conf"
|
||||
|
||||
# wall
|
||||
hsetroot -fill $PREF_DARK_BG
|
||||
else
|
||||
xfconf-query -c xsettings -p /Net/ThemeName -s $PREF_LIGHT_THEME
|
||||
# xfconf-query -c xsettings -p /Gtk/DecorationLayout -s menu:
|
||||
|
||||
gsettings set org.gnome.desktop.interface gtk-theme $PREF_LIGHT_THEME
|
||||
# gsettings set org.gnome.desktop.wm.preferences button-layout '"menu:"'
|
||||
|
||||
# sublime text
|
||||
sed -i -e "s/$sublime_colorscheme_dark/$sublime_colorscheme_light/g" "$sublime_conf"
|
||||
sed -i -e "s/$sublime_theme_dark.sublime-theme/$sublime_theme_light.sublime-theme/g" "$sublime_conf"
|
||||
|
||||
# ~/.xsettingsd
|
||||
sed -i -e "s/$PREF_DARK_THEME/$PREF_LIGHT_THEME/g" "$xsettings_d"
|
||||
sed -i -e "s/$PREF_DARK_ICO/$PREF_LIGHT_ICO/g" "$xsettings_d"
|
||||
killall xsettingsd
|
||||
xsettingsd &
|
||||
|
||||
# openbox theme
|
||||
sed -i -e "s/$OB_DARK_THEME/$OB_LIGHT_THEME/g" "$ob_rc"
|
||||
sed -i -e "s/$PREF_DARK_BG_OB/$PREF_LIGHT_BG_OB/g" "$ob_autostart"
|
||||
openbox --reconfigure
|
||||
|
||||
# urxvt color palet
|
||||
# sed -i -e "s/$xresources_color_light/$xresources_color_dark/g" "$xresources_conf"
|
||||
# xrdb -merge $HOME/.Xresources
|
||||
# kill -1 $(pidof urxvt)
|
||||
|
||||
# kitty
|
||||
# kitty @ set-colors -a $HOME/.config/kitty/light.conf
|
||||
|
||||
# qt5ct
|
||||
sed -i -e "s/icon_theme=$PREF_DARK_ICO/icon_theme=$PREF_LIGHT_ICO/g" "$qt_conf"
|
||||
|
||||
# wall
|
||||
hsetroot -fill $PREF_LIGHT_BG
|
||||
fi
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
killall jgmenu
|
||||
jgmenu --config-file="$HOME/.config/jgmenu/ob-jgmenurc" &
|
|
@ -0,0 +1,437 @@
|
|||
#!/bin/bash
|
||||
|
||||
# . .
|
||||
# | |
|
||||
# ,-. |-. |- ,-: ,-. ;-.
|
||||
# | | | | | | | |-' | |
|
||||
# `-' `-' `-' `-| `-' ' '
|
||||
# `-'
|
||||
# Openbox Theme Generator
|
||||
|
||||
file=$HOME/.colors/ln
|
||||
wb(){
|
||||
{
|
||||
fill_color
|
||||
cat <<EOF
|
||||
|
||||
# Menu
|
||||
menu.border.width: 10
|
||||
menu.overlap.x: -20
|
||||
menu.overlap.y: -20
|
||||
|
||||
menu.border.color: #${get_colors_bg}
|
||||
menu.separator.color: #${get_colors_bg}
|
||||
|
||||
menu.title.bg: flat solid
|
||||
menu.title.bg.color: #${get_colors_bg}
|
||||
menu.title.text.color: #$(get_colors 4)
|
||||
menu.title.text.justify: Center
|
||||
|
||||
menu.items.bg: flat solid
|
||||
menu.items.bg.color: #${get_colors_bg}
|
||||
|
||||
menu.items.text.color: #$(get_colors 7)
|
||||
menu.items.disabled.text.color: #${get_colors_bg}
|
||||
|
||||
menu.items.active.bg: flat solid
|
||||
menu.items.active.bg.color: #${get_colors_bg}
|
||||
menu.items.active.text.color: #$(get_colors 4)
|
||||
|
||||
# Active window
|
||||
window.active.border.color: #$(get_colors 4)
|
||||
|
||||
window.active.title.bg: solid flat
|
||||
window.active.title.bg.color: #$(get_colors 4)
|
||||
window.active.title.separator.color: #$(get_colors 4)
|
||||
window.active.text.justify: center
|
||||
|
||||
window.active.label.bg: parentrelative
|
||||
window.active.label.text.color: #$(get_colors 4)
|
||||
|
||||
window.active.handle.bg: flat solid
|
||||
window.active.handle.bg.color: #$(get_colors 4)
|
||||
|
||||
window.active.grip.bg: flat solid
|
||||
window.active.grip.bg.color: #$(get_colors 4)
|
||||
|
||||
window.active.button.unpressed.bg: parentrelative
|
||||
window.active.button.unpressed.bg.color: #${get_colors_bg}
|
||||
|
||||
window.active.button.iconify.unpressed.image.color: #$(get_colors 7)
|
||||
window.active.button.iconify.pressed.image.color: #$(get_colors 3)
|
||||
window.active.button.iconify.hover.image.color: #$(get_colors 3)
|
||||
|
||||
window.active.button.max.unpressed.image.color: #$(get_colors 7)
|
||||
window.active.button.max.pressed.image.color: #$(get_colors 2)
|
||||
window.active.button.max.hover.image.color: #$(get_colors 2)
|
||||
|
||||
window.active.button.close.unpressed.image.color: #$(get_colors 7)
|
||||
window.active.button.close.pressed.image.color: #$(get_colors 1)
|
||||
window.active.button.close.hover.image.color: #$(get_colors 1)
|
||||
|
||||
window.active.button.shade.unpressed.image.color: #$(get_colors 7)
|
||||
window.active.button.shade.pressed.image.color: #$(get_colors 5)
|
||||
window.active.button.shade.hover.image.color: #$(get_colors 5)
|
||||
|
||||
window.active.button.desk.unpressed.image.color: #$(get_colors 7)
|
||||
window.active.button.desk.pressed.image.color: #$(get_colors 6)
|
||||
window.active.button.desk.hover.image.color: #$(get_colors 6)
|
||||
|
||||
window.active.button.pressed.bg: parentrelative
|
||||
window.active.button.pressed.bg.color: #$(get_colors 7)
|
||||
|
||||
window.active.button.disabled.bg: parentrelative
|
||||
window.active.button.disabled.bg.color: #${get_colors_bg}
|
||||
window.active.button.disabled.image.color: #${get_colors_bg}
|
||||
|
||||
window.active.button.toggled.bg: parentrelative
|
||||
window.active.button.toggled.image.color: #$(get_colors 5)
|
||||
|
||||
window.active.button.toggled.pressed.bg: parentrelative
|
||||
window.active.button.toggled.pressed.image.color: #$(get_colors 7)
|
||||
|
||||
# Inactive window
|
||||
window.inactive.border.color: #$(get_colors 5)
|
||||
|
||||
window.inactive.title.bg: flat solid
|
||||
window.inactive.title.bg.color: #$(get_colors 5)
|
||||
window.inactive.title.separator.color: #$(get_colors 5)
|
||||
window.inactive.text.justify: center
|
||||
|
||||
window.inactive.label.bg: parentrelative
|
||||
window.inactive.label.text.color: #$(get_colors 5)
|
||||
|
||||
window.inactive.handle.bg: flat solid
|
||||
window.inactive.handle.bg.color: #$(get_colors 5)
|
||||
|
||||
window.inactive.grip.bg: flat solid
|
||||
window.inactive.grip.bg.color: #$(get_colors 5)
|
||||
|
||||
window.inactive.button.unpressed.bg: parentrelative
|
||||
window.inactive.button.unpressed.bg.color: #${get_colors_bg}
|
||||
|
||||
window.inactive.button.iconify.unpressed.image.color: #$(get_colors 7)
|
||||
window.inactive.button.iconify.pressed.image.color: #$(get_colors 3)
|
||||
window.inactive.button.iconify.hover.image.color: #$(get_colors 3)
|
||||
|
||||
window.inactive.button.max.unpressed.image.color: #$(get_colors 7)
|
||||
window.inactive.button.max.pressed.image.color: #$(get_colors 2)
|
||||
window.inactive.button.max.hover.image.color: #$(get_colors 2)
|
||||
|
||||
window.inactive.button.close.unpressed.image.color: #$(get_colors 7)
|
||||
window.inactive.button.close.pressed.image.color: #$(get_colors 1)
|
||||
window.inactive.button.close.hover.image.color: #$(get_colors 1)
|
||||
|
||||
window.inactive.button.shade.unpressed.image.color: #$(get_colors 7)
|
||||
window.inactive.button.shade.pressed.image.color: #$(get_colors 5)
|
||||
window.inactive.button.shade.hover.image.color: #$(get_colors 5)
|
||||
|
||||
window.inactive.button.desk.unpressed.image.color: #$(get_colors 7)
|
||||
window.inactive.button.desk.pressed.image.color: #$(get_colors 6)
|
||||
window.inactive.button.desk.hover.image.color: #$(get_colors 6)
|
||||
|
||||
window.inactive.button.pressed.bg: parentrelative
|
||||
window.inactive.button.pressed.bg.color: #$(get_colors 4)
|
||||
|
||||
window.inactive.button.disabled.bg: parentrelative
|
||||
window.inactive.button.disabled.bg.color: #${get_colors_bg}
|
||||
window.inactive.button.disabled.image.color: #${get_colors_bg}
|
||||
|
||||
window.inactive.button.toggled.bg: parentrelative
|
||||
window.inactive.button.toggled.image.color: #$(get_colors 4)
|
||||
|
||||
window.inactive.button.toggled.pressed.bg: parentrelative
|
||||
window.inactive.button.toggled.pressed.image.color: #$(get_colors 4)
|
||||
|
||||
# OSD
|
||||
osd.border.width: 3
|
||||
osd.border.color: #${get_colors_bg}
|
||||
|
||||
osd.bg: flat solid
|
||||
osd.bg.color: #${get_colors_bg}
|
||||
osd.label.bg: flat solid
|
||||
osd.label.bg.color: #${get_colors_bg}
|
||||
osd.label.text.color: #$(get_colors 7)
|
||||
|
||||
osd.hilight.bg: flat solid
|
||||
osd.hilight.bg.color: #$(get_colors 4)
|
||||
|
||||
osd.unhilight.bg: flat solid
|
||||
osd.unhilight.bg.color: #$(get_colors 8)
|
||||
|
||||
osd.button.unpressed.bg: flat border
|
||||
osd.button.unpressed.bg.color: #$(get_colors 8)
|
||||
osd.button.unpressed.*.border.color: #${get_colors_bg}
|
||||
|
||||
osd.button.pressed.bg: flat border
|
||||
osd.button.pressed.bg.color: #$(get_colors 8)
|
||||
osd.button.pressed.*.border.color: #${get_colors_bg}
|
||||
|
||||
osd.button.focused.bg: flat solid border
|
||||
osd.button.focused.bg.color: #${get_colors_bg}
|
||||
osd.button.focused.*.border.color: #${get_colors_bg}
|
||||
|
||||
osd.button.focused.box.color: #$(get_colors 4)
|
||||
|
||||
# Fonts
|
||||
window.active.label.text.font: shadow=n
|
||||
window.inactive.label.text.font: shadow=n
|
||||
menu.items.font: shadow=n
|
||||
menu.title.text.font: shadow=n
|
||||
|
||||
# Everything else
|
||||
border.width: 0
|
||||
padding.width: 15
|
||||
padding.height: 10
|
||||
window.handle.width: 0
|
||||
window.client.padding.width: 0
|
||||
window.label.text.justify: center
|
||||
|
||||
EOF
|
||||
} > ~/.local/bin/my-obtgen/openbox-3/themerc
|
||||
cp ~/.local/bin/my-obtgen/openbox-3/* ~/.themes/myobtheme/openbox-3/
|
||||
check_theme
|
||||
}
|
||||
|
||||
nrml(){
|
||||
{
|
||||
fill_color
|
||||
cat <<EOF
|
||||
|
||||
# Menu
|
||||
menu.border.width: 10
|
||||
menu.overlap.x: -20
|
||||
menu.overlap.y: -20
|
||||
|
||||
menu.border.color: #${get_colors_bg}
|
||||
menu.separator.color: #${get_colors_bg}
|
||||
|
||||
menu.title.bg: flat solid
|
||||
menu.title.bg.color: #${get_colors_bg}
|
||||
menu.title.text.color: #$(get_colors 4)
|
||||
menu.title.text.justify: Center
|
||||
|
||||
menu.items.bg: flat solid
|
||||
menu.items.bg.color: #${get_colors_bg}
|
||||
|
||||
menu.items.text.color: #$(get_colors 7)
|
||||
menu.items.disabled.text.color: #${get_colors_bg}
|
||||
|
||||
menu.items.active.bg: flat solid
|
||||
menu.items.active.bg.color: #${get_colors_bg}
|
||||
menu.items.active.text.color: #$(get_colors 4)
|
||||
|
||||
# Active window
|
||||
window.active.border.color: #$(get_colors 4)
|
||||
|
||||
window.active.title.bg: solid flat
|
||||
window.active.title.bg.color: #${get_colors_bg}
|
||||
window.active.title.separator.color: #${get_colors_bg}
|
||||
window.active.text.justify: center
|
||||
|
||||
window.active.label.bg: parentrelative
|
||||
window.active.label.text.color: #${get_colors_bg}
|
||||
|
||||
window.active.handle.bg: flat solid
|
||||
window.active.handle.bg.color: #$(get_colors 4)
|
||||
|
||||
window.active.grip.bg: flat solid
|
||||
window.active.grip.bg.color: #$(get_colors 4)
|
||||
|
||||
window.active.button.unpressed.bg: parentrelative
|
||||
window.active.button.unpressed.bg.color: #${get_colors_bg}
|
||||
|
||||
window.active.button.iconify.unpressed.image.color: #$(get_colors 3)
|
||||
window.active.button.iconify.pressed.image.color: #$(get_colors 3)
|
||||
window.active.button.iconify.hover.image.color: #$(get_colors 3)
|
||||
|
||||
window.active.button.max.unpressed.image.color: #$(get_colors 2)
|
||||
window.active.button.max.pressed.image.color: #$(get_colors 2)
|
||||
window.active.button.max.hover.image.color: #$(get_colors 2)
|
||||
|
||||
window.active.button.close.unpressed.image.color: #$(get_colors 1)
|
||||
window.active.button.close.pressed.image.color: #$(get_colors 1)
|
||||
window.active.button.close.hover.image.color: #$(get_colors 1)
|
||||
|
||||
window.active.button.shade.unpressed.image.color: #$(get_colors 5)
|
||||
window.active.button.shade.pressed.image.color: #$(get_colors 5)
|
||||
window.active.button.shade.hover.image.color: #$(get_colors 5)
|
||||
|
||||
window.active.button.desk.unpressed.image.color: #$(get_colors 6)
|
||||
window.active.button.desk.pressed.image.color: #$(get_colors 6)
|
||||
window.active.button.desk.hover.image.color: #$(get_colors 6)
|
||||
|
||||
window.active.button.pressed.bg: parentrelative
|
||||
window.active.button.pressed.bg.color: #${get_colors_bg}
|
||||
|
||||
window.active.button.disabled.bg: parentrelative
|
||||
window.active.button.disabled.bg.color: #${get_colors_bg}
|
||||
window.active.button.disabled.image.color: #${get_colors_bg}
|
||||
|
||||
window.active.button.toggled.bg: parentrelative
|
||||
window.active.button.toggled.image.color: #$(get_colors 4)
|
||||
|
||||
window.active.button.toggled.pressed.bg: parentrelative
|
||||
window.active.button.toggled.pressed.image.color: #$(get_colors 4)
|
||||
|
||||
# Inactive window
|
||||
window.inactive.border.color: #$(get_colors 5)
|
||||
|
||||
window.inactive.title.bg: flat solid
|
||||
window.inactive.title.bg.color: #${get_colors_bg}
|
||||
window.inactive.title.separator.color: #${get_colors_bg}
|
||||
window.inactive.text.justify: center
|
||||
|
||||
window.inactive.label.bg: parentrelative
|
||||
window.inactive.label.text.color: #${get_colors_bg}
|
||||
|
||||
window.inactive.handle.bg: flat solid
|
||||
window.inactive.handle.bg.color: #$(get_colors 5)
|
||||
|
||||
window.inactive.grip.bg: flat solid
|
||||
window.inactive.grip.bg.color: #$(get_colors 5)
|
||||
|
||||
window.inactive.button.unpressed.bg: parentrelative
|
||||
window.inactive.button.unpressed.bg.color: #${get_colors_bg}
|
||||
|
||||
window.inactive.button.iconify.unpressed.image.color: #$(get_colors 8)
|
||||
window.inactive.button.iconify.pressed.image.color: #$(get_colors 3)
|
||||
window.inactive.button.iconify.hover.image.color: #$(get_colors 3)
|
||||
|
||||
window.inactive.button.max.unpressed.image.color: #$(get_colors 8)
|
||||
window.inactive.button.max.pressed.image.color: #$(get_colors 2)
|
||||
window.inactive.button.max.hover.image.color: #$(get_colors 2)
|
||||
|
||||
window.inactive.button.close.unpressed.image.color: #$(get_colors 8)
|
||||
window.inactive.button.close.pressed.image.color: #$(get_colors 1)
|
||||
window.inactive.button.close.hover.image.color: #$(get_colors 1)
|
||||
|
||||
window.inactive.button.shade.unpressed.image.color: #$(get_colors 8)
|
||||
window.inactive.button.shade.pressed.image.color: #$(get_colors 5)
|
||||
window.inactive.button.shade.hover.image.color: #$(get_colors 5)
|
||||
|
||||
window.inactive.button.desk.unpressed.image.color: #$(get_colors 8)
|
||||
window.inactive.button.desk.pressed.image.color: #$(get_colors 6)
|
||||
window.inactive.button.desk.hover.image.color: #$(get_colors 6)
|
||||
|
||||
window.inactive.button.pressed.bg: flat solid
|
||||
window.inactive.button.pressed.bg.color: #$(get_colors 4)
|
||||
|
||||
window.inactive.button.disabled.bg: flat solid
|
||||
window.inactive.button.disabled.bg.color: #${get_colors_bg}
|
||||
window.inactive.button.disabled.image.color: #${get_colors_bg}
|
||||
|
||||
window.inactive.button.toggled.bg: parentrelative
|
||||
window.inactive.button.toggled.image.color: #$(get_colors 4)
|
||||
|
||||
window.inactive.button.toggled.pressed.bg: parentrelative
|
||||
window.inactive.button.toggled.pressed.image.color: #$(get_colors 4)
|
||||
|
||||
# OSD
|
||||
osd.border.width: 3
|
||||
osd.border.color: #${get_colors_bg}
|
||||
|
||||
osd.bg: flat solid
|
||||
osd.bg.color: #${get_colors_bg}
|
||||
osd.label.bg: flat solid
|
||||
osd.label.bg.color: #${get_colors_bg}
|
||||
osd.label.text.color: #$(get_colors 7)
|
||||
|
||||
osd.hilight.bg: flat solid
|
||||
osd.hilight.bg.color: #$(get_colors 4)
|
||||
|
||||
osd.unhilight.bg: flat solid
|
||||
osd.unhilight.bg.color: #$(get_colors 8)
|
||||
|
||||
osd.button.unpressed.bg: flat border
|
||||
osd.button.unpressed.bg.color: #$(get_colors 8)
|
||||
osd.button.unpressed.*.border.color: #${get_colors_bg}
|
||||
|
||||
osd.button.pressed.bg: flat border
|
||||
osd.button.pressed.bg.color: #$(get_colors 8)
|
||||
osd.button.pressed.*.border.color: #${get_colors_bg}
|
||||
|
||||
osd.button.focused.bg: flat solid border
|
||||
osd.button.focused.bg.color: #${get_colors_bg}
|
||||
osd.button.focused.*.border.color: #${get_colors_bg}
|
||||
|
||||
osd.button.focused.box.color: #$(get_colors 4)
|
||||
|
||||
# Fonts
|
||||
window.active.label.text.font: shadow=n
|
||||
window.inactive.label.text.font: shadow=n
|
||||
menu.items.font: shadow=n
|
||||
menu.title.text.font: shadow=n
|
||||
|
||||
# Everything else
|
||||
border.width: 5
|
||||
padding.width: 15
|
||||
padding.height: 10
|
||||
window.handle.width: 0
|
||||
window.client.padding.width: 0
|
||||
window.label.text.justify: center
|
||||
|
||||
EOF
|
||||
} > ~/.local/bin/myobtheme/openbox-3/themerc
|
||||
cp -r ~/.local/bin/myobtheme/ ~/.themes/
|
||||
check_theme
|
||||
}
|
||||
|
||||
fill_color(){
|
||||
get_colors(){
|
||||
grep "color$1 *:" $file | awk -F\# '{print $2}' | head -1
|
||||
}
|
||||
get_colors_bg=`grep "background *:" $file | awk -F\# '{print $2}' | head -1`
|
||||
}
|
||||
|
||||
check_theme(){
|
||||
if [[ $(cat $HOME/.config/openbox/rc.xml | grep "myobtheme") ]]; then
|
||||
notify-send "Done. now you can try your theme :)"
|
||||
openbox --reconfigure
|
||||
elif [[ $(find /usr/lib -type d -name lxappearance | xargs ls -R | grep ob) ]]; then
|
||||
lxappearance >/dev/null 2>&1
|
||||
elif [[ $(which obconf) ]]; then
|
||||
obconf >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
help(){
|
||||
cat <<-EOF
|
||||
|
||||
888 888
|
||||
888 888
|
||||
888 888
|
||||
.d88b. 88888b. 888888 .d88b. .d88b. 88888b.
|
||||
d88""88b888 "88b888 d88P"88bd8P Y8b888 "88b
|
||||
888 888888 888888 888 88888888888888 888
|
||||
Y88..88P888 d88PY88b. Y88b 888Y8b. 888 888
|
||||
"Y88P" 88888P" "Y888 "Y88888 "Y8888 888 888
|
||||
888
|
||||
Y8b d88P
|
||||
"Y88P"
|
||||
|
||||
Openbox Theme Generator
|
||||
|
||||
Usage : obtgen [options #optional]
|
||||
|
||||
Avaible options
|
||||
--wal Generate color from pywal cache
|
||||
--wb Generate borderless theme
|
||||
--help Show help
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
if [[ "$(echo "$@" | grep '\--wal')" && "$(echo "$@" | grep '\--wb')" ]]; then
|
||||
file=$HOME/.cache/wal/colors.Xresources
|
||||
wb
|
||||
elif [[ "$(echo "$@" | grep '\--wb')" ]]; then
|
||||
wb
|
||||
elif [[ "$(echo "$@" | grep '\--wal')" ]]; then
|
||||
file=$HOME/.cache/wal/colors.Xresources
|
||||
nrml
|
||||
elif [[ "$(echo "$@" | grep '\--help')" ]]; then
|
||||
help
|
||||
else
|
||||
nrml
|
||||
fi
|
|
@ -0,0 +1,79 @@
|
|||
#!/bin/bash
|
||||
|
||||
openbox_autostart="$HOME/.config/openbox/autostart"
|
||||
ob_rc_xml="$HOME/.config/openbox/rc.xml"
|
||||
xsettingsd_conf="$HOME/.xsettingsd"
|
||||
qt_conf="$HOME/.config/qt5ct/qt5ct.conf"
|
||||
sublime_conf="$HOME/.config/sublime-text-3/Packages/User/Preferences.sublime-settings"
|
||||
|
||||
|
||||
# preferences for light theme mode
|
||||
PREF_LIGHT_THEME="lui"
|
||||
PREF_LIGHT_BG="$HOME/.wall/Crowl.png"
|
||||
PREF_LIGHT_ICO="lui-ico"
|
||||
|
||||
sublime_theme_light="gruvbox"
|
||||
sublime_colorscheme_light="Packages\\/User\\/Boxy Yesterday.tmTheme"
|
||||
|
||||
# preferences for dark theme mode
|
||||
PREF_DARK_THEME="dui"
|
||||
PREF_DARK_BG="$HOME/.wall/lcrow.png"
|
||||
PREF_DARK_ICO="dui-ico"
|
||||
|
||||
sublime_theme_dark="gruvbox"
|
||||
sublime_colorscheme_dark="Packages\\/One Dark Color Scheme\\/One Dark.tmTheme"
|
||||
|
||||
|
||||
# wall
|
||||
hsetroot_autostart_light="hsetroot -fill ~\\/.wall\\/Crowl.png"
|
||||
hsetroot_autostart_dark="hsetroot -fill ~\\/.wall\\/lcrow.png"
|
||||
|
||||
|
||||
# Xresources color theme ~/.colors
|
||||
xresources_conf="$HOME/.Xresources"
|
||||
|
||||
xresources_color_light="colors\\/lui"
|
||||
xresources_color_dark="colors\\/dui"
|
||||
|
||||
|
||||
ob_theme="$(awk -F "[<,>]" '/<theme/ {getline; print $3}' "$ob_rc_xml")"
|
||||
|
||||
|
||||
if [[ "$ob_theme" == "$PREF_LIGHT_THEME" ]]; then
|
||||
hsetroot -fill $PREF_DARK_BG
|
||||
sed -i -e "s/$hsetroot_autostart_light/$hsetroot_autostart_dark/g" "$openbox_autostart"
|
||||
sed -i -e "s/$PREF_LIGHT_THEME/$PREF_DARK_THEME/g" "$ob_rc_xml"
|
||||
openbox --reconfigure
|
||||
|
||||
sed -i -e "s/$PREF_LIGHT_THEME/$PREF_DARK_THEME/g" "$xsettingsd_conf"
|
||||
sed -i -e 's/IconThemeName "$PREF_LIGHT_ICO"/IconThemeName "$PREF_DARK_ICO"/g' "$xsettingsd_conf"
|
||||
xsettingsd &
|
||||
|
||||
sed -i -e "s/$sublime_colorscheme_light/$sublime_colorscheme_dark/g" "$sublime_conf"
|
||||
sed -i -e "s/$sublime_theme_light.sublime-theme/$sublime_theme_dark.sublime-theme/g" "$sublime_conf"
|
||||
|
||||
sed -i -e "s/$xresources_color_light/$xresources_color_dark/g" "$xresources_conf"
|
||||
xrdb -merge $HOME/.Xresources
|
||||
kill -1 $(pidof urxvtd)
|
||||
|
||||
sed -i -e "s/icon_theme='$PREF_LIGHT_ICO'/icon_theme='$PREF_DARK_ICO'/g" "$qt_conf"
|
||||
|
||||
else
|
||||
hsetroot -fill $PREF_LIGHT_BG
|
||||
sed -i -e "s/$hsetroot_autostart_dark/$hsetroot_autostart_light/g" "$openbox_autostart"
|
||||
sed -i -e "s/$PREF_DARK_THEME/$PREF_LIGHT_THEME/g" "$ob_rc_xml"
|
||||
openbox --reconfigure
|
||||
|
||||
sed -i -e "s/$PREF_DARK_THEME/$PREF_LIGHT_THEME/g" "$xsettingsd_conf"
|
||||
sed -i -e 's/IconThemeName "$PREF_DARK_ICO"/IconThemeName "$PREF_LIGHT_ICO"/g' "$xsettingsd_conf"
|
||||
xsettingsd &
|
||||
|
||||
sed -i -e "s/$sublime_colorscheme_dark/$sublime_colorscheme_light/g" "$sublime_conf"
|
||||
sed -i -e "s/$sublime_theme_dark.sublime-theme/$sublime_theme_light.sublime-theme/g" "$sublime_conf"
|
||||
|
||||
sed -i -e "s/$xresources_color_dark/$xresources_color_light/g" "$xresources_conf"
|
||||
xrdb -merge $HOME/.Xresources
|
||||
kill -1 $(pidof urxvtd)
|
||||
|
||||
sed -i -e "s/icon_theme='$PREF_DARK_ICO'/icon_theme='$PREF_LIGHT_ICO'/g" "$qt_conf"
|
||||
fi
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
sudo sed -i '/#Color/ s/^#//' /etc/pacman.conf
|
||||
sudo sed -i '/^Co/ aILoveCandy' /etc/pacman.conf
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
colorpicker --short --one-shot --preview | head -c -1 | xsel -b -i
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh
|
||||
|
||||
# 1 variant
|
||||
# TOGGLE_CMD='polybar-msg cmd toggle &'
|
||||
# SHOW_CMD='polybar-msg cmd show &'
|
||||
# HIDE_CMD='polybar-msg cmd hide &'
|
||||
|
||||
# 2 variant
|
||||
# pacman -S xdo
|
||||
# SHOW_CMD='xdo show -N Polybar'
|
||||
# HIDE_CMD='xdo hide -N Polybar'
|
||||
|
||||
BAR_HEIGHT_SHOW=2
|
||||
BAR_HEIGHT_HIDE=22
|
||||
SHOW_CMD='polybar-msg cmd show &'
|
||||
HIDE_CMD='polybar-msg cmd hide &'
|
||||
|
||||
# Return y-position of cursor
|
||||
get_y_position() {
|
||||
loc=$(xdotool getmouselocation --shell | grep Y)
|
||||
echo ${loc:2}
|
||||
}
|
||||
|
||||
hidden=true
|
||||
eval $HIDE_CMD
|
||||
while :; do
|
||||
|
||||
y_loc=$(get_y_position)
|
||||
sleep 0.10
|
||||
|
||||
if (( y_loc < BAR_HEIGHT_SHOW )) && [ "$hidden" = true ]; then
|
||||
eval $SHOW_CMD
|
||||
hidden=false
|
||||
fi
|
||||
|
||||
if (( y_loc >= BAR_HEIGHT_HIDE )) && [ "$hidden" = false ]; then
|
||||
eval $HIDE_CMD
|
||||
hidden=true
|
||||
fi
|
||||
done
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
killall picom
|
||||
|
||||
if [ "$1" = "glx" ]; then
|
||||
picom --config $HOME/.config/picom.conf -b
|
||||
else
|
||||
picom --config $HOME/.config/picom.conf --backend xrender -b
|
||||
fi
|
|
@ -0,0 +1,4 @@
|
|||
#! /bin/sh
|
||||
|
||||
placeholder=$1
|
||||
curl -F"file=@$placeholder" http://0x0.st | xsel -b -i
|
|
@ -0,0 +1,136 @@
|
|||
#!/usr/bin/env bash
|
||||
# pipes.sh: Animated pipes terminal screensaver.
|
||||
#
|
||||
# This modified version is maintained at:
|
||||
#
|
||||
# https://github.com/pipeseroni/pipes.sh
|
||||
|
||||
VERSION=1.2.0
|
||||
|
||||
M=32768
|
||||
p=1
|
||||
f=75 s=13 r=2000 t=0
|
||||
w=80 h=24
|
||||
|
||||
resize() {
|
||||
w=$(tput cols) h=$(tput lines)
|
||||
}
|
||||
|
||||
# ab -> idx = a*4 + b
|
||||
# 0: up, 1: right, 2: down, 3: left
|
||||
# 00 means going up , then going up -> ┃
|
||||
# 12 means going right, then going down -> ┓
|
||||
sets=(
|
||||
"┃┏ ┓┛━┓ ┗┃┛┗ ┏━"
|
||||
"│╭ ╮╯─╮ ╰│╯╰ ╭─"
|
||||
"│┌ ┐┘─┐ └│┘└ ┌─"
|
||||
"║╔ ╗╝═╗ ╚║╝╚ ╔═"
|
||||
"|+ ++-+ +|++ +-"
|
||||
"|/ \/-\ \|/\ /-"
|
||||
".. .... .... .."
|
||||
".o oo.o o.oo o."
|
||||
"-\ /\|/ /-\/ \|" # railway
|
||||
"╿┍ ┑┚╼┒ ┕╽┙┖ ┎╾" # knobby pipe
|
||||
)
|
||||
v=()
|
||||
RNDSTART=0
|
||||
BOLD=1
|
||||
NOCOLOR=0
|
||||
|
||||
OPTIND=1
|
||||
while getopts "p:t:f:s:r:RBChv" arg; do
|
||||
case $arg in
|
||||
p) ((p=(OPTARG>0)?OPTARG:p));;
|
||||
t)
|
||||
if [[ "$OPTARG" = c???????????????? ]]; then
|
||||
V+=(${#sets[@]})
|
||||
sets+=("${OPTARG:1}")
|
||||
else
|
||||
((OPTARG>=0 && OPTARG<${#sets[@]})) && V+=($OPTARG)
|
||||
fi
|
||||
;;
|
||||
f) ((f=(OPTARG>19 && OPTARG<101)?OPTARG:f));;
|
||||
s) ((s=(OPTARG>4 && OPTARG<16 )?OPTARG:s));;
|
||||
r) ((r=(OPTARG>=0)?OPTARG:r));;
|
||||
R) RNDSTART=1;;
|
||||
B) BOLD=0;;
|
||||
C) NOCOLOR=1;;
|
||||
h) echo -e "Usage: $(basename $0) [OPTION]..."
|
||||
echo -e "Animated pipes terminal screensaver.\n"
|
||||
echo -e " -p [1-]\tnumber of pipes (D=1)."
|
||||
echo -e " -t [0-$((${#sets[@]} - 1))]\ttype of pipes, can be used more than once (D=0)."
|
||||
echo -e " -t c[16 chars]\tcustom type of pipes."
|
||||
echo -e " -f [20-100]\tframerate (D=75)."
|
||||
echo -e " -s [5-15]\tprobability of a straight fitting (D=13)."
|
||||
echo -e " -r LIMIT\treset after x characters, 0 if no limit (D=2000)."
|
||||
echo -e " -R \t\trandom starting point."
|
||||
echo -e " -B \t\tno bold effect."
|
||||
echo -e " -C \t\tno color."
|
||||
echo -e " -h\t\thelp (this screen)."
|
||||
echo -e " -v\t\tprint version number.\n"
|
||||
exit 0;;
|
||||
v) echo "$(basename -- "$0") $VERSION"
|
||||
exit 0
|
||||
esac
|
||||
done
|
||||
|
||||
# set default values if not by options
|
||||
((${#V[@]})) || V=(0)
|
||||
|
||||
cleanup() {
|
||||
# clear up standard input
|
||||
read -t 0.001 && cat </dev/stdin>/dev/null
|
||||
|
||||
# terminal has no smcup and rmcup capabilities
|
||||
((FORCE_RESET)) && reset && exit 0
|
||||
|
||||
tput rmcup
|
||||
tput cnorm
|
||||
stty echo
|
||||
((NOCOLOR)) && echo -ne '\x1b[0m'
|
||||
exit 0
|
||||
}
|
||||
trap resize SIGWINCH
|
||||
trap cleanup HUP TERM
|
||||
trap 'break 2' INT
|
||||
|
||||
resize
|
||||
|
||||
for (( i=1; i<=p; i++ )); do
|
||||
c[i]=$((i%8)) n[i]=0 l[i]=0
|
||||
((x[i]=RNDSTART==1?RANDOM*w/32768:w/2))
|
||||
((y[i]=RNDSTART==1?RANDOM*h/32768:h/2))
|
||||
v[i]=${V[${#V[@]} * RANDOM / M]}
|
||||
done
|
||||
|
||||
stty -echo
|
||||
tput smcup || FORCE_RESET=1
|
||||
tput civis
|
||||
tput clear
|
||||
# any key press exits the loop and this script
|
||||
while REPLY=; read -t 0.0$((1000/f)) -n 1 2>/dev/null; [[ -z $REPLY ]] ; do
|
||||
for (( i=1; i<=p; i++ )); do
|
||||
# New position:
|
||||
((${l[i]}%2)) && ((x[i]+=-${l[i]}+2,1)) || ((y[i]+=${l[i]}-1))
|
||||
|
||||
# Loop on edges (change color on loop):
|
||||
((${x[i]}>=w||${x[i]}<0||${y[i]}>=h||${y[i]}<0)) && ((c[i]=RANDOM%8, v[i]=V[${#V[@]}*RANDOM/M]))
|
||||
((x[i]=(x[i]+w)%w))
|
||||
((y[i]=(y[i]+h)%h))
|
||||
|
||||
# New random direction:
|
||||
((n[i]=RANDOM%s-1))
|
||||
((n[i]=(${n[i]}>1||${n[i]}==0)?${l[i]}:${l[i]}+${n[i]}))
|
||||
((n[i]=(${n[i]}<0)?3:${n[i]}%4))
|
||||
|
||||
# Print:
|
||||
tput cup ${y[i]} ${x[i]}
|
||||
echo -ne "\x1b[${BOLD}m"
|
||||
[[ $NOCOLOR == 0 ]] && echo -ne "\x1b[3${c[i]}m"
|
||||
echo -n "${sets[v[i]]:l[i]*4+n[i]:1}"
|
||||
l[i]=${n[i]}
|
||||
done
|
||||
((r>0 && t*p>=r)) && tput reset && tput civis && t=0 || ((t++))
|
||||
done
|
||||
|
||||
cleanup
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
|
||||
pkg_list=$(grep -h -v ^# ~/.pkglist.txt)
|
||||
sudo pacman -S --noconfirm --needed - < $pkg_list
|
||||
|
||||
aur_list=$(grep -h -v ^# ~/.aurlist.txt)
|
||||
yay -S --noconfirm --needed - < $aur_list
|
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# ffmpeg -i .wall/Crowl.png -s 1366x768 .pscircle.png
|
||||
# convert -resize 1366x768 .wall/Crowl.png .pscircle.png
|
||||
|
||||
# xfce wall
|
||||
# xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image -s ~/.pscircle.png
|
||||
|
||||
TIME_INTERVAL=3 # Seconds
|
||||
|
||||
# gsettings set org.gnome.desktop.background picture-uri file:///tmp/output.png
|
||||
# xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image -s ~/.pscircle.png
|
||||
# xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorVGA-0/workspace0/last-image -s ~/.pscircle.png
|
||||
# hsetroot -fill $HOME/.pscircle.png
|
||||
|
||||
output=$HOME/.wall/pscircle.png
|
||||
|
||||
while [ 1 ]; do
|
||||
# Replace the next line with any parameters given in the examples.
|
||||
pscircle \
|
||||
--output-width=1366 \
|
||||
--output-height=768 \
|
||||
--background-image=$HOME/.wall/.pscircle.png \
|
||||
--link-color-min=444444 \
|
||||
--link-color-max=375143 \
|
||||
--dot-color-min=b4b6e4 \
|
||||
--dot-color-max=ffa2b1 \
|
||||
--tree-font-color=87d2ff \
|
||||
--toplists-font-color=C8D2D7 \
|
||||
--toplists-pid-font-color=7B9098 \
|
||||
--toplists-bar-background=444444 \
|
||||
--toplists-bar-color=87d2ff \
|
||||
--max-children=55 \
|
||||
--tree-radius-increment=110 \
|
||||
--dot-radius=3 \
|
||||
--link-width=1.3 \
|
||||
--tree-font-face="Clear Sans Medium" \
|
||||
--tree-font-size=11 \
|
||||
--toplists-font-size=12 \
|
||||
--toplists-bar-width=30 \
|
||||
--toplists-row-height=15 \
|
||||
--toplists-bar-height=3 \
|
||||
--cpulist-center=400.0:-80.0 \
|
||||
--memlist-center=400.0:80.0 \
|
||||
--interval=0 \
|
||||
--output=$output
|
||||
|
||||
hsetroot -fill $output
|
||||
sleep $TIME_INTERVAL
|
||||
done
|
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# ffmpeg -i .wall/Crowl.png -s 1366x768 .pscircle.png
|
||||
# convert -resize 1366x768 .wall/Crowl.png .pscircle.png
|
||||
|
||||
# xfce wall
|
||||
# xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image -s ~/.pscircle.png
|
||||
|
||||
TIME_INTERVAL=3 # Seconds
|
||||
|
||||
# gsettings set org.gnome.desktop.background picture-uri file:///tmp/output.png
|
||||
# xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image -s ~/.pscircle.png
|
||||
# hsetroot -fill $HOME/.pscircle.png
|
||||
|
||||
output=$HOME/.wall/pscircle.png
|
||||
|
||||
while [ 1 ]; do
|
||||
# Replace the next line with any parameters given in the examples.
|
||||
pscircle \
|
||||
--output-width=1366 \
|
||||
--output-height=768 \
|
||||
--background-image=$HOME/.pscircle.png \
|
||||
--link-color-min=aaa \
|
||||
--link-color-max=900 \
|
||||
--dot-color-min=0a0 \
|
||||
--dot-color-max=900 \
|
||||
--tree-font-color=444 \
|
||||
--toplists-font-color=444 \
|
||||
--toplists-pid-font-color=777 \
|
||||
--toplists-bar-background=999 \
|
||||
--toplists-bar-color=ddbf54 \
|
||||
--max-children=55 \
|
||||
--tree-radius-increment=110 \
|
||||
--dot-radius=3 \
|
||||
--link-width=1.3 \
|
||||
--tree-font-face="Clear Sans Medium" \
|
||||
--tree-font-size=11 \
|
||||
--toplists-font-size=12 \
|
||||
--toplists-bar-width=30 \
|
||||
--toplists-row-height=15 \
|
||||
--toplists-bar-height=3 \
|
||||
--cpulist-center=400.0:-80.0 \
|
||||
--memlist-center=400.0:80.0 \
|
||||
--interval=0 \
|
||||
--output=$output
|
||||
|
||||
hsetroot -fill $output
|
||||
sleep $TIME_INTERVAL
|
||||
done
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/bash
|
||||
|
||||
# qemu-img create -f qcow2 ctlos.qcow2 14G
|
||||
|
||||
# -net nic -net user,hostfwd=tcp::22222-:22 \
|
||||
# sudo systemctl start sshd
|
||||
# ssh -p 22222 liveuser@localhost
|
||||
# -net nic -net user \
|
||||
# -vnc :1 \
|
||||
|
||||
QVIRT_DIR=$HOME/.qvirt
|
||||
QVIRT_QCOW=arch.qcow2
|
||||
QVIRT_SIZE=10G
|
||||
|
||||
# create dir & drive
|
||||
if [ ! -d $QVIRT_DIR ]; then
|
||||
mkdir -p $QVIRT_DIR
|
||||
qemu-img create -f qcow2 $QVIRT_DIR/$QVIRT_QCOW $QVIRT_SIZE
|
||||
fi
|
||||
|
||||
if [ "$1" = "-i" ]; then
|
||||
# qvirt -i
|
||||
qemu-system-x86_64 \
|
||||
-enable-kvm \
|
||||
-m 2048M \
|
||||
-net nic,model=virtio -net user,hostfwd=tcp::22222-:22 \
|
||||
-vga qxl \
|
||||
-device AC97 \
|
||||
-drive file=$QVIRT_DIR/$QVIRT_QCOW,if=virtio \
|
||||
-cdrom $2 \
|
||||
-boot d
|
||||
else
|
||||
# qvirt
|
||||
qemu-system-x86_64 \
|
||||
-enable-kvm \
|
||||
-m 2048M \
|
||||
-net nic,model=virtio-net-pci -net user,hostfwd=tcp::22222-:22 \
|
||||
-vga qxl \
|
||||
-device AC97 \
|
||||
-hda $1
|
||||
fi
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/sh
|
||||
# reload-browser - A cross-platform wrapper for reloading the current
|
||||
# browser tab
|
||||
# Eric Radman, 2014
|
||||
# http://eradman.com/entrproject/scripts/
|
||||
|
||||
usage() {
|
||||
case `uname` in
|
||||
Darwin)
|
||||
# applescript needs the exact title
|
||||
echo "Usage: $(basename $0) Firefox [Safari \"Google Chrome\" ...]"
|
||||
;;
|
||||
*)
|
||||
# xdotool uses regular expressions
|
||||
echo "Usage: $(basename $0) Firefox [Chrome ...]"
|
||||
;;
|
||||
esac
|
||||
exit 1
|
||||
}
|
||||
[ $# -lt 1 ] && usage
|
||||
|
||||
for app in "$@"
|
||||
do
|
||||
case `uname` in
|
||||
Darwin)
|
||||
/usr/bin/osascript <<-APPLESCRIPT
|
||||
set prev to (path to frontmost application as text)
|
||||
tell application "$app"
|
||||
activate
|
||||
end tell
|
||||
delay 0.5
|
||||
tell application "System Events" to keystroke "r" using {command down}
|
||||
delay 0.5
|
||||
activate application prev
|
||||
APPLESCRIPT
|
||||
;;
|
||||
*)
|
||||
xdotool search --onlyvisible --class "$app" windowfocus key \
|
||||
--window %@ 'ctrl+r' || {
|
||||
1>&2 echo "unable to signal an application named \"$app\""
|
||||
}
|
||||
;;
|
||||
esac
|
||||
done
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/sh
|
||||
|
||||
DIALOG_RESULT=$(echo -e 'chromium\nsubl3\ntelegram\nthunar\ndiscord\nsteam\npavucontrol\nCalculator\nlxappearance\ngparted' | rofi -dmenu -i -p "Favorite [APP]" -hide-scrollbar -tokenize -lines 9 -eh 1 -width 25 -location 0 -xoffset -450 -yoffset -150 -padding 20 -disable-history -font "ClearSansMedium 10")
|
||||
|
||||
echo "This result is : $DIALOG_RESULT"
|
||||
sleep 1;
|
||||
|
||||
if [ "$DIALOG_RESULT" = "chromium" ];
|
||||
then
|
||||
exec chromium
|
||||
|
||||
elif [ "$DIALOG_RESULT" = "subl3" ];
|
||||
then
|
||||
exec subl3
|
||||
|
||||
elif [ "$DIALOG_RESULT" = "telegram" ];
|
||||
then
|
||||
exec telegram-desktop
|
||||
|
||||
elif [ "$DIALOG_RESULT" = "thunar" ];
|
||||
then
|
||||
exec thunar
|
||||
|
||||
elif [ "$DIALOG_RESULT" = "discord" ];
|
||||
then
|
||||
exec discord
|
||||
|
||||
elif [ "$DIALOG_RESULT" = "steam" ];
|
||||
then
|
||||
exec /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=/app/bin/steam-wrapper --file-forwarding com.valvesoftware.Steam @@u %U @@
|
||||
|
||||
elif [ "$DIALOG_RESULT" = "pavucontrol" ];
|
||||
then
|
||||
exec pavucontrol
|
||||
|
||||
elif [ "$DIALOG_RESULT" = "Calculator" ];
|
||||
then
|
||||
exec gnome-calculator
|
||||
|
||||
elif [ "$DIALOG_RESULT" = "lxappearance" ];
|
||||
then
|
||||
exec lxappearance
|
||||
|
||||
elif [ "$DIALOG_RESULT" = "gparted" ];
|
||||
then
|
||||
exec gparted
|
||||
fi
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
DIALOG_RESULT=$(echo -e 'exit openbox\nsuspend\nhibernate\nreboot\npoweroff\nclose' | rofi -dmenu -i -p "SYSTEM" -hide-scrollbar -tokenize -lines 6 -eh 1 -width 25 -location 0 -xoffset 0 -yoffset 0 -padding 20 -disable-history)
|
||||
|
||||
echo "This result is : $DIALOG_RESULT"
|
||||
sleep 1;
|
||||
|
||||
if [ "$DIALOG_RESULT" = "exit openbox" ];
|
||||
then
|
||||
openbox --exit
|
||||
elif [ "$DIALOG_RESULT" = "suspend" ];
|
||||
then
|
||||
exec systemctl suspend
|
||||
elif [ "$DIALOG_RESULT" = "hibernate" ];
|
||||
then
|
||||
exec systemctl hibernate
|
||||
elif [ "$DIALOG_RESULT" = "reboot" ];
|
||||
then
|
||||
exec systemctl reboot
|
||||
elif [ "$DIALOG_RESULT" = "poweroff" ];
|
||||
then
|
||||
exec systemctl poweroff
|
||||
elif [ "$DIALOG_RESULT" = "close" ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
|
@ -0,0 +1,247 @@
|
|||
#!/bin/bash
|
||||
|
||||
#when set to exit, mpd_control will exit if you press escape
|
||||
#when set to break, mpd_control will go the upper level if possible
|
||||
ESC_ACTION="break"
|
||||
# source configuration file for rofi if exists
|
||||
|
||||
ROFI="rofi -dmenu -lines 10 -columns 4 -width 1000 -p Search"
|
||||
|
||||
addaftercurrent(){
|
||||
|
||||
#playlist is empty, just add the song
|
||||
if [ "$(mpc -p 6600 playlist | wc -l)" == "0" ]; then
|
||||
mpc -p 6600 add "$1"
|
||||
|
||||
#there is no current song so mpd is stopped
|
||||
#it seems to be impossible to determine the current songs' position when
|
||||
#mpd is stopped, so just add to the end
|
||||
elif [ -z "$(mpc -p 6600 current)" ]; then
|
||||
mpc -p 6600 play
|
||||
CUR_POS=$(mpc -p 6600 | tail -2 | head -1 | awk '{print $2}' | sed 's/#//' | awk -F/ '{print $1}')
|
||||
END_POS=$(mpc -p 6600 playlist | wc -l)
|
||||
mpc -p 6600 add "$1"
|
||||
mpc -p 6600 move $(($END_POS+1)) $(($CUR_POS+1))
|
||||
mpc -p 6600 stop
|
||||
|
||||
#at least 1 song is in the playlist, determine the position of the
|
||||
#currently played song and add $1 after it
|
||||
else
|
||||
|
||||
CUR_POS=$(mpc -p 6600 | tail -2 | head -1 | awk '{print $2}' | sed 's/#//' | awk -F/ '{print $1}')
|
||||
END_POS=$(mpc -p 6600 playlist | wc -l)
|
||||
mpc -p 6600 add "$1"
|
||||
mpc -p 6600 move $(($END_POS+1)) $(($CUR_POS+1))
|
||||
fi
|
||||
}
|
||||
addaftercurrentandplay(){
|
||||
|
||||
#playlist is empty, just add the song
|
||||
if [ "$(mpc -p 6600 playlist | wc -l)" == "0" ]; then
|
||||
mpc -p 6600 add "$1"
|
||||
mpc -p 6600 play
|
||||
|
||||
#there is no current song so mpd is stopped
|
||||
#it seems to be impossible to determine the current songs' position when
|
||||
#mpd is stopped, so just add to the end
|
||||
elif [ -z "$(mpc -p 6600 current)" ]; then
|
||||
mpc -p 6600play
|
||||
CUR_POS=$(mpc -p 6600 | tail -2 | head -1 | awk '{print $2}' | sed 's/#//' | awk -F/ '{print $1}')
|
||||
END_POS=$(mpc -p 6600 playlist | wc -l)
|
||||
mpc -p 6600 add "$1"
|
||||
mpc -p 6600 move $(($END_POS+1)) $(($CUR_POS+1))
|
||||
mpc -p 6600 play $(($CUR_POS+1))
|
||||
|
||||
#at least 1 song is in the playlist, determine the position of the
|
||||
#currently played song and add $1 after it
|
||||
else
|
||||
|
||||
CUR_POS=$(mpc -p 6600 | tail -2 | head -1 | awk '{print $2}' | sed 's/#//' | awk -F/ '{print $1}')
|
||||
END_POS=$(mpc -p 6600 playlist | wc -l)
|
||||
mpc -p 6600 add "$1"
|
||||
mpc -p 6600 move $(($END_POS+1)) $(($CUR_POS+1))
|
||||
mpc -p 6600 play $(($CUR_POS+1))
|
||||
fi
|
||||
}
|
||||
|
||||
case $1 in
|
||||
|
||||
-a|--artist)
|
||||
|
||||
while true; do
|
||||
|
||||
ARTIST="$(mpc -p 6600 list artist | sort -f | $ROFI)";
|
||||
if [ "$ARTIST" = "" ]; then $ESC_ACTION; fi
|
||||
|
||||
while true; do
|
||||
|
||||
ALBUMS=$(mpc -p 6600 list album artist "$ARTIST" | sort -f);
|
||||
ALBUM=$(echo -e "replace all\nadd all\n--------------------------\n$ALBUMS" | $ROFI);
|
||||
if [ "$ALBUM" = "" ]; then $ESC_ACTION;
|
||||
|
||||
elif [ "$ALBUM" = "replace all" ]; then
|
||||
CUR_SONG=$(mpc -p 6600 current)
|
||||
mpc -p 6600 clear
|
||||
mpc -p 6600 find artist "$ARTIST" | mpc -p 6600 add
|
||||
if [ -n "$CUR_SONG" ]; then mpc -p 6600 play; fi
|
||||
$ESC_ACTION
|
||||
elif [ "$ALBUM" = "add all" ]; then
|
||||
mpc -p 6600 find artist "$ARTIST" | mpc -p 6600 add
|
||||
$ESC_ACTION
|
||||
fi
|
||||
|
||||
while true; do
|
||||
|
||||
TITLES=$(mpc -p 6600 list title artist "$ARTIST" album "$ALBUM")
|
||||
TITLE=$(echo -e "replace all\nadd all\n--------------------------\n$TITLES" | $ROFI);
|
||||
if [ "$TITLE" = "" ]; then $ESC_ACTION
|
||||
elif [ "$TITLE" = "replace all" ]; then
|
||||
CUR_SONG=$(mpc -p 6600 current)
|
||||
mpc -p 6600 clear;
|
||||
mpc -p 6600 find artist "$ARTIST" album "$ALBUM" | mpc -p 6600 add
|
||||
if [ -n "$CUR_SONG" ]; then mpc -p 6600 play; fi
|
||||
$ESC_ACTION
|
||||
elif [ "$TITLE" = "add all" ]; then
|
||||
mpc -p 6600 find artist "$ARTIST" album "$ALBUM" | mpc -p 6600 add
|
||||
$ESC_ACTION
|
||||
|
||||
fi
|
||||
|
||||
while true; do
|
||||
DEC=$(echo -e "add after current and play\nadd after current\nreplace\nadd at the end" | $ROFI);
|
||||
case $DEC in
|
||||
|
||||
"")
|
||||
$ESC_ACTION
|
||||
;;
|
||||
|
||||
"add after current and play")
|
||||
addaftercurrentandplay "$(mpc -p 6600 find artist "$ARTIST" album "$ALBUM" title "$TITLE" | head -1 )"
|
||||
;;
|
||||
|
||||
"add after current")
|
||||
addaftercurrent "$(mpc -p 6600 find artist "$ARTIST" album "$ALBUM" title "$TITLE" | head -1 )"
|
||||
;;
|
||||
|
||||
"replace")
|
||||
CUR_SONG=$(mpc -p 6600 current)
|
||||
mpc -p 6600 clear
|
||||
mpc -p 6600 find artist "$ARTIST" album "$ALBUM" title "$TITLE" | head -1 | mpc -p 6600 add
|
||||
if [ -n "$CUR_SONG" ]; then mpc -p 6600 play; fi
|
||||
;;
|
||||
|
||||
"add at the end")
|
||||
mpc -p 6600 find artist "$ARTIST" album "$ALBUM" title "$TITLE" | head -1 | mpc -p 6600 add
|
||||
;;
|
||||
|
||||
esac
|
||||
$ESC_ACTION
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
;;
|
||||
|
||||
-t|--track)
|
||||
|
||||
TITLE=$(mpc -p 6600 list title | sort -f | $ROFI)
|
||||
if [ "$TITLE" = "" ]; then exit; fi
|
||||
|
||||
SONG=$(mpc -p 6600 find title "$TITLE" | head -1)
|
||||
addaftercurrentandplay "$SONG"
|
||||
;;
|
||||
|
||||
-p|--playlist)
|
||||
PLAYLIST=$(mpc -p 6600 lsplaylists | $ROFI);
|
||||
if [ "$PLAYLIST" = "" ]; then exit; fi
|
||||
CUR_SONG=$(mpc -p 6600 current)
|
||||
mpc -p 6600 clear
|
||||
mpc -p 6600 load "$PLAYLIST";
|
||||
if [ -n "$CUR_SONG" ]; then mpc -p 6600 play; fi
|
||||
;;
|
||||
|
||||
-j|--jump)
|
||||
|
||||
TITLE=$(mpc -p 6600 playlist | $ROFI);
|
||||
if [ "$TITLE" = "" ]; then exit; fi
|
||||
POS=$(mpc -p 6600 playlist | grep -n "$TITLE" | awk -F: '{print $1}')
|
||||
mpc -p 6600 play $POS;
|
||||
;;
|
||||
|
||||
-l|--longplayer)
|
||||
|
||||
while true; do
|
||||
|
||||
ALBUM=$(mpc -p 6600 list album | sort -f | $ROFI);
|
||||
if [ "$ALBUM" = "" ]; then $ESC_ACTION;
|
||||
fi
|
||||
|
||||
while true; do
|
||||
|
||||
TITLES=$(mpc -p 6600 list title album "$ALBUM")
|
||||
TITLE=$(echo -e "replace all\nadd all\n--------------------------\n$TITLES" | $ROFI);
|
||||
if [ "$TITLE" = "" ]; then $ESC_ACTION
|
||||
elif [ "$TITLE" = "replace all" ]; then
|
||||
CUR_SONG=$(mpc -p 6600 current)
|
||||
mpc -p 6600 clear;
|
||||
mpc -p 6600 find album "$ALBUM" | mpc -p 6600 add
|
||||
if [ -n "$CUR_SONG" ]; then mpc -p 6600 play; fi
|
||||
$ESC_ACTION
|
||||
elif [ "$TITLE" = "add all" ]; then
|
||||
mpc -p 6600 find album "$ALBUM" | mpc -p 6600 add
|
||||
$ESC_ACTION
|
||||
|
||||
fi
|
||||
|
||||
while true; do
|
||||
DEC=$(echo -e "add after current and play\nadd after current\nreplace\nadd at the end" | $ROFI);
|
||||
case $DEC in
|
||||
|
||||
"")
|
||||
$ESC_ACTION
|
||||
;;
|
||||
|
||||
"add after current and play")
|
||||
addaftercurrentandplay "$(mpc -p 6600 find album "$ALBUM" title "$TITLE" | head -1 )"
|
||||
;;
|
||||
|
||||
"add after current")
|
||||
addaftercurrent "$(mpc -p 6600 find album "$ALBUM" title "$TITLE" | head -1 )"
|
||||
;;
|
||||
|
||||
"replace")
|
||||
CUR_SONG=$(mpc -p 6600 current)
|
||||
mpc -p 6600 clear
|
||||
mpc -p 6600 find album "$ALBUM" title "$TITLE" | head -1 | mpc -p 6600 add
|
||||
if [ -n "$CUR_SONG" ]; then mpc -p 6600 play; fi
|
||||
;;
|
||||
|
||||
"add at the end")
|
||||
mpc -p 6600 find album "$ALBUM" title "$TITLE" | head -1 | mpc -p 6600 add
|
||||
;;
|
||||
|
||||
esac
|
||||
$ESC_ACTION
|
||||
done
|
||||
done
|
||||
done
|
||||
;;
|
||||
|
||||
-h|--help)
|
||||
echo "-a, --artist search for artist, then album, then title"
|
||||
echo "-t, --track search for a single track in the whole database"
|
||||
echo "-p, --playlist search for a playlist load it"
|
||||
echo "-j, --jump jump to another song in the current playlist"
|
||||
echo "-l, --longplayer search for album, then title"
|
||||
|
||||
|
||||
|
||||
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: rofi-mpd [OPTION]"
|
||||
echo "Try 'rofi-mpd --help' for more information."
|
||||
;;
|
||||
|
||||
esac
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/bash
|
||||
|
||||
SESSION=work
|
||||
|
||||
pid="$(pidof tmux)"
|
||||
|
||||
# exec
|
||||
if test "$pid"; then
|
||||
tmux attach
|
||||
else
|
||||
tmux new -d -s $SESSION
|
||||
#
|
||||
tmux new-window -t $SESSION:1 -n 'music'
|
||||
tmux send-keys "ncmpcpp" C-m
|
||||
tmux split-window -h
|
||||
tmux select-pane -t 1
|
||||
tmux resize-pane -R 10
|
||||
tmux split-window -v
|
||||
tmux resize-pane -D 1
|
||||
tmux send-keys "cava" C-m
|
||||
tmux select-pane -t 3
|
||||
tmux send-keys "pfetch" C-m
|
||||
#
|
||||
tmux new-window -t $SESSION:2 -n 'proc'
|
||||
tmux send-keys "gotop" C-m
|
||||
tmux split-window -h
|
||||
tmux select-pane -t 1
|
||||
tmux resize-pane -R 5
|
||||
tmux split-window -v
|
||||
tmux resize-pane -D 1
|
||||
tmux send-keys "htop" C-m
|
||||
tmux select-pane -t 3
|
||||
tmux send-keys "ranger" C-m
|
||||
#
|
||||
tmux new-window -t $SESSION:3 -n 'edit'
|
||||
tmux send-keys "nvim" C-m
|
||||
tmux split-window -h
|
||||
tmux resize-pane -R 40
|
||||
tmux select-pane -t 2
|
||||
tmux send-keys C-m
|
||||
#
|
||||
tmux select-window -t $SESSION:1
|
||||
tmux attach-session -t $SESSION
|
||||
fi
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
#scrot 'Cheese_%a-%d%b%y_%H.%M.png' \
|
||||
#-e 'mv $f ~/Pictures ; viewnior ~/Pictures/$f'
|
||||
|
||||
read -p "1 - Full, 2 - Delay(5), 0 - Crop: " scr_scrot
|
||||
if [[ $scr_scrot == 0 ]]; then
|
||||
scrot -s -e 'mv $f ~/Pictures/screen; viewnior ~/Pictures/screen/$f'
|
||||
elif [[ $scr_scrot == 1 ]]; then
|
||||
scrot -e 'mv $f ~/Pictures/screen; viewnior ~/Pictures/screen/$f'
|
||||
elif [[ $scr_scrot == 2 ]]; then
|
||||
scrot -d 5 -e 'mv $f ~/Pictures/screen; viewnior ~/Pictures/screen/$f'
|
||||
fi
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRATCHPAD_SESSION="$(tmux ls | grep scratchpad)"
|
||||
SCRATCHPAD_WINDOW="$(xdotool search --classname scratchpad)"
|
||||
|
||||
# If there is no such window
|
||||
# (Checking for the window should not be necessary if AwesomeWM does it already)
|
||||
if [ ${#SCRATCHPAD_WINDOW} -eq "0" ]; then
|
||||
# If the session does not exist, create a new one
|
||||
if [ ${#SCRATCHPAD_SESSION} -eq "0" ]; then
|
||||
urxvt -name scratchpad -e tmux new-session -s scratchpad &
|
||||
# Else attach to the session
|
||||
else
|
||||
urxvt -name scratchpad -e tmux attach -t scratchpad &
|
||||
fi
|
||||
fi
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
# URL='https://yubnub.org/parser/parse?command='
|
||||
|
||||
URL='https://duckduckgo.com/?q='
|
||||
QUERY=$(cat ~/.cache/search_history | rofi -dmenu -p "Search")
|
||||
if [ -n "$QUERY" ]; then
|
||||
grep -q "$QUERY" "$HOME/.cache/search_history"
|
||||
echo $QUERY >> ~/.cache/search_history_temp && sort -u ~/.cache/search_history_temp > ~/.cache/search_history
|
||||
xdg-open "${URL}${QUERY}" 2> /dev/null
|
||||
fi
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
if wmctrl -m | grep "mode: ON"; then
|
||||
exec wmctrl -k off
|
||||
else
|
||||
exec wmctrl -k on
|
||||
fi
|
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env bash
|
||||
# vars
|
||||
colors="$HOME/.bin/color"
|
||||
w="$(xdotool getdisplaygeometry | awk '{print $2}')"
|
||||
h="$(xdotool getdisplaygeometry | awk '{print $1}')"
|
||||
refresh="10"
|
||||
padding=" "
|
||||
height="35"
|
||||
offx="$(($h - 125))"
|
||||
offy="$(($w - 75))"
|
||||
font="-*-euphon-*"
|
||||
font2="-*-ijis-*"
|
||||
font3="-*-vanilla-*"
|
||||
font4="-efont-biwidth-*"
|
||||
|
||||
|
||||
# colors
|
||||
source "$colors"
|
||||
|
||||
|
||||
# functions
|
||||
clock() {
|
||||
date "+%R"
|
||||
}
|
||||
|
||||
|
||||
# loops
|
||||
loop() {
|
||||
while :; do
|
||||
echo "%{c}%{A:calendar &:}$(clock)%{A}$f"
|
||||
sleep "$refresh"
|
||||
done |\
|
||||
|
||||
lemonbar \
|
||||
-f "$font" \
|
||||
-f "$font2" \
|
||||
-f "$font3" \
|
||||
-f "$font4" \
|
||||
-g "75x$height+$offx+$offy" \
|
||||
-F "$text" \
|
||||
-B "$color0" \
|
||||
-d \
|
||||
| bash &
|
||||
|
||||
n30f -x "$(($offx - 5))" \
|
||||
-y "$(($offy - 5))" \
|
||||
"$HOME/.bin/img/small.png"
|
||||
}
|
||||
|
||||
|
||||
# exec
|
||||
loop
|
|
@ -0,0 +1,2 @@
|
|||
#! /bin/zsh
|
||||
for f in ~/.config/conky/*.conf;do; conky -c $f &!; done;
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
notify-send "Now Playing ♫" "$(mpc current)"
|
||||
n30f -x 1080 -y 60 /tmp/kunst.png -c "killall n30f"
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
killall jgmenu
|
||||
jgmenu --config-file="$HOME/.config/jgmenu/jgmenurc" &
|
|
@ -0,0 +1,30 @@
|
|||
_tmuxinator() {
|
||||
local commands projects
|
||||
commands=(${(f)"$(tmuxinator commands zsh)"})
|
||||
projects=(${(f)"$(tmuxinator completions start)"})
|
||||
|
||||
if (( CURRENT == 2 )); then
|
||||
_alternative \
|
||||
'commands:: _describe -t commands "tmuxinator subcommands" commands' \
|
||||
'projects:: _describe -t projects "tmuxinator projects" projects'
|
||||
elif (( CURRENT == 3)); then
|
||||
case $words[2] in
|
||||
copy|debug|delete|open|start)
|
||||
_arguments '*:projects:($projects)'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
compdef _tmuxinator tmuxinator mux
|
||||
alias mux="tmuxinator"
|
||||
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 2
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
# vars
|
||||
# pid="$(pidof tint2)"
|
||||
pid="$(ps aux | grep task.tint2rc | grep -v grep | awk -n '{print $2}')"
|
||||
|
||||
# exec
|
||||
if test "$pid"; then
|
||||
kill -9 "$pid"
|
||||
else
|
||||
tint2 -c $HOME/.config/tint2/task.tint2rc
|
||||
fi
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# vars
|
||||
pid="$(pidof picom)"
|
||||
|
||||
# exec
|
||||
if test "$pid"; then
|
||||
kill -9 "$pid"
|
||||
notify-send "compositor disabled"
|
||||
else
|
||||
picom &
|
||||
disown
|
||||
notify-send "compositor enabled"
|
||||
fi
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
# vars
|
||||
pid="$(pidof netwmpager)"
|
||||
|
||||
|
||||
# exec
|
||||
if test "$pid"; then
|
||||
kill -9 "$pid"
|
||||
else
|
||||
netwmpager &
|
||||
disown
|
||||
fi
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
# vars
|
||||
# pid="$(pidof tint2)"
|
||||
pid="$(ps aux | grep button.tint2rc | grep -v grep | awk -n '{print $2}')"
|
||||
|
||||
# exec
|
||||
if test "$pid"; then
|
||||
kill -9 "$pid"
|
||||
else
|
||||
tint2 -c $HOME/.config/tint2/button.tint2rc
|
||||
fi
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
# vars
|
||||
# pid="$(pidof tint2)"
|
||||
pid="$(ps aux | grep my_ob.tint2rc | grep -v grep | awk -n '{print $2}')"
|
||||
|
||||
# exec
|
||||
if test "$pid"; then
|
||||
kill -9 "$pid"
|
||||
else
|
||||
tint2 -c $HOME/.config/tint2/my_ob.tint2rc
|
||||
fi
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
# vars
|
||||
# pid="$(pidof stalonetray)"
|
||||
pid="$(ps aux | grep tray.tint2rc | grep -v grep | awk -n '{print $2}')"
|
||||
|
||||
|
||||
# exec
|
||||
if test "$pid"; then
|
||||
# killall "stalonetray"
|
||||
kill -9 $pid 2> /dev/null
|
||||
# kill -TERM $pid || kill -KILL $pid
|
||||
else
|
||||
# stalonetray &
|
||||
tint2 -c $HOME/.config/tint2/tray.tint2rc &
|
||||
fi
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
TRANSDIR=$HOME/Downloads
|
||||
|
||||
cp -r $1 $TRANSDIR
|
||||
|
||||
transmission-create $1 -t udp://tracker.openbittorrent.com:80 -o $2
|
||||
|
||||
transmission-remote -a $2
|
|
@ -0,0 +1,63 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# ufetch-ctlos - tiny system info for arch
|
||||
|
||||
## INFO
|
||||
|
||||
# user is already defined
|
||||
host="$(hostname)"
|
||||
os='Ctlos Linux'
|
||||
kernel="$(uname -r)"
|
||||
uptime="$(uptime -p | sed 's/up //')"
|
||||
packages="$(pacman -Q | wc -l)"
|
||||
shell="$(basename ${SHELL})"
|
||||
|
||||
if [ -z "${WM}" ]; then
|
||||
if [ "${XDG_CURRENT_DESKTOP}" ]; then
|
||||
envtype='DE'
|
||||
WM="${XDG_CURRENT_DESKTOP}"
|
||||
elif [ "${DESKTOP_SESSION}" ]; then
|
||||
envtype='DE'
|
||||
WM="${DESKTOP_SESSION}"
|
||||
else
|
||||
envtype='WM'
|
||||
WM="$(tail -n 1 "${HOME}/.xinitrc" | cut -d ' ' -f 2)"
|
||||
fi
|
||||
else
|
||||
envtype='WM'
|
||||
fi
|
||||
|
||||
## DEFINE COLORS
|
||||
|
||||
# probably don't change these
|
||||
bold="$(tput bold)"
|
||||
black="$(tput setaf 0)"
|
||||
red="$(tput setaf 1)"
|
||||
green="$(tput setaf 2)"
|
||||
yellow="$(tput setaf 3)"
|
||||
blue="$(tput setaf 4)"
|
||||
magenta="$(tput setaf 5)"
|
||||
cyan="$(tput setaf 6)"
|
||||
white="$(tput setaf 7)"
|
||||
reset="$(tput sgr0)"
|
||||
|
||||
# you can change these
|
||||
lc="${reset}${bold}${cyan}" # labels
|
||||
nc="${reset}${bold}${cyan}" # user and hostname
|
||||
ic="${reset}${bold}${white}" # info
|
||||
c0="${reset}${bold}${cyan}" # first color
|
||||
c1="${reset}${cyan}" # second color
|
||||
|
||||
## OUTPUT
|
||||
|
||||
cat <<EOF
|
||||
|
||||
${c0} /\ ${nc}${USER}${c1}@${nc}${host}${reset}
|
||||
${c0} / \ ${lc}OS: ${c1}${os}${reset}
|
||||
${c0} / \ ${lc}KERNEL: ${c1}${kernel}${reset}
|
||||
${c0} / ${c1}__ \ ${lc}UPTIME: ${c1}${uptime}${reset}
|
||||
${c1} / (**) \ ${lc}PACKAGES: ${c1}${packages}${reset}
|
||||
${c1} //__| |__\\\\ ${lc}SHELL: ${c1}${shell}${reset}
|
||||
${c1} /// \\\\\ ${lc}${envtype}: ${c1}${WM}${reset}
|
||||
|
||||
EOF
|
|
@ -0,0 +1,190 @@
|
|||
#!/bin/bash
|
||||
#=======================================================================================
|
||||
#
|
||||
# Transforms cava music visualizer in a cool desktop decoration
|
||||
#
|
||||
# Author: Guido_Fe
|
||||
#
|
||||
# Dependencies (and credits):
|
||||
# xdotool
|
||||
# cava
|
||||
# URxvt
|
||||
# devilspie
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# To start, execute this script. To stop, execute this sctipt again.
|
||||
#
|
||||
# Description:
|
||||
#
|
||||
# This script starts the cava music visualizer on a transparent backround through URxvt
|
||||
# ('cause it's easy to customize and support transparent foreground and background). It
|
||||
# then uses devilspie to strip it of his window decorations and rules, move it to the
|
||||
# right place and resize it.
|
||||
# Problem: the panel doesn't allow you to focus the windows below it.
|
||||
# My solution: move cava under the screen when the mouse pointer go over
|
||||
# it, and reset its position when I move the pointer away. I accomplished this
|
||||
# behavior with xdotool.
|
||||
#
|
||||
#========================================================================================
|
||||
|
||||
#=============
|
||||
# PARAMETERS TO SET
|
||||
#
|
||||
# Remember to don't leave spaces before and after the equal symbol
|
||||
|
||||
# X value of the screen resolution
|
||||
Xscreen=1366
|
||||
|
||||
# Y value
|
||||
Yscreen=768
|
||||
|
||||
# Offset applied to the window's vertical position
|
||||
offset=5
|
||||
|
||||
# Height of the cava panel
|
||||
h=200
|
||||
|
||||
# If you want to use a different cava config, set this parameter to the respective path or
|
||||
# leave '' if you don't want to change it
|
||||
cavaConf=''
|
||||
|
||||
# Set these parameters if you want to transform a default terminal color to another one.
|
||||
# This is useful if you want to have semitransparent cava bars. To do so, first set the
|
||||
# cava bar colors to a default one, different to the background (white, red, green...),
|
||||
# form the cava config file, and assign it's color number to the inColor variable.
|
||||
# The numbers are:
|
||||
#
|
||||
# black='0', red='1', green='2', yellow='3', blue='4', magenta='5', cyan='6', white='7'
|
||||
#
|
||||
# then set the outColor variable to the color you
|
||||
# want. Examples: inColor='2' outColor='[80]#223454', where 80 is the alpha level. The
|
||||
# alpha level can be '0' (fully transparent), '100' (fully opaque, or a value in between.
|
||||
# For outCol you can also use normal color definitions, like '#223454'.
|
||||
# As usual, leave both blank ('') if you don't want to set them.
|
||||
inCol='5'
|
||||
outCol='[80]#fd971f'
|
||||
|
||||
# Set after how much time this program will check your mouse coordinates, in seconds. Higher the value, slower
|
||||
# the response, but less cpu usage
|
||||
mouseDelay=0.3
|
||||
|
||||
# After how much time the program will read a file in a loop (seconds). It will directly influence how
|
||||
# fast the window under the cava panel will regain focus after hiding the panel.
|
||||
fileCheck=0.1
|
||||
|
||||
# Time between each frame of the panel transition animation (seconds). Can be 0
|
||||
trTime=0.01
|
||||
|
||||
# How much the panel move in each frame of the transition animation (pixels).
|
||||
# It must be positive
|
||||
trPixel=10
|
||||
#=============
|
||||
|
||||
# Process parameters
|
||||
|
||||
|
||||
if [ ! $cavaConf = '' ]; then
|
||||
cavaConf=" -p $cavaConf"
|
||||
fi
|
||||
if [ ! $inCol = '' -a ! $outCol = '' ]; then
|
||||
inCol=" --color$inCol"
|
||||
outCol=" $outCol"
|
||||
else
|
||||
inCol=''
|
||||
outCol=''
|
||||
fi
|
||||
#Check if it's already running
|
||||
if [ $# -eq 0 ]; then
|
||||
if [ `cat /tmp/processesToKill 2> /dev/null | wc -l` -ne 0 ]; then
|
||||
#Kills the processes of the other instance and itself
|
||||
echo "Found another $0 running, killig it and terminating..."
|
||||
kill -15 `cat /tmp/processesToKill` > /dev/null 2>&1
|
||||
rm /tmp/processesToKill
|
||||
killall cava
|
||||
exit
|
||||
else
|
||||
#It hasn't found other instances, call himself with the argument 'start'
|
||||
#to start cava
|
||||
echo "Starting the visualizer..."
|
||||
#$0 start
|
||||
#UNCOMMENT THE LINE ABOVE and comment the line below if you want to debug
|
||||
setsid $0 'start' >/dev/null 2>&1 < /dev/null &
|
||||
# focus on the right window
|
||||
eval $(xdotool getmouselocation --shell)
|
||||
sleep 0.1
|
||||
xdotool windowfocus $WINDOW
|
||||
exit
|
||||
fi
|
||||
elif [ "$1" = 'start' ]; then
|
||||
#The core of the program
|
||||
echo $$ >> /tmp/processesToKill
|
||||
#File that xdotool uses to communicate when the mouse go over the panel
|
||||
isTriggeredFile='/tmp/isTriggered'
|
||||
echo 0 > $isTriggeredFile
|
||||
#Write the conf file for devilspie
|
||||
echo '(and
|
||||
(is (window_name) "cava")
|
||||
(is (window_class) "URxvt")
|
||||
(begin
|
||||
(stick)
|
||||
(above)
|
||||
(pin)
|
||||
(undecorate)
|
||||
(skip_pager)
|
||||
(skip_tasklist)
|
||||
(wintype "dock")
|
||||
(geometry "'$Xscreen'x'$h'+0+'`expr $Yscreen - $h + $offset`'")
|
||||
)
|
||||
)' > /tmp/cava.ds
|
||||
#Start urxvt and execute cava in it. Change the color white to the one chosen
|
||||
urxvt -bg "[0]red"$inCol$outCol -b 0 -depth 32 +sb -e cava$cavaConf &
|
||||
wPid=$!
|
||||
echo $wPid >> /tmp/processesToKill
|
||||
# Starts devilspie, that will move and resize the window
|
||||
devilspie /tmp/cava.ds > /dev/null &
|
||||
echo $! >> /tmp/processesToKill
|
||||
# Get the window id (!= pid) of the instance
|
||||
sleep 0.5
|
||||
pids=`xdotool search --class "URxvt"`
|
||||
for pid in $pids; do
|
||||
name=`xdotool getwindowname $pid`
|
||||
if [[ $name == *"cava"* ]]; then
|
||||
wId=$pid
|
||||
fi
|
||||
done
|
||||
# Wait that the mouse go over the window. When it does, write 1 to $isTriggeredFile
|
||||
# and move the window over the bottom edge of the screen, hiding it
|
||||
xdotool behave $wId mouse-enter windowmove x $Yscreen exec sh -c "echo 1 > $isTriggeredFile" > /dev/null &
|
||||
echo $! >> /tmp/processesToKill
|
||||
# Infinite loop hide/show
|
||||
while [ 0 -eq 0 ]; do
|
||||
# what for the mouse to go over the panel
|
||||
while [ `cat $isTriggeredFile` = 0 ]
|
||||
do
|
||||
sleep $fileCheck
|
||||
done
|
||||
echo 0 > $isTriggeredFile
|
||||
# focus on the right window
|
||||
eval $(xdotool getmouselocation --shell)
|
||||
xdotool windowfocus $WINDOW
|
||||
cursorExited=0;
|
||||
# wait for the mouse to leave the bottom of the screen
|
||||
while [ $cursorExited -eq 0 ]; do
|
||||
eval $(xdotool getmouselocation --shell)
|
||||
if [ $Y -lt `expr $Yscreen - $h + $offset` ]; then
|
||||
# Reset cava position
|
||||
cursorExited=1
|
||||
Yd=$Yscreen
|
||||
Ydefault=`expr $Yscreen - $h + $offset`
|
||||
while [ $Yd -gt $Ydefault ]; do
|
||||
Yd=`expr $Yd - $trPixel`
|
||||
sleep $trTime
|
||||
xdotool windowmove $wId x $Yd
|
||||
done
|
||||
xdotool windowmove $wId x $Ydefault
|
||||
fi
|
||||
sleep $mouseDelay
|
||||
done
|
||||
done
|
||||
fi
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env bash
|
||||
# Download random images from wallhaven.cc
|
||||
# By mhess
|
||||
|
||||
FOLDER=/tmp/wallhaven
|
||||
WALL=/tmp/list.txt
|
||||
|
||||
[ -d ${FOLDER} ] && rm ${FOLDER}/* || mkdir -p ${FOLDER}
|
||||
[ -e ${WALL} ] && rm ${WALL}
|
||||
|
||||
down() {
|
||||
for num in {1..2}; do
|
||||
curl -s "https://wallhaven.cc/search?q=&resolutions=1920x1080&sorting=random&page=$num" --compressed |
|
||||
grep -o -E 'https://wallhaven.cc/w/([0-9 & A-Z & a-z]+)' |
|
||||
cut -f2 -d '-' >> ${WALL}
|
||||
done
|
||||
|
||||
for list in $(cat /tmp/list.txt); do
|
||||
|
||||
wget --quiet -O ${FOLDER}/${list}.jpg "https://w.wallhaven.cc/full/wallhaven-${list}.jpg"
|
||||
FILE="${FOLDER}/${list}"
|
||||
|
||||
if [ $(du -h ${FILE}.jpg | cut -f1) = "0" ]; then
|
||||
rm ${FILE}.jpg
|
||||
wget --quiet -O ${FOLDER}/${list}.png "https://w.wallhaven.cc/full/wallhaven-${list}.png"
|
||||
fi
|
||||
done
|
||||
}
|
||||
down &>/dev/null &
|
||||
|
||||
pid=$!
|
||||
spin[0]="-"
|
||||
spin[1]="\\"
|
||||
spin[2]="|"
|
||||
spin[3]="/"
|
||||
|
||||
echo -n "Downloading wallpapers... ${spin[0]}"
|
||||
while kill -0 $pid &>/dev/null
|
||||
do
|
||||
for i in "${spin[@]}"
|
||||
do
|
||||
echo -ne "\b$i"
|
||||
sleep 0.1
|
||||
done
|
||||
done
|
||||
|
||||
printf "\nFinished! All wallpapers has been saved on ${FOLDER}\n"
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Minimalistic random wallpaper downloader, uses unsplash as source because they seem to have the best wallpapers.
|
||||
# I guess i could add an favourites option later on but for now it works for me-
|
||||
# Requirements:
|
||||
# feh, wget, imlib2, curl, imagemagic
|
||||
# battery=$(cat /sys/class/power_supply/BAT1/capacity)
|
||||
# weather=$(cat /tmp/weather.tmp)
|
||||
# date=$(date +"%H:%M")
|
||||
savelocation=/tmp/wall.jpg
|
||||
default_wall="$HOME/.wall/lcrow.png"
|
||||
imgprovider=https://source.unsplash.com/1920x1080/?nature,dark
|
||||
|
||||
if [ "$1" = "d" ]; then
|
||||
hsetroot -fill "$default_wall"
|
||||
dunstify "Default wallpaper set!"
|
||||
else
|
||||
wget -N "$imgprovider" -O "$savelocation" 2> /dev/null
|
||||
# convert -pointsize 48 -fill white -annotate +1200+1000 "$weather | $date | $battery%" $savelocation $statslocation
|
||||
hsetroot -fill "$savelocation"
|
||||
dunstify "New wallpaper set!"
|
||||
fi
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
IFS='x' read screenWidth screenHeight < <(xdpyinfo | grep dimensions | grep -o '[0-9x]*' | head -n1)
|
||||
|
||||
width=$(xdotool getactivewindow getwindowgeometry --shell | head -4 | tail -1 | sed 's/[^0-9]*//')
|
||||
height=$(xdotool getactivewindow getwindowgeometry --shell | head -5 | tail -1 | sed 's/[^0-9]*//')
|
||||
|
||||
newPosX=$((screenWidth/2-width/2))
|
||||
newPosY=$((screenHeight/2-height/2))
|
||||
|
||||
xdotool getactivewindow windowmove "$newPosX" "$newPosY"
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
DIALOG_RESULT=$(echo -e 'exit xfce\nsuspend\nhibernate\nreboot\npoweroff\nexit' | rofi -dmenu -i -p "SYSTEM" -hide-scrollbar -tokenize -lines 6 -eh 1 -width 25 -location 0 -xoffset 0 -yoffset 0 -padding 20 -disable-history)
|
||||
|
||||
echo "This result is : $DIALOG_RESULT"
|
||||
sleep 1;
|
||||
|
||||
if [ "$DIALOG_RESULT" = "exit xfce" ];
|
||||
then
|
||||
xfce4-session-logout --logout
|
||||
elif [ "$DIALOG_RESULT" = "suspend" ];
|
||||
then
|
||||
xfce4-session-logout --suspend
|
||||
elif [ "$DIALOG_RESULT" = "hibernate" ];
|
||||
then
|
||||
xfce4-session-logout --hibernate
|
||||
elif [ "$DIALOG_RESULT" = "reboot" ];
|
||||
then
|
||||
xfce4-session-logout --reboot
|
||||
elif [ "$DIALOG_RESULT" = "poweroff" ];
|
||||
then
|
||||
xfce4-session-logout --halt
|
||||
elif [ "$DIALOG_RESULT" = "exit" ];
|
||||
then
|
||||
exit 0
|
||||
fi
|
|
@ -0,0 +1,101 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
sublime_conf="$HOME/.config/sublime-text-3/Packages/User/Preferences.sublime-settings"
|
||||
qt_conf="$HOME/.config/qt5ct/qt5ct.conf"
|
||||
|
||||
|
||||
# preferences for light theme mode
|
||||
PREF_LIGHT_THEME="lui"
|
||||
PREF_LIGHT_DECO="lui"
|
||||
PREF_LIGHT_BG="$HOME/.wall/Crowl.png"
|
||||
PREF_LIGHT_ICO="lui-ico"
|
||||
|
||||
sublime_theme_light="gruvbox"
|
||||
sublime_colorscheme_light="Packages\\/User\\/Boxy Yesterday.tmTheme"
|
||||
# preferences for dark theme mode
|
||||
PREF_DARK_THEME="dui"
|
||||
PREF_DARK_DECO="dui"
|
||||
PREF_DARK_BG="$HOME/.wall/lcrow.png"
|
||||
PREF_DARK_ICO="dui-ico"
|
||||
|
||||
sublime_theme_dark="gruvbox"
|
||||
sublime_colorscheme_dark="Packages\\/One Dark Color Scheme\\/One Dark.tmTheme"
|
||||
|
||||
|
||||
# Xresources color theme ~/.colors
|
||||
xresources_conf="$HOME/.Xresources"
|
||||
|
||||
xresources_color_light="colors\\/lui"
|
||||
xresources_color_dark="colors\\/dui"
|
||||
|
||||
# rofi conf
|
||||
rofi_conf="$HOME/.config/rofi/config"
|
||||
|
||||
# gtk.css
|
||||
gtk_css="$HOME/.config/gtk-3.0/gtk.css"
|
||||
br_color_light="#F4F5F6"
|
||||
br_color_dark="#2B2C33"
|
||||
|
||||
|
||||
de_theme="$(xfconf-query -c xsettings -p /Net/ThemeName)"
|
||||
|
||||
|
||||
if [[ "$de_theme" == "$PREF_LIGHT_THEME" ]]; then
|
||||
xfconf-query -c xsettings -p /Net/ThemeName -s $PREF_DARK_THEME
|
||||
xfconf-query -c xfwm4 -p /general/theme -s $PREF_DARK_DECO
|
||||
xfconf-query -c xsettings -p /Net/IconThemeName -s $PREF_DARK_ICO
|
||||
hsetroot -fill $PREF_DARK_BG
|
||||
# for i in $(xfconf-query -c xfce4-desktop -p /backdrop -l|egrep -e "screen.*/monitor.*image-path$" -e "screen.*/monitor.*/last-image$"); do
|
||||
# # if [ ! -z "$PREF_DARK_BG" ]; then xfconf-query -c xfce4-desktop -p $i -n -t string -s $PREF_DARK_BG ; fi
|
||||
# if [ ! -z "$PREF_DARK_BG" ]; then xfconf-query -c xfce4-desktop -p $i -s $PREF_DARK_BG ; fi
|
||||
# # if [ ! -z "$PREF_DARK_BG" ]; then xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image -s $PREF_DARK_BG ; fi
|
||||
# done
|
||||
xfconf-query -c xsettings -p /Gtk/DecorationLayout -s menu:minimize,maximize,close
|
||||
|
||||
gsettings set org.gnome.desktop.interface gtk-theme $PREF_DARK_THEME
|
||||
gsettings set org.gnome.desktop.wm.preferences button-layout '"menu:minimize,maximize,close"'
|
||||
|
||||
sed -i -e "s/$sublime_colorscheme_light/$sublime_colorscheme_dark/g" "$sublime_conf"
|
||||
sed -i -e "s/$sublime_theme_light.sublime-theme/$sublime_theme_dark.sublime-theme/g" "$sublime_conf"
|
||||
|
||||
sed -i -e "s/$xresources_color_light/$xresources_color_dark/g" "$xresources_conf"
|
||||
# https://github.com/budlabs/youtube/tree/master/letslinux/021-urxvt-reload
|
||||
xrdb -merge $HOME/.Xresources
|
||||
# kill -1 $(pidof urxvtd)
|
||||
|
||||
sed -i -e "s/$PREF_LIGHT_ICO/$PREF_DARK_ICO/g" "$rofi_conf"
|
||||
|
||||
# sed -i -e "s/$br_color_light/$br_color_dark/g" "$gtk_css"
|
||||
|
||||
sed -i -e "s/icon_theme=$PREF_LIGHT_ICO/icon_theme=$PREF_DARK_ICO/g" "$qt_conf"
|
||||
|
||||
else
|
||||
xfconf-query -c xsettings -p /Net/ThemeName -s $PREF_LIGHT_THEME
|
||||
xfconf-query -c xfwm4 -p /general/theme -s $PREF_LIGHT_DECO
|
||||
xfconf-query -c xsettings -p /Net/IconThemeName -s $PREF_LIGHT_ICO
|
||||
hsetroot -fill $PREF_LIGHT_BG
|
||||
# for i in $(xfconf-query -c xfce4-desktop -p /backdrop -l|egrep -e "screen.*/monitor.*image-path$" -e "screen.*/monitor.*/last-image$"); do
|
||||
# # if [ ! -z "$PREF_LIGHT_BG" ]; then xfconf-query -c xfce4-desktop -p $i -n -t string -s $PREF_LIGHT_BG ; fi
|
||||
# if [ ! -z "$PREF_LIGHT_BG" ]; then xfconf-query -c xfce4-desktop -p $i -s $PREF_LIGHT_BG ; fi
|
||||
# # if [ ! -z "$PREF_LIGHT_BG" ]; then xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image -s $PREF_LIGHT_BG ; fi
|
||||
# done
|
||||
xfconf-query -c xsettings -p /Gtk/DecorationLayout -s menu:minimize,maximize,close
|
||||
|
||||
gsettings set org.gnome.desktop.interface gtk-theme $PREF_LIGHT_THEME
|
||||
gsettings set org.gnome.desktop.wm.preferences button-layout '"menu:minimize,maximize,close"'
|
||||
|
||||
sed -i -e "s/$sublime_colorscheme_dark/$sublime_colorscheme_light/g" "$sublime_conf"
|
||||
sed -i -e "s/$sublime_theme_dark.sublime-theme/$sublime_theme_light.sublime-theme/g" "$sublime_conf"
|
||||
|
||||
sed -i -e "s/$xresources_color_dark/$xresources_color_light/g" "$xresources_conf"
|
||||
# https://github.com/budlabs/youtube/tree/master/letslinux/021-urxvt-reload
|
||||
xrdb -merge $HOME/.Xresources
|
||||
# kill -1 $(pidof urxvtd)
|
||||
|
||||
sed -i -e "s/$PREF_DARK_ICO/$PREF_LIGHT_ICO/g" "$rofi_conf"
|
||||
|
||||
# sed -i -e "s/$br_color_dark/$br_color_light/g" "$gtk_css"
|
||||
|
||||
sed -i -e "s/icon_theme=$PREF_DARK_ICO/icon_theme=$PREF_LIGHT_ICO/g" "$qt_conf"
|
||||
fi
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Get Color from Xresource Database
|
||||
# usage :
|
||||
# xrgc (colornumber|bg|fg)
|
||||
# example :
|
||||
# $ xrgc 1
|
||||
# return: #ff0000
|
||||
# $ xrgc bg
|
||||
# return: #101010
|
||||
#
|
||||
|
||||
case $1 in
|
||||
fg)
|
||||
xrdb -query | egrep -m1 "^\*\.?foreground:" | awk '{print $NF}'
|
||||
;;
|
||||
bg)
|
||||
xrdb -query | egrep -m1 "^\*\.?background:" | awk '{print $NF}'
|
||||
;;
|
||||
*)
|
||||
xrdb -query | egrep -m1 "^\*\.?color$1:" | awk '{print $NF}'
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
# Install script yay
|
||||
# autor: Alex Creio https://creio.github.io/
|
||||
|
||||
# wget git.io/yay.sh
|
||||
# sh yay.sh
|
||||
|
||||
sudo pacman -S --noconfirm --needed wget curl git
|
||||
git clone https://aur.archlinux.org/yay-bin.git
|
||||
cd yay-bin
|
||||
# makepkg -si
|
||||
makepkg -si --skipinteg
|
||||
cd ..
|
||||
rm -rf yay-bin
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Script to download musics on youtube
|
||||
# Dep: youtube-dl
|
||||
# Usage e.g: ydl.sh https://youtu.be/1dAazZxw83Y?list=PLYaK2zRLpEbvjyUIqjroO5sVxugCRTH7c
|
||||
|
||||
LINK_MUSIC="$1"
|
||||
WORKDIR="$HOME/mps"
|
||||
OLDPATH="$(pwd)"
|
||||
agentsList=(
|
||||
"Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0"
|
||||
"Mozilla/5.0 (Windows; U; Windows NT 6.1; rv:2.2) Gecko/20110201"
|
||||
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
|
||||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36"
|
||||
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36"
|
||||
)
|
||||
RANDOM=$$$(date +%s)
|
||||
rand=$[$RANDOM % ${#agentsList[@]}]
|
||||
agent="${agentsList[$rand]}"
|
||||
|
||||
cd $WORKDIR
|
||||
echo "Downloading $LINK_MUSIC..."
|
||||
# TOR_PORT=$(grep -i socksport /etc/tor/torrc | head -n 1 | awk '{print $2}')
|
||||
# --proxy "socks5://127.0.0.1:${TOR_PORT:-9050}" \
|
||||
|
||||
youtube-dl \
|
||||
--proxy "socks5://127.0.0.1:9050" \
|
||||
--user-agent "$agent" \
|
||||
--add-metadata \
|
||||
--ignore-errors \
|
||||
-f bestaudio \
|
||||
--extract-audio \
|
||||
--audio-format mp3 \
|
||||
--audio-quality 0 \
|
||||
-o '%(playlist)s/%(title)s.%(ext)s' \
|
||||
"$LINK_MUSIC" || exit 1
|
||||
|
||||
echo "$LINK_MUSIC success"
|
||||
cd $OLDPATH
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env bash
|
||||
# by mhess
|
||||
|
||||
# Font
|
||||
FN='ClearSansMedium:size=10'
|
||||
# Background Commands
|
||||
NB='#111113'
|
||||
# Foreground Commands
|
||||
NF='#FFF'
|
||||
# Background Prompt
|
||||
SB='#5a74ca'
|
||||
# Foreground Prompt
|
||||
SF='#FFF'
|
||||
|
||||
CACHEDIR="/tmp/dyou"
|
||||
PLAYER="mpv"
|
||||
|
||||
# Style of dmenu
|
||||
search=$(echo | dmenu -fn $FN -i -p "YouTube >" -nb $NB -nf $NF -sb $SB -sf $SF | tr " " +)
|
||||
|
||||
[ -z ${search} ] && exit
|
||||
|
||||
[ -d "${CACHEDIR}/${search}" ] || mkdir -p ${CACHEDIR}/${search}
|
||||
|
||||
curl -so $CACHEDIR/$search/search.txt "https://www.youtube.com/results?hl=en&search_query=$search"
|
||||
|
||||
# Get video titles
|
||||
cat $CACHEDIR/$search/search.txt |\
|
||||
grep "Duration" |\
|
||||
awk ' /yt-lockup-title/ {print $13 " " $14 " " $15 " " $16 " " $17 " " $18 " " $19 " " $20 " " $21 " " $22 " " $23 " " $24 " " $25 " " $26 " " $27 " " $28 " " $29 " " $30}' |\
|
||||
sed 's/aria-describedby="description-id.*//g;s/title=//g;s/"//g;s/spf-link//g;s/data-session-link=itct*.//;s/spf-prefetch//g;s/rel=//g;s/"//g;s/&/\&/g;s/\"\;/\"/g'|\
|
||||
sed s/\'\;/"'"/g |\
|
||||
nl -ba -w 3 -s '. ' > $CACHEDIR/$search/titles.txt || return 1
|
||||
|
||||
# Get video urls
|
||||
cat $CACHEDIR/$search/search.txt |\
|
||||
sed -rn 's/^.*yt-lockup-title.{6}href="(.{20})" class.*$/\1/p' |\
|
||||
sed 's/^/https:\/\/www.youtube.com/' |\
|
||||
nl -ba -w 3 -s '. ' > $CACHEDIR/$search/urls.txt || return 1
|
||||
|
||||
# Print 20 first video titles for the user to choose from
|
||||
get_video=$(cat $CACHEDIR/$search/titles.txt | dmenu -fn $FN -i -p "YouTube >" -nb $NB -nf $NF -sb $SB -sf $SF -l 30)
|
||||
|
||||
[ -z ${get_video} ] && exit
|
||||
|
||||
# Play the video with your favorite player
|
||||
$PLAYER $(sed -n $(echo ${get_video} | grep -Eo "^[[:digit:]]+")p < $CACHEDIR/$search/urls.txt | awk '{print $2}') > /dev/null 2>&1 &
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
# George Ornbo (shapeshed) http://shapeshed.com
|
||||
# License - http://unlicense.org
|
||||
#
|
||||
# Fixes a corrupt .zhistory file
|
||||
|
||||
mv ~/.zhistory ~/.zhistory_bad
|
||||
strings ~/.zhistory_bad > ~/.zhistory
|
||||
fc -R ~/.zhistory
|
||||
rm ~/.zhistory_bad
|
|
@ -0,0 +1,635 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Zen Installer Framework version 1.00
|
||||
#
|
||||
# Written by Jody James
|
||||
#
|
||||
#
|
||||
#Maintained by Josiah Ward(aka spookykidmm)
|
||||
#
|
||||
# This program is free software, provided under the GNU General Public License
|
||||
# as published by the Free Software Foundation. So feel free to copy, distribute,
|
||||
# or modify it as you wish.
|
||||
#
|
||||
# Special Recognition to Carl Duff, as some code was adapted from the Architect Installer
|
||||
# Special Recognition to 'angeltoast' as some code was adapted from the Feliz Installer
|
||||
#
|
||||
#
|
||||
# Selecting the Drive
|
||||
man_partition() {
|
||||
list=` lsblk -lno NAME,TYPE,SIZE,MOUNTPOINT | grep "disk" `
|
||||
|
||||
zenity --info --height=500 width=450 --title="$title" --text "Below is a list of the available drives on your system:\n\n$list"
|
||||
|
||||
lsblk -lno NAME,TYPE | grep 'disk' | awk '{print "/dev/" $1 " " $2}' | sort -u > devices.txt
|
||||
sed -i 's/\<disk\>//g' devices.txt
|
||||
devices=` awk '{print "FALSE " $0}' devices.txt `
|
||||
|
||||
dev=$(zenity --list --radiolist --height=500 --width=450 --title="$title" --text "Select the drive that you want to use for installation." --column Drive --column Info $devices)
|
||||
|
||||
# Partitioning
|
||||
# Allow user to partition using gparted
|
||||
zenity --question --height=500 --width=450 --title="$title" --text "Do you need to partition $dev?\nSelect 'yes' to open gparted and partition\nthe disk or format partitions if needed.\nThe installer will not format the partitions after this,\nso if your partitions need to be formatted please select yes\nand use gparted to format them now.\nThe installer supports using a seperate /boot /home and /root partition, as well as a swap partition or file."
|
||||
if [ "$?" = "0" ]
|
||||
then gparted
|
||||
fi
|
||||
|
||||
# Select root partition
|
||||
root_part=$(zenity --list --radiolist --height=500 --width=450 --title="$title" --text="Choose a partition to use for the root partition\nWarning, this list shows all available partitions on all available drives.\nPlease choose with care." --column ' ' --column Partitions $(sudo fdisk -l | grep dev | grep -v Disk | awk '{print $1}' | awk '{ printf " FALSE ""\0"$0"\0" }'))
|
||||
#mounting root partition
|
||||
touch root_part.txt
|
||||
echo $root_part >> root_part.txt
|
||||
mount $root_part /mnt
|
||||
|
||||
# Swap partition?
|
||||
zenity --question --height=500 --width=450 --title="$title" --text "Do you want to use a swap partition?"
|
||||
if [ "$?" = "0" ]
|
||||
then swap_part=$(zenity --list --radiolist --height=500 --width=450 --title="$title" --text="Choose a partition to use for the swap partition\nWarning, this list shows all available partitions on all available drives.\nPlease choose with care." --column ' ' --column 'Partitions' $(sudo fdisk -l | grep dev | grep -v Disk | awk '{print $1}' | awk '{ printf " FALSE ""\0"$0"\0" }'))
|
||||
mkswap $swap_part
|
||||
swapon $swap_part
|
||||
fi
|
||||
zenity --question --height=500 --width=450 --title="$title" --text "Would you like to create a 1GB swapfile on root?\nIf you've already mounted a swap partition or don't want swap, select \"No\".\nThis process could take some time, so please be patient."
|
||||
if [ "$?" = "0" ]
|
||||
then swapfile="yes"
|
||||
(echo "# Creating swapfile..."
|
||||
touch /mnt/swapfile
|
||||
dd if=/dev/zero of=/mnt/swapfile bs=1M count=1024
|
||||
chmod 600 /mnt/swapfile
|
||||
mkswap /mnt/swapfile
|
||||
swapon /mnt/swapfile) | zenity --progress --title="$title" --width=450 --pulsate --auto-close --no-cancel
|
||||
fi
|
||||
|
||||
# Boot Partition?
|
||||
zenity --question --height=500 --width=450 --title="$title" --text "Do you want to use a seperate boot partition?"
|
||||
if [ "$?" = "0" ]
|
||||
then boot_part=$(zenity --list --radiolist --height=500 --width=450 --title="$title" --text="Please select a partition for /boot. This list shows all available drives on your system, so choose with care." --column ' ' --column Partitions $(sudo fdisk -l | grep dev | grep -v Disk | awk '{print $1}' | awk '{ printf " FALSE ""\0"$0"\0" }'))
|
||||
|
||||
mkdir -p /mnt/boot
|
||||
mount $boot_part /mnt/boot
|
||||
|
||||
fi
|
||||
|
||||
# Home Partition?
|
||||
zenity --question --height=500 --width=450 --title="$title" --text "Do you want to use a seperate home partition?"
|
||||
if [ "$?" = "0" ]
|
||||
then home_part=$(zenity --list --radiolist --height=500 --width=450 --title="$title" --text="Select your home partition" --column ' ' --column Partitions $(sudo fdisk -l | grep dev | grep -v Disk | awk '{print $1}' | awk '{ printf " FALSE ""\0"$0"\0" }'))
|
||||
# mounting home partition
|
||||
mkdir -p /mnt/home
|
||||
mount $home_part /mnt/home
|
||||
fi
|
||||
}
|
||||
|
||||
auto_partition() {
|
||||
list=` lsblk -lno NAME,TYPE,SIZE,MOUNTPOINT | grep "disk" `
|
||||
|
||||
zenity --info --height=500 --width=450 --title="$title" --text "Below is a list of the available drives on your system:\n\n$list"
|
||||
|
||||
lsblk -lno NAME,TYPE | grep 'disk' | awk '{print "/dev/" $1 " " $2}' | sort -u > devices.txt
|
||||
sed -i 's/\<disk\>//g' devices.txt
|
||||
devices=` awk '{print "FALSE " $0}' devices.txt `
|
||||
|
||||
dev=$(zenity --list --radiolist --height=500 --width=450 --title="$title" --text "Select the drive that you want to use for installation." --column Drive --column Info $devices)
|
||||
|
||||
zenity --question --height=500 --width=450 --title="$title" --text "Warning! This will erase all data on $dev\!\nAre you sure you want to continue?\nSelect 'Yes' to continue and 'No' to go back."
|
||||
yn="$?"
|
||||
touch root_part.txt
|
||||
if [ "$SYSTEM" = "BIOS" ]
|
||||
then echo {$dev}1 >> root_part.txt
|
||||
else echo {$dev}2 >> root_part.txt
|
||||
fi
|
||||
if [ "$yn" = "1" ]
|
||||
then partition
|
||||
fi
|
||||
|
||||
# Find total amount of RAM
|
||||
ram=$(grep MemTotal /proc/meminfo | awk '{print $2/1024}' | sed 's/\..*//')
|
||||
# Find where swap partition stops
|
||||
num=4000
|
||||
|
||||
if [ "$ram" -gt "$num" ]
|
||||
then swap_space=4096
|
||||
else swap_space=$ram
|
||||
fi
|
||||
|
||||
uefi_swap=$(($swap_space + 513))
|
||||
|
||||
|
||||
#BIOS or UEFI
|
||||
if [ "$SYSTEM" = "BIOS" ]
|
||||
then
|
||||
(echo "# Creating Partitions for BIOS..."
|
||||
dd if=/dev/zero of=$dev bs=512 count=1
|
||||
Parted "mklabel msdos"
|
||||
Parted "mkpart primary ext4 1MiB 100%"
|
||||
Parted "set 1 boot on"
|
||||
mkfs.ext4 -F ${dev}1
|
||||
mount ${dev}1 /mnt
|
||||
touch /mnt/swapfile
|
||||
dd if=/dev/zero of=/mnt/swapfile bs=1M count=${swap_space}
|
||||
chmod 600 /mnt/swapfile
|
||||
mkswap /mnt/swapfile
|
||||
swapon /mnt/swapfile
|
||||
swapfile="yes") | zenity --progress --title="$title" --width=450 --pulsate --auto-close --no-cancel
|
||||
else
|
||||
(echo "# Creating Partitions for UEFI..."
|
||||
dd if=/dev/zero of=$dev bs=512 count=1
|
||||
Parted "mklabel gpt"
|
||||
Parted "mkpart primary fat32 1MiB 513MiB"
|
||||
Parted "mkpart primary ext4 513MiB 100%"
|
||||
Parted "set 1 boot on"
|
||||
mkfs.fat -F32 ${dev}1
|
||||
mkfs.ext4 -F ${dev}2
|
||||
mount ${dev}2 /mnt
|
||||
mkdir -p /mnt/boot
|
||||
mount ${dev}1 /mnt/boot
|
||||
touch /mnt/swapfile
|
||||
dd if=/dev/zero of=/mnt/swapfile bs=1M count=${swap_space}
|
||||
chmod 600 /mnt/swapfile
|
||||
mkswap /mnt/swapfile
|
||||
swapon /mnt/swapfile
|
||||
swapfile="yes") | zenity --progress --title="$title" --width=450 --pulsate --auto-close --no-cancel
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
partition() {
|
||||
ans=$(zenity --list --radiolist --height=500 --width=450 --title="$title" --text "Would you like to use automatic partitioning or would you like to partition the disk for installation yourself?\nAutomatic Partitioning will completely erase the disk that you select and install Arch." --column Select --column Choice FALSE "Automatic Partitioning" FALSE "Manual Partitioning")
|
||||
|
||||
if [ "$ans" = "Automatic Partitioning" ]
|
||||
then auto_partition
|
||||
else
|
||||
man_partition
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
configure() {
|
||||
# Getting Locale
|
||||
locales=$(cat /etc/locale.gen | grep -v "# " | sed 's/#//g' | sed 's/ UTF-8//g' | grep .UTF-8 | sort | awk '{ printf "FALSE ""\0"$0"\0" }')
|
||||
|
||||
locale=$(zenity --list --radiolist --height=500 --width=450 --title="$title" --text "Select your locale/language.\nThe default is American English 'en_US.UTF-8'." --column Select --column Locale TRUE en_US.UTF-8 $locales)
|
||||
|
||||
zenity --question --height=500 --width=450 --title="$title" --text="Would you like to change your keyboard model? The default is pc105"
|
||||
mod="$?"
|
||||
|
||||
if [ "$mod" = "0" ]
|
||||
then model=$(zenity --list --radiolist --height=500 --width=450 --title="$title" --text="Select your keyboard model" --column Select --column Model $(localectl list-x11-keymap-models | awk '{ printf " FALSE ""\0"$0"\0" }'))
|
||||
fi
|
||||
|
||||
layout=$(zenity --list --radiolist --height=500 --width=450 --title="$title" --text="Select your layout, a two-character country code" --column Select --column Layout $(localectl list-x11-keymap-layouts | awk '{ printf " FALSE ""\0"$0"\0" }'))
|
||||
|
||||
zenity --question --height=500 --width=450 --title="$title" --text="Would you like to change your keyboard variant?"
|
||||
vary="$?"
|
||||
|
||||
if [ "$vary" = "0" ]
|
||||
then variant=$(zenity --list --radiolist --height=500 --width=450 --title="$title" --text="Select your preferred variant" --column Select --column Variant $(localectl list-x11-keymap-variants | awk '{ printf " FALSE ""\0"$0"\0" }'))
|
||||
fi
|
||||
|
||||
setxkbmap $layout
|
||||
|
||||
if [ "$model" = "0" ]
|
||||
then setxkbmap -model $model
|
||||
fi
|
||||
|
||||
if [ "$vary" = "0" ]
|
||||
then setxkbmap -variant $variant
|
||||
fi
|
||||
# Getting Timezone
|
||||
zones=$(cat /usr/share/zoneinfo/zone.tab | awk '{print $3}' | grep "/" | sed "s/\/.*//g" | sort -ud | sort | awk '{ printf " FALSE ""\0"$0"\0" }')
|
||||
|
||||
zone=$(zenity --list --radiolist --height=500 --width=450 --title="$title" --text "Select your country/zone." --column Select --column Zone $zones)
|
||||
|
||||
subzones=$(cat /usr/share/zoneinfo/zone.tab | awk '{print $3}' | grep "$zone/" | sed "s/$zone\///g" | sort -ud | sort | awk '{ printf " FALSE ""\0"$0"\0" }')
|
||||
|
||||
subzone=$(zenity --list --radiolist --height=500 --width=450 --title="$title" --text "Select your sub-zone." --column Select --column Zone $subzones)
|
||||
|
||||
# Getting Clock Preference
|
||||
clock=$(zenity --list --radiolist --height=500 --width=450 --title="$title" --text "Would you like to use UTC or Local Time\nUTC is recommended unless you are dual booting with Windows." --column Select --column Time TRUE utc FALSE localtime)
|
||||
|
||||
# Getting hostname, username, root password, and user password
|
||||
hname=$(zenity --entry --title="$title" --text "Please enter a hostname for your system.\nIt must be in all lowercase letters." --entry-text "revenge")
|
||||
|
||||
username=$(zenity --entry --title="$title" --text "Please enter a username for the new user.\nAgain, in all lowercase." --entry-text "user")
|
||||
}
|
||||
|
||||
vbox() {
|
||||
graphics=$(lspci | grep -i "vga" | sed 's/.*://' | sed 's/(.*//' | sed 's/^[ \t]*//')
|
||||
if [[ $(echo $graphics | grep -i 'virtualbox') != "" ]]
|
||||
then zenity --question --height=500 --width=450 --title="$title" --text "The Revenge Installer has detected that you are currently running in Virtualbox.\nWould you like to install Virtualbox Utilities to the installed system?"
|
||||
vb="$?"
|
||||
fi
|
||||
}
|
||||
|
||||
nvidia() {
|
||||
graphics=$(lspci | grep -i "vga" | sed 's/.*://' | sed 's/(.*//' | sed 's/^[ \t]*//')
|
||||
card=$(lspci -k | grep -A 2 -E "(VGA|3D)")
|
||||
if [[ $(echo $card | grep -i 'nvidia') != "" ]]
|
||||
then zenity --question --height=500 --width=450 --title="$title" --text "The Revenge Installer has detected that you are currently running an Nvidia graphics card.\nWould you like to install Proprietary Nvidia graphics drivers to the installed system?"
|
||||
if [ "$?" = "0" ]
|
||||
then video=$(zenity --list --checklist --height=500 --width=450 --title="$title" --text "You will need to know what model of NVIDIA graphics card you are using.\nFor NVIDIA 400 series and newer install nvidia and nvidia-libgl.\nFor 8000-9000 or 100-300 series install nvidia-304xx and nvidia-304xx-libgl.\n\nYour current graphics card is:\n$card\n\nSelect the NVIDIA drivers that you would like to install." --column "Select" --column "Driver" FALSE "nvidia nvidia-utils nvidia-settings" FALSE "nvidia-304xx nvidia-304xx-utils nvidia-settings" FALSE "nvidia-340xx nvidia-340xx-utils nvidia-settings" FALSE "nvidia-lts nvidia-settings nvidia-utils" FALSE "nvidia-340xx-lts nvidia-340xx-utils nvidia-settings" FALSE "nvidia-304xx-lts nvidia-304xx-utils nvidia-settings" FALSE "nvidia-dkms" FALSE "nvidia-340xx-dkms" FALSE "nvidia-304xx-dkms")
|
||||
else video="mesa xf86-video-nouveau"
|
||||
fi
|
||||
else video="mesa xf86-video-nouveau"
|
||||
fi
|
||||
}
|
||||
|
||||
kernel() {
|
||||
kernel=$(zenity --list --radiolist --height=500 --width=450 --title="$title" --text "There are several kernels available for the system.\n\nThe most common is the current linux kernel.\nThis kernel is the most up to date, providing the best hardware support.\nHowever, there could be possible bugs in this kernel, despite testing.\n\nThe linux-lts kernel provides a focus on stability.\nIt is based on an older kernel, so it may lack some newer features.\n\nThe linux-hardened kernel is focused on security\nIt contains the Grsecurity Patchset and PaX for increased security.\n\nThe linux-zen kernel is the result of a collaboration of kernel hackers\nto provide the best possible kernel for everyday systems.\n\nPlease select the kernel that you would like to install." --column "Select" --column "Kernel" FALSE linux FALSE linux-lts FALSE linux-hardened FALSE linux-zen)
|
||||
}
|
||||
|
||||
root_password() {
|
||||
rtpasswd=$(zenity --entry --title="$title" --text "Please enter a root password." --hide-text)
|
||||
rtpasswd2=$(zenity --entry --title="$title" --text "Please re-enter your root password." --hide-text)
|
||||
if [ "$rtpasswd" != "$rtpasswd2" ]
|
||||
then zenity --error --height=500 --width=450 --title="$title" --text "The passwords did not match, please try again."
|
||||
root_password
|
||||
fi
|
||||
}
|
||||
|
||||
changeshell() {
|
||||
shell=$(zenity --list --radiolist --height=500 --width=450 --title="$title" --text "What shell would you like to use?" --column Select --column Choice FALSE bash FALSE zsh FALSE fish)
|
||||
}
|
||||
|
||||
user_password() {
|
||||
userpasswd=$(zenity --entry --title="$title" --text "Please enter a password for $username." --hide-text)
|
||||
userpasswd2=$(zenity --entry --title="$title" --text "Please re-enter a password for $username." --hide-text)
|
||||
if [ "$userpasswd" != "$userpasswd2" ]
|
||||
then zenity --error --height=500 --width=450 --title="$title" --text "The passwords did not match, please try again."
|
||||
user_password
|
||||
fi
|
||||
}
|
||||
|
||||
cups() {
|
||||
zenity --question --height=500 --width=450 --title="$title" --text "Would you like to install printer support?"
|
||||
cp="$?"
|
||||
}
|
||||
|
||||
desktop() {
|
||||
# Choosing Desktop
|
||||
desktops=$(zenity --list --height=500 --width=450 --title="$title" --radiolist --text "What desktop would you like to install?" --column Select --column Desktop FALSE "gnome" FALSE "gnome gnome-extra" FALSE "plasma" FALSE "plasma kde-applications" FALSE "xfce4" FALSE "xfce4 xfce4-goodies" FALSE "lxde" FALSE "lxqt" FALSE "mate" FALSE "mate mate-extra" FALSE "budgie-desktop" FALSE "cinnamon" FALSE "deepin" FALSE "enlightenment" FALSE "jwm" FALSE "i3-wm i3lock i3status" FALSE "i3-gaps i3status i3lock" FALSE "openbox tint2 openbox-themes" FALSE "mate mate-extra mate-revenge-desktop" FALSE "i3-revenge-desktop" FALSE "Look at more window managers")
|
||||
if [ "$desktops" = "Look at more window managers" ]
|
||||
then zenity --list --title="$title" --text="Look at these window managers. You will select the one you want in the next step" --column View --width=450 --height=550 "$(pacman -Ss window manager)"
|
||||
wm=$(zenity --list --radiolist --height=500 --width=450 --column Select --column WM --title="$title" --radiolist --text="What window manager would you like?" $(pacman -Ssq window manager | awk '{ printf " FALSE ""\0"$0"\0" }'))
|
||||
fi
|
||||
}
|
||||
|
||||
displaymanager() {
|
||||
dm=$(zenity --list --title="$title" --radiolist --height=500 --width=450 --text "What display manager would you like to use?" --column "Select" --column "Display Manager" FALSE "lightdm" FALSE "lxdm" FALSE "sddm" FALSE "gdm" FALSE "default")
|
||||
}
|
||||
|
||||
revengerepo() {
|
||||
zenity --question --title="$title" --height=500 --width=450 --text="Would you like to add the revenge_repo to your /etc/pacman.conf?\n The revenge_repo contains a few extra packages, such as spotify and pamac."
|
||||
rr="$?"
|
||||
}
|
||||
|
||||
pamacaur() {
|
||||
zenity --question --title="$title" --height=500 --width=450 --text="Would you like to install pamac?\nPamac is a GUI tool to install packages from the repo and the aur"
|
||||
pa="$?"
|
||||
}
|
||||
|
||||
archuserrepo() {
|
||||
zenity --question --height=500 --width=450 --title="$title" --text "Would you like to install support for the Arch User Repository 'pacaur'?"
|
||||
abs="$?"
|
||||
}
|
||||
|
||||
# internet app list
|
||||
internet_apps() {
|
||||
zenity --list --checklist --height=500 --width=450 --title="$title" --text "Select the Internet Applications that You Would Like to Install" --column "Select" --column "Applications" FALSE "chromium " FALSE "midori " FALSE "qupzilla " FALSE "netsurf " FALSE "filezilla " FALSE "opera " FALSE "evolution " FALSE "geary " FALSE "thunderbird " FALSE "transmission-gtk " FALSE "qbittorrent " FALSE "hexchat " > int2.txt
|
||||
sed -i -e 's/[|]//g' int2.txt
|
||||
}
|
||||
|
||||
# media app list
|
||||
media_apps() {
|
||||
zenity --list --checklist --height=500 --width=450 --title="$title" --text "Select the Media Applications that You Would Like to Install" --column "Select" --column "Applications" FALSE "kodi " FALSE "gimp " FALSE "vlc " FALSE "phonon-qt4-vlc " FALSE "totem " FALSE "parole " FALSE "audacious " FALSE "clementine " FALSE "gthumb " FALSE "shotwell " FALSE "ristretto " FALSE "gpicview " FALSE "brasero " FALSE "audacity " FALSE "simplescreenrecorder " FALSE "xfburn " FALSE "kdenlive " > med2.txt
|
||||
sed -i -e 's/[|]//g' med2.txt
|
||||
}
|
||||
|
||||
# office app list
|
||||
office_apps() {
|
||||
zenity --list --checklist --height=500 --width=450 --title="$title" --text "Select the Office Applications that You Would Like to Install" --column "Select" --column "Applications" FALSE "calligra " FALSE "abiword " FALSE "gnumeric " FALSE "pdfmod " FALSE "evince " FALSE "epdfview " FALSE "calibre " FALSE "fbreader " > off2.txt
|
||||
sed -i -e 's/[|]//g' off2.txt
|
||||
}
|
||||
|
||||
# utility app list
|
||||
utility_apps() {
|
||||
zenity --list --checklist --height=500 --width=450 --title="$title" --text "Select the Utility Applications that You Would Like to Install" --column "Select" --column "Applications" FALSE "htop " FALSE "terminator " FALSE "gnome-disk-utility " FALSE "gparted " FALSE "synapse " FALSE "virtualbox " FALSE "gufw " FALSE "redshift " FALSE "leafpad " FALSE "geany " FALSE "parcellite " FALSE "grsync " FALSE "guake " FALSE "ntfs-3g " FALSE "btrfs-progs " FALSE "gptfdisk " > utils.txt
|
||||
sed -i -e 's/[|]//g' utils.txt
|
||||
}
|
||||
|
||||
# allowing user to select extra applications
|
||||
pacman -Syy
|
||||
libreoffice() {
|
||||
zenity --question --height=500 --width=450 --title="$title" --text="Would you like to install libreoffice, an open source ms office alternative?"
|
||||
lbr="$?"
|
||||
if [ "$lbr" = "0" ]
|
||||
then lover=$(zenity --list --radiolist --height=500 --width=450 --text="Libreoffice-fresh is the newest up-to-date version of libreoffice, while still is less frequently updated" --column Select --column Version FALSE "fresh" FALSE "still")
|
||||
lolang=$(zenity --list --radiolist --height=500 --width=450 --column Select --column Langpack $(pacman -Ssq libreoffice-$lover lang | awk '{ printf " FALSE ""\0"$0"\0" }'))
|
||||
fi
|
||||
}
|
||||
|
||||
firefox() {
|
||||
zenity --question --height=500 --width=450 --title="$title" --text="Would you like to install Firefox, a browser by the Mozilla foundation?"
|
||||
frf="$?"
|
||||
if [ "$frf" = "0" ]
|
||||
then fflang=$(zenity --list --radiolist --height=500 --width=450 --column Select --column Langpack $(pacman -Ssq firefox lang | awk '{ printf " FALSE ""\0"$0"\0" }'))
|
||||
fi
|
||||
}
|
||||
|
||||
installapps() {
|
||||
extra=$(zenity --list --height=500 --width=450 --title="$title" --radiolist --text "If you would like to select more applications to install,\nChoose the category from the
|
||||
list below.\nWhen you are finished selecting applications\nin each category you will be returned to this menu.\nThen simply select 'finished' when you are
|
||||
finished." --column Select --column Category FALSE internet FALSE media FALSE office FALSE utilities FALSE finished)
|
||||
|
||||
if [ "$extra" = "internet" ]
|
||||
then internet_apps;installapps
|
||||
elif [ "$extra" = "media" ]
|
||||
then media_apps;installapps
|
||||
elif [ "$extra" = "office" ]
|
||||
then office_apps;installapps
|
||||
elif [ "$extra" = "utilities" ]
|
||||
then utility_apps;installapps
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# bootloader?
|
||||
bootloader() {
|
||||
lsblk -lno NAME,TYPE | grep 'disk' | awk '{print "/dev/" $1 " " $2}' | sort -u > devices.txt
|
||||
sed -i 's/\<disk\>//g' devices.txt
|
||||
devices=` awk '{print "FALSE " $0}' devices.txt `
|
||||
|
||||
grub=$(zenity --question --height=500 --width=450 --title="$title" --text "Would you like to install the bootloader?\nThe answer to this is usually yes,\nunless you are dual-booting and plan to have another system handle\nthe boot process.")
|
||||
grb="$?"
|
||||
if [ "$grb" = "0" ]
|
||||
then grub_device=$(zenity --list --radiolist --height=500 --width=450 --title="$title" --text "Where do you want to install the bootloader?" --column Select --column Device $devices)
|
||||
fi
|
||||
}
|
||||
|
||||
# Installation
|
||||
installing() {
|
||||
zenity --question --height=500 --width=450 --title="$title" --text "Please click yes to begin installation.\nClick no to abort installation.\nAll of the packages will be downloaded fresh, so installation\nmay take a few minutes."
|
||||
|
||||
if [ "$?" = "1" ]
|
||||
then exit
|
||||
else (
|
||||
# sorting pacman mirrors
|
||||
echo "# Sorting fastest pacman mirrors..."
|
||||
reflector --verbose -l 50 -p http --sort rate --save /etc/pacman.d/mirrorlist
|
||||
|
||||
# updating pacman cache
|
||||
echo "# Updating Pacman Cache..."
|
||||
pacman -Syy
|
||||
arch_chroot "pacman -Syy"
|
||||
|
||||
#installing base
|
||||
echo "# Installing Base..."
|
||||
if [ "$kernel" = "linux" ]
|
||||
then pacstrap /mnt base base-devel
|
||||
elif [ "$kernel" = "linux-lts" ]
|
||||
then pacstrap /mnt $(pacman -Sqg base | sed 's/^\(linux\)$/\1-lts/') base-devel
|
||||
elif [ "$kernel" = "linux-hardened" ]
|
||||
then pacstrap /mnt $(pacman -Sqg base | sed 's/^\(linux\)$/\1-hardened/') base-devel
|
||||
elif [ "$kernel" = "linux-zen" ]
|
||||
then pacstrap /mnt $(pacman -Sqg base | sed 's/^\(linux\)$/\1-zen/') base-devel
|
||||
|
||||
fi
|
||||
|
||||
#generating fstab
|
||||
echo "# Generating File System Table..."
|
||||
genfstab -p /mnt >> /mnt/etc/fstab
|
||||
if grep -q "/mnt/swapfile" "/mnt/etc/fstab"; then
|
||||
sed -i '/swapfile/d' /mnt/etc/fstab
|
||||
echo "/swapfile none swap defaults 0 0" >> /mnt/etc/fstab
|
||||
fi
|
||||
|
||||
# installing video and audio packages
|
||||
echo "# Installing Desktop, Sound, and Video Drivers..."
|
||||
pacstrap /mnt mesa xorg-server xorg-apps xorg-xinit xorg-twm xterm xorg-drivers alsa-utils pulseaudio pulseaudio-alsa xf86-input-synaptics xf86-input-keyboard xf86-input-mouse xf86-input-libinput intel-ucode b43-fwcutter networkmanager nm-connection-editor network-manager-applet polkit-gnome ttf-dejavu gnome-keyring xdg-user-dirs gvfs
|
||||
|
||||
# virtualbox
|
||||
if [ "$vb" = "0" ]
|
||||
then
|
||||
if [ "$kernel" = "linux" ]
|
||||
then pacstrap /mnt virtualbox-guest-modules-arch virtualbox-guest-utils
|
||||
echo -e "vboxguest\nvboxsf\nvboxvideo" > /mnt/etc/modules-load.d/virtualbox.conf
|
||||
elif [ "$kernel" = "linux-lts" ]
|
||||
then pacstrap /mnt virtualbox-guest-dkms virtualbox-guest-utils linux-lts-headers
|
||||
echo -e "vboxguest\nvboxsf\nvboxvideo" > /mnt/etc/modules-load.d/virtualbox.conf
|
||||
elif [ "$kernel" = "linux-hardened" ]
|
||||
then pacstrap /mnt virtualbox-guest-dkms virtualbox-guest-utils linux-hardened-headers
|
||||
echo -e "vboxguest\nvboxsf\nvboxvideo" > /mnt/etc/modules-load.d/virtualbox.conf
|
||||
elif [ "$kernel" = "linux-zen" ]
|
||||
then pacstrap /mnt virtualbox-guest-dkms virtualbox-guest-utils linux-zen-headers
|
||||
echo -e "vboxguest\nvboxsf\nvboxvideo" > /mnt/etc/modules-load.d/virtualbox.conf
|
||||
fi
|
||||
fi
|
||||
echo "25"
|
||||
|
||||
# installing chosen desktop
|
||||
if [ "$desktops" = "Look at more window managers" ]
|
||||
then pacstrap /mnt $wm
|
||||
else pacstrap /mnt $desktops
|
||||
fi
|
||||
|
||||
# cups
|
||||
if [ "$cp" = "0" ]
|
||||
then pacstrap /mnt ghostscript gsfonts system-config-printer gtk3-print-backends cups cups-pdf cups-filters
|
||||
arch_chroot "systemctl enable org.cups.cupsd.service"
|
||||
fi
|
||||
|
||||
# enabling network manager
|
||||
arch_chroot "systemctl enable NetworkManager"
|
||||
echo "50"
|
||||
# adding revenge_repo
|
||||
if [ "$rr" = "0" ]
|
||||
then echo "[revenge_repo]" >> /mnt/etc/pacman.conf;echo "SigLevel = Optional TrustAll" >> /mnt/etc/pacman.conf;echo "Server = https://raw.github.com/obrevenge/revenge_repo/master/x86_64" >> /mnt/etc/pacman.conf;echo "Server = https://downloads.sourceforge.net/project/revenge-repo/revenge_repo/x86_64" >> /mnt/etc/pacman.conf;echo "Server = ftp://ftp.heanet.ie/mirrors/sourceforge/r/re/revenge-repo/revenge_repo/x86_64" >> /mnt/etc/pacman.conf
|
||||
arch_chroot "sudo pacman -Syy"
|
||||
fi
|
||||
|
||||
# installing pamac-aur
|
||||
if [ "$pa" = "0" ]
|
||||
then echo "[spooky_aur]" >> /mnt/etc/pacman.conf;echo "SigLevel = Optional TrustAll" >> /mnt/etc/pacman.conf;echo "Server = https://raw.github.com/spookykidmm/spooky_aur/master/x86_64" >> /mnt/etc/pacman.conf
|
||||
arch_chroot "pacman -Syy"
|
||||
arch_chroot "pacman -S --noconfirm pamac-aur"
|
||||
fi
|
||||
|
||||
# AUR
|
||||
if [ "$abs" = "0" ]
|
||||
then echo "[spooky_aur]" >> /mnt/etc/pacman.conf;echo "SigLevel = Optional TrustAll" >> /mnt/etc/pacman.conf;echo "Server = https://raw.github.com/spookykidmm/spooky_aur/master/x86_64" >> /mnt/etc/pacman.conf
|
||||
arch_chroot "pacman -Syy"
|
||||
arch_chroot "pacman -S --noconfirm pacaur"
|
||||
|
||||
fi
|
||||
echo "75"
|
||||
|
||||
# installing bootloader
|
||||
if [ "$grb" = "0" ]
|
||||
then if [ "$SYSTEM" = 'BIOS' ]
|
||||
then echo "# Installing Bootloader..."
|
||||
pacstrap /mnt grub
|
||||
arch_chroot "grub-install --target=i386-pc $grub_device"
|
||||
arch_chroot "grub-mkconfig -o /boot/grub/grub.cfg"
|
||||
else
|
||||
echo "# Installing Bootloader..."
|
||||
|
||||
|
||||
if [ "$ans" = "Automatic Partitioning" ]
|
||||
then root_part=${dev}2
|
||||
fi
|
||||
|
||||
[[ $(echo $root_part | grep "/dev/mapper/") != "" ]] && bl_root=$root_part \
|
||||
|| bl_root=$"PARTUUID="$(blkid -s PARTUUID ${root_part} | sed 's/.*=//g' | sed 's/"//g')
|
||||
|
||||
arch_chroot "bootctl --path=/boot install"
|
||||
echo -e "default Arch\ntimeout 10" > /mnt/boot/loader/loader.conf
|
||||
[[ -e /mnt/boot/initramfs-linux.img ]] && echo -e "title\tArch Linux\nlinux\t/vmlinuz-linux\ninitrd\t/initramfs-linux.img\noptions\troot=${bl_root} rw" > /mnt/boot/loader/entries/Arch.conf
|
||||
[[ -e /mnt/boot/initramfs-linux-lts.img ]] && echo -e "title\tArchLinux LTS\nlinux\t/vmlinuz-linux-lts\ninitrd\t/initramfs-linux-lts.img\noptions\troot=${bl_root} rw" > /mnt/boot/loader/entries/Arch-lts.conf
|
||||
[[ -e /mnt/boot/initramfs-linux-hardened.img ]] && echo -e "title\tArch Linux hardened\nlinux\t/vmlinuz-linux-hardened\ninitrd\t/initramfs-linux-hardened.img\noptions\troot=${bl_root} rw" > /mnt/boot/loader/entries/Arch-hardened.conf
|
||||
[[ -e /mnt/boot/initramfs-linux-zen.img ]] && echo -e "title\tArch Linux Zen\nlinux\t/vmlinuz-linux-zen\ninitrd\t/initramfs-linux-zen.img\noptions\troot=${bl_root} rw" > /mnt/boot/loader/entries/Arch-zen.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
# running mkinit
|
||||
echo "# Running mkinitcpio..."
|
||||
arch_chroot "mkinitcpio -p $kernel"
|
||||
|
||||
|
||||
# installing chosen software
|
||||
echo "# Installing chosen software packages..."
|
||||
# Making Variables from Applications Lists
|
||||
int=` cat int2.txt `
|
||||
med=` cat med2.txt `
|
||||
off=` cat off2.txt `
|
||||
utils=` cat utils.txt `
|
||||
|
||||
|
||||
# Installing Selecting Applications
|
||||
arch_chroot "pacman -Syy"
|
||||
arch_chroot "pacman -S --noconfirm $int $med $off $utils"
|
||||
if [ "$lbr" = "0" ]
|
||||
then arch_chroot "pacman -S --noconfirm libreoffice-$lover $lolang"
|
||||
fi
|
||||
if [ "$frf" = "0" ]
|
||||
then arch_chroot "pacman -S --noconfirm firefox $fflang"
|
||||
fi
|
||||
#root password
|
||||
echo "# Setting root password..."
|
||||
touch .passwd
|
||||
echo -e "$rtpasswd\n$rtpasswd2" > .passwd
|
||||
arch_chroot "passwd root" < .passwd >/dev/null
|
||||
rm .passwd
|
||||
|
||||
#adding user
|
||||
echo "# Making new user..."
|
||||
arch_chroot "useradd -m -g users -G adm,lp,wheel,power,audio,video -s /bin/bash $username"
|
||||
touch .passwd
|
||||
echo -e "$userpasswd\n$userpasswd2" > .passwd
|
||||
arch_chroot "passwd $username" < .passwd >/dev/null
|
||||
rm .passwd
|
||||
|
||||
#setting locale
|
||||
echo "# Generating Locale..."
|
||||
echo "LANG=\"${locale}\"" > /mnt/etc/locale.conf
|
||||
echo "${locale} UTF-8" > /mnt/etc/locale.gen
|
||||
arch_chroot "locale-gen"
|
||||
export LANG=${locale}
|
||||
|
||||
#setting keymap
|
||||
mkdir -p /mnt/etc/X11/xorg.conf.d/
|
||||
echo -e 'Section "InputClass"\n\tIdentifier "system-keyboard"\n\tMatchIsKeyboard "on"\n\tOption "XkbLayout" "'$layout'"\n\tOption "XkbModel" "'$model'"\n\tOption "XkbVariant" ",'$variant'"\n\tOption "XkbOptions" "grp:alt_shift_toggle"\nEndSection' > /mnt/etc/X11/xorg.conf.d/00-keyboard.conf
|
||||
|
||||
#setting timezone
|
||||
echo "# Setting Timezone..."
|
||||
arch_chroot "rm /etc/localtime"
|
||||
arch_chroot "ln -s /usr/share/zoneinfo/${zone}/${subzone} /etc/localtime"
|
||||
|
||||
#setting hw clock
|
||||
echo "# Setting System Clock..."
|
||||
arch_chroot "hwclock --systohc --$clock"
|
||||
|
||||
#setting hostname
|
||||
echo "# Setting Hostname..."
|
||||
arch_chroot "echo $hname > /etc/hostname"
|
||||
|
||||
# setting sudo permissions
|
||||
echo "%wheel ALL=(ALL) ALL" >> /mnt/etc/sudoers
|
||||
|
||||
# selecting shell
|
||||
if [ "$shell" = "zsh" ]
|
||||
then arch_chroot "sudo pacman -S --noconfirm zsh zsh-syntax-highlighting zsh-completions grml-zsh-config;chsh -s /usr/bin/zsh $username"
|
||||
else arch_chroot "sudo pacman -S --noconfirm $shell;chsh -s /usr/bin/$shell"
|
||||
fi
|
||||
|
||||
# starting desktop manager
|
||||
if [ "$dm" = "default" ]
|
||||
then if [ "$desktop" == "gnome" ]
|
||||
then arch_chroot "systemctl enable gdm.service"
|
||||
elif [ "$desktop" = "budgie-desktop" ]
|
||||
then pacstrap /mnt lightdm lightdm-gtk-greeter-settings lightdm-gtk-greeter gnome-control-center gnome-backgrounds;arch_chroot "systemctl enable lightdm.service"
|
||||
elif [ "$desktop" = "lxde" ]
|
||||
then pacstrap /mnt lxdm-gtk3;arch_chroot "systemctl enable lxdm.service"
|
||||
elif [ "$desktop" == "plasma" ]
|
||||
then pacstrap /mnt sddm;arch_chroot "systemctl enable sddm.service"
|
||||
else pacstrap /mnt lightdm lightdm-gtk-greeter-settings lightdm-gtk-greeter
|
||||
arch_chroot "systemctl enable lightdm.service"
|
||||
fi
|
||||
elif [ "$dm" = "lightdm" ]
|
||||
then pacstrap /mnt lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings;arch_chroot "systemctl enable lightdm.service"
|
||||
else pacstrap /mnt $dm;arch_chroot "systemctl enable $dm.service"
|
||||
fi
|
||||
|
||||
# unmounting partitions
|
||||
umount -R /mnt
|
||||
echo "100"
|
||||
echo "# Installation Finished!"
|
||||
) | zenity --progress --percentage=0 --title="$title" --width=450 --no-cancel
|
||||
fi
|
||||
}
|
||||
|
||||
# execution
|
||||
# System Detection
|
||||
if [[ -d "/sys/firmware/efi/" ]]; then
|
||||
SYSTEM="UEFI"
|
||||
else
|
||||
SYSTEM="BIOS"
|
||||
fi
|
||||
|
||||
|
||||
# Setting variables
|
||||
title="Zen Installer Framework 1.00 $SYSTEM"
|
||||
|
||||
# Adapted from AIS. An excellent bit of code!
|
||||
arch_chroot() {
|
||||
arch-chroot /mnt /bin/bash -c "${1}"
|
||||
}
|
||||
|
||||
# Adapted from Feliz Installer
|
||||
Parted() {
|
||||
parted --script $dev "$1"
|
||||
}
|
||||
# Greeting the user
|
||||
zenity --question --height=50--title="$title" --text "Welcome to the Zen Arch Installer.\n\nNext you will be prompted with a series of questions that will\nguide you through installing Arch Linux.\nYou will be asked if you want to use manual or auto partitioning.\nIf you select auto partitioning the drive that you select will be completely deleted\nand Arch will be installed. If you select manual, you will have the opportunity to partition the disk yourself\nand select which partitons to use for installation.\nClick 'yes' to begin or 'no' to exit."
|
||||
|
||||
if [ "$?" = "1" ]
|
||||
then exit
|
||||
fi
|
||||
|
||||
partition
|
||||
configure
|
||||
root_password
|
||||
user_password
|
||||
changeshell
|
||||
kernel
|
||||
vbox
|
||||
#nvidia
|
||||
revengerepo
|
||||
pamacaur
|
||||
archuserrepo
|
||||
cups
|
||||
displaymanager
|
||||
desktop
|
||||
firefox
|
||||
libreoffice
|
||||
installapps
|
||||
bootloader
|
||||
installing
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue