1
0
Fork 0

idk, something has changed

This commit is contained in:
Arthur Khachaturov 2024-07-20 01:39:49 +03:00
parent ffe452fe24
commit ed190866f5
No known key found for this signature in database
GPG key ID: CAC2B7EB6DF45D55
28 changed files with 94 additions and 2179 deletions

View file

@ -5,29 +5,21 @@ PIDFILE="${XDG_RUNTIME_DIR}/mkchromecast.pid"
WIDTH=1440
HEIGHT=1080
ASPECT_OFFSET=240
OUTPUT_NAME='DVI-I-2-2'
inhibit_pid=''
OUTPUT_NAME='DVI-I-1-1'
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"
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,$2 -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() {
close() {
xrandr --output ${OUTPUT_NAME} --off
xrandr --delmode ${OUTPUT_NAME} "1920x1080"
pid="$(cat ${PIDFILE})"
pid="$(cat "${PIDFILE}")"
rm "${PIDFILE}"
pkill -35 dwmblocks
kill -INT "${pid}"
pkill -P "${pid}"
}
run() {
@ -37,18 +29,19 @@ run() {
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})"
h_offset=$(( "$(xrandr | grep ${OUTPUT_NAME} | cut -d ' ' -f 3 | cut -d '+' -f 2)" + "${ASPECT_OFFSET}" ))
v_offset="$(xrandr | grep ${OUTPUT_NAME} | cut -d ' ' -f 3 | cut -d '+' -f 3)"
systemd-inhibit --what=handle-lid-switch sleep 2592000 &
mkchromecast --video --command "$(command ${h_offset} "${v_offset}")"
}
if [ "$1" = "-k" ]; then
cleanup
close
exit 0
fi
if [ -f "${PIDFILE}" ]; then
cleanup || run
close || run
else
run
fi

View file

@ -1,3 +1,3 @@
#!/bin/bash
echo $(dmenu -p "$1" -nf '#3a3a3a' <&-)
dmenu -p "$1" -nf '#3a3a3a' <&-

View file

@ -19,7 +19,7 @@ remove() {
}
create_or_remove() {
if [ ! -z "$(xrandr | grep ${RES} | grep '*')" ]; then
if xrandr --listactivemonitors | grep -q "${OUTPUT}"; then
remove
else
create

View file

@ -6,7 +6,7 @@ if [ ! -d .git ]; then
fi
echo "Last commit: $(git log | grep 'Date' | cut -d ' ' -f 4- | head -1)"
read -p "Date: " date
read -r -p "Date: " date
export GIT_AUTHOR_DATE="${date}"
export GIT_COMMITTER_DATE="${date}"

6
.local/bin/scripts/pentablet Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
OUTPUT="${1:-"DP-1"}"
xinput --map-to-output "UGTABLET 6 inch PenTablet Mouse" "${OUTPUT}"
xinput --map-to-output "UGTABLET 6 inch PenTablet Pen (0)" "${OUTPUT}"
xinput --map-to-output "UGTABLET 6 inch PenTablet Eraser (0)" "${OUTPUT}"

View file

@ -30,15 +30,16 @@ sudo_a() {
dmenu -p "$1" <&-
}
if [ ! -z "${USE_TERMINAL}" ]; then
if [ -n "${USE_TERMINAL}" ]; then
LAUNCH_CMD=(sudo -A -p "Password:")
fi
# shellcheck disable=SC2068
if [ -z "${UP_NAME}" ]; then
IFNAME="${IFNAME}${DPI}"
${LAUNCH_CMD[@]} wg-quick up ${IFNAME}
${LAUNCH_CMD[@]} wg-quick up "${IFNAME}"
else
${LAUNCH_CMD[@]} wg-quick down ${UP_NAME}
${LAUNCH_CMD[@]} wg-quick down "${UP_NAME}"
fi
pkill -36 dwmblocks

View file

@ -6,12 +6,10 @@ 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 "Xft/DPI $(($1 * 1024))" > ~/.xsettingsd
echo "Gtk/CursorThemeSize $2" >> ~/.xsettingsd
xrdb -merge ~/.Xresources
@ -30,10 +28,14 @@ if [[ -z "${EXT_MON}" ]]; then
change_dpi 192 48
else
xrandr --rmmode "${INT_RES}"
xrandr --newmode $(echo $INT_MODELINE)
# shellcheck disable=all
xrandr --newmode $(echo $INT_MODELINE) # this is a hack to make xrandr recognize the resolution
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
xrandr --output eDP-1 --pos 2560x400 --mode "${INT_RES}" --output "${EXT_MON}" --pos 0x0 --mode "2560x1440" --rate 144 --primary
change_dpi 96 24
xinput --map-to-output "UGTABLET 6 inch PenTablet Mouse" "${EXT_MON}"
xinput --map-to-output "UGTABLET 6 inch PenTablet Pen (0)" "${EXT_MON}"
xinput --map-to-output "UGTABLET 6 inch PenTablet Eraser (0)" "${EXT_MON}"
fi
${HOME}/.config/X11/autostart
"${HOME}/.config/X11/autostart"