plock and updates to other tools

This commit is contained in:
cubernetes 2023-11-08 02:04:15 +01:00
parent def66c82f5
commit 16c7474ca9
5 changed files with 93 additions and 5 deletions

75
plock Executable file
View File

@ -0,0 +1,75 @@
#!/usr/bin/env python3
import sys
import hashlib
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWidgets import QMainWindow
from PyQt5.QtWidgets import QLineEdit
from PyQt5.QtWidgets import QVBoxLayout
from PyQt5.QtWidgets import QWidget
from PyQt5.QtGui import QCursor
from PyQt5.QtCore import Qt
from PyQt5.QtCore import QTimer
CORRECT_PASSWORD_HASH = '1d2e2b10cf9a5474612138ac00bc8b1e8fe895822ddc1e77e0edd023fcff4565'
class FullScreenWindow(QMainWindow):
def __init__(self):
super().__init__()
self.title = 'plock'
self.initUI()
def initUI(self):
self.setWindowTitle(self.title)
self.central_widget = QWidget()
self.setCentralWidget(self.central_widget)
layout = QVBoxLayout()
self.password_field = QLineEdit()
self.password_field.setEchoMode(QLineEdit.Password)
self.password_field.returnPressed.connect(self.check_password)
self.password_field.setFixedWidth(200)
layout.addWidget(self.password_field, 0, Qt.AlignCenter)
self.central_widget.setLayout(layout)
self.showFullScreen()
def check_password(self):
entered_password_hash = hashlib.sha256(self.password_field.text().encode('utf-8')).hexdigest()
if entered_password_hash == CORRECT_PASSWORD_HASH:
self.close()
def showEvent(self, event):
super().showEvent(event)
QTimer.singleShot(100, self.grabKeyboardAndMouse)
def grabKeyboardAndMouse(self):
super().showFullScreen()
self.grabMouse()
self.grabKeyboard()
self.setCursor(QCursor(Qt.BlankCursor))
self.password_field.setFocus()
def keyPressEvent(self, event):
self.grabMouse()
self.grabKeyboard()
if event.key() == Qt.Key_Escape:
if event.modifiers() & Qt.ControlModifier:
print("Secure exit requested")
self.close()
else:
self.password_field.keyPressEvent(event)
def main() -> int:
app = QApplication(sys.argv)
ex = FullScreenWindow()
return app.exec_()
if __name__ == '__main__':
raise SystemExit(main())

10
pvis
View File

@ -24,7 +24,7 @@ Collapsed=0
IMGUI
2>/dev/null visualizer &
sleep .2
sleep .5
xdotool key Super+Down
wid="$(xdotool getactivewindow)"
xdotool windowsize "${wid}" 600 670
@ -35,7 +35,11 @@ xdotool mousemove 1780 935
xdotool click 1
sleep .1
xdotool type 100
amount="${1}"
if [ -z "${amount}" ]; then
amount="100"
fi
xdotool type "${amount}"
sleep .1
xdotool mousemove 1780 960
@ -46,7 +50,7 @@ xdotool mousemove 1780 1060
xdotool click 1
sleep .1
speed="${1}"
speed="${2}"
if [ -z "${speed}" ]; then
speed="100"
fi

View File

@ -1,2 +0,0 @@
#!/bin/sh
/home/"$(whoami)"/.local/bin/cbonsai -li -M1 -L25

2
start_cmatrix.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
/home/"$(whoami)"/.local/bin/cmatrix -f

9
term_setup.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
cd "${HOME}"/.local/bin
alacritty --config-file "${HOME}"/.config/alacritty/alacritty_cmatrix.yml -e ./start_cmatrix.sh &
alacritty --config-file "${HOME}"/.config/alacritty/alacritty_parrotlive.yml -e ./start_parrot_live.sh &
alacritty --config-file "${HOME}"/.config/alacritty/alacritty_pomo.yml -e ./start_pomo.sh &
sleep .2
alacritty --working-directory "${HOME}" &
sleep .5
tmux send-keys "ls" ENTER