Inicio app

This commit is contained in:
2023-08-03 13:14:07 +02:00
commit 51bf40542b
3 changed files with 58 additions and 0 deletions

BIN
cinema.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

58
pyStScreen.py Normal file
View File

@@ -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()

BIN
work.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB