summaryrefslogtreecommitdiff
path: root/scripts/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/desktop')
-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-all3
-rwxr-xr-xscripts/desktop/xbox-controller-battery2
21 files changed, 137 insertions, 7 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/desktop/unzip-all b/scripts/desktop/unzip-all
new file mode 100755
index 0000000..0982666
--- /dev/null
+++ b/scripts/desktop/unzip-all
@@ -0,0 +1,3 @@
+#! /usr/bin/env sh
+# https://askubuntu.com/a/518376
+find "$1" ! -path "${1%/}/$(basename $PWD)/*" -name '*.zip' -exec sh -c 'x=${1%.*}; unzip -d "${x##*/}" "$1"' _ {} \;
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