summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2025-10-17 12:22:00 -0400
committerAndrew Opalach <andrew@akon.city> 2025-10-17 12:32:42 -0400
commit544da1ba50d9cbf51a18ca0abf1db66b3baa7460 (patch)
tree1caa87664ea4937c5f4e6e8dc83c49b3132ddd70 /scripts
parent85a47287e56ba9100420246531ebea5996cc0486 (diff)
downloaddotfiles-544da1ba50d9cbf51a18ca0abf1db66b3baa7460.tar.gz
dotfiles-544da1ba50d9cbf51a18ca0abf1db66b3baa7460.tar.bz2
dotfiles-544da1ba50d9cbf51a18ca0abf1db66b3baa7460.zip
Gentoo desktop
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/desktop/bemenu-colored2
-rwxr-xr-xscripts/desktop/dbus-sway-environment1
-rwxr-xr-xscripts/desktop/dmenu-emoji3
-rwxr-xr-xscripts/desktop/dmenu-path2
-rwxr-xr-xscripts/desktop/dmenu-path02
-rwxr-xr-xscripts/desktop/export-nfs6
-rwxr-xr-xscripts/desktop/id-dm-device2
-rwxr-xr-xscripts/desktop/iommu-groups7
-rwxr-xr-xscripts/desktop/map-kernel-ata4
-rwxr-xr-xscripts/desktop/mount-nfs6
-rwxr-xr-xscripts/desktop/mount-vm-disk28
-rwxr-xr-xscripts/desktop/nvidia-fan-speed4
-rwxr-xr-xscripts/desktop/prepare-virt-shm4
-rwxr-xr-xscripts/desktop/proton-env24
-rwxr-xr-xscripts/desktop/proton-env3222
-rwxr-xr-xscripts/desktop/raid-status2
-rwxr-xr-xscripts/desktop/rip-dvd13
-rwxr-xr-xscripts/desktop/sp5
-rwxr-xr-xscripts/desktop/unrar-all2
-rwxr-xr-xscripts/desktop/unzip-all (renamed from scripts/unzip-all)0
-rwxr-xr-xscripts/desktop/xbox-controller-battery2
-rwxr-xr-xscripts/gentoo/check-orphans2
-rwxr-xr-xscripts/gentoo/do-grub-install2
-rwxr-xr-xscripts/gentoo/gen-dracut2
-rwxr-xr-xscripts/gentoo/use-flags2
-rwxr-xr-xscripts/sync/pull.sh8
-rwxr-xr-xscripts/sync/push.sh10
27 files changed, 156 insertions, 11 deletions
diff --git a/scripts/desktop/bemenu-colored b/scripts/desktop/bemenu-colored
new file mode 100755
index 0000000..2636cab
--- /dev/null
+++ b/scripts/desktop/bemenu-colored
@@ -0,0 +1,2 @@
+#! /usr/bin/env sh
+bemenu -C --single-instance -B 0 -M 0 --hp 6 -p ""
diff --git a/scripts/desktop/dbus-sway-environment b/scripts/desktop/dbus-sway-environment
index 249d610..27dd28c 100755
--- a/scripts/desktop/dbus-sway-environment
+++ b/scripts/desktop/dbus-sway-environment
@@ -1,5 +1,4 @@
#! /usr/bin/env sh
-
dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK
systemctl --user stop pipewire{,-pulse}.{socket,service} xdg-desktop-portal xdg-desktop-portal-wlr
systemctl --user start pipewire{,-pulse}.{socket,service} xdg-desktop-portal xdg-desktop-portal-wlr
diff --git a/scripts/desktop/dmenu-emoji b/scripts/desktop/dmenu-emoji
index 07c1900..083cd65 100755
--- a/scripts/desktop/dmenu-emoji
+++ b/scripts/desktop/dmenu-emoji
@@ -1,2 +1,3 @@
#! /usr/bin/env sh
-jq -r ".[] | .emoji + \" \" + (.aliases[0])" /etc/emoji.json
+# https://raw.githubusercontent.com/chalda-pnuzig/emojis.json/refs/heads/master/dist/categories.min.json
+jq -r ".emojis[][][] | .emoji + \" \" + .name" ../categories.min.json
diff --git a/scripts/desktop/dmenu-path b/scripts/desktop/dmenu-path
index 9c8122a..da86257 100755
--- a/scripts/desktop/dmenu-path
+++ b/scripts/desktop/dmenu-path
@@ -1,3 +1,3 @@
#! /usr/bin/env sh
# https://github.com/ema/dotfiles/blob/fb7f5cab530daba74edefb9cecb401262db063a9/bin/dmenu_path
-printf $PATH -print0 | tr ':' '\0' | uniq -z | xargs -0 ls -Llu --time-style=+%s | awk '/^(-|l)/ { printf $6" "$7"\n" }' | sort -rn | cut -d' ' -f 2
+printf $PATH -print0 | tr ':' '\0' | uniq -z | xargs -0 ls -Llu --time-style=+%s 2>/dev/null | awk '/^(-|l)/ { printf $6" "$7"\n" }' | sort -rn | cut -d' ' -f 2
diff --git a/scripts/desktop/dmenu-path0 b/scripts/desktop/dmenu-path0
index 593ecf6..c90ecfe 100755
--- a/scripts/desktop/dmenu-path0
+++ b/scripts/desktop/dmenu-path0
@@ -1,3 +1,3 @@
#! /usr/bin/env sh
# https://github.com/ema/dotfiles/blob/fb7f5cab530daba74edefb9cecb401262db063a9/bin/dmenu_path
-printf $PATH -print0 | tr ':' '\0' | uniq -z | xargs -0 ls -Llu --time-style=+%s | awk '/^(-|l)/ { printf $6" "$7"\0" }' | sort -zrn | cut -z -d' ' -f 2
+printf $PATH -print0 | tr ':' '\0' | uniq -z | xargs -0 ls -Llu --time-style=+%s 2>/dev/null | awk '/^(-|l)/ { printf $6" "$7"\0" }' | sort -zrn | cut -z -d' ' -f 2
diff --git a/scripts/desktop/export-nfs b/scripts/desktop/export-nfs
new file mode 100755
index 0000000..deb3beb
--- /dev/null
+++ b/scripts/desktop/export-nfs
@@ -0,0 +1,6 @@
+#! /usr/bin/env sh
+if [ "$(id -u)" -ne 0 ]; then
+ echo 'This script must be run by root.' >&2
+ exit 1
+fi
+exportfs -o rw,async,insecure,no_subtree_check,crossmnt -i 192.168.0.0/16:$1
diff --git a/scripts/desktop/id-dm-device b/scripts/desktop/id-dm-device
new file mode 100755
index 0000000..7b6eaa6
--- /dev/null
+++ b/scripts/desktop/id-dm-device
@@ -0,0 +1,2 @@
+#! /usr/bin/env sh
+doas dmsetup info /dev/$1
diff --git a/scripts/desktop/iommu-groups b/scripts/desktop/iommu-groups
new file mode 100755
index 0000000..56cfd85
--- /dev/null
+++ b/scripts/desktop/iommu-groups
@@ -0,0 +1,7 @@
+#! /usr/bin/env bash
+# This was copied from somewhere a while ago, forgot to put the link.
+for d in /sys/kernel/iommu_groups/*/devices/*; do
+ n=${d#*/iommu_groups/*}; n=${n%%/*}
+ printf 'IOMMU Group %s ' "$n"
+ lspci -nns "${d##*/}"
+done
diff --git a/scripts/desktop/map-kernel-ata b/scripts/desktop/map-kernel-ata
new file mode 100755
index 0000000..2af6918
--- /dev/null
+++ b/scripts/desktop/map-kernel-ata
@@ -0,0 +1,4 @@
+#! /usr/bin/env sh
+# https://superuser.com/a/617193
+#doas grep '[0-9]' /sys/class/scsi_host/host{0..9}/unique_id
+doas ls -l /sys/block/*
diff --git a/scripts/desktop/mount-nfs b/scripts/desktop/mount-nfs
index a07f4cf..09095d3 100755
--- a/scripts/desktop/mount-nfs
+++ b/scripts/desktop/mount-nfs
@@ -1,2 +1,6 @@
#! /usr/bin/env sh
-sudo mount -t nfs4 -o noatime,nodiratime,rw,hard,fsc,proto=tcp,timeo=600,retrans=2,nfsvers=4,minorversion=2 moyo:$1 $2
+if [ "$(id -u)" -ne 0 ]; then
+ echo 'This script must be run by root.' >&2
+ exit 1
+fi
+mount -t nfs4 -o noatime,nodiratime,rw,hard,fsc,proto=tcp,timeo=600,retrans=2,nfsvers=4,minorversion=2 moyo:$1 $2
diff --git a/scripts/desktop/mount-vm-disk b/scripts/desktop/mount-vm-disk
new file mode 100755
index 0000000..3d1423d
--- /dev/null
+++ b/scripts/desktop/mount-vm-disk
@@ -0,0 +1,28 @@
+#! /usr/bin/env sh
+if [ "$(id -u)" -ne 0 ]; then
+ echo 'This script must be run by root.' >&2
+ exit 1
+fi
+
+# https://gist.github.com/pshchelo/6ffabbffaedc46456b39c037d16e1d8c
+
+#LIBGUESTFS_PATH=/usr/share/guestfs/appliance \
+# guestmount -a "$1" -m /dev/vda1 --ro "$2"
+modprobe nbd max_part=8
+
+#qemu-nbd --connect=/dev/nbd0 /var/lib/libvirt/images/devuan.qcow2
+#cryptsetup open /dev/nbd0p3 vm-disk
+#pvscan --cache /dev/mapper/vm-disk
+
+qemu-nbd --connect=/dev/nbd1 /var/lib/libvirt/images/nixos-test.qcow2
+pvscan --cache /dev/ndb1p3
+
+#qemu-nbd --connect=/dev/nbd2 /var/lib/libvirt/images/tora.qcow2
+#pvscan --cache /dev/ndb2p3
+
+vgscan
+lvscan
+
+#mount /dev/shima-vg/root /mnt/tmp/
+mount /dev/test-vg0/root /mnt/tmp/
+#mount /dev/tora-vg0/root /mnt/tmp/
diff --git a/scripts/desktop/nvidia-fan-speed b/scripts/desktop/nvidia-fan-speed
new file mode 100755
index 0000000..87cc9ec
--- /dev/null
+++ b/scripts/desktop/nvidia-fan-speed
@@ -0,0 +1,4 @@
+#! /usr/bin/env sh
+nvidia-settings --display :0 -q "[gpu:0]/GPUFanControlState" -q "[fan:0]/GPUTargetFanSpeed"
+#nvidia-settings --display :0 -a "[gpu:0]/GPUFanControlState=1" -a "[fan:0]/GPUTargetFanSpeed=55"
+
diff --git a/scripts/desktop/prepare-virt-shm b/scripts/desktop/prepare-virt-shm
new file mode 100755
index 0000000..95cc848
--- /dev/null
+++ b/scripts/desktop/prepare-virt-shm
@@ -0,0 +1,4 @@
+#! /usr/bin/env sh
+touch /dev/shm/looking-glass
+chown andrew:kvm /dev/shm/looking-glass
+chmod 0666 /dev/shm/looking-glass
diff --git a/scripts/desktop/proton-env b/scripts/desktop/proton-env
new file mode 100755
index 0000000..c25fe30
--- /dev/null
+++ b/scripts/desktop/proton-env
@@ -0,0 +1,24 @@
+#! /usr/bin/env sh
+
+# https://gist.github.com/Kron4ek/af1bbc1353302751a0941308294ec24a
+
+export STEAM_COMPAT_LAUNCHER_SERVICE=proton
+
+export DXVK_HUD=compiler
+export DXVK_LOG_LEVEL=none
+export DXVK_DEBUG=none
+
+export VKD3D_HUD=compiler
+export VKD3D_DEBUG=none
+export VKD3D_SHADER_DEBUG=none
+
+unset SDL_VIDEODRIVER
+unset SDL_VIDEO_DRIVER
+
+xrandr --output $MAIN_MONITOR --primary
+
+if [[ $MANGOHUD == 1 || -z $MANGOHUD ]]; then
+ exec env LD_PRELOAD="/usr/lib64/libgamemodeauto.so:/usr/lib64/libMangoHud.so:/usr/lib64/libMangoHud_opengl.so" mangohud "$@"
+else
+ exec env LD_PRELOAD="/usr/lib64/libgamemodeauto.so" "$@"
+fi
diff --git a/scripts/desktop/proton-env32 b/scripts/desktop/proton-env32
new file mode 100755
index 0000000..067ef02
--- /dev/null
+++ b/scripts/desktop/proton-env32
@@ -0,0 +1,22 @@
+#! /usr/bin/env sh
+
+export STEAM_COMPAT_LAUNCHER_SERVICE=proton
+
+export DXVK_HUD=compiler
+export DXVK_LOG_LEVEL=none
+export DXVK_DEBUG=none
+
+export VKD3D_HUD=compiler
+export VKD3D_DEBUG=none
+export VKD3D_SHADER_DEBUG=none
+
+unset SDL_VIDEODRIVER
+unset SDL_VIDEO_DRIVER
+
+xrandr --output $MAIN_MONITOR --primary
+
+if [[ $MANGOHUD == 1 || -z $MANGOHUD ]]; then
+ exec env LD_PRELOAD="/usr/lib/libgamemodeauto.so:/usr/lib/libMangoHud.so:/usr/lib/libMangoHud_opengl.so" mangohud "$@"
+else
+ exec env LD_PRELOAD="/usr/lib/libgamemodeauto.so" "$@"
+fi
diff --git a/scripts/desktop/raid-status b/scripts/desktop/raid-status
new file mode 100755
index 0000000..516ffd8
--- /dev/null
+++ b/scripts/desktop/raid-status
@@ -0,0 +1,2 @@
+#! /usr/bin/env sh
+doas lvs -a -o name,copy_percent,health_status,devices $1
diff --git a/scripts/desktop/rip-dvd b/scripts/desktop/rip-dvd
new file mode 100755
index 0000000..6886ee9
--- /dev/null
+++ b/scripts/desktop/rip-dvd
@@ -0,0 +1,13 @@
+#! /usr/bin/env bash
+
+# https://old.reddit.com/r/linux/comments/b3kj72/recently_decided_to_archive_some_of_my_dvds/
+#NAME=$1
+#ARRAY=($(isoinfo -d -f -i /dev/sr0 | grep -i -E 'block size|volume size' | sed '/is/ s/[^:]*: *//; s/,.*//'))
+#printf "Creating $NAME\n"
+#printf "bs=${ARRAY[0]}, count=${ARRAY[1]}\n"
+#dcfldd if=/dev/sr0 of=$NAME bs=${ARRAY[0]} count=${ARRAY[1]} status=on errlog=errors.log hash=md5 hashlog=hash.log
+
+# https://gist.github.com/Querulous/3124f53ce6ddf5a55c262234e74028ba
+BLOCK_SIZE=$(isosize -x /dev/sr0 | awk '{print $6}')
+# ddrescue "direct" mode doesn't work with my drive, it just spams errors.
+ddrescue -b $BLOCK_SIZE -r 1 -v /dev/sr0 --log-events=events.log --log-rates=rates.log --log-reads=reads.log "$1.iso" "$1.log"
diff --git a/scripts/desktop/sp b/scripts/desktop/sp
index 19d38a1..6ccdfce 100755
--- a/scripts/desktop/sp
+++ b/scripts/desktop/sp
@@ -1,6 +1,7 @@
#! /usr/bin/env sh
if [ $# -eq 0 ]; then
- wl-paste | aspell -a
+ INPUT=$(wl-paste)
else
- echo "$@" | aspell -a
+ INPUT="$@"
fi
+echo $INPUT | aspell -a | tee /dev/tty | awk 'FNR==2{ printf $5}' | sed 's/,//' | wl-copy
diff --git a/scripts/desktop/unrar-all b/scripts/desktop/unrar-all
new file mode 100755
index 0000000..7c9f531
--- /dev/null
+++ b/scripts/desktop/unrar-all
@@ -0,0 +1,2 @@
+#! /usr/bin/env sh
+find "$1" ! -path "${1%/}/$(basename $PWD)/*" -name '*.rar' -exec sh -c 'x=${1%.*}; 7z x -o"${x##*/}" "$1"' _ {} \;
diff --git a/scripts/unzip-all b/scripts/desktop/unzip-all
index 0982666..0982666 100755
--- a/scripts/unzip-all
+++ b/scripts/desktop/unzip-all
diff --git a/scripts/desktop/xbox-controller-battery b/scripts/desktop/xbox-controller-battery
new file mode 100755
index 0000000..84913cc
--- /dev/null
+++ b/scripts/desktop/xbox-controller-battery
@@ -0,0 +1,2 @@
+#! /usr/bin/env sh
+cat /sys/class/power_supply/gip0.0/capacity_level
diff --git a/scripts/gentoo/check-orphans b/scripts/gentoo/check-orphans
new file mode 100755
index 0000000..b253282
--- /dev/null
+++ b/scripts/gentoo/check-orphans
@@ -0,0 +1,2 @@
+#! /usr/bin/env sh
+find $1 -type f | xargs -I{} qfile -o {}
diff --git a/scripts/gentoo/do-grub-install b/scripts/gentoo/do-grub-install
new file mode 100755
index 0000000..eb5d04e
--- /dev/null
+++ b/scripts/gentoo/do-grub-install
@@ -0,0 +1,2 @@
+#! /usr/bin/env sh
+doas grub-install --target=x86_64-efi --efi-directory=/efi
diff --git a/scripts/gentoo/gen-dracut b/scripts/gentoo/gen-dracut
new file mode 100755
index 0000000..a8d692f
--- /dev/null
+++ b/scripts/gentoo/gen-dracut
@@ -0,0 +1,2 @@
+#! /usr/bin/env sh
+dracut -a lvm --kver=6.15.6-gentoo --force
diff --git a/scripts/gentoo/use-flags b/scripts/gentoo/use-flags
new file mode 100755
index 0000000..ea691bb
--- /dev/null
+++ b/scripts/gentoo/use-flags
@@ -0,0 +1,2 @@
+#! /usr/bin/env sh
+less /var/db/repos/gentoo/profiles/use.desc
diff --git a/scripts/sync/pull.sh b/scripts/sync/pull.sh
index 1bf5b48..924499a 100755
--- a/scripts/sync/pull.sh
+++ b/scripts/sync/pull.sh
@@ -3,7 +3,7 @@
set -e
SOURCE="$(cat remote)/"
-if [ ! -d $SOURCE ]; then
+if [ ! -d $SOURCE ] && [[ ! $SOURCE =~ ":" ]]; then
echo "Path $SOURCE does not exist."
exit 1
fi
@@ -24,6 +24,10 @@ while getopts 'cfdr' opt; do
r) # Revert
FORCE=1
;;
+ *)
+ echo "Unknown argument"
+ exit 1
+ ;;
esac
done
@@ -31,4 +35,4 @@ if [ $FORCE = 0 ]; then
ARGS+=('--update')
fi
-rsync --archive --itemize-changes "${ARGS[@]}" $SOURCE .
+rsync --archive --itemize-changes "${ARGS[@]}" $SOURCE/$2 .
diff --git a/scripts/sync/push.sh b/scripts/sync/push.sh
index 3adbd02..9e35994 100755
--- a/scripts/sync/push.sh
+++ b/scripts/sync/push.sh
@@ -1,9 +1,11 @@
#! /usr/bin/env sh
+# https://serverfault.com/a/211083
+
set -e
DEST="$(cat remote)"
-if [ ! -d $DEST ]; then
+if [ ! -d $DEST ] && [[ ! $DEST =~ ":" ]]; then
echo "Path $DEST does not exist."
exit 1
fi
@@ -24,6 +26,10 @@ while getopts 'cfdr' opt; do
r) # Revert
FORCE=1
;;
+ *)
+ echo "Unknown argument"
+ exit 1
+ ;;
esac
done
@@ -31,4 +37,4 @@ if [ $FORCE = 0 ]; then
ARGS+=('--update')
fi
-rsync --archive --itemize-changes "${ARGS[@]}" ./ $DEST
+rsync --archive --itemize-changes "${ARGS[@]}" ./$2 $DEST