Add scripts

This commit is contained in:
samedamci 2020-05-08 20:35:40 +02:00
parent 170db64dac
commit b037373ade
No known key found for this signature in database
GPG Key ID: FCB4A9A20D00E894
10 changed files with 150 additions and 1 deletions

51
.local/bin/scripts/autostart Executable file
View File

@ -0,0 +1,51 @@
#!/bin/bash
# _ _ _
# __ _ _ _| |_ ___ ___| |_ __ _ _ __| |_
# / _` | | | | __/ _ \/ __| __/ _` | '__| __|
# | (_| | |_| | || (_) \__ \ || (_| | | | |_
# \__,_|\__,_|\__\___/|___/\__\__,_|_| \__|
# Load .Xresources
xrdb ~/.Xresources
# Wallpaper
if [ "$HOSTNAME" == "pc" ];then
feh --bg-fill --randomize /home/samedamci/.config/wallpapers/1920x1080/ &
elif [ "$HOSTNAME" == "laptop" ];then
feh --bg-fill --randomize /home/samedamci/.config/wallpapers/1366x768/ &
fi
# Polybar
# killall -q polybar
# while pgrep -u $UID -x polybar >/dev/null; do killall -q polybar; done
# polybar polybarexe &
# sxhkd
# killall -q sxhkd
# while pgrep -u $UID -x sxhkd >/dev/null; do killall -q sxhkd; done
# sxhkd &
# Dunst
killall -q dunst
while pgrep -u $UID -x dunst >/dev/null; do killall -q dunst; done
dunst &
# Picom
killall -q picom
while pgrep -u $UID -x picom >/dev/null; do killall -q picom; done
picom &
# Set keyboard layout & key swaping
setxkbmap -layout 'pl' -option caps:swapescape &
# Cursor
xsetroot -cursor_name left_ptr & # change the cursor shape from "x" to normal
xsetroot -name " samedamci "
# Not reload
[[ -z $(pgrep udiskie) ]] && udiskie &
[[ -z $(pgrep clipmenud) ]] && clipmenud &
[[ -z $(pgrep mpd) ]] && mpd &
[[ -z $(pgrep dunst) ]] && dunst &
[[ -z $(pgrep syncthing) ]] && syncthing -no-browser &
telegram-desktop &
~/.scripts/dwmbar &
# Welcome notify
dunstify "Hello ${USER}!"

6
.local/bin/scripts/dwmbar Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
while true; do
xsetroot -name "  $(awk -F"[][]" '/dB/ { print $2 }' <(amixer sget Master)) |  $(date "+%H:%M:%S %p") |  $(pacman -Qu | wc -l) "
sleep 1
done

11
.local/bin/scripts/lockscreen Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env sh
mkdir ~/.cache/lock/
f="$HOME/.cache/lock/lock.jpg"
maim -u -m 7 -f jpg "$f"
convert "$f" -blur 0x6 "$f"
i3lock -i "$f" --composite --insidecolor=55443311 --ringcolor=99443300 --insidevercolor=55443311 --keyhlcolor=99999999 --indicator --veriftext= --wrongtext=! --radius 180 -b --separatorcolor=00000000
rm "$f"

11
.local/bin/scripts/powermenu Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env sh
WHAT="$(printf "Shutdown\nSuspend\nLock\nReboot" | dmenu -i -p 'What do you want?' -h 24)"
if [ -z "$WHAT" ]; then exit; fi
case "$WHAT" in
Shutdown) systemctl poweroff;;
Suspend) sh ~/.scripts/lockscreen; systemctl suspend;;
Lock) sh ~/.scripts/lockscreen;;
Reboot) systemctl reboot
esac

23
.local/bin/scripts/screenshot Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env sh
m() { rofi -dmenu -i -l "$@"; }
TYPE="$(printf "Screen\nArea\n" | m 2 -p 'What do you want to screenshot?')"
[ ! "$TYPE" ] && exit
SAVE="$(printf "No\nYes" | m 2 -p 'Do you want to copy to clipboard?')"
[ ! "$SAVE" ] && exit
TIME="$(printf "0.7\n5\n10\n15" | m 3 -p 'How many seconds you want to wait?')"
[ ! "$TIME" ] && exit
[ "$TYPE" = "Area" ] && TYPE="-s -u" || TYPE=""
mkdir -p ~/Pictures/Screenshots
sleep "$TIME"
SCREEN_PATH=~/Pictures/Screenshots/$(date +%G-%m-%d_%s).png
maim $TYPE "$SCREEN_PATH" &&
notify-send -u low -t 1400 -i "$SCREEN_PATH" "Screenshot created!"
[ "$SAVE" = "Yes" ] &&
xclip -sel clip /dev/null; sleep 0.5
xclip -selection clipboard -t image/png "$SCREEN_PATH" || exit

10
.local/bin/scripts/update-check Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
# killall wificheck.sh &> /dev/null
if ping -w 1 archlinux.org &> /dev/null
then
printf "$(checkupdates | wc -l)"
else
echo "  "
fi

14
.local/bin/scripts/updater Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
CHECK="$(printf "Yes\nNo\nShow packages" | dmenu -i -p 'Do you want to make packages update?' -h 24)"
if [ -z "$CHECK" ]; then exit; fi
case "$CHECK" in
Yes)
export PASS=$(printf | dmenu -P -p "Enter password: " -h 24)
if [ -z "$PASS" ]; then exit; fi
st -e sh -c 'bspc node -d '^10'; echo $PASS | sudo -S -v && clear; sudo pacman -Su --noconfirm';;
"Show packages")
pacman -Qu | dmenu -l 50 ;;
*) exit
esac

22
.local/bin/scripts/websearch Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env sh
bookmarks="redd.it\narch wiki\ninvidio.us\ngithub\ngitlab\ndotfiles\npython doc\nvulcan"
PHRASE="$(printf "${bookmarks}" | dmenu -h 24 -p "Web search:")"
case "$PHRASE" in
"redd.it") PG="https://reddit.com" ;;
"arch wiki") PG="https://wiki.archlinux.org" ;;
"invidio.us") PG="https://invidio.us" ;;
"github") PG="https://github.com" ;;
"gitlab") PG="https://gitlab.com" ;;
"dotfiles") PG="https:github.com/samedamci/biual-dot-conf" ;;
"python doc") PG="https://docs.python.org/3/" ;;
"vulcan") PG="https://uonetplus.vulcan.net.pl/powiatrycki" ;;
*) PG="$PHRASE"
esac
if [ -n "$PG" ]; then
qutebrowser "$PG" &
bspc desktop -f '^3'
fi

1
.local/bin/scripts/wifi-ip Executable file
View File

@ -0,0 +1 @@
ip a show wlp8s0 | grep -Eo '(inet)?*([0-9]*\.){3}[0-9]*' | grep -v '**\.255'

View File

@ -22,7 +22,7 @@ export TERMINAL="st"
export GOPATH=$HOME/.local/go
export NPM_PACKAGES="$HOME/.yarn/bin/"
export PATH="$PATH:$HOME/Dotfiles:$HOME/.local/bin:$NPM_PACKAGES:$GOROOT/bin:$GOPATH/bin"
export PATH="$PATH:$HOME/.local/bin/:$HOME/.local/bin/scripts/:$NPM_PACKAGES:$GOROOT/bin:$GOPATH/bin"
export SCRD=$HOME/.scripts/