哪个显示管理器适用于非交互式 Python 应用程序和 mplayer?

发布于 2024-09-05 04:36:14 字数 285 浏览 5 评论 0原文

我正在开发一个将在 Linux 上运行的应用程序,以便始终全屏运行(没有菜单或托盘或任何内容可见)。

该应用程序将用 Python 开发,这对于窗口管理器来说并不重要,但我遇到的困难是选择窗口管理器。

我需要占用空间最小的东西,它可以让我以宽屏分辨率(宽屏、16:10、16:9 等)运行图形 Python 应用程序并同时拥有 mplayer 窗口。除此之外,它不需要很多功能,但最终的占地面积大小是我要考虑的最重要的事情。

您会推荐什么窗口管理器?

编辑:不会与所需的应用程序进行任何交互。

I am developing an application that will run on Linux to run fullscreen all the time (no menus or trays or anything will be visible).

The application is going to be developed in Python, not that that matters as far as the window manager, but what I am having a hard time with is choosing a window manager.

I need something with the smallest possible footprint, that will let me run a graphical Python app and have an mplayer window at the same time, at widescreen resolutions (widescreen, 16:10,16:9, etc). Other than that, it doesn't need a lot of features, but the end footprint size is the most important thing I'll be looking at.

What window manager would you recommend?

EDIT: There won't be any interaction with the application needed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

尹雨沫 2024-09-12 04:36:14

您实际上不需要任何窗口管理器或显示管理器。您所需要做的就是打开与根窗口具有相同几何形状的初始窗口。我想如果您愿意的话,您甚至可以直接绘制到根窗口中。

如果您正在使用某些显示库,它可能有一种简单的方法来打开全屏窗口。例如,通过 pygame 使用足够新的 SDL 版本,您可以

pygame.display.init()
surface = pygame.display.set_mode((0,0),pygame.FULLSCREEN,0)

得到一个充满整个屏幕的窗口。即使没有运行窗口管理器,这也将起作用。

至于 mplayer,它接受 -geometry 标志,因此您可以使用 mplayer -geometry 640x480+20+20 之类的内容来显示距前 20 个像素 20 个像素的 mplayer 窗口从左侧开始的像素,大小为 640x480 像素。

You don't actually need any window manager or display manager. All you need to do is open your initial window with the same geometry as the root window. I suppose you could even draw directly into the root window if you wanted.

If you are using some display library it probably has an easy way to open a full screen window. For example using a recent enough version of SDL through pygame you can do

pygame.display.init()
surface = pygame.display.set_mode((0,0),pygame.FULLSCREEN,0)

to get a window that fills the entire screen. This will work even if there is no window manager running.

As for mplayer, it accepts the -geometry flag, so you can use something like mplayer -geometry 640x480+20+20 to display the mplayer window 20 pixels from the top 20 pixels from the left and with a size of 640x480 pixels.

上课铃就是安魂曲 2024-09-12 04:36:14

您可能指的是窗口管理器。显示管理有KDM、GDM等。 Windoe 管理器,例如 GNOME、Xfce、KDE、ratpoison、fvwm、twm、blackbox 等。 ratpoison 为前台的应用程序提供全屏显示,但需要大量的键盘交互(因此得名ratpoison),并且根本不需要鼠标交互。

You probably meant window manager. Display manages are KDM, GDM and the like. Windoe managers, to name, GNOME, Xfce, KDE, ratpoison, fvwm, twm, blackbox are a few. ratpoison gives full screen to the application that is in the foreground but demands heavy keyboard interaction (hence the name ratpoison) and no mouse interaction at all.

差↓一点笑了 2024-09-12 04:36:14

我假设您将以某种几何组合运行 python GUI 和 mplayer,同时显示两者,填满屏幕。

正如所评论的,您不需要窗口管理器来实现这一点。您可以让您的 python GUI 应用程序获取命令行参数来设置其窗口几何形状,并使用 -geometry 参数调用全屏 mplayer。这应该按预期填满屏幕,没有任何窗口装饰。

现在,您可以调用 startx 脚本来让用户运行所有脚本,并使用自定义的 ~/.xinitrc 脚本执行以下操作:

#!/bin/sh

exec python my_gui_app --whatever-sets-geom &
exec mplayer -fs video.avi

如果您 p​​yhon 应用程序将启动 mplayer,则只需保留第一个 'exex' 调用(删除 '& ;') 并让它根据需要以“-fs”模式下的预期尺寸调用 mplayer。

请注意,您可能需要使用“xset”程序之类的东西来禁用显示器消隐,以节省能源,隐藏光标(尽管 IIRC 这是 mplayer 为自己的窗口所做的事情),以及类似的事情。

此外,有时在裸露的 X 显示器上运行 GTK 应用程序可能最终会使用“丑陋”的主题,因此您可能需要以某种方式处理工具包样式配置。

I assume you'll be running both your python GUI and mplayer in some sort of geometries combination that shows both at the same time, filling the screen.

As commented, you should not need a window manager to achieve that. You could have your python GUI app get command-line parameters for setting its window geometry and also call fullscreen mplayer with the -geometry parameter. That should fill the screen as expected, without any window decorations.

Now you could have the startx script called for the user running it all and have a custom ~/.xinitrc script doing something like:

#!/bin/sh

exec python my_gui_app --whatever-sets-geom &
exec mplayer -fs video.avi

If yout pyhon app will instead be launching mplayer then just leave the first 'exex' call (remove the '&') and have it call mplayer as desired with the expected dimensions in '-fs' mode.

Please note you may need to use something like the 'xset' program to disable monitor blanking due to energy savings, hide the cursor (although IIRC that's something mplayer does for its own window), and things like that.

Also, somethimes running, for example, GTK apps on a bare X display may end up using an "ugly" theme, so you may need to have the toolkit style configuration taken care of someway.

記柔刀 2024-09-12 04:36:14

我正在我的“机顶盒”上做类似的事情,并且我不使用任何窗口管理器。

它启动 debian,并从 inittab 我自动登录运行显示器的用户。该用户的 .profile 启动 X,它运行 .xinitrc,它启动我的 python 应用程序,该应用程序作为 mplayer 前面的网络服务器运行(在 -slave 模式下运行 mplayer)。

我的 python 应用程序没有 GUI 元素 - 只有 mplayer 在 X 显示器上运行。但就你的情况而言,应该没有什么不同。正如我在另一个答案的评论中提到的,您可能想研究如何重新设置 mplayer 窗口的父级,以便更好地控制其位置和/或移动/大小。

这样做可以避免使用显示管理器和窗口管理器。这简化了解决方案,启动速度更快,占用空间更小(它使用 SD 卡运行,有大量空闲空间)。

I am doing something similar on my "set-top box" and I don't use any window manager.

It boots debian, and from inittab I auto-login the user that runs the display. That user's .profile starts X, which runs .xinitrc, which starts my python app that runs as a network server in front of mplayer (running mplayer in -slave mode).

My python app does not have a GUI element - only mplayer runs on the X display. But in your case, it should be no different. As I mentioned in a comment to another answer, you may want to look into how you can reparent mplayer's window to give you greater control over its placement and/or movement/size.

Doing it this way avoided a display manager and a window manager. This simplifies the solution, boots faster and uses a smaller footprint (it runs of an SD card, with heaps of room to spare).

泪是无色的血 2024-09-12 04:36:14

我意识到这是一个老问题,但我在我的系统上使用 openbox,我创建了一个自定义配置文件,该文件禁用所有鼠标键盘快捷键,并删除应用程序上的边框等。
在 openbox 配置中,我什至创建了一些可以运行 fx 的秘密快捷方式。用于现场调试的 xterm。

openbox 文档对于解决所有问题非常有帮助,我在大约 30 分钟内完成了配置。

I realize this is an old question, but I use openbox on my system, I have created a custom config file that disables all mouse keyboard shortcuts, and removes borders etc on the applications.
In the openbox config i even created some secret shortcuts that can run fx. an xterm for debugging live on the box.

The openbox documentation was very helpful in figuring everything out, I did the config in about 30 minutes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文