move script folders to a correct place, some vim config changes, etc...
This commit is contained in:
parent
c360fc2339
commit
ffe452fe24
28 changed files with 380 additions and 360 deletions
54
.local/bin/scripts/cast
Executable file
54
.local/bin/scripts/cast
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/bash
|
||||
|
||||
PIDFILE="${XDG_RUNTIME_DIR}/mkchromecast.pid"
|
||||
|
||||
WIDTH=1440
|
||||
HEIGHT=1080
|
||||
ASPECT_OFFSET=240
|
||||
OUTPUT_NAME='DVI-I-2-2'
|
||||
|
||||
inhibit_pid=''
|
||||
|
||||
command() {
|
||||
echo "ffmpeg -ac 2 -ar 44100 -frame_size 2048 -fragment_size 2048 -f pulse -ac 2 -i Mkchromecast.monitor -f x11grab -r 30 -s ${WIDTH}x${HEIGHT} -i :0.0+$1,0 -vcodec libx264 -preset veryfast -tune zerolatency -maxrate 10000k -bufsize 20000k -pix_fmt yuv420p -g 60 -f mp4 -vf scale=1280:720 -movflags frag_keyframe+empty_moov -ar 44100 -acodec libvorbis pipe:1"
|
||||
}
|
||||
|
||||
set -x
|
||||
|
||||
sigint() {
|
||||
kill -9 ${inhibit_pid}
|
||||
}
|
||||
|
||||
trap 'sigint' SIGINT
|
||||
|
||||
cleanup() {
|
||||
xrandr --output ${OUTPUT_NAME} --off
|
||||
xrandr --delmode ${OUTPUT_NAME} "1920x1080"
|
||||
pid="$(cat ${PIDFILE})"
|
||||
rm "${PIDFILE}"
|
||||
pkill -35 dwmblocks
|
||||
kill -INT "${pid}"
|
||||
}
|
||||
|
||||
run() {
|
||||
xrandr --setprovideroutputsource 1 0
|
||||
xrandr --addmode ${OUTPUT_NAME} 1920x1080
|
||||
xrandr --output ${OUTPUT_NAME} --mode 1920x1080 --rate 60 --right-of eDP-1
|
||||
|
||||
echo $$ > "${PIDFILE}"
|
||||
pkill -35 dwmblocks
|
||||
offset=$(( "$(xrandr | grep ${OUTPUT_NAME} | cut -d ' ' -f 3 | cut -d '+' -f 2)" + ${ASPECT_OFFSET} ))
|
||||
systemd-inhibit --what=handle-lid-switch sleep 2592000 & inhibit_pid="$!"
|
||||
mkchromecast --video --command "$(command ${offset})"
|
||||
}
|
||||
|
||||
if [ "$1" = "-k" ]; then
|
||||
cleanup
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f "${PIDFILE}" ]; then
|
||||
cleanup || run
|
||||
else
|
||||
run
|
||||
fi
|
||||
3
.local/bin/scripts/dmenu_askpass
Executable file
3
.local/bin/scripts/dmenu_askpass
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo $(dmenu -p "$1" -nf '#3a3a3a' <&-)
|
||||
36
.local/bin/scripts/dual_monitor
Executable file
36
.local/bin/scripts/dual_monitor
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
|
||||
MODELINE=$(cvt 4120 1440 144 | tail -1 | cut -d " " -f 2- | tr -d '"')
|
||||
RES="$(echo $MODELINE | cut -d ' ' -f 1 | tr -d '\"')"
|
||||
OUTPUT="DVI-I-1-1"
|
||||
|
||||
create() {
|
||||
xrandr --newmode $(echo $MODELINE)
|
||||
xrandr --addmode ${OUTPUT} "${RES}"
|
||||
xrandr --output ${OUTPUT} --mode "${RES}"
|
||||
}
|
||||
|
||||
remove() {
|
||||
xrandr --output ${OUTPUT} --off
|
||||
xrandr --delmode ${OUTPUT} "${RES}"
|
||||
xrandr --rmmode "${RES}"
|
||||
}
|
||||
|
||||
create_or_remove() {
|
||||
if [ ! -z "$(xrandr | grep ${RES} | grep '*')" ]; then
|
||||
remove
|
||||
else
|
||||
create
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
'-c'|'--create') create
|
||||
;;
|
||||
'-d'|'--delete') remove
|
||||
;;
|
||||
*) create_or_remove
|
||||
;;
|
||||
esac
|
||||
14
.local/bin/scripts/gdt
Executable file
14
.local/bin/scripts/gdt
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ ! -d .git ]; then
|
||||
echo "missing .git dir!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Last commit: $(git log | grep 'Date' | cut -d ' ' -f 4- | head -1)"
|
||||
read -p "Date: " date
|
||||
|
||||
export GIT_AUTHOR_DATE="${date}"
|
||||
export GIT_COMMITTER_DATE="${date}"
|
||||
|
||||
git "$@"
|
||||
11
.local/bin/scripts/mnt
Executable file
11
.local/bin/scripts/mnt
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
[ -z "$1" ] && (echo "No arguments supplied!" ; exit 1)
|
||||
|
||||
if [ "$(udisksctl info -b "$1" | grep -c 'MountPoints:\s\{8\}.')" -eq 0 ]; then
|
||||
udisksctl mount -b "$1"
|
||||
else
|
||||
udisksctl unmount -b "$1"
|
||||
fi
|
||||
44
.local/bin/scripts/vpn
Executable file
44
.local/bin/scripts/vpn
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/bash
|
||||
|
||||
IFNAME="wg_lva"
|
||||
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
'd'|'-d'|'--dpi') DPI="_d"
|
||||
;;
|
||||
'm'|'msk') IFNAME='wg_msk'
|
||||
;;
|
||||
'-v'|'--verbose') VERBOSE=1
|
||||
;;
|
||||
'--visual') USE_TERMINAL=1
|
||||
;;
|
||||
*) echo "Wrong argument!"; exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -z "${VERBOSE}" ]; then
|
||||
exec &>/dev/null
|
||||
else
|
||||
set -x
|
||||
fi
|
||||
|
||||
UP_NAME="$(ip link show | grep 'wg' | cut -d ' ' -f 2 | sed 's/://')"
|
||||
|
||||
sudo_a() {
|
||||
dmenu -p "$1" <&-
|
||||
}
|
||||
|
||||
if [ ! -z "${USE_TERMINAL}" ]; then
|
||||
LAUNCH_CMD=(sudo -A -p "Password:")
|
||||
fi
|
||||
|
||||
if [ -z "${UP_NAME}" ]; then
|
||||
IFNAME="${IFNAME}${DPI}"
|
||||
${LAUNCH_CMD[@]} wg-quick up ${IFNAME}
|
||||
else
|
||||
${LAUNCH_CMD[@]} wg-quick down ${UP_NAME}
|
||||
fi
|
||||
|
||||
pkill -36 dwmblocks
|
||||
39
.local/bin/scripts/xr
Executable file
39
.local/bin/scripts/xr
Executable file
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
# supress stderr
|
||||
exec 2> /dev/null
|
||||
|
||||
change_dpi() {
|
||||
sed -i -E --follow-symlinks "s/Xft\.dpi: .*?/Xft\.dpi: $1/g" ~/.Xresources
|
||||
sed -i -E --follow-symlinks "s/Xcursor\.size: .*?/Xcursor\.size: $2/g" ~/.Xresources
|
||||
|
||||
sed -i -E --follow-symlinks "s/gtk-cursor-theme-size=.*?/gtk-cursor-theme-size=$2/g" ~/.config/gtk-3.0/settings.ini
|
||||
|
||||
sed -i -E --follow-symlinks "s/gtk-cursor-theme-size=.*?/gtk-cursor-theme-size=$2/g" ~/.gtkrc-2.0
|
||||
|
||||
echo "Xft/DPI $(expr $1 \* 1024)" > ~/.xsettingsd
|
||||
echo "Gtk/CursorThemeSize $2" >> ~/.xsettingsd
|
||||
|
||||
xrdb -merge ~/.Xresources
|
||||
killall -HUP dwm
|
||||
killall -HUP xsettingsd
|
||||
}
|
||||
|
||||
EXT_MON="$(xrandr | grep -ow "\(DP-[0-9]\) connected" | cut -d " " -f 1)"
|
||||
INT_MODELINE=$(cvt 1560 1040 90 | grep "Modeline" | cut -d " " -f 2- | tr -d '"')
|
||||
INT_RES="$(echo $INT_MODELINE | cut -d ' ' -f 1 | tr -d '\"')"
|
||||
|
||||
if [[ -z "${EXT_MON}" ]]; then
|
||||
xrandr --output eDP-1 --pos 0x0 --mode "3120x2080" --rate 90 --primary --output DP-1 --off --output DP-2 --off --output DP-3 --off --output DP-4 --off
|
||||
xrandr --delmode eDP-1 "${INT_RES}"
|
||||
xrandr --rmmode "${INT_RES}"
|
||||
change_dpi 192 48
|
||||
else
|
||||
xrandr --rmmode "${INT_RES}"
|
||||
xrandr --newmode $(echo $INT_MODELINE)
|
||||
xrandr --addmode eDP-1 "${INT_RES}"
|
||||
xrandr --output eDP-1 --pos 2560x400 --mode "${INT_RES}" --output ${EXT_MON} --pos 0x0 --mode "2560x1440" --rate 144 --primary
|
||||
change_dpi 96 24
|
||||
fi
|
||||
|
||||
${HOME}/.config/X11/autostart
|
||||
Loading…
Add table
Add a link
Reference in a new issue