You are not logged in.
Pages: 1
Is there a command or app to display black, on CLI or GUI (at least, KDE)? Not "Turn off screen" on KDE because I need audio, see https://bbs.archlinux.org/viewtopic.php?id=315325 .
Googling "linux how to display black" I found 2 commands using xrandr or xset but as their names suggest it's X, GUI KDE I use Wayland & on CLI they don't work.
#!/bin/bash
gwenview -f /home/a/.png(.png is a 1920*1080 (resolution of my display) black image) but only GUI & then I must close Gwenview.
The ideal:
I click on a file, I enter a shortcut or a command: black display (still audio),
then any input e.g. pressing any key: back to normal.
On CLI or GUI (at least, KDE).
Arch Linux KDE
Offline
Small python script that renders a black rectangle window that can be maximized with right click and closed with left click. Use -m to start it in fullscreen Requires tk package installed
karabaja4 made the script
#!/usr/bin/env python3
import sys
import os
import tkinter as tk
class ToggleFullscreenApp:
def __init__(self, root, start_fullscreen=False):
self.root = root
self.fullscreen = False
# Initial window size (rectangle)
self.width = 1280
self.height = 800
self.root.geometry(f"{self.width}x{self.height}") # let WM place it
self.root.configure(background="black")
pid = os.getpid()
self.root.title(f"OLED saver [{pid}]")
# Bind click events
self.root.bind("<Button-3>", self.toggle_fullscreen)
self.root.bind("<Button-1>", self.exit_app)
# Force window manager to place window and get actual geometry
self.root.update_idletasks()
x = self.root.winfo_x()
y = self.root.winfo_y()
w = self.root.winfo_width()
h = self.root.winfo_height()
self.saved_geometry = f"{w}x{h}+{x}+{y}"
# Start in fullscreen if requested
if start_fullscreen:
self.toggle_fullscreen()
def toggle_fullscreen(self, event=None):
self.fullscreen = not self.fullscreen
if self.fullscreen:
# Save current geometry
self.root.update_idletasks()
x = self.root.winfo_x()
y = self.root.winfo_y()
w = self.root.winfo_width()
h = self.root.winfo_height()
self.saved_geometry = f"{w}x{h}+{x}+{y}"
# Go fullscreen
self.root.attributes("-fullscreen", True)
else:
# Restore original size and position
self.root.attributes("-fullscreen", False)
self.root.geometry(self.saved_geometry)
def exit_app(self, event=None):
self.root.quit()
if __name__ == "__main__":
script_name = sys.argv[0]
if "-h" in sys.argv or "--help" in sys.argv:
print(
f"Usage: python3 {script_name} [options]\n\n"
"Options:\n"
" -h, --help Show this help message and exit\n"
" -m Start the application in fullscreen mode\n\n"
"Controls:\n"
" Right-click Toggle fullscreen on/off\n"
" Left-click Exit the application"
)
sys.exit(0)
start_fullscreen = "-m" in sys.argv
root = tk.Tk()
app = ToggleFullscreenApp(root, start_fullscreen=start_fullscreen)
root.mainloop()I Have Linux Perl Can i Download Gnome???
Offline
Afaiu DPMS should™ not cut down the audio signal - does your monitor have settings to control its DPMS (powersaving) behavior?
Otherwise it's not very hard to write a tiny Qt/wlr program to create a black window but the most reasonable approach would likely be a kwin script that just stops all rendering.
Edit: F5
Last edited by seth (Today 09:02:45)
Offline
should is trademarked?
Yes my ViewSonic VP16-OLED has Sleep & Auto Power Off, but what link? Googling "displayport audio only": "It cannot transmit an "audio-only" signal by itself because DisplayPort architecture requires an accompanying video stream/handshake to function." https://en.wikipedia.org/wiki/DisplayPort#Main_link , so "Turn off screen" cuts audio.
According to Gemini & I think it's right: stopping all rendering would freeze...
killertofus I've better: Gemini gave me a C code using SDL: it works! But cuts audio on CLI... https://share.gemini.google/HskqfqlkkigD
Last edited by bivan (Today 13:43:36)
Arch Linux KDE
Offline
Yes should™ is trademarked to separate it from "should" which indicates a neglect of reality ![]()
The other thread said HDMI, but either way I'd ask the LLM for a kwin script that will also skip all rendering overhead.
As for the CLI, setterm -blank will likely cause DPMS, but ctrl+l should™ do most of it ?
Offline
As for the CLI ... ctrl+l should™ do most of it ?
Or the following script will do all of it. And if you have a TE with a black (or suitably dark) background, launching a fullscreen terminal to run this script would work in the GUI as well.
#!/bin/sh
printf '\033[?25l'
clear
read -n 1
printf '\033[?25h'"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Googling "hdmi vs displayport": it seems complicated... I use HDMI because my old PC hasn't USB-C but in the future I'll use USB-C (DisplayPort & PD power delivery) by a new mini PC.
"a kwin script that will also skip all rendering overhead" like window shadow etc? No need, I all disabled.
setterm --blank returns 0 ...
TE terminal?
Nice your script, there's audio! Good job inspector. But Konsole even fullscreen by F11 there's still a bar above.
Last edited by bivan (Today 14:44:36)
Arch Linux KDE
Offline
"Terminal Emulator", the command would be "setterm --blank force"
like window shadow etc?
"Like everything" - notably all windows etc. leaving only the (default black) canvas.
You're losing audio when entering DPMS via HDMI? Is it maybe because the monitor completely shuts down and unregisters?
Offline
Pages: 1