From f8130bd7d0a47e65716e82d5e5f477e4f7ed357e Mon Sep 17 00:00:00 2001 From: lucca Date: Thu, 11 Jun 2026 13:47:48 -0400 Subject: [PATCH] added scripts folder to gitea --- .swp | Bin 0 -> 12288 bytes "\\" | 44 +++++ __pycache__/vidModeFunctions.cpython-312.pyc | Bin 0 -> 3213 bytes alttab.sh | 19 ++ binary-to-text.sh | 10 + clipboardBufferData.pk | Bin 0 -> 323 bytes clipboardbuffers.py | 90 +++++++++ .../windowsVidModeFunctions.cpython-312.pyc | Bin 0 -> 902 bytes .../windowsVidModeFunctions.cpython-313.pyc | Bin 0 -> 904 bytes gamingpc/monitorLin.py | 6 + gamingpc/monitorWin.py | 6 + .../windowsVidModeFunctions.cpython-312.pyc | Bin 0 -> 3229 bytes gamingpc/old/btoff.sh | 4 + gamingpc/old/bton.sh | 5 + gamingpc/old/linScreenOff | 2 + gamingpc/old/monitorLin.sh | 4 + gamingpc/old/monitorWin.sh | 4 + gamingpc/old/multiplayer.sh | 3 + gamingpc/old/off.sh | 2 + gamingpc/old/old/gaming-high.sh | 3 + gamingpc/old/old/gaming.sh | 3 + gamingpc/old/old/media.sh | 4 + gamingpc/old/old/xmonad-nv.sh | 3 + gamingpc/old/old/xmonad-off.sh | 3 + gamingpc/old/old/xmonad-on.sh | 3 + gamingpc/old/on.sh | 2 + gamingpc/old/reboot.sh | 2 + gamingpc/old/vmswap.sh | 5 + gamingpc/old/windowsVidMode.py | 3 + gamingpc/old/windowsVidModeFunctions.py | 39 ++++ gamingpc/old/xmonad-nv.sh | 3 + gamingpc/script.bat | 1 + gamingpc/windowsVidMode.py | 3 + gamingpc/windowsVidModeFunctions.py | 8 + hdmi-audio-selector.sh | 40 ++++ input.sh | 17 ++ keymaps.sh | 9 + keymaps.sh.old | 16 ++ keymaps/autokey/.New Script.json | 26 +++ keymaps/autokey/.folder.json | 23 +++ keymaps/autokey/New Script.py | 1 + keymaps/autokey/copy-paste/.folder.json | 23 +++ .../autokey/copy-paste/.type clipboard.json | 28 +++ keymaps/autokey/copy-paste/type clipboard.py | 3 + keymaps/autokey/hotstrings/.folder.json | 23 +++ keymaps/autokey/hotstrings/.iirc.json | 31 +++ .../hotstrings/.luccapirovanogmx.com.json | 31 +++ keymaps/autokey/hotstrings/iirc.txt | 1 + .../hotstrings/luccapirovanogmx.com.txt | 1 + keymaps/map2-test.py | 22 +++ keymaps/test.ahk | 0 keymapsUdev.sh | 3 + lgctl | 1 + lgctl.sh | 2 + monitormodes.sh | 4 + mount-all-filesystems.sh | 4 + move-to-next-monitor | 75 +++++++ mpv-openclipboard.sh | 2 + nohup.out | 0 notification-parse.sh | 12 ++ numpad-hotkeys-keyd.sh | 46 +++++ ps3-controller-bluetooth-latency-fix.sh | 95 +++++++++ quest-cast.sh | 37 ++++ quest-cast2.sh | 43 ++++ quest-cast3.sh | 48 +++++ quest-cast4.sh | 47 +++++ quest-cast5.sh | 46 +++++ quest-cast6.sh | 47 +++++ quest-cast7.sh | 44 +++++ quest-cast8.sh | 42 ++++ quest-cast9.sh | 43 ++++ rmctrl/.light.swp | Bin 0 -> 12288 bytes rmctrl/commands/lightoff | 2 + rmctrl/commands/lighton | 2 + rmctrl/commands/monitoroff | 6 + rmctrl/commands/monitoron | 3 + rmctrl/commands/wega | 3 + rmctrl/hs100.sh | 157 +++++++++++++++ rmctrl/inputtest.py | 184 ++++++++++++++++++ rmctrl/joysticklightswitchTmux.yaml | 10 + rmctrl/keepalive.sh | 8 + rmctrl/smartplug.sh | 3 + rofi/viewcam | 2 + setup-keyboard-remap-poller.sh | 113 +++++++++++ tModLoader | 5 + typeclipboard.sh | 3 + ultrawide-monitor-split.sh | 9 + warpMouse.sh | 25 +++ warpMouseAndWindow.sh | 35 ++++ workspace/wl.sh | 8 + ytmusicquick | 70 +++++++ 91 files changed, 1868 insertions(+) create mode 100644 .swp create mode 100644 "\\" create mode 100644 __pycache__/vidModeFunctions.cpython-312.pyc create mode 100755 alttab.sh create mode 100755 binary-to-text.sh create mode 100644 clipboardBufferData.pk create mode 100644 clipboardbuffers.py create mode 100644 gamingpc/__pycache__/windowsVidModeFunctions.cpython-312.pyc create mode 100644 gamingpc/__pycache__/windowsVidModeFunctions.cpython-313.pyc create mode 100755 gamingpc/monitorLin.py create mode 100755 gamingpc/monitorWin.py create mode 100644 gamingpc/old/__pycache__/windowsVidModeFunctions.cpython-312.pyc create mode 100755 gamingpc/old/btoff.sh create mode 100755 gamingpc/old/bton.sh create mode 100755 gamingpc/old/linScreenOff create mode 100755 gamingpc/old/monitorLin.sh create mode 100755 gamingpc/old/monitorWin.sh create mode 100755 gamingpc/old/multiplayer.sh create mode 100755 gamingpc/old/off.sh create mode 100755 gamingpc/old/old/gaming-high.sh create mode 100755 gamingpc/old/old/gaming.sh create mode 100755 gamingpc/old/old/media.sh create mode 100755 gamingpc/old/old/xmonad-nv.sh create mode 100755 gamingpc/old/old/xmonad-off.sh create mode 100755 gamingpc/old/old/xmonad-on.sh create mode 100755 gamingpc/old/on.sh create mode 100755 gamingpc/old/reboot.sh create mode 100755 gamingpc/old/vmswap.sh create mode 100644 gamingpc/old/windowsVidMode.py create mode 100644 gamingpc/old/windowsVidModeFunctions.py create mode 100755 gamingpc/old/xmonad-nv.sh create mode 100644 gamingpc/script.bat create mode 100644 gamingpc/windowsVidMode.py create mode 100644 gamingpc/windowsVidModeFunctions.py create mode 100755 hdmi-audio-selector.sh create mode 100755 input.sh create mode 100755 keymaps.sh create mode 100755 keymaps.sh.old create mode 100644 keymaps/autokey/.New Script.json create mode 100644 keymaps/autokey/.folder.json create mode 100644 keymaps/autokey/New Script.py create mode 100644 keymaps/autokey/copy-paste/.folder.json create mode 100644 keymaps/autokey/copy-paste/.type clipboard.json create mode 100644 keymaps/autokey/copy-paste/type clipboard.py create mode 100644 keymaps/autokey/hotstrings/.folder.json create mode 100644 keymaps/autokey/hotstrings/.iirc.json create mode 100644 keymaps/autokey/hotstrings/.luccapirovanogmx.com.json create mode 100644 keymaps/autokey/hotstrings/iirc.txt create mode 100644 keymaps/autokey/hotstrings/luccapirovanogmx.com.txt create mode 100644 keymaps/map2-test.py create mode 100644 keymaps/test.ahk create mode 100755 keymapsUdev.sh create mode 120000 lgctl create mode 100755 lgctl.sh create mode 100755 monitormodes.sh create mode 100755 mount-all-filesystems.sh create mode 100755 move-to-next-monitor create mode 100755 mpv-openclipboard.sh create mode 100644 nohup.out create mode 100755 notification-parse.sh create mode 100755 numpad-hotkeys-keyd.sh create mode 100755 ps3-controller-bluetooth-latency-fix.sh create mode 100755 quest-cast.sh create mode 100755 quest-cast2.sh create mode 100755 quest-cast3.sh create mode 100755 quest-cast4.sh create mode 100755 quest-cast5.sh create mode 100755 quest-cast6.sh create mode 100755 quest-cast7.sh create mode 100755 quest-cast8.sh create mode 100755 quest-cast9.sh create mode 100644 rmctrl/.light.swp create mode 100755 rmctrl/commands/lightoff create mode 100755 rmctrl/commands/lighton create mode 100755 rmctrl/commands/monitoroff create mode 100755 rmctrl/commands/monitoron create mode 100755 rmctrl/commands/wega create mode 100755 rmctrl/hs100.sh create mode 100755 rmctrl/inputtest.py create mode 100755 rmctrl/joysticklightswitchTmux.yaml create mode 100755 rmctrl/keepalive.sh create mode 100755 rmctrl/smartplug.sh create mode 100755 rofi/viewcam create mode 100755 setup-keyboard-remap-poller.sh create mode 100755 tModLoader create mode 100755 typeclipboard.sh create mode 100755 ultrawide-monitor-split.sh create mode 100755 warpMouse.sh create mode 100755 warpMouseAndWindow.sh create mode 100755 workspace/wl.sh create mode 100755 ytmusicquick diff --git a/.swp b/.swp new file mode 100644 index 0000000000000000000000000000000000000000..1ebb8be7ad043321993fb25a584b066f602946da GIT binary patch literal 12288 zcmeI%Jr05}7{>9Ulaod-fI4ds7d?W5Bkol+d>Al*ar8PKLJ#8+yn$_`D-*)s-0tmDx(DRn= z!qNHD$=DtZz4n$uG6D!7fB*srAbH5^!~s3|Noe=+LHJX0tg_000IagfB*srAbeYT XNY;)z0!NkVB03$zC{APP=js$+NlzVM literal 0 HcmV?d00001 diff --git "a/\\" "b/\\" new file mode 100644 index 0000000..ac1ba69 --- /dev/null +++ "b/\\" @@ -0,0 +1,44 @@ +#!/bin/bash + +# Quest 2 wireless mirror to PC → 480i CRT +# Right-eye focus crop + audio kept on Quest (no mute) + +IP="10.0.0.30:5555" + +echo "Enabling ADB over TCP..." +adb tcpip 5555 +sleep 2 + +echo "Connecting to Quest..." +adb connect "${IP}" + +echo "" +echo "ADB devices (should list your Quest):" +adb devices + +echo "" +read -p "Disconnect USB now. Wake Quest fully (put it on), launch game/app, press Enter..." + +echo "" +echo "Starting scrcpy... (fullscreen with F11 or similar; q/Ctrl+C to quit)" +echo "" + +scrcpy -s "${IP}" \ + --crop=1832:960:1832:0 \ + --max-size=640 \ + --max-fps=30 \ + --video-bit-rate=800K \ + --no-control \ + --always-on-top \ + --window-width=640 \ + --window-height=480 \ + --window-borderless + +echo "" +echo "Troubleshooting:" +echo " - Still seeing both eyes/duplication? Increase x-offset: try --crop=1832:960:1850:100 or --crop=1832:960:1900:0" +echo " - Right eye looks wrong/black? Swap to left: --crop=1832:960:0:0 (or tweak offset lower like 100:100)" +echo " - Black screen overall? Add --encoder=OMX.google.h264.encoder" +echo " - No audio on Quest? (rare) — audio should play normally in headset; scrcpy captures to PC too unless --no-audio is added" +echo " - Game lag? Lower --video-bit-rate=500K or --max-size=480" +echo " - HDMI from PC → composite adapter → CRT" diff --git a/__pycache__/vidModeFunctions.cpython-312.pyc b/__pycache__/vidModeFunctions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f3bbdce99084cc2efde6483287f699707092d661 GIT binary patch literal 3213 zcmd5;&2JM&6yI5I96Pa{ME#)9mP|sM)TqvG(vU9|6htT_Ry=!LH ziEUMFk&xg&;7}oPjrtGpKlI`Qz8G#jaj1l1^}?y|&Dx0*oN};Kb>#icc;4HY_kQ!< z+xa6J?NFeV{<^YJZc~&$@lU;}wL#T^!DEFfjHH#M-;*R^>H{UIvH)O!X@DAQ18ieK zz#wY}Y-b_B5DNo_SqEST>jdm%5x@wG0!CR3Fvhw7yI411cY(xvUg748DN?fmJFrg) zz*Fr9c&vE)GDdzp=JbY{v7L>?j_uGvE4As;;#qou ziWIlA-q0P>qXPr*Z__iymZ18LoI~}M#hQF@msCPRY|i6KaZ(9`erhx2GE3lQ^i99M z>1Hfl?xc%NecNUWApIuiq&(Yo#89?S3Hy7&$~*)wp(o-4fM1oDTBOu9@U-xBt2F$5 zDY{nHeyD;#Y1Q-M%#`kLD)a@{u|1bx=kB_lww8BnaKPfXw~cYbSgQ%^vqM(iqKUL? zvZ+f``nSU3LYJ=V7qi(J(=+uOu4J>mYW+pMw!F}b+E6}|-X+piV5~jsZ|w8M+rhg^ zN5*w(FYqW#;H3Bx02ztCR+OG=D&V}jjNLVL1-ljX7Is~$>fgX&QsrTI;Sf<8Ovn%! zg+XJ8+^q*Q%-5SAHc!+;L8C4f6C%f4n#fUkq!iAcCT!Yx%0n=x+w3+MCXK5V)fJVX zCsRE#a9MkqK@xDt***g6nr|M`tXR^XxPgmbabC(nLZy z^y}(>Eo=Awzx0j$2lSou>ErJK zJ53n;4j4QEq8N&?`1}i7r$BsMut8;oBY(Rom9<=xXnD8+?9Q|u)^U>x-c4l_@`uxS!^HT=RLusWfn-O%~ z+7=E9Szk;+IFCtT9&f}8ef267_a+L0)_5US(|CeSjiNogQN-=Yo5CMNrP0K z1tWTqrFT%31fAmwhllYb+g+_bI_O!$m&?QJfNbpWl}=l%gm$bAbIC~;Ug7o2uS0m` z=b#o14^L7%uE`ou(L6h2RoX<_va<3ja)fG**9{4MFc6pmel;jQ*G|3ELJ#Ne&po>L zU;*wUt=FkaaQWu!%;lx#sUhIbXu0SV9|1EyM|%!ZBVX1&k_R5|;awo&LkM_}^oyOm zT;L~BmUmfZWs#FLM&`IoI2rCTqU34%?&EexczF~0I^(ij+Pc8M0x7aA)&O1y2q7<& z@C&7LFG$FbWKSa`sUpt8SS6h71$`vs3{F#ozWq@zj-=qSd>4iRa;6$0OV literal 0 HcmV?d00001 diff --git a/alttab.sh b/alttab.sh new file mode 100755 index 0000000..becc5b3 --- /dev/null +++ b/alttab.sh @@ -0,0 +1,19 @@ +#!/bin/bash +mousewarp () +{ +HERE="$(xdotool getwindowfocus)" +ULX=$(xwininfo -id "$HERE" | grep " Absolute upper-left X:" | awk '{print $4}') +ULY=$(xwininfo -id "$HERE" | grep " Absolute upper-left Y:" | awk '{print $4}') + +# If there is no window, ULX == 1 and ULY == 1. +if [ "$ULX" != "-1" ] || [ "$ULY" != "-1" ]; then + eval "$(xdotool getwindowgeometry --shell "$HERE")" + + ((NX="$WIDTH"/2)) + ((NY="$HEIGHT"/2)) + + xdotool mousemove --window "$WINDOW" "$NX" "$NY" +fi +} +rofi -show window -show-icons +mousewarp diff --git a/binary-to-text.sh b/binary-to-text.sh new file mode 100755 index 0000000..ac35433 --- /dev/null +++ b/binary-to-text.sh @@ -0,0 +1,10 @@ +#!/bin/bash +BINARY="01001000 01100101 01101100 01101100 01101111" +binaryToText() { +while read line +do +echo -n "\x$(echo obase=16\;ibase=2\;$line | bc)" +done +} +echo $BINARY | binaryToText + diff --git a/clipboardBufferData.pk b/clipboardBufferData.pk new file mode 100644 index 0000000000000000000000000000000000000000..f32d9b7f16633bee23768e4f51501b7605a1a9f8 GIT binary patch literal 323 zcmaKnF;2rk6huJ+Dmpm8R|*IM))6?ySVD>-(Q^TW)_*_tir8!Y{f;9l4zT5N8VZiY z6|h1ZF~v;tG@AK1_{{hBwt9}!aA=6$FJnjz>)}OcBhxIMT|t_UHhE(59v)jE265m; zvw+kDm2PNq5yL6!_FSO%1XkdcT>~Y?a9xXZzDN>dJvugx7Pgy`t*J<@dPLn>c5B@_ zg|3O=WCs_+QI_4`CP@s(W`2`neuwEiFJm}clp5cp=Gjo7YfV4&R(91s{Cs^cwuF`c g$O3fNdE&K2^1xJCKRzC3Ij&T>qSg?rk literal 0 HcmV?d00001 diff --git a/clipboardbuffers.py b/clipboardbuffers.py new file mode 100644 index 0000000..5ba6706 --- /dev/null +++ b/clipboardbuffers.py @@ -0,0 +1,90 @@ +import sys +import os +import subprocess +import time +import pyperclip +import pyautogui as pg +from PyHotKey import Key, keyboard +import pickle +import tkinter as tk + +#pg.prompt(text="deez nuts?", title="deez nutz!", default="deez nars") + +def dumpClipboardBufferToFile(): + global clipboardBuffer + with open("clipboardBufferData.pk", 'wb') as fi: + pickle.dump(clipboardBuffer, fi) + +def getClipboardBufferFromFile(): + global clipboardBuffer + with open("clipboardBufferData.pk", 'rb') as fi: + clipboardBuffer = pickle.load(fi) + +#scriptFolder = (os.path.dirname(__file__)) +clipboardBuffer = [] +clipboardBuffer = ["No value in this clipboard buffer" for i in range(10)] + +#check if pickle file exists, if not, then create one +if os.path.isfile("clipboardBufferData.pk"): + getClipboardBufferFromFile() +else: + dumpClipboardBufferToFile() + +def inputbox(inputBuffer): + inputText = "No Input Given Yet" + window = tk.Tk() + window.title(f'Clipboard Buffer {inputBuffer}') + textbox = tk.Entry(window, width=70) + textbox.pack() + textbox.insert(0, clipboardBuffer[inputBuffer]) + textbox.focus_set() + def entry_select_all(event): + event.widget.select_range(0, 'end') + event.widget.icursor('end') + return 'break' + def entry_ctrl_backspace(event): + end_idx = textbox.index(tk.INSERT) + start_idx = textbox.get().rfind(" ", None, end_idx) + textbox.selection_range(start_idx, end_idx) + def onclick(pos): + nonlocal inputText + inputText = textbox.get() + global clipboardBuffer + clipboardBuffer[inputBuffer] = inputText + print(f"Clipboard buffer {inputBuffer} was set to: {inputText}") + window.destroy() + b = tk.Button(window, text="OK", width=10, command=onclick) + b.pack() + textbox.bind('', onclick) + textbox.bind('', onclick) + textbox.bind('', entry_ctrl_backspace) + textbox.bind('', entry_select_all) + window.mainloop() + print(clipboardBuffer) + dumpClipboardBufferToFile() + return (inputText) + + +def sendMessage(message): + subprocess.Popen(['notify-send', message]) + return + +def typeBuffer(inputBuffer): + global clipboardBuffer +# pyautogui.write(clipboardBuffer[inputBuffer]) + keyboard.type(clipboardBuffer[inputBuffer]) +def copyToBuffer(inputBuffer): + global clipboardBuffer +# clip = pyperclip.paste() + clip = os.popen('xsel -op').read() + sendMessage(f"Copied to buffer {inputBuffer}:\n===================\n{clip}") + clipboardBuffer[inputBuffer] = clip + print(clipboardBuffer[inputBuffer]) + dumpClipboardBufferToFile() + +if sys.argv[1] == "paste": + typeBuffer(int(sys.argv[2])) +if sys.argv[1] == "copy": + copyToBuffer(int(sys.argv[2])) +if sys.argv[1] == "edit": + inputbox(int(sys.argv[2])) diff --git a/gamingpc/__pycache__/windowsVidModeFunctions.cpython-312.pyc b/gamingpc/__pycache__/windowsVidModeFunctions.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..62f76ce0172efde23c891a329c70a0b101e5a512 GIT binary patch literal 902 zcmbtSzi-n(6uvvVKawh~G9c8YSPU&jG#3F9QiLi{E2KzGgh~S<6%^NJYE#>1-8oGY z7(hZ|&DH^RFY155zrd2EOJHMStB6=S@y>RlmX(wI-MjbWp5J%hw?ZM0V10E@T!9h# zsScw>GGn*^#vx*eVIMUSBOg%{GYyb19Z>6FbK;juuG?_Ocujz%!8g1PaERh@jNy0a zGu(5eon$_YI>^-O-K+Z|c4Yiu*9yFFcR8|+CC7HT(Y}Ud+W~!C!m6^Q7&;K#thnFW)PdN5PS|DQ&HMEB~VPlc!PYv!>mBefI~gEyak{r zDV!lxTql4vvZ=Op(okE2JXhOXll*~-Eh46&;1W|hI1<&|1>>S>-i-7J{?SU6bVM%c zh}63}2*5DOfN(jOlpPs6fttcjHF04Iq1q*&UUmGUlb@;|sy)5;tXJ*NE}ZJulK(Vy zQBdhBH5oZ6{DP8TLdyB{{eZKU@2rR-Bq_Pcd4MwwWBeWEe(M;&!V0&@5YR|U{{ou{ B(Y^ox literal 0 HcmV?d00001 diff --git a/gamingpc/__pycache__/windowsVidModeFunctions.cpython-313.pyc b/gamingpc/__pycache__/windowsVidModeFunctions.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f85617011a16cca4863b70a6edd6443c1f47113e GIT binary patch literal 904 zcmbtS&2G~`5Z+z8X_G3cazLmYiq%7l5zR(KfE1w$)Cwu0jZoZxAfmI7bFD@KeN*L2e+94F!-GDxlKE`od3{+_d11xh#OCz&Bk7I7gj%%)o6_f_rMp zz09YfF4C3e@cIdl91%V0n!Xoww?a$XbS#%?!`s@nCM@oSQRS@}X&W1GawAh53yrq= zfkqFSS$tE+aX|=ohxxu4*l@~2h2>hzc7$xF#doR8e24b>*0D*2OVe(lMF(DBvw?W- z+53?Fq#sz3#{y9a&*FUA9eVM_Y%XyPj1TC$S{j#cU94U#k87{TD~Ffr(G&vce|PbI zw@%Zhg6^}xix_{#**mZ27y}Oma`@3n^+B~d3(mY1=hV@*dd#%zJ9XL?4i_|CD}5Y> zyJlq47EAW~Zzav{7j&prPW_&alUZSfi(%S1T_DfFcyYmJK~}(*!6Bbp+yRg)DNYb7 z?-9U#av;?nX-m~6FQr;}MSep?hwvpRxUwk~90_agg8{4oOr}eb!OIJ zTUFagk&^!)hbmI8sQ*CzhhBV$FHUYfLsVXH*13-ra4%uI`aNzJo9$md%t<_ z?femowJFewe_h=uwJ6G;_@~y?>Y(Dn;IYCKMp8;L=t+_=^?{O9SqL!1G(e5D0Jg9& zV3@T6wz3Fdghc_PtPQY@wF9=Z4!{l;1B|gaV4QUVcCs$Ot~?p&euc^xEK;=rJFrg) z!BaT{@L2Kp*BJRp`AuQ!lhE(gIilp1fzU$XL@H}-nNu5P+Hp4$JB~~HZEMq`g>&>G z6&80g{@@+cr+t0!Z__u$mZ190tV{Lfh3b0$E-6QZ*qp*zN31w(9;Cm?x|Z*Ft{BYZ%h5nLXyOsr1U(ZU0Q{=F)H;ft zeNXdGw~9mG7h`KB?S~31D9tian4Z)Fr9z+gT*vqL4eqTwDSK(h0f%gUd)pW@jJ4`w zZFbPk*));zOg4FWQvX)iTK^x4aQ@cdE3JkVp z0>uG;ycN7Fx1~L|`T~!^1Wt-C0g#c{Yenh4t^&@fOW0jkm$6$`Z(-NDs{RceCRHAV z7Y-4n!GsK%5g62m%-vdW!+fm;Ve~{j6h!JmAtAENqlqk)M@%6WXu_fOr#=XCy2EaB zVbTG$ta_px7J1>@X>`}}(rMFWb?$OJa0zI!_z(d73_qN?KU3_w@NDDRYB7Gbq+JU< zsu_qqdLunDU{LQ7BL{ZZrN&`zASGs`7gIYP-x9uw5t-m7qtZt`E4Y5gadpP5tnZ|# zu>EZ-LlX(%(re4J^CN~aHfm7#jnTe>8EjRbUDK18OZt*bEumYU>vJ!a&cpFy$h|co z!%JVX{T0~EKB8l^pW^}UDw2kSK*62n9GAZji|z1Ka1f+U?ACK_6>}(-DQWlqzx0j% z2lSl}=;QAJI}I584j4QEOL1Jr;`1+Tor2}#f(Mhzne7JwOs;qXry7}0@7)WkRi2|NT*BO_ky>?vuqDKlbn z{|U4L$Y^MVqynt~DUKgj3<-W3K~_^3?6>{e^X_oy7>6xkTXa9uP;nc$Ulrn?feMTU zac~4bm$cJOSs()v;((4pFk(PD#|9)wWzBcecDY5QY&#>bB1fp^c-@fD3j={E5LAQ0bM4ei zE%I>o{_LZB59Z-M(tMpNhnH4nrmrkEP7Sf`Fxx|?_%N99IoflO8o848kv#B$Zr%w? zd=LTekwLMOmkazP%JMGDtSoY}#>gC(2`9r{MwC3wzNhpoW*I1(7QkC!I50JBHx8!h@7oN J2stU;`v>A9hK~RM literal 0 HcmV?d00001 diff --git a/gamingpc/old/btoff.sh b/gamingpc/old/btoff.sh new file mode 100755 index 0000000..560c7d4 --- /dev/null +++ b/gamingpc/old/btoff.sh @@ -0,0 +1,4 @@ +#!/bin/bash +bluetoothctl disconnect 9B:40:B0:7F:F9:9F +#bluetoothctl power off +notify-send "bluetooth headset disconnected" diff --git a/gamingpc/old/bton.sh b/gamingpc/old/bton.sh new file mode 100755 index 0000000..c449b7f --- /dev/null +++ b/gamingpc/old/bton.sh @@ -0,0 +1,5 @@ +#!/bin/bash +bluetoothctl power on +sleep 5 +bluetoothctl connect 9B:40:B0:7F:F9:9F +notify-send "bluetooth headset connected" diff --git a/gamingpc/old/linScreenOff b/gamingpc/old/linScreenOff new file mode 100755 index 0000000..59de581 --- /dev/null +++ b/gamingpc/old/linScreenOff @@ -0,0 +1,2 @@ +#!/bin/bash +ssh -J gpc xmonad-rad xset -display :0 dpms force off diff --git a/gamingpc/old/monitorLin.sh b/gamingpc/old/monitorLin.sh new file mode 100755 index 0000000..28bd344 --- /dev/null +++ b/gamingpc/old/monitorLin.sh @@ -0,0 +1,4 @@ +#!/bin/bash +sudo /usr/bin/ddcutil setvcp --sn HTJM400760 60 7 & +sshLucka("lucka@gaming-win 'D: && /Scripts/controlmymonitor/controlmymonitor.exe /SetValue HTJM400760 60 6'") + diff --git a/gamingpc/old/monitorWin.sh b/gamingpc/old/monitorWin.sh new file mode 100755 index 0000000..8aeb9fb --- /dev/null +++ b/gamingpc/old/monitorWin.sh @@ -0,0 +1,4 @@ +#!/bin/bash +sudo /usr/bin/ddcutil setvcp --sn HTJM400760 60 7 & +ssh vrtest@gaming-pc 'D: && /Scripts/controlmymonitor/controlmymonitor.exe /SetValue HTJM400760 60 6' + diff --git a/gamingpc/old/multiplayer.sh b/gamingpc/old/multiplayer.sh new file mode 100755 index 0000000..f3747f6 --- /dev/null +++ b/gamingpc/old/multiplayer.sh @@ -0,0 +1,3 @@ +#!/bin/bash +~/sh/gamingpc/vmswap.sh ltsc2021-nv-mp +~/sh/gamingpc/vmswap.sh tv-rad-vg-mp diff --git a/gamingpc/old/off.sh b/gamingpc/old/off.sh new file mode 100755 index 0000000..ac9fc24 --- /dev/null +++ b/gamingpc/old/off.sh @@ -0,0 +1,2 @@ +ssh 192.168.0.2 sudo /sbin/poweroff +notify-send "gaming pc turned off" diff --git a/gamingpc/old/old/gaming-high.sh b/gamingpc/old/old/gaming-high.sh new file mode 100755 index 0000000..142710b --- /dev/null +++ b/gamingpc/old/old/gaming-high.sh @@ -0,0 +1,3 @@ +notify-send "switching to gaming hi-spec vm..." +ssh 192.168.0.2 /home/lucka/sh/vm/ltsc2021-nv-high +notify-send "switched to gaming hi-spec vm" diff --git a/gamingpc/old/old/gaming.sh b/gamingpc/old/old/gaming.sh new file mode 100755 index 0000000..4344010 --- /dev/null +++ b/gamingpc/old/old/gaming.sh @@ -0,0 +1,3 @@ +notify-send "switching to gaming vm..." +ssh 192.168.0.2 /home/lucka/sh/vm/ltsc2021-nv +notify-send "switched to gaming vm" diff --git a/gamingpc/old/old/media.sh b/gamingpc/old/old/media.sh new file mode 100755 index 0000000..87b7e70 --- /dev/null +++ b/gamingpc/old/old/media.sh @@ -0,0 +1,4 @@ +#!/bin/bash +notify-send "switching to media vm..." +ssh 192.168.0.2 /home/lucka/sh/vm/tv-nv +notify-send "switched to media vm" diff --git a/gamingpc/old/old/xmonad-nv.sh b/gamingpc/old/old/xmonad-nv.sh new file mode 100755 index 0000000..f810333 --- /dev/null +++ b/gamingpc/old/old/xmonad-nv.sh @@ -0,0 +1,3 @@ +notify-send "switching to nvidia workstation vm..." +ssh 192.168.0.2 /home/lucka/sh/vm/xmonad-nv +notify-send "switched to nvidia workstation vm" diff --git a/gamingpc/old/old/xmonad-off.sh b/gamingpc/old/old/xmonad-off.sh new file mode 100755 index 0000000..0d83946 --- /dev/null +++ b/gamingpc/old/old/xmonad-off.sh @@ -0,0 +1,3 @@ +ssh 192.168.0.2 virsh -c qemu:///system shutdown xmonad-rad +notify-send "powered off workstation VM" + diff --git a/gamingpc/old/old/xmonad-on.sh b/gamingpc/old/old/xmonad-on.sh new file mode 100755 index 0000000..de8bfd9 --- /dev/null +++ b/gamingpc/old/old/xmonad-on.sh @@ -0,0 +1,3 @@ +ssh 192.168.0.2 virsh -c qemu:///system start xmonad-rad +notify-send "powered on workstation VM" + diff --git a/gamingpc/old/on.sh b/gamingpc/old/on.sh new file mode 100755 index 0000000..91a917a --- /dev/null +++ b/gamingpc/old/on.sh @@ -0,0 +1,2 @@ +wakeonlan D0:50:99:C3:29:4D +notify-send "gaming pc turned on" diff --git a/gamingpc/old/reboot.sh b/gamingpc/old/reboot.sh new file mode 100755 index 0000000..268e41c --- /dev/null +++ b/gamingpc/old/reboot.sh @@ -0,0 +1,2 @@ +ssh 192.168.0.2 sudo /sbin/reboot +notify-send "gaming pc rebooted" diff --git a/gamingpc/old/vmswap.sh b/gamingpc/old/vmswap.sh new file mode 100755 index 0000000..e2118c7 --- /dev/null +++ b/gamingpc/old/vmswap.sh @@ -0,0 +1,5 @@ +newvm=$1 +echo $newvm +notify-send "switching to $newvm vm..." +ssh gaming-pc /home/lucka/sh/vm/swap-nv $newvm +notify-send "switched to $newvm vm" diff --git a/gamingpc/old/windowsVidMode.py b/gamingpc/old/windowsVidMode.py new file mode 100644 index 0000000..2edb66d --- /dev/null +++ b/gamingpc/old/windowsVidMode.py @@ -0,0 +1,3 @@ +import sys +from windowsVidModeFunctions import * +monProfile(sys.argv[1]) diff --git a/gamingpc/old/windowsVidModeFunctions.py b/gamingpc/old/windowsVidModeFunctions.py new file mode 100644 index 0000000..abf795d --- /dev/null +++ b/gamingpc/old/windowsVidModeFunctions.py @@ -0,0 +1,39 @@ +import os +import time + +#Functions, hotkeys are at the bottom +def scriptRun(batchcode): + sshLucka(f"lucka@gaming-win 'echo {batchcode} > script.bat && schtasks /Run /TN script'") +def monProfile(profile): + scriptRun(f"D:/scripts/MonitorProfileSwitcher_v0700\MonitorSwitcher.exe -load:C:/Users/vmtest/AppData/Roaming/MonitorSwitcher/Profiles/{profile}.xml") +def sshLucka(command): + os.system(f"sudo -u lucka ssh -i /home/lucka/.ssh/id_rsa {command}") +def monitorLin(): + sshLucka("lucka@workstation-rad sudo /usr/bin/ddcutil setvcp --sn HTJM400760 60 7 &") + sshLucka("lucka@gaming-win 'D: && /Scripts/controlmymonitor/controlmymonitor.exe /SetValue HTJM400760 60 6'") +def monitorWin(): + sshLucka("lucka@workstation-rad sudo /usr/bin/ddcutil setvcp --sn HTJM400760 60 6 &") + sshLucka("lucka@gaming-win 'D: && /Scripts/controlmymonitor/controlmymonitor.exe /SetValue HTJM400760 60 5'") +def res640x480(): + scriptRun("res 640 480 120 p") +def res1280x960(): + monProfile("1280x960@120i") +def res1600x1200(): + monProfile("1600x1200@100i") +def res1600x900(): + monProfile("1600x900@120i") +def res800x600(): + monProfile("800x600@100p") +def res960x720(): + scriptRun("res 960 720 120 i") +def linScreenOff(): + sshLucka("lucka@workstation-rad DISPLAY=:0 xset dpms force off") +def res1280x720(): + scriptRun("res 1280 720 60 p") +def wegaOnly(): + monProfile("wegaOnly") + time.sleep(1) + scriptRun("res 720 540 119 i") +def svideoOnly(): + monProfile("SVIDEO") + diff --git a/gamingpc/old/xmonad-nv.sh b/gamingpc/old/xmonad-nv.sh new file mode 100755 index 0000000..f810333 --- /dev/null +++ b/gamingpc/old/xmonad-nv.sh @@ -0,0 +1,3 @@ +notify-send "switching to nvidia workstation vm..." +ssh 192.168.0.2 /home/lucka/sh/vm/xmonad-nv +notify-send "switched to nvidia workstation vm" diff --git a/gamingpc/script.bat b/gamingpc/script.bat new file mode 100644 index 0000000..69cdd6c --- /dev/null +++ b/gamingpc/script.bat @@ -0,0 +1 @@ +D:/Scripts/controlmymonitor/controlmymonitor.exe /SetValue HTJM400760 60 6 diff --git a/gamingpc/windowsVidMode.py b/gamingpc/windowsVidMode.py new file mode 100644 index 0000000..2edb66d --- /dev/null +++ b/gamingpc/windowsVidMode.py @@ -0,0 +1,3 @@ +import sys +from windowsVidModeFunctions import * +monProfile(sys.argv[1]) diff --git a/gamingpc/windowsVidModeFunctions.py b/gamingpc/windowsVidModeFunctions.py new file mode 100644 index 0000000..97f59dc --- /dev/null +++ b/gamingpc/windowsVidModeFunctions.py @@ -0,0 +1,8 @@ +import os + +def scriptRun(batchcode): + sshCommand(f"vrtest@gaming-pc 'echo {batchcode} > script.bat && schtasks /Run /TN script'") +def monProfile(profile): + scriptRun(f"D:/scripts/MonitorProfileSwitcher_v0700/MonitorSwitcher.exe -load:C:/Users/vrtest/AppData/Roaming/MonitorSwitcher/Profiles/{profile}.xml") +def sshCommand(command): + os.system(f"ssh {command}") diff --git a/hdmi-audio-selector.sh b/hdmi-audio-selector.sh new file mode 100755 index 0000000..6bef81e --- /dev/null +++ b/hdmi-audio-selector.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +CARD="alsa_card.pci-0000_04_00.1" + +# Rofi menu with extra options + fixed bindings to avoid "failed to set binding" +CHOICE=$(echo -e "HDMI 0 (CRT)\nHDMI 5 (HDTV)" | \ +rofi -dmenu \ + -p "HDMI Audio Output" \ + -mesg "Toggle between your two HDMI monitors" \ + -i \ + -no-custom \ + -theme-str 'window {width: 420px;}' \ + -theme-str 'listview {lines: 4;}' \ + -kb-row-up "Up,Control+p" \ + -kb-row-down "Down,Control+n" \ + -kb-accept-entry "Return,KP_Enter" \ + -kb-cancel "Escape,Control+g,Control+bracketleft" \ + -kb-mode-next "" \ # disable problematic defaults + -kb-mode-previous "" ) + +case "$CHOICE" in + "HDMI 0 (CRT)") + pactl set-card-profile "$CARD" output:hdmi-stereo + notify-send "Audio Switch" "Switched to HDMI 0" -i audio-card + ;; + "HDMI 5 (HDTV)") + pactl set-card-profile "$CARD" output:hdmi-stereo-extra4 + notify-send "Audio Switch" "Switched to HDMI 5" -i audio-card + ;; + *) + exit 0 + ;; +esac + +# Small delay + move all running audio streams to the new sink +sleep 0.5 +NEW_SINK=$(pactl list short sinks | grep -E 'hdmi-stereo' | awk '{print $2}' | head -1) +pactl set-default-sink $NEW_SINK +#pactl list short sink-inputs | awk '{print $1}' | xargs -r -I {} pactl move-sink-input {} "$NEW_SINK" 2>/dev/null + diff --git a/input.sh b/input.sh new file mode 100755 index 0000000..84f7bf0 --- /dev/null +++ b/input.sh @@ -0,0 +1,17 @@ +#!/bin/bash +while : +do +read -n 2 -s -r -p "Press any key to continue: " action +echo $action +case $action in + 00) + echo "mario is real" + ;; + 01) + echo "L is real 2401" + ;; + 02) + neofetch + ;; +esac +done diff --git a/keymaps.sh b/keymaps.sh new file mode 100755 index 0000000..d8d3f4b --- /dev/null +++ b/keymaps.sh @@ -0,0 +1,9 @@ +#!/bin/bash +#======================================================= +notify-send "keymaps loaded!" +#xmodmap -e "keycode 79 = KP_7" -e "keycode 80 = KP_8" -e "keycode 81 = KP_9" -e "keycode 83 = KP_4" -e "keycode 84 = KP_5" -e "keycode 85 = KP_6" -e "keycode 87 = KP_1" -e "keycode 88 = KP_2" -e "keycode 89 = KP_3" -e "keycode 90 = KP_0" -e "keycode 91 = KP_Decimal" -e "keycode 104 = KP_Enter" +xmodmap -e 'keycode 108 = Hyper_L' +xmodmap -e 'remove mod4 = Hyper_L' +xmodmap -e 'remove mod1 = Hyper_L' +xmodmap -e 'clear mod3' +xmodmap -e 'add mod3 = Hyper_L' diff --git a/keymaps.sh.old b/keymaps.sh.old new file mode 100755 index 0000000..03604ee --- /dev/null +++ b/keymaps.sh.old @@ -0,0 +1,16 @@ +#!/bin/bash +#======================================================= +#Leave mod4 as windows key _only_ +xmodmap -e 'remove mod4 = Hyper_L' +#======================================================= +#Set mod3 to capslock +xmodmap -e 'add mod3 = Hyper_L' +#======================================================= +#bind the ><\ key next to left shift and ctrl to be the left windows key since this ibm keyboard doesnt have one +xmodmap -e 'keycode 94 = Super_L' +#======================================================= +#bind the capslock key to Hyper, which is an unused extra modifier key +#xmodmap -e 'keycode 66 = Hyper_L' +#======================================================= +#Bind hyper, when pressed and released by itself, to hit escape, because vim is cool +#pkill xcape && xcape -e 'Hyper_L=Escape' -d diff --git a/keymaps/autokey/.New Script.json b/keymaps/autokey/.New Script.json new file mode 100644 index 0000000..8a13226 --- /dev/null +++ b/keymaps/autokey/.New Script.json @@ -0,0 +1,26 @@ +{ + "type": "script", + "description": "New Script", + "store": {}, + "modes": [], + "usageCount": 0, + "prompt": false, + "omitTrigger": false, + "showInTrayMenu": false, + "abbreviation": { + "abbreviations": [], + "backspace": true, + "ignoreCase": false, + "immediate": false, + "triggerInside": false, + "wordChars": "[\\w]" + }, + "hotkey": { + "modifiers": [], + "hotKey": null + }, + "filter": { + "regex": null, + "isRecursive": false + } +} \ No newline at end of file diff --git a/keymaps/autokey/.folder.json b/keymaps/autokey/.folder.json new file mode 100644 index 0000000..c630cdc --- /dev/null +++ b/keymaps/autokey/.folder.json @@ -0,0 +1,23 @@ +{ + "type": "folder", + "title": "autokey", + "modes": [], + "usageCount": 0, + "showInTrayMenu": false, + "abbreviation": { + "abbreviations": [], + "backspace": true, + "ignoreCase": false, + "immediate": false, + "triggerInside": false, + "wordChars": "[\\w]" + }, + "hotkey": { + "modifiers": [], + "hotKey": null + }, + "filter": { + "regex": null, + "isRecursive": false + } +} \ No newline at end of file diff --git a/keymaps/autokey/New Script.py b/keymaps/autokey/New Script.py new file mode 100644 index 0000000..fb7c278 --- /dev/null +++ b/keymaps/autokey/New Script.py @@ -0,0 +1 @@ +# Enter script code \ No newline at end of file diff --git a/keymaps/autokey/copy-paste/.folder.json b/keymaps/autokey/copy-paste/.folder.json new file mode 100644 index 0000000..4ba6b51 --- /dev/null +++ b/keymaps/autokey/copy-paste/.folder.json @@ -0,0 +1,23 @@ +{ + "type": "folder", + "title": "copy-paste", + "modes": [], + "usageCount": 0, + "showInTrayMenu": false, + "abbreviation": { + "abbreviations": [], + "backspace": true, + "ignoreCase": false, + "immediate": false, + "triggerInside": false, + "wordChars": "[\\w]" + }, + "hotkey": { + "modifiers": [], + "hotKey": null + }, + "filter": { + "regex": null, + "isRecursive": false + } +} \ No newline at end of file diff --git a/keymaps/autokey/copy-paste/.type clipboard.json b/keymaps/autokey/copy-paste/.type clipboard.json new file mode 100644 index 0000000..7c4fdfd --- /dev/null +++ b/keymaps/autokey/copy-paste/.type clipboard.json @@ -0,0 +1,28 @@ +{ + "type": "script", + "description": "type clipboard", + "store": {}, + "modes": [ + 3 + ], + "usageCount": 54, + "prompt": false, + "omitTrigger": false, + "showInTrayMenu": false, + "abbreviation": { + "abbreviations": [], + "backspace": true, + "ignoreCase": false, + "immediate": false, + "triggerInside": false, + "wordChars": "[\\w]" + }, + "hotkey": { + "modifiers": [], + "hotKey": "" + }, + "filter": { + "regex": null, + "isRecursive": false + } +} \ No newline at end of file diff --git a/keymaps/autokey/copy-paste/type clipboard.py b/keymaps/autokey/copy-paste/type clipboard.py new file mode 100644 index 0000000..b80b7e9 --- /dev/null +++ b/keymaps/autokey/copy-paste/type clipboard.py @@ -0,0 +1,3 @@ +# Enter script code +content = clipboard.get_clipboard() +keyboard.send_keys(content) \ No newline at end of file diff --git a/keymaps/autokey/hotstrings/.folder.json b/keymaps/autokey/hotstrings/.folder.json new file mode 100644 index 0000000..5396c5b --- /dev/null +++ b/keymaps/autokey/hotstrings/.folder.json @@ -0,0 +1,23 @@ +{ + "type": "folder", + "title": "hotstrings", + "modes": [], + "usageCount": 0, + "showInTrayMenu": false, + "abbreviation": { + "abbreviations": [], + "backspace": true, + "ignoreCase": false, + "immediate": false, + "triggerInside": false, + "wordChars": "[\\w]" + }, + "hotkey": { + "modifiers": [], + "hotKey": null + }, + "filter": { + "regex": null, + "isRecursive": false + } +} \ No newline at end of file diff --git a/keymaps/autokey/hotstrings/.iirc.json b/keymaps/autokey/hotstrings/.iirc.json new file mode 100644 index 0000000..e8adf3f --- /dev/null +++ b/keymaps/autokey/hotstrings/.iirc.json @@ -0,0 +1,31 @@ +{ + "type": "phrase", + "description": "iirc", + "modes": [ + 1 + ], + "usageCount": 6, + "prompt": false, + "omitTrigger": false, + "matchCase": false, + "showInTrayMenu": false, + "abbreviation": { + "abbreviations": [ + "iirc" + ], + "backspace": true, + "ignoreCase": false, + "immediate": false, + "triggerInside": false, + "wordChars": "[^ \\n]" + }, + "hotkey": { + "modifiers": [], + "hotKey": null + }, + "filter": { + "regex": null, + "isRecursive": false + }, + "sendMode": "kb" +} \ No newline at end of file diff --git a/keymaps/autokey/hotstrings/.luccapirovanogmx.com.json b/keymaps/autokey/hotstrings/.luccapirovanogmx.com.json new file mode 100644 index 0000000..a4f1e8f --- /dev/null +++ b/keymaps/autokey/hotstrings/.luccapirovanogmx.com.json @@ -0,0 +1,31 @@ +{ + "type": "phrase", + "description": "luccapirovano@gmx.com", + "modes": [ + 1 + ], + "usageCount": 1, + "prompt": false, + "omitTrigger": false, + "matchCase": false, + "showInTrayMenu": false, + "abbreviation": { + "abbreviations": [ + "myemail" + ], + "backspace": true, + "ignoreCase": false, + "immediate": false, + "triggerInside": false, + "wordChars": "[^ \\n]" + }, + "hotkey": { + "modifiers": [], + "hotKey": null + }, + "filter": { + "regex": null, + "isRecursive": false + }, + "sendMode": "kb" +} \ No newline at end of file diff --git a/keymaps/autokey/hotstrings/iirc.txt b/keymaps/autokey/hotstrings/iirc.txt new file mode 100644 index 0000000..cf4c357 --- /dev/null +++ b/keymaps/autokey/hotstrings/iirc.txt @@ -0,0 +1 @@ +if I recall correctly \ No newline at end of file diff --git a/keymaps/autokey/hotstrings/luccapirovanogmx.com.txt b/keymaps/autokey/hotstrings/luccapirovanogmx.com.txt new file mode 100644 index 0000000..3769f75 --- /dev/null +++ b/keymaps/autokey/hotstrings/luccapirovanogmx.com.txt @@ -0,0 +1 @@ +luccapirovano@gmx.com \ No newline at end of file diff --git a/keymaps/map2-test.py b/keymaps/map2-test.py new file mode 100644 index 0000000..6d0c28d --- /dev/null +++ b/keymaps/map2-test.py @@ -0,0 +1,22 @@ +import time +import map2 + +# readers intercept all keyboard inputs and forward them +reader = map2.Reader(patterns=["/dev/input/by-id/usb-Lite-On_Tech_IBM_USB_Travel_Keyboard_with_Ultra_Nav-event-kbd"]) + +# mappers change inputs, you can also chain multiple mappers! +mapper = map2.Mapper() + +# writers create new virtual devices we can write into +writer = map2.Writer(clone_from = "/dev/input/by-id/usb-Lite-On_Tech_IBM_USB_Travel_Keyboard_with_Ultra_Nav-event-kbd") + +# finally, link nodes to control the event flow +map2.link([reader, mapper, writer]) + +mapper.map("!j", "{ctrl down}{pagedown}{ctrl up}") +mapper.map("!+j", "{ctrl down}{shift down}{pagedown}{shift up}{ctrl up}") +mapper.map("!k", "{ctrl down}{pageup}{ctrl up}") +mapper.map("!+k", "{ctrl down}{shift down}{pageup}{shift up}{ctrl up}") + +# keep running indefinitely +map2.wait() diff --git a/keymaps/test.ahk b/keymaps/test.ahk new file mode 100644 index 0000000..e69de29 diff --git a/keymapsUdev.sh b/keymapsUdev.sh new file mode 100755 index 0000000..240dd95 --- /dev/null +++ b/keymapsUdev.sh @@ -0,0 +1,3 @@ +#!/bin/bash +#======================================================= +exec nohup /home/lucka/sh/keymaps.sh & diff --git a/lgctl b/lgctl new file mode 120000 index 0000000..6b86b31 --- /dev/null +++ b/lgctl @@ -0,0 +1 @@ +lgctl.sh \ No newline at end of file diff --git a/lgctl.sh b/lgctl.sh new file mode 100755 index 0000000..85e8256 --- /dev/null +++ b/lgctl.sh @@ -0,0 +1,2 @@ +#!/bin/bash +ssh gaming-win 'sc '$1' "Looking Glass (host)"' diff --git a/monitormodes.sh b/monitormodes.sh new file mode 100755 index 0000000..3dea335 --- /dev/null +++ b/monitormodes.sh @@ -0,0 +1,4 @@ +#!/bin/bash +scriptfolder=~/sh/monitormodes +cd $scriptfolder +bash ./$(ls . | rofi -dmenu -drun -p "Run: ") diff --git a/mount-all-filesystems.sh b/mount-all-filesystems.sh new file mode 100755 index 0000000..6951a3a --- /dev/null +++ b/mount-all-filesystems.sh @@ -0,0 +1,4 @@ +#!/bin/bash +sshfs nas.mario:/mnt/b8ce9a57-7ce7-47b8-a233-21184c8a0953/share ~/share -o reconnect -o ServerAliveInterval=15 +sshfs gaming-win:/ ~/mnt/gaming-win +sshfs nas.mario:/mnt/mario/ ~/mnt/mario diff --git a/move-to-next-monitor b/move-to-next-monitor new file mode 100755 index 0000000..b4ea351 --- /dev/null +++ b/move-to-next-monitor @@ -0,0 +1,75 @@ +#!/bin/bash +# +# Move the current window to the next monitor. +# +# Also works only on one X screen (which is the most common case). +# +# Props to +# http://icyrock.com/blog/2012/05/xubuntu-moving-windows-between-monitors/ +# +# Unfortunately, both "xdotool getwindowgeometry --shell $window_id" and +# checking "-geometry" of "xwininfo -id $window_id" are not sufficient, as +# the first command does not respect panel/decoration offsets and the second +# will sometimes give a "-0-0" geometry. This is why we resort to "xwininfo". + +screen_width=$(xdpyinfo | awk '/dimensions:/ { print $2; exit }' | cut -d"x" -f1) +screen_height=$(xdpyinfo | awk '/dimensions:/ { print $2; exit }' | cut -d"x" -f2) +display_width=$(xdotool getdisplaygeometry | cut -d" " -f1) +display_height=$(xdotool getdisplaygeometry | cut -d" " -f2) +window_id=$(xdotool getactivewindow) + +# Remember if it was maximized. +window_horz_maxed=$(xprop -id "$window_id" _NET_WM_STATE | grep '_NET_WM_STATE_MAXIMIZED_HORZ') +window_vert_maxed=$(xprop -id "$window_id" _NET_WM_STATE | grep '_NET_WM_STATE_MAXIMIZED_VERT') + +# Un-maximize current window so that we can move it +wmctrl -ir "$window_id" -b remove,maximized_vert,maximized_horz + +# Read window position +x=$(xwininfo -id "$window_id" | awk '/Absolute upper-left X:/ { print $4 }') +y=$(xwininfo -id "$window_id" | awk '/Absolute upper-left Y:/ { print $4 }') + +# Subtract any offsets caused by panels or window decorations +x_offset=$(xwininfo -id "$window_id" | awk '/Relative upper-left X:/ { print $4 }') +y_offset=$(xwininfo -id "$window_id" | awk '/Relative upper-left Y:/ { print $4 }') +x=$(( x - x_offset)) +y=$(( y - y_offset)) + +# Compute new X position +new_x=$((x + display_width)) +# Compute new Y position +new_y=$((y + display_height)) + +# If we would move off the right-most monitor, we set it to the left one. +# We also respect the window's width here: moving a window off more than half its width won't happen. +width=$(xdotool getwindowgeometry "$window_id" | awk '/Geometry:/ { print $2 }'|cut -d"x" -f1) +if [ "$(( new_x + width / 2))" -gt "$screen_width" ]; then + new_x=$((new_x - screen_width)) +fi + +height=$(xdotool getwindowgeometry "$window_id" | awk '/Geometry:/ { print $2 }'|cut -d"x" -f2) +if [ "$((new_y + height / 2))" -gt "$screen_height" ]; then + new_y=$((new_y - screen_height)) +fi + +# Don't move off the left side. +if [ "$new_x" -lt 0 ]; then + new_x=0 +fi + +# Don't move off the bottom +if [ "$new_y" -lt 0 ]; then + new_y=0 +fi + +# Move the window +xdotool windowmove "$window_id" "$new_x" "$new_y" + +# Maximize window again, if it was before +if [ -n "${window_horz_maxed}" ] && [ -n "${window_vert_maxed}" ]; then + wmctrl -ir "$window_id" -b add,maximized_vert,maximized_horz +elif [ -n "${window_horz_maxed}" ]; then + wmctrl -ir "$window_id" -b add,maximized_horz +elif [ -n "${window_vert_maxed}" ]; then + wmctrl -ir "$window_id" -b add,maximized_vert +fi diff --git a/mpv-openclipboard.sh b/mpv-openclipboard.sh new file mode 100755 index 0000000..26fcec7 --- /dev/null +++ b/mpv-openclipboard.sh @@ -0,0 +1,2 @@ +#!/bin/bash +mpv $(xclip -sel clip -o) diff --git a/nohup.out b/nohup.out new file mode 100644 index 0000000..e69de29 diff --git a/notification-parse.sh b/notification-parse.sh new file mode 100755 index 0000000..fc14e6d --- /dev/null +++ b/notification-parse.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +n1='cute ass mf' +n2='backthr0w' +n3='lucca' + +dbus-monitor "interface=org.freedesktop.Notifications" | grep -B 50 -i "dev.vencord.Vesktop" | grep -i -e "$n1" -e "$n2" -e $n3 --line-buffered | +while read found_line; do + echo "$found_line" + mpv --volume=50 --force-window=no "${HOME}/share/audio/dark_souls_2_parry.mp3" # replace with your command & +# ssh gaming-pc.mario F:/Scripts/jabra-headset-keepawake/mpv.exe F:/scripts/jabra-headset-keepawake/dark_souls_2_parry.mp3 +done diff --git a/numpad-hotkeys-keyd.sh b/numpad-hotkeys-keyd.sh new file mode 100755 index 0000000..f7f6efb --- /dev/null +++ b/numpad-hotkeys-keyd.sh @@ -0,0 +1,46 @@ +#!/bin/bash +sudo keyd monitor | +while + read; + do + if echo "$REPLY" | fgrep "04d9:1503:20f521c9"; then + if echo "$REPLY" | fgrep "kp0 down"; then echo "this is button 0"; + fi + if echo "$REPLY" | fgrep "kp1 down"; then echo "this is button 1"; + fi + if echo "$REPLY" | fgrep "kp2 down"; then echo "this is button 2"; + fi + if echo "$REPLY" | fgrep "kp3 down"; then echo "this is button 3"; + fi + if echo "$REPLY" | fgrep "kp4 down"; then echo "this is button 4"; + fi + if echo "$REPLY" | fgrep "kp5 down"; then echo "this is button 5"; + fi + if echo "$REPLY" | fgrep "kp6 down"; then echo "this is button 6"; + ~/sh/rmctrl/commands/wega toggle + fi + if echo "$REPLY" | fgrep "kp7 down"; then echo "this is button 7"; + python3 ~/sh/gamingpc/monitorLin.py + fi + if echo "$REPLY" | fgrep "kp8 down"; then echo "this is button 8"; + python3 ~/sh/gamingpc/monitorWin.py + fi + if echo "$REPLY" | fgrep "kp9 down"; then echo "this is button 9"; + fi + if echo "$REPLY" | fgrep "numlock down"; then echo "this is button numlock"; + ~/sh/rmctrl/commands/lightoff + fi + if echo "$REPLY" | fgrep "kpslash down"; then echo "this is button /"; + ~/sh/rmctrl/commands/lighton + fi + if echo "$REPLY" | fgrep "kpasterisk down"; then echo "this is button *"; + ~/sh/rmctrl/commands/monitoroff + fi + if echo "$REPLY" | fgrep "backspace down"; then echo "this is button backspace"; + ~/sh/rmctrl/commands/monitoron + fi + if echo "$REPLY" | fgrep "kpenter down"; then echo "this is button kpenter"; + curl -v -u lucka:h0gC3PMwSCXjJH8L 'http://wattbox.mario/control.cgi?outlet=2&command=0' & + fi + fi + done diff --git a/ps3-controller-bluetooth-latency-fix.sh b/ps3-controller-bluetooth-latency-fix.sh new file mode 100755 index 0000000..5af1dd1 --- /dev/null +++ b/ps3-controller-bluetooth-latency-fix.sh @@ -0,0 +1,95 @@ +#!/usr/bin/env bash + +# setup-ps3-bt-slave-poller.sh +# ============================ +# Installs a systemd service + script to poll for your PS3 controllers +# and force slave/peripheral mode (PC master) when connected. +# No udev timing issues. Works around hcitool sr race. + +set -euo pipefail + +MACS=("00:1B:FB:F0:7C:85" "00:1B:FB:F3:D2:25" "00:1B:FB:6A:1E:E4") + +SERVICE_FILE="/etc/systemd/system/ps3-bt-slave.service" +POLLER_SCRIPT="/usr/local/bin/ps3-bt-slave-poller.sh" +HCITOOL="$(which hcitool 2>/dev/null || echo "/usr/bin/hcitool")" + +if [[ ${EUID:-} -ne 0 ]]; then + echo "Run with sudo." + exit 1 +fi + +if [[ ! -x "$HCITOOL" ]]; then + echo "hcitool missing. Install bluez-deprecated-tools:" + echo " sudo apt install bluez-deprecated-tools (Debian/Ubuntu/Mint)" + echo " or equivalent for your distro." + exit 1 +fi + +echo "Creating poller script: $POLLER_SCRIPT" + +cat > "$POLLER_SCRIPT" << 'EOP' +#!/usr/bin/env bash +# ps3-bt-slave-poller.sh - background checker for PS3 BT role switch + +MACS=("00:1B:FB:F0:7C:85" "00:1B:FB:F3:D2:25" "00:1B:FB:6A:1E:E4") +LOG="/tmp/ps3-bt-slave-poller.log" + +while true; do + for mac in "${MACS[@]}"; do + if hcitool con | grep -q "$mac"; then + # Connected → force slave/peripheral + echo "$(date '+%Y-%m-%d %H:%M:%S') - $mac connected, forcing slave" >> "$LOG" + hcitool sr "$mac" slave >> "$LOG" 2>&1 || echo "$(date '+%Y-%m-%d %H:%M:%S') - Failed for $mac" >> "$LOG" + fi + done + sleep 10 +done +EOP + +chmod +x "$POLLER_SCRIPT" +echo "Poller script created." + +echo "Creating systemd service: $SERVICE_FILE" + +cat > "$SERVICE_FILE" << EOF +[Unit] +Description=PS3 Bluetooth Slave/Peripheral Mode Poller +After=bluetooth.service network.target + +[Service] +ExecStart=$POLLER_SCRIPT +Restart=always +RestartSec=5 +User=root + +[Install] +WantedBy=multi-user.target +EOF + +echo "Service file created." + +echo "Enabling/starting service..." +systemctl daemon-reload +systemctl enable --now ps3-bt-slave.service + +echo "" +echo "=== Setup Complete ===" +echo "The poller runs in background. After any controller connects:" +echo " - Wait 10-30 seconds" +echo " - Run: hcitool con" +echo " → Should show lm PERIPHERAL (good) instead of lm CENTRAL" +echo "" +echo "Check log for activity/errors:" +echo " tail -f /tmp/ps3-bt-slave-poller.log" +echo "" +echo "Test:" +echo " 1. Disconnect controller fully (hold PS ~10s, lights off)" +echo " 2. Reconnect (press PS button)" +echo " 3. Wait 20-30s" +echo " 4. hcitool con" +echo "" +echo "If still CENTRAL after 30s: Check log for 'Failed' → may need different adapter or accept manual 'sudo hcitool sr MAC slave' after connect." +echo "To stop/uninstall: sudo systemctl stop ps3-bt-slave.service && sudo systemctl disable ps3-bt-slave.service" + +exit 0 diff --git a/quest-cast.sh b/quest-cast.sh new file mode 100755 index 0000000..9c6f1ab --- /dev/null +++ b/quest-cast.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +adb tcpip 5555 +sleep 1 +adb connect 10.0.0.30:5555 +read -p "Disconnect from USB and press Enter to continue" + +set -e +trap 'kill 0' EXIT + +screen_record() { + adb exec-out screenrecord \ + --bit-rate=5m \ + --output-format=h264 \ + --size 1832x960 \ + --time-limit=0 \ + - +} + +stream_play() { + ffplay \ + -framerate 30 \ + -fflags nobuffer+discardcorrupt\ + -flags low_delay \ + -framedrop \ + -strict experimental \ + -analyzeduration 100000 \ + -probesize 32 \ + -sync ext \ + -vf "setpts=PTS-STARTPTS,crop=916:960:0:0" \ + - +} + +# uncomment for audio + scrcpy --no-video --audio-buffer=200 & + +screen_record | stream_play diff --git a/quest-cast2.sh b/quest-cast2.sh new file mode 100755 index 0000000..04906af --- /dev/null +++ b/quest-cast2.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +# Enable ADB over TCP (run once usually) +adb tcpip 5555 +sleep 1 +adb connect 10.0.0.30:5555 || { echo "Connection failed - check IP/Wi-Fi"; exit 1; } + +read -p "Disconnect USB now if desired, then press Enter..." + +set -e +trap 'kill 0' EXIT INT TERM + +stream_play() { + ffplay \ + -fflags nobuffer+discardcorrupt+flush_packets \ + -flags low_delay \ + -framedrop \ + -probesize 32 \ + -analyzeduration 0 \ + -sync ext \ + -vf "setpts=PTS-STARTPTS" \ + - +} + +# Optional audio (low buffer, background) +# scrcpy --no-video --audio-buffer=80 --audio-bit-rate=128K & + +echo "Starting low-latency Quest mirror (Wi-Fi). Ctrl+C to stop." +echo "Expect 150–500 ms latency depending on network." + +while true; do + echo "[$(date '+%H:%M:%S')] (Re)starting screenrecord segment..." + + adb exec-out screenrecord \ + --bit-rate=8M \ + --output-format=h264 \ + --size 1280x720 \ + --time-limit 120 \ + - | stream_play + + # Small delay to let ffplay drain & avoid rapid respawn spam on error + sleep 0.5 +done diff --git a/quest-cast3.sh b/quest-cast3.sh new file mode 100755 index 0000000..bccf054 --- /dev/null +++ b/quest-cast3.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# Quest 2 wireless mirror to PC → 480i CRT (ultra-low quality for min game lag/latency) +# Removed --stay-awake (conflicts with --no-control) + fixed previous issues + +IP="10.0.0.30:5555" + +echo "Enabling ADB over TCP..." +adb tcpip 5555 +sleep 2 + +echo "Connecting to Quest..." +adb connect "${IP}" + +echo "" +echo "ADB devices (should list your Quest):" +adb devices + +echo "" +read -p "Disconnect USB now. Wake Quest fully (put it on), launch game/app, press Enter..." + +echo "" +echo "Starting scrcpy... (fullscreen the window with F11 or OS shortcut; q/Ctrl+C to quit)" +echo "" + +scrcpy -s "${IP}" \ +# --crop=1832:960:1832:0 \ + --crop=1832:960:0:0 \ + --max-size=640 \ + --max-fps=30 \ + --video-bit-rate=800K \ + --no-audio \ + --no-control \ + --always-on-top \ + --window-width=640 \ + --window-height=480 \ + --window-borderless + +echo "" +echo "Troubleshooting:" +echo " - Black screen? Try left-eye crop instead: change to --crop=1832:960:0:0" +echo " Or tweak offset: --crop=1832:960:1700:100 (experiment in 100-pixel steps)" +echo " - Still black/no video? Add this to the scrcpy line:" +echo " --encoder=OMX.google.h264.encoder" +echo " (forces a software encoder on Quest — often fixes black screens on Horizon OS)" +echo " - Game lag/stutter? Lower further: --video-bit-rate=500K or --max-size=480" +echo " - Output HDMI from PC → cheap HDMI-to-composite adapter → your 480i CRT" +echo " - Quest sleeps too fast? Enable 'Stay awake' manually in Quest Developer Options (while charging via USB briefly)" diff --git a/quest-cast4.sh b/quest-cast4.sh new file mode 100755 index 0000000..5f7d094 --- /dev/null +++ b/quest-cast4.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# Quest 2 wireless mirror to PC → 480i CRT (ultra-low quality for min game lag/latency) +# Removed --stay-awake (conflicts with --no-control) + fixed previous issues + +IP="10.0.0.30:5555" + +echo "Enabling ADB over TCP..." +adb tcpip 5555 +sleep 2 + +echo "Connecting to Quest..." +adb connect "${IP}" + +echo "" +echo "ADB devices (should list your Quest):" +adb devices + +echo "" +read -p "Disconnect USB now. Wake Quest fully (put it on), launch game/app, press Enter..." + +echo "" +echo "Starting scrcpy... (fullscreen the window with F11 or OS shortcut; q/Ctrl+C to quit)" +echo "" + +scrcpy -s "${IP}" \ +# --crop=1832:960:1832:0 \ + --crop=1832:960:0:0 \ + --max-size=640 \ + --max-fps=30 \ + --video-bit-rate=800K \ + --no-control \ + --always-on-top \ + --window-width=640 \ + --window-height=480 \ + --window-borderless + +echo "" +echo "Troubleshooting:" +echo " - Black screen? Try left-eye crop instead: change to --crop=1832:960:0:0" +echo " Or tweak offset: --crop=1832:960:1700:100 (experiment in 100-pixel steps)" +echo " - Still black/no video? Add this to the scrcpy line:" +echo " --encoder=OMX.google.h264.encoder" +echo " (forces a software encoder on Quest — often fixes black screens on Horizon OS)" +echo " - Game lag/stutter? Lower further: --video-bit-rate=500K or --max-size=480" +echo " - Output HDMI from PC → cheap HDMI-to-composite adapter → your 480i CRT" +echo " - Quest sleeps too fast? Enable 'Stay awake' manually in Quest Developer Options (while charging via USB briefly)" diff --git a/quest-cast5.sh b/quest-cast5.sh new file mode 100755 index 0000000..c0f3ece --- /dev/null +++ b/quest-cast5.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# Quest 2 wireless mirror to PC → 480i CRT +# --no-audio ensures Quest headset NOT muted (sound stays in-headset) +# Left-eye crop (since right gave black; tweak if needed) + +IP="10.0.0.30:5555" + +echo "Enabling ADB over TCP..." +adb tcpip 5555 +sleep 2 + +echo "Connecting to Quest..." +adb connect "${IP}" + +echo "" +echo "ADB devices (should list your Quest):" +adb devices + +echo "" +read -p "Disconnect USB now. Wake Quest fully (put it on), launch game/app, press Enter..." + +echo "" +echo "Starting scrcpy... (fullscreen with F11 or similar; q/Ctrl+C to quit)" +echo "" + +scrcpy -s "${IP}" \ + --crop=1832:960:0:0 \ + --max-size=640 \ + --max-fps=30 \ + --video-bit-rate=800K \ + --no-audio \ + --no-control \ + --always-on-top \ + --window-width=640 \ + --window-height=480 \ + --window-borderless + +echo "" +echo "Troubleshooting:" +echo " - Black screen? Try centered/right-ish crop: --crop=1600:900:2017:510" +echo " Or simple right half: --crop=1832:960:1832:0" +echo " Add --encoder=OMX.google.h264.encoder if black persists (forces software encoder)" +echo " - Audio still muted on Quest? Double-check no other flags removed --no-audio; restart Quest if stuck" +echo " - Game lag? Lower to --video-bit-rate=500K or --max-size=480" +echo " - HDMI from PC → composite adapter → CRT" diff --git a/quest-cast6.sh b/quest-cast6.sh new file mode 100755 index 0000000..31a983f --- /dev/null +++ b/quest-cast6.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# Quest 2 wireless mirror to PC → 480i CRT +# Updated crop to avoid lens top (centered single view) + audio on Quest + +IP="10.0.0.30:5555" + +echo "Enabling ADB over TCP..." +adb tcpip 5555 +sleep 2 + +echo "Connecting to Quest..." +adb connect "${IP}" + +echo "" +echo "ADB devices (should list your Quest):" +adb devices + +echo "" +read -p "Disconnect USB now. Wake Quest fully (put it on), launch game/app, press Enter..." + +echo "" +echo "Starting scrcpy... (fullscreen with F11 or similar; q/Ctrl+C to quit)" +echo "" + +scrcpy -s "${IP}" \ + --crop=1600:900:2017:510 \ + --max-size=640 \ + --max-fps=30 \ + --video-bit-rate=800K \ + --no-audio \ + --no-control \ + --always-on-top \ + --window-width=640 \ + --window-height=480 \ + --window-borderless + +echo "" +echo "Troubleshooting:" +echo " - Still seeing lens top/empty area? Try higher y-offset: --crop=1600:900:2017:550" +echo " Or alternative crops:" +echo " --crop=1600:900:68:495 (left-leaning centered view)" +echo " --crop=1832:960:1832:100 (simple right half, shifted down a bit)" +echo " - Black screen? Add --encoder=OMX.google.h264.encoder" +echo " - Crop feels off-center/UI cut? Tweak x-offset by 50–100 (e.g. 2017 → 1950 or 2100)" +echo " - Game lag? Lower --video-bit-rate=500K or --max-size=480" +echo " - HDMI from PC → composite adapter → CRT" diff --git a/quest-cast7.sh b/quest-cast7.sh new file mode 100755 index 0000000..34f2c86 --- /dev/null +++ b/quest-cast7.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# Quest 2 wireless mirror to PC → 480i CRT +# Only crop changed for better 4:3 compatibility (taller source to reduce bars) + +IP="10.0.0.30:5555" + +echo "Enabling ADB over TCP..." +adb tcpip 5555 +sleep 2 + +echo "Connecting to Quest..." +adb connect "${IP}" + +echo "" +echo "ADB devices (should list your Quest):" +adb devices + +echo "" +read -p "Disconnect USB now. Wake Quest fully (put it on), launch game/app, press Enter..." + +echo "" +echo "Starting scrcpy... (fullscreen with F11 or similar; q/Ctrl+C to quit)" +echo "" + +scrcpy -s "${IP}" \ + --crop=1440:1080:2017:420 \ + --max-size=800 \ + --max-fps=30 \ + --video-bit-rate=800K \ + --no-audio \ + --no-control \ + --always-on-top \ + --window-width=640 \ + --window-height=480 \ + --window-borderless + +echo "" +echo "Troubleshooting:" +echo " - Too much lens top again? Increase y-offset: --crop=1440:1080:2017:480" +echo " - Cuts bottom/UI? Lower y-offset back: --crop=1440:1080:2017:510 or try original 1600:900:2017:510" +echo " - Still too many black bars? Use wider source: --crop=1500:1125:2017:450 (closer to 4:3 fill)" +echo " - Black screen? Add --encoder=OMX.google.h264.encoder" +echo " - HDMI from PC → composite adapter → CRT" diff --git a/quest-cast8.sh b/quest-cast8.sh new file mode 100755 index 0000000..0176eff --- /dev/null +++ b/quest-cast8.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Quest 2 wireless mirror to PC → 480i CRT +# No crop to reduce flickering/black intermittents (common fix for Horizon OS 74+) + +IP="10.0.0.30:5555" + +echo "Enabling ADB over TCP..." +adb tcpip 5555 +sleep 2 + +echo "Connecting to Quest..." +adb connect "${IP}" + +echo "" +echo "ADB devices (should list your Quest):" +adb devices + +echo "" +read -p "Disconnect USB now. Put on Quest fully, launch game/app FIRST, then press Enter..." + +echo "" +echo "Starting scrcpy... (fullscreen with F11; q/Ctrl+C to quit)" +echo "" + +scrcpy -s "${IP}" \ + --max-size=480 \ + --max-fps=15 \ + --video-bit-rate=400K \ + --no-audio \ + --no-control \ + --always-on-top \ + --window-width=640 \ + --window-height=480 \ + --window-borderless + +echo "" +echo "Troubleshooting:" +echo " - Flicker gone? Re-add crop later (--crop=1440:1080:2017:420) and test if it returns" +echo " - Still flickers? Try --encoder=OMX.google.h264.encoder or lower bitrate to 500K" +echo " - Wider black bars now? Normal without crop — use OBS crop if needed" +echo " - HDMI PC → composite adapter → CRT" diff --git a/quest-cast9.sh b/quest-cast9.sh new file mode 100755 index 0000000..4d5528e --- /dev/null +++ b/quest-cast9.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# Quest 2 wireless mirror to PC → 480i CRT +# Forced encoder + low settings to stop ~20s black flicker (Horizon OS v74+ bug) + +IP="10.0.0.30:5555" + +echo "Enabling ADB over TCP..." +adb tcpip 5555 +sleep 2 + +echo "Connecting to Quest..." +adb connect "${IP}" + +echo "" +echo "ADB devices:" +adb devices + +echo "" +read -p "Disconnect USB now. Reboot Quest if possible. Put on headset, enter game/app NOW, then press Enter..." + +echo "" +echo "Starting scrcpy (test for flicker after 20–60s)..." +echo "" + +scrcpy -s "${IP}" \ + --max-size=640 \ + --max-fps=30 \ + --video-bit-rate=800K \ + --video-encoder=c2.qti.avc.encoder \ + --no-audio \ + --no-control \ + --always-on-top \ + --window-width=640 \ + --window-height=480 \ + --window-borderless + +echo "" +echo "Next steps if flicker remains:" +echo " - Swap encoder: --video-encoder=OMX.qcom.video.encoder.avc" +echo " - Lower more: --max-size=480 --video-bit-rate=400K --max-fps=24" +echo " - Check issue #5913 on GitHub for patched binaries (search 'Quest 2 fix')" +echo " - HDMI PC out → composite adapter → CRT" diff --git a/rmctrl/.light.swp b/rmctrl/.light.swp new file mode 100644 index 0000000000000000000000000000000000000000..2bbb6f0e4e2ff302f057f6f85c5390abca9a0873 GIT binary patch literal 12288 zcmeI%zYf7b9Ki7(gMkR)1<+NUKMRjwFbR80Xro$bPi#DzhcJ5z2BTJVY%B(n?eg(inAm61S>I`*B`PO9i>sisJ1T8!L%_Xon!&MB37B;G3bf%-nr^ zB~+24!tFwbp7PwaqcgX&fB*vD64>jNIV{fx{a!aoX|$S+dTsWt?BqcJ0R#|0009IL zKmdV15YW4voZ>q3?^@F__nxQYA6$hJ5kLR|1Q0*~0R#|0009ILKp;aP`L4fIL~e0U t{{PeW|2>UmoFj|?0tg_000IagfB*srAb/dev/null 2>&1 || { echo >&2 "The nc programme for sending data over the network isn't in the path, communication with the plug will fail"; exit 2; } + command -v base64 >/dev/null 2>&1 || { echo >&2 "The base64 programme for decoding base64 encoded strings isn't in the path, decoding of payloads will fail"; exit 2; } + command -v od >/dev/null 2>&1 || { echo >&2 "The od programme for converting binary data to numbers isn't in the path, the status and emeter commands will fail";} + command -v read >/dev/null 2>&1 || { echo >&2 "The read programme for splitting text into tokens isn't in the path, the status and emeter commands will fail";} + command -v printf >/dev/null 2>&1 || { echo >&2 "The printf programme for converting numbers into binary isn't in the path, the status and emeter commands will fail";} +} + +show_usage() { + echo Usage: $0 IP PORT COMMAND + echo where COMMAND is one of on/off/check/status/emeter/toggle + exit 1 +} + + +check_arguments() { + check_arg() { + name="$1" + value="$2" + if [ -z "$value" ]; then + echo "missing argument $name" + show_usage + fi + } + check_arg "ip" $ip + check_arg "port" $port + check_arg "command" $cmd +} + +send_to_plug() { + ip="$1" + port="$2" + payload="$3" + echo -n "$payload" | base64 --decode | nc -v $ip $port || echo couldn''t connect to $ip:$port, nc failed with exit code $? +} + +decode(){ + code=171 + offset=4 + input_num=`od -j $offset -An -t u1 -v | tr "\n" " "` + IFS=' ' read -r -a array <<< "$input_num" + args_for_printf="" + for element in "${array[@]}" + do + output=$(( $element ^ $code )) + args_for_printf="$args_for_printf\x$(printf %x $output)" + code=$element + done + printf "$args_for_printf" +} + +query_plug(){ + payload=$1 + send_to_plug $ip $port "$payload" | decode +} + +# plug commands + +cmd_print_plug_relay_state(){ + output=`send_to_plug $ip $port "$payload_query" | decode | egrep -oa 'relay_state":[0,1]' | egrep -o '[0,1]'` + if [[ $output -eq 0 ]]; then + echo OFF + elif [[ $output -eq 1 ]]; then + echo ON + else + echo Couldn''t understand plug response $output + fi +} + +cmd_print_plug_status(){ + query_plug "$payload_query" +} + +cmd_print_plug_consumption(){ + query_plug "$payload_emeter" +} + +cmd_switch_on(){ + send_to_plug $ip $port $payload_on > /dev/null +} + +cmd_switch_off(){ + send_to_plug $ip $port $payload_off > /dev/null +} + +cmd_switch_toggle() { + output=`cmd_print_plug_relay_state` + if [[ $output == OFF ]]; then + cmd_switch_on + elif [[ $output == ON ]]; then + cmd_switch_off + else + echo $output + fi +} + +## +# Main programme +## + + +check_dependencies +check_arguments + +case "$cmd" in + on) + cmd_switch_on + ;; + off) + cmd_switch_off + ;; + toggle) + cmd_switch_toggle + ;; + check) + cmd_print_plug_relay_state + ;; + status) + cmd_print_plug_status + ;; + emeter) + cmd_print_plug_consumption + ;; + *) + show_usage + ;; +esac diff --git a/rmctrl/inputtest.py b/rmctrl/inputtest.py new file mode 100755 index 0000000..ce18d1d --- /dev/null +++ b/rmctrl/inputtest.py @@ -0,0 +1,184 @@ +# Released by rdb under the Unlicense (unlicense.org) +# Based on information from: +# https://www.kernel.org/doc/Documentation/input/joystick-api.txt + +import os, struct, array, sys +from fcntl import ioctl + +# Iterate over the joystick devices. +print('Available devices:') + +for fn in os.listdir('/dev/input'): + if fn.startswith('js'): + print(' /dev/input/%s' % (fn)) + +# We'll store the states here. +axis_states = {} +button_states = {} + +# These constants were borrowed from linux/input.h +axis_names = { + 0x00 : 'x', + 0x01 : 'y', + 0x02 : 'z', + 0x03 : 'rx', + 0x04 : 'ry', + 0x05 : 'rz', + 0x06 : 'throttle', + 0x07 : 'rudder', + 0x08 : 'wheel', + 0x09 : 'gas', + 0x0a : 'brake', + 0x10 : 'hat0x', + 0x11 : 'hat0y', + 0x12 : 'hat1x', + 0x13 : 'hat1y', + 0x14 : 'hat2x', + 0x15 : 'hat2y', + 0x16 : 'hat3x', + 0x17 : 'hat3y', + 0x18 : 'pressure', + 0x19 : 'distance', + 0x1a : 'tilt_x', + 0x1b : 'tilt_y', + 0x1c : 'tool_width', + 0x20 : 'volume', + 0x28 : 'misc', +} + +button_names = { + 0x120 : 'trigger', + 0x121 : 'thumb', + 0x122 : 'thumb2', + 0x123 : 'top', + 0x124 : 'top2', + 0x125 : 'pinkie', + 0x126 : 'base', + 0x127 : 'base2', + 0x128 : 'base3', + 0x129 : 'base4', + 0x12a : 'base5', + 0x12b : 'base6', + 0x12f : 'dead', + 0x130 : 'a', + 0x131 : 'b', + 0x132 : 'c', + 0x133 : 'x', + 0x134 : 'y', + 0x135 : 'z', + 0x136 : 'tl', + 0x137 : 'tr', + 0x138 : 'tl2', + 0x139 : 'tr2', + 0x13a : 'select', + 0x13b : 'start', + 0x13c : 'mode', + 0x13d : 'thumbl', + 0x13e : 'thumbr', + + 0x220 : 'dpad_up', + 0x221 : 'dpad_down', + 0x222 : 'dpad_left', + 0x223 : 'dpad_right', + + # XBox 360 controller uses these codes. + 0x2c0 : 'dpad_left', + 0x2c1 : 'dpad_right', + 0x2c2 : 'dpad_up', + 0x2c3 : 'dpad_down', +} + +axis_map = [] +button_map = [] + +# Open the joystick device. +fn = f'/dev/input/{sys.argv[1]}' +print('Opening %s...' % fn) +jsdev = open(fn, 'rb') + +# Get the device name. +#buf = bytearray(63) +buf = array.array('B', [0] * 64) +ioctl(jsdev, 0x80006a13 + (0x10000 * len(buf)), buf) # JSIOCGNAME(len) +js_name = buf.tobytes().rstrip(b'\x00').decode('utf-8') +print('Device name: %s' % js_name) + +# Get number of axes and buttons. +buf = array.array('B', [0]) +ioctl(jsdev, 0x80016a11, buf) # JSIOCGAXES +num_axes = buf[0] + +buf = array.array('B', [0]) +ioctl(jsdev, 0x80016a12, buf) # JSIOCGBUTTONS +num_buttons = buf[0] + +# Get the axis map. +buf = array.array('B', [0] * 0x40) +ioctl(jsdev, 0x80406a32, buf) # JSIOCGAXMAP + +for axis in buf[:num_axes]: + axis_name = axis_names.get(axis, 'unknown(0x%02x)' % axis) + axis_map.append(axis_name) + axis_states[axis_name] = 0.0 + +# Get the button map. +buf = array.array('H', [0] * 200) +ioctl(jsdev, 0x80406a34, buf) # JSIOCGBTNMAP + +for btn in buf[:num_buttons]: + btn_name = button_names.get(btn, 'unknown(0x%03x)' % btn) + button_map.append(btn_name) + button_states[btn_name] = 0 + +print('%d axes found: %s' % (num_axes, ', '.join(axis_map))) +print('%d buttons found: %s' % (num_buttons, ', '.join(button_map))) + +# Main event loop +while True: + evbuf = jsdev.read(8) + if evbuf: + time, value, type, number = struct.unpack('IhBB', evbuf) + + if type & 0x80: + print("(initial)", end="") + + if type & 0x01: + button = button_map[number] + if button: + button_states[button] = value + if value: + print("%s pressed" % (button)) + + else: + print("%s released" % (button)) + + if type & 0x02: + axis = axis_map[number] + if axis: + fvalue = value / 32767.0 + axis_states[axis] = fvalue + #print("%s: %.3f" % (axis, fvalue)) + print(axis, fvalue) + + #IF STATEMENTS FOR DPAD + + if axis == 'hat0y' and fvalue == 1.0: # DPAD DOWN + os.system('echo dpad up') + if axis == 'hat0y' and fvalue == -1.0: # DPAD UP + os.system('echo dpad up') + + #IF STATEMENTS FOR C BUTTONS + + if axis == 'rz' and fvalue == 0.8453627124851222: # C LEFT + #os.system('~/rmctrl/smartplug.sh hs100-lights.mario off') + os.system('~/rmctrl/commands/lightoff &') + if axis == 'rz' and fvalue == -0.8247932370983001: # C RIGHT + #os.system('~/rmctrl/smartplug.sh hs100-lights.mario on') + os.system('~/rmctrl/commands/lighton &') + if axis == 'z' and fvalue == 0.8453627124851222: # C DOWN + #os.system('~/rmctrl/smartplug.sh hs100-monitors.mario off') + os.system('~/rmctrl/commands/monitoroff &') + os.system('ssh -i ~/.ssh/screenoff-key/screenoff lucka@x201t.mario &') + if axis == 'z' and fvalue == -0.8247932370983001: # C UP + #os.system('~/rmctrl/smartplug.sh hs100-monitors.mario on') + os.system('~/rmctrl/commands/monitoron &') diff --git a/rmctrl/joysticklightswitchTmux.yaml b/rmctrl/joysticklightswitchTmux.yaml new file mode 100755 index 0000000..bd79a02 --- /dev/null +++ b/rmctrl/joysticklightswitchTmux.yaml @@ -0,0 +1,10 @@ +session_name: 3-pane-split +windows: + - window_name: dev window + layout: tiled + shell_command_before: + - cd ~/rmctrl # run as a first command in all panes + panes: + - while true; do python3 inputtest.py js0; done # pane no. 1 + - while true; do python3 inputtest.py js1; done # pane no. 2 + - ./keepalive.sh # pane no. 3 diff --git a/rmctrl/keepalive.sh b/rmctrl/keepalive.sh new file mode 100755 index 0000000..1b1916b --- /dev/null +++ b/rmctrl/keepalive.sh @@ -0,0 +1,8 @@ +#!/bin/bash +while true +do +./smartplug.sh hs100-lights.mario check +./smartplug.sh hs100-monitors.mario check +sleep 2m +done + diff --git a/rmctrl/smartplug.sh b/rmctrl/smartplug.sh new file mode 100755 index 0000000..49534f1 --- /dev/null +++ b/rmctrl/smartplug.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cd /home/lucka/sh/rmctrl +./hs100.sh $1 9999 $2 & diff --git a/rofi/viewcam b/rofi/viewcam new file mode 100755 index 0000000..7dba6ee --- /dev/null +++ b/rofi/viewcam @@ -0,0 +1,2 @@ +#!/bin/bash +mpv av://v4l2:/dev/v4l/by-id/usb-Sonix_Technology_Co.__Ltd._Lenovo_FHD_Webcam_Audio_SN0001-video-index0 --profile=low-latency --untimed --demuxer-lavf-o-set=input_format=mjpeg -vf=hflip diff --git a/setup-keyboard-remap-poller.sh b/setup-keyboard-remap-poller.sh new file mode 100755 index 0000000..25499b7 --- /dev/null +++ b/setup-keyboard-remap-poller.sh @@ -0,0 +1,113 @@ +#!/usr/bin/env bash + +# setup-keyboard-remap-poller.sh +# ============================= +# Installs a systemd user service that polls for keyboard plug-in / KVM switch events +# and runs ~/sh/keymaps.sh (your xmodmap stuff) when it detects a change. +# +# Why polling? Udev is too early / env broken for X11 tools in most cases. + +set -euo pipefail + +SERVICE_NAME="keyboard-remap-poller" +SERVICE_FILE="$HOME/.config/systemd/user/$SERVICE_NAME.service" +POLLER_SCRIPT="$HOME/.local/bin/keyboard-remap-poller.sh" +KEYMAPS_SCRIPT="$HOME/sh/keymaps.sh" + +if [[ ! -x "$KEYMAPS_SCRIPT" ]]; then + echo "Error: $KEYMAPS_SCRIPT not found or not executable." + echo "Make sure it exists and chmod +x it." + exit 1 +fi + +echo "Creating poller script: $POLLER_SCRIPT" + +mkdir -p "$(dirname "$POLLER_SCRIPT")" + +cat > "$POLLER_SCRIPT" << 'EOP' +#!/usr/bin/env bash +# keyboard-remap-poller.sh - checks for keyboard/input changes and runs keymaps.sh + +KEYMAPS_SCRIPT="$HOME/sh/keymaps.sh" +LOG_FILE="$HOME/.local/share/keyboard-remap.log" +LAST_COUNT_FILE="$HOME/.cache/keyboard-event-count" + +# Initial count of input devices (rough way to detect plug/unplug/KVM) +get_input_count() { + ls /dev/input/event* 2>/dev/null | wc -l +} + +last_count=$(cat "$LAST_COUNT_FILE" 2>/dev/null || echo "0") + +while true; do + current_count=$(get_input_count) + + if [[ "$current_count" != "$last_count" ]]; then + echo "$(date '+%Y-%m-%d %H:%M:%S') - Input device count changed ($last_count → $current_count). Running keymaps.sh" >> "$LOG_FILE" + + # Run your script in X session context + if [[ -n "${DISPLAY:-}" ]]; then + "$KEYMAPS_SCRIPT" >> "$LOG_FILE" 2>&1 + else + # Fallback: try common display :0 or :0.0 + DISPLAY=:0 XAUTHORITY="$HOME/.Xauthority" "$KEYMAPS_SCRIPT" >> "$LOG_FILE" 2>&1 || \ + DISPLAY=:0.0 XAUTHORITY="$HOME/.Xauthority" "$KEYMAPS_SCRIPT" >> "$LOG_FILE" 2>&1 + fi + + echo "$(date '+%Y-%m-%d %H:%M:%S') - keymaps.sh finished (exit code $?)" >> "$LOG_FILE" + echo "$current_count" > "$LAST_COUNT_FILE" + fi + + last_count="$current_count" + sleep 8 # Check every 8 seconds - low overhead +done +EOP + +chmod +x "$POLLER_SCRIPT" +echo "Poller script created." + +echo "Creating systemd user service: $SERVICE_FILE" + +mkdir -p "$(dirname "$SERVICE_FILE")" + +cat > "$SERVICE_FILE" << EOF +[Unit] +Description=Poll for keyboard plug-in / KVM events and run keymaps.sh +After=graphical-session.target + +[Service] +Type=simple +ExecStart=$POLLER_SCRIPT +Restart=always +RestartSec=5 + +[Install] +WantedBy=graphical-session.target +EOF + +echo "Service file created." + +echo "Enabling and starting the service (user level)..." +systemctl --user daemon-reload +systemctl --user enable --now "$SERVICE_NAME.service" + +echo "" +echo "=== Setup Done ===" +echo "The service is now running as your user." +echo "" +echo "Test it:" +echo " 1. Switch KVM or plug/unplug a keyboard" +echo " 2. Wait 10–20 seconds" +echo " 3. Check if your xmodmap changes applied (e.g. press your remapped keys)" +echo " 4. Look at log:" +echo " tail -f $HOME/.local/share/keyboard-remap.log" +echo "" +echo "If it doesn't trigger reliably:" +echo " - Increase sleep 8 → sleep 5 in $POLLER_SCRIPT" +echo " - Or if DISPLAY is wrong, edit the DISPLAY/XAUTHORITY lines" +echo "" +echo "To stop/disable:" +echo " systemctl --user stop $SERVICE_NAME.service" +echo " systemctl --user disable $SERVICE_NAME.service" +echo "" +echo "Enjoy your remaps without F10 every time!" diff --git a/tModLoader b/tModLoader new file mode 100755 index 0000000..427bb74 --- /dev/null +++ b/tModLoader @@ -0,0 +1,5 @@ +#!/bin/bash +cd /home/lucka/.steam/debian-installation/steamapps/common/tModLoader +/home/lucka/.steam/debian-installation/steamapps/common/tModLoader/start-tModLoader-FamilyShare.sh +#sleep 10 +#steam steam://rungameid/12579072071637663744 diff --git a/typeclipboard.sh b/typeclipboard.sh new file mode 100755 index 0000000..d193cc6 --- /dev/null +++ b/typeclipboard.sh @@ -0,0 +1,3 @@ +#!/bin/bash +sleep 0.9 +/bin/bash -c "sh -c 'sleep 0.2; xdotool type --delay $1ms \"\$(xclip -o -selection clipboard)\"'" diff --git a/ultrawide-monitor-split.sh b/ultrawide-monitor-split.sh new file mode 100755 index 0000000..92da8a5 --- /dev/null +++ b/ultrawide-monitor-split.sh @@ -0,0 +1,9 @@ +#!/bin/bash +xrandr --delmonitor m1 +xrandr --delmonitor m2 +#xrandr --setmonitor m1 1920/1x1080/1+640+0 DisplayPort-0 +#xrandr --setmonitor m1 1920/1x1080/1+0+0 DisplayPort-0 +xrandr --setmonitor m1 2880/1x1080/1+1600+0 DisplayPort-0 +xrandr --setmonitor m2 727/1x1080/1+640+0 none +#xrandr --setmonitor m2 1920/1x1080/1+2560+0 none +#xrandr --setmonitor m2 1920/1x1080/1+1920+0 none diff --git a/warpMouse.sh b/warpMouse.sh new file mode 100755 index 0000000..daccc14 --- /dev/null +++ b/warpMouse.sh @@ -0,0 +1,25 @@ +#!/bin/bash +focusWindowUnderMouse () { +xdotool windowactivate $(xdotool getmouselocation|sed "s/.*://") +} +case $1 in +1) +xdotool mousemove 800 400 +focusWindowUnderMouse +;; +2) +xdotool mousemove 2650 500 +focusWindowUnderMouse +;; +3) +xdotool mousemove 800 1600 +focusWindowUnderMouse +;; +4) +#xdotool mousemove 2560 1600 +xdotool mousemove 2180 1300 +focusWindowUnderMouse +;; +esac + + diff --git a/warpMouseAndWindow.sh b/warpMouseAndWindow.sh new file mode 100755 index 0000000..3267593 --- /dev/null +++ b/warpMouseAndWindow.sh @@ -0,0 +1,35 @@ +#!/bin/bash +focusWindowUnderMouse () { +xdotool windowactivate $(xdotool getmouselocation|sed "s/.*://") +} +maximizeWindow () { +wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz +} +unMaximizeWindow () { +wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz +} +moveWindowToMonitor () { +if [ "$(xprop -id $(xdotool getmouselocation --shell | awk -F= '/WINDOW/{print $2}') WM_CLASS | awk -F\" '{print $4}')" != "plasmashell" ]; then +unMaximizeWindow +xdotool getactivewindow windowsize 800 600 +xdotool mousemove $1 $2 +xdotool getactivewindow windowmove $1 $2 +maximizeWindow +fi +} + +case $1 in +1) +moveWindowToMonitor 800 400 +;; +2) +moveWindowToMonitor 2650 500 +;; +3) +moveWindowToMonitor 800 1600 +;; +4) +#moveWindowToMonitor 2560 1600 +moveWindowToMonitor 2180 1300 +;; +esac diff --git a/workspace/wl.sh b/workspace/wl.sh new file mode 100755 index 0000000..86ce8bd --- /dev/null +++ b/workspace/wl.sh @@ -0,0 +1,8 @@ +sudo apt install \ + libwayland-dev \ + libwayland-client++0 \ + libwayland-client0 \ + libwayland-client-extra++0 \ + libegl-dev \ + libtls-dev + diff --git a/ytmusicquick b/ytmusicquick new file mode 100755 index 0000000..8242214 --- /dev/null +++ b/ytmusicquick @@ -0,0 +1,70 @@ +#!/bin/bash +# dependencies: mpv youtube-dl fzf rofi/dmenu +# search videos and playlists on youtube and play them in mpv, without an API +# usage: +# yt asks for input in stdin, prompts using fzf +# yt search query takes input from the passed arg, prompts using fzf +# yt -r takes input and prompts using rofi ($guicmd) + +defcmd="fzf" +guicmd="rofi -dmenu -i" #uncomment next line for dmenu +#guicmd="dmenu -i -l 15" +promptcmd="$defcmd" +if [ -z "$*" ]; then + echo -n "Search: " + read -r query +else + case "$1" in + -r) query=$(echo | $guicmd -p "Youtube Search: ") + promptcmd="$guicmd -p Video:";; + *) query="$*";; + esac +fi +if [ -z "$query" ]; then exit; fi +# sanitise the query +query=$(sed \ + -e 's|+|%2B|g'\ + -e 's|#|%23|g'\ + -e 's|&|%26|g'\ + -e 's| |+|g'\ + <<< "$query") +# fetch the results with the $query and +# delete all escaped characters +response="$(curl -s "https://www.youtube.com/results?search_query=$query" |\ + sed 's|\\.||g')" +# if unable to fetch the youtube results page, inform and exit +if ! grep -q "script" <<< "$response"; then echo "unable to fetch yt"; exit 1; fi +# regex expression to match video and playlist entries from yt result page +vgrep='"videoRenderer":{"videoId":"\K.{11}".+?"text":".+?[^\\](?=")' +pgrep='"playlistRenderer":{"playlistId":"\K.{34}?","title":{"simpleText":".+?[^\"](?=")' +# grep the id and title +# return them in format id (type) title +getresults() { + grep -oP "$1" <<< "$response" |\ + awk -F\" -v p="$2" '{ print $1 "\t" p " " $NF}' +} +# get the list of videos/playlists and their ids in videoids and playlistids +videoids=$(getresults "$vgrep") +playlistids=$(getresults "$pgrep" "(playlist)") +# if there are playlists or videos, append them to list +[ -n "$playlistids" ] && ids="$playlistids\n" +[ -n "$videoids" ] && ids="$ids$videoids" +# url prefix for videos and playlists +videolink="https://youtu.be/" +playlink="https://youtube.com/playlist?list=" +# prompt the results to user infinitely until they exit (escape) +while true; do + echo "Choose Video/Playlist to play: " + choice=$(echo -e "$ids" | cut -d' ' -f2 | $promptcmd) # dont show id + if [ -z "$choice" ]; then exit; fi # if esc-ed then exit + id=$(echo -e "$ids" | grep -Fwm1 "$choice" | cut -d' ' -f1) # get id of choice + echo -e "$choice\t($id)" + echo "$videolink$id" + case $id in + # 11 digit id = video + ???????????) mpv "$videolink$id" --no-video --force-window=no;; + # 34 digit id = playlist + ??????????????????????????????????) mpv "$playlink$id" --no-video --force-window=no;; + *) exit ;; + esac +done