funciona
This commit is contained in:
74
nohup.out
Normal file
74
nohup.out
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
|
||||||
|
(xfce4-power-manager:6532): xfce4-power-manager-WARNING **: 11:18:23.212: could not map keysym 1008ffa8 to keycode
|
||||||
|
|
||||||
|
|
||||||
|
** (xfce4-power-manager:6532): WARNING **: 11:18:23.247: No outputs have backlight property
|
||||||
|
xfce4-power-manager-Message: 11:18:23.299: Set kernel brightness switch to 0
|
||||||
|
|
||||||
|
(xfce4-power-manager:6532): xfce4-power-manager-WARNING **: 11:18:23.312: Failed to get keyboard max brightness level : GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: El objeto no existe en la ruta «/org/freedesktop/UPower/KbdBacklight»
|
||||||
|
|
||||||
|
(xfce4-power-manager:6532): xfconf-WARNING **: 11:18:23.313: Failed to set property "xfce4-power-manager::/xfce4-power-manager/brightness-switch": Se canceló la operación
|
||||||
|
xfce4-power-manager-Message: 11:18:23.352: Set kernel brightness switch to 0
|
||||||
|
xfce4-power-manager-Message: 11:18:30.430: Restored brightness switch value to: 1
|
||||||
|
|
||||||
|
(xfce4-power-manager:6644): xfce4-power-manager-WARNING **: 11:19:20.656: could not map keysym 1008ffa8 to keycode
|
||||||
|
|
||||||
|
|
||||||
|
** (xfce4-power-manager:6644): WARNING **: 11:19:20.693: No outputs have backlight property
|
||||||
|
xfce4-power-manager-Message: 11:19:20.745: Set kernel brightness switch to 0
|
||||||
|
|
||||||
|
(xfce4-power-manager:6644): xfce4-power-manager-WARNING **: 11:19:20.757: Failed to get keyboard max brightness level : GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: El objeto no existe en la ruta «/org/freedesktop/UPower/KbdBacklight»
|
||||||
|
|
||||||
|
(xfce4-power-manager:6644): xfconf-WARNING **: 11:19:20.758: Failed to set property "xfce4-power-manager::/xfce4-power-manager/brightness-switch": Se canceló la operación
|
||||||
|
xfce4-power-manager-Message: 11:19:20.791: Set kernel brightness switch to 0
|
||||||
|
xfce4-power-manager-Message: 11:19:23.410: Restored brightness switch value to: 1
|
||||||
|
|
||||||
|
(xfce4-power-manager:6688): xfce4-power-manager-WARNING **: 11:19:31.136: could not map keysym 1008ffa8 to keycode
|
||||||
|
|
||||||
|
|
||||||
|
** (xfce4-power-manager:6688): WARNING **: 11:19:31.160: No outputs have backlight property
|
||||||
|
xfce4-power-manager-Message: 11:19:31.210: Set kernel brightness switch to 0
|
||||||
|
|
||||||
|
(xfce4-power-manager:6688): xfce4-power-manager-WARNING **: 11:19:31.219: Failed to get keyboard max brightness level : GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: El objeto no existe en la ruta «/org/freedesktop/UPower/KbdBacklight»
|
||||||
|
|
||||||
|
(xfce4-power-manager:6688): xfconf-WARNING **: 11:19:31.221: Failed to set property "xfce4-power-manager::/xfce4-power-manager/brightness-switch": Se canceló la operación
|
||||||
|
xfce4-power-manager-Message: 11:19:31.252: Set kernel brightness switch to 0
|
||||||
|
xfce4-power-manager-Message: 11:19:42.719: Restored brightness switch value to: 1
|
||||||
|
|
||||||
|
(xfce4-power-manager:6734): xfce4-power-manager-WARNING **: 11:19:44.497: could not map keysym 1008ffa8 to keycode
|
||||||
|
|
||||||
|
|
||||||
|
** (xfce4-power-manager:6734): WARNING **: 11:19:44.528: No outputs have backlight property
|
||||||
|
xfce4-power-manager-Message: 11:19:44.578: Set kernel brightness switch to 0
|
||||||
|
|
||||||
|
(xfce4-power-manager:6734): xfce4-power-manager-WARNING **: 11:19:44.586: Failed to get keyboard max brightness level : GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: El objeto no existe en la ruta «/org/freedesktop/UPower/KbdBacklight»
|
||||||
|
|
||||||
|
(xfce4-power-manager:6734): xfconf-WARNING **: 11:19:44.587: Failed to set property "xfce4-power-manager::/xfce4-power-manager/brightness-switch": Se canceló la operación
|
||||||
|
xfce4-power-manager-Message: 11:19:44.623: Set kernel brightness switch to 0
|
||||||
|
xfce4-power-manager-Message: 11:19:46.480: Restored brightness switch value to: 1
|
||||||
|
|
||||||
|
(xfce4-power-manager:6779): xfce4-power-manager-WARNING **: 11:19:47.913: could not map keysym 1008ffa8 to keycode
|
||||||
|
|
||||||
|
|
||||||
|
** (xfce4-power-manager:6779): WARNING **: 11:19:47.948: No outputs have backlight property
|
||||||
|
xfce4-power-manager-Message: 11:19:47.996: Set kernel brightness switch to 0
|
||||||
|
|
||||||
|
(xfce4-power-manager:6779): xfce4-power-manager-WARNING **: 11:19:48.008: Failed to get keyboard max brightness level : GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: El objeto no existe en la ruta «/org/freedesktop/UPower/KbdBacklight»
|
||||||
|
|
||||||
|
(xfce4-power-manager:6779): xfconf-WARNING **: 11:19:48.009: Failed to set property "xfce4-power-manager::/xfce4-power-manager/brightness-switch": Se canceló la operación
|
||||||
|
xfce4-power-manager-Message: 11:19:48.041: Set kernel brightness switch to 0
|
||||||
|
Gestor de energía de Xfce: Ya se está ejecutando otro gestor de energía
|
||||||
|
xfce4-power-manager-Message: 11:21:24.654: Restored brightness switch value to: 1
|
||||||
|
|
||||||
|
(xfce4-power-manager:7320): xfce4-power-manager-WARNING **: 11:21:52.214: could not map keysym 1008ffa8 to keycode
|
||||||
|
|
||||||
|
|
||||||
|
** (xfce4-power-manager:7320): WARNING **: 11:21:52.248: No outputs have backlight property
|
||||||
|
xfce4-power-manager-Message: 11:21:52.292: Set kernel brightness switch to 0
|
||||||
|
|
||||||
|
(xfce4-power-manager:7320): xfce4-power-manager-WARNING **: 11:21:52.304: Failed to get keyboard max brightness level : GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: El objeto no existe en la ruta «/org/freedesktop/UPower/KbdBacklight»
|
||||||
|
|
||||||
|
(xfce4-power-manager:7320): xfconf-WARNING **: 11:21:52.305: Failed to set property "xfce4-power-manager::/xfce4-power-manager/brightness-switch": Se canceló la operación
|
||||||
|
xfce4-power-manager-Message: 11:21:52.343: Set kernel brightness switch to 0
|
||||||
|
Gestor de energía de Xfce: Ya se está ejecutando otro gestor de energía
|
||||||
|
xfce4-power-manager-Message: 11:31:02.171: Restored brightness switch value to: 1
|
||||||
104
pyStScreen.py
104
pyStScreen.py
@@ -2,40 +2,98 @@ 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
|
import signal
|
||||||
|
import subprocess
|
||||||
|
path = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
# enable
|
|
||||||
# xset s on +dpms;xscreensaver --nosplash
|
|
||||||
# disable
|
|
||||||
# xset s off -dpms;xscreensaver-command -exit
|
|
||||||
|
|
||||||
app = QApplication([])
|
app = QApplication([])
|
||||||
app.setQuitOnLastWindowClosed(False)
|
app.setQuitOnLastWindowClosed(False)
|
||||||
|
|
||||||
# Adding an icon
|
|
||||||
icon = QIcon("work.png")
|
# PID procesos
|
||||||
|
pidx = os.popen('pidof xscreensaver').read()
|
||||||
|
pid4 = os.popen('pidof xfce4-screensaver').read()
|
||||||
|
|
||||||
|
|
||||||
|
# Creating the options
|
||||||
|
menu = QMenu()
|
||||||
|
|
||||||
|
|
||||||
|
# Menú activar
|
||||||
|
optionActivo = QAction("Activar salvapantallas")
|
||||||
|
optionActivo.triggered.connect(lambda: activar())
|
||||||
|
|
||||||
|
# Menú desactivar
|
||||||
|
optionDesactivo = QAction("Desactivar salvapantallas")
|
||||||
|
optionDesactivo.triggered.connect(lambda: desactivar())
|
||||||
|
|
||||||
|
|
||||||
|
# Saber si está funcionando y cambiar el icono
|
||||||
|
if pidx == "" and pid4 == "":
|
||||||
|
icon = QIcon(path+"/cinema.png")
|
||||||
|
menu.addAction(optionActivo)
|
||||||
|
os.popen('xset -dpms').read()
|
||||||
|
result = subprocess.run(
|
||||||
|
["/usr/bin/bash", "-c", "xfce4-power-manager -q"])
|
||||||
|
print(result)
|
||||||
|
else:
|
||||||
|
icon = QIcon(path+"/work.png")
|
||||||
|
menu.addAction(optionDesactivo)
|
||||||
|
os.popen('xset +dpms').read()
|
||||||
|
result = subprocess.run(
|
||||||
|
["/usr/bin/bash", "-c", "nohup xfce4-power-manager & 2>&1 >/dev/null"])
|
||||||
|
print(result)
|
||||||
|
|
||||||
|
|
||||||
|
# opción desactivar
|
||||||
|
def desactivar():
|
||||||
|
global icon
|
||||||
|
os.popen('xset +dpms').read()
|
||||||
|
result = subprocess.run(
|
||||||
|
["/usr/bin/bash", "-c", "xfce4-power-manager -q"])
|
||||||
|
print(result)
|
||||||
|
icon = QIcon(path+"/cinema.png")
|
||||||
|
tray.setIcon(icon)
|
||||||
|
menu.removeAction(optionDesactivo)
|
||||||
|
menu.removeAction(quit)
|
||||||
|
menu.addAction(optionActivo)
|
||||||
|
menu.addAction(quit)
|
||||||
|
pidx = os.popen('pidof xscreensaver').read()
|
||||||
|
pid4 = os.popen('pidof xfce4-screensaver').read()
|
||||||
|
if pidx != "":
|
||||||
|
os.kill(int(pidx), signal.SIGKILL)
|
||||||
|
if pid4 != "":
|
||||||
|
os.kill(int(pid4), signal.SIGKILL)
|
||||||
|
|
||||||
|
|
||||||
|
# opción activar
|
||||||
|
def activar():
|
||||||
|
global icon
|
||||||
|
os.popen('xset -dpms').read()
|
||||||
|
result = subprocess.run(
|
||||||
|
["/usr/bin/bash", "-c", "nohup xfce4-power-manager & 2>&1 >/dev/null"])
|
||||||
|
print(result)
|
||||||
|
icon = QIcon(path+"/work.png")
|
||||||
|
tray.setIcon(icon)
|
||||||
|
menu.removeAction(optionActivo)
|
||||||
|
menu.removeAction(quit)
|
||||||
|
menu.addAction(optionDesactivo)
|
||||||
|
menu.addAction(quit)
|
||||||
|
if os.path.isfile('/usr/bin/xfce4-screensaver'):
|
||||||
|
result = subprocess.run(
|
||||||
|
["/usr/bin/bash", "-c", "xfce4-screensaver &"])
|
||||||
|
print(result)
|
||||||
|
elif os.path.isfile('/usr/bin/xscreensaver'):
|
||||||
|
result = subprocess.run(
|
||||||
|
["/usr/bin/bash", "-c", "xscreensaver &"])
|
||||||
|
print(result)
|
||||||
|
|
||||||
|
|
||||||
# Adding item on the menu bar
|
# Adding item on the menu bar
|
||||||
tray = QSystemTrayIcon()
|
tray = QSystemTrayIcon()
|
||||||
tray.setIcon(icon)
|
tray.setIcon(icon)
|
||||||
tray.setVisible(True)
|
tray.setVisible(True)
|
||||||
|
|
||||||
# Creating the options
|
|
||||||
menu = QMenu()
|
|
||||||
|
|
||||||
|
|
||||||
# opción desactivar screensaver
|
|
||||||
def desactivar():
|
|
||||||
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")
|
|
||||||
optionDesactivo.triggered.connect(lambda: desactivar())
|
|
||||||
menu.addAction(optionDesactivo)
|
|
||||||
|
|
||||||
# To quit the app
|
# To quit the app
|
||||||
quit = QAction("Quit")
|
quit = QAction("Quit")
|
||||||
|
|||||||
8
pystscreen.desktop
Normal file
8
pystscreen.desktop
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Encoding=UTF-8
|
||||||
|
Version=1.0
|
||||||
|
Type=Application
|
||||||
|
Terminal=false
|
||||||
|
Exec=python3 /opt/pyStScreen/pyStScreen.py
|
||||||
|
Name=PyStScreen
|
||||||
|
Icon=/opt/pyStScreen/cinema.png
|
||||||
Reference in New Issue
Block a user