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