diff --git a/plock b/plock new file mode 100755 index 0000000..e6ca1ea --- /dev/null +++ b/plock @@ -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()) diff --git a/pvis b/pvis index 8e9e39d..b77ed04 100755 --- a/pvis +++ b/pvis @@ -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 diff --git a/start_cbonsai.sh b/start_cbonsai.sh deleted file mode 100755 index 3a33651..0000000 --- a/start_cbonsai.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -/home/"$(whoami)"/.local/bin/cbonsai -li -M1 -L25 diff --git a/start_cmatrix.sh b/start_cmatrix.sh new file mode 100755 index 0000000..324e4aa --- /dev/null +++ b/start_cmatrix.sh @@ -0,0 +1,2 @@ +#!/bin/sh +/home/"$(whoami)"/.local/bin/cmatrix -f diff --git a/term_setup.sh b/term_setup.sh new file mode 100755 index 0000000..6e45d9d --- /dev/null +++ b/term_setup.sh @@ -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