commit 51bf40542b3d228ed6dda2f23ed77eb029340b5e Author: clonbg Date: Thu Aug 3 13:14:07 2023 +0200 Inicio app diff --git a/cinema.png b/cinema.png new file mode 100644 index 0000000..acb4ff1 Binary files /dev/null and b/cinema.png differ diff --git a/pyStScreen.py b/pyStScreen.py new file mode 100644 index 0000000..e535561 --- /dev/null +++ b/pyStScreen.py @@ -0,0 +1,58 @@ +from PyQt6.QtGui import QIcon, QAction +from PyQt6.QtWidgets import QApplication, QMenu, QSystemTrayIcon +import os + +# enable +# xset s on +dpms;xscreensaver --nosplash +# disable +# xset s off -dpms;xscreensaver-command -exit + +# saber si se está ejecutando + + +pid = os.popen('pidof xscreensaver').read() +print(pid) +matado = os.popen('kill {int(pid)}').read() +print(matado) + + +# Al iniciar se activa xscreensaver +salida = os.popen( + 'xset s on +dpms;/usr/bin/xscreensaver --nosplash;echo ENABLE xscreensaver').read() +print(salida) + +app = QApplication([]) +app.setQuitOnLastWindowClosed(False) + +# Adding an icon +icon = QIcon("work.png") + +# Adding item on the menu bar +tray = QSystemTrayIcon() +tray.setIcon(icon) +tray.setVisible(True) + +# Creating the options +menu = QMenu() + + +# opción desactivar screensaver +def desactivar(): + salida = os.popen( + 'xset s off -dpms;xscreensaver-command -exit').read() + print(salida) + + +optionDesactivo = QAction("Desactivar salvapantallas") +optionDesactivo.triggered.connect(lambda: desactivar()) +menu.addAction(optionDesactivo) + +# To quit the app +quit = QAction("Quit") +quit.triggered.connect(app.quit) +menu.addAction(quit) + +# Adding options to the System Tray +tray.setContextMenu(menu) + +app.exec() diff --git a/work.png b/work.png new file mode 100644 index 0000000..40c9660 Binary files /dev/null and b/work.png differ