kill process :(
This commit is contained in:
@@ -1,26 +1,13 @@
|
||||
from PyQt6.QtGui import QIcon, QAction
|
||||
from PyQt6.QtWidgets import QApplication, QMenu, QSystemTrayIcon
|
||||
import os
|
||||
import signal
|
||||
|
||||
# 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)
|
||||
|
||||
@@ -38,9 +25,12 @@ menu = QMenu()
|
||||
|
||||
# opción desactivar screensaver
|
||||
def desactivar():
|
||||
salida = os.popen(
|
||||
'xset s off -dpms;xscreensaver-command -exit').read()
|
||||
print(salida)
|
||||
pidx = os.popen('pidof xscreensaver').read()
|
||||
if pidx != "":
|
||||
os.killpg(int(pidx), signal.SIGTERM)
|
||||
pid4 = os.popen('pidof xfce4-screensaver').read()
|
||||
if pid4 != "":
|
||||
os.killpg(os.getpid(int(pid4)), signal.SIGTERM)
|
||||
|
||||
|
||||
optionDesactivo = QAction("Desactivar salvapantallas")
|
||||
|
||||
Reference in New Issue
Block a user