Created
March 30, 2025 18:46
-
-
Save supechicken/301f10eacaecdf72fb455edf0e4e8d1f to your computer and use it in GitHub Desktop.
A simple utility written in C for forcing any X11 application getting into fullscreen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <X11/Xlib.h> | |
#include <X11/Xatom.h> | |
int main(int argc, char** argv) { | |
Window win = strtoul(argv[1], NULL, 16); | |
Display *display = XOpenDisplay(getenv("ORIGDISP")); | |
XEvent ev; | |
ev.xclient.window = win; | |
ev.xclient.type = ClientMessage; | |
ev.xclient.format = 32; | |
ev.xclient.message_type = XInternAtom(display, "_NET_WM_STATE", False); | |
ev.xclient.data.l[0] = 1; | |
ev.xclient.data.l[1] = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", False); | |
ev.xclient.data.l[2] = 1; | |
XSendEvent(display, DefaultRootWindow(display), False, SubstructureRedirectMask | SubstructureNotifyMask, &ev); | |
XCloseDisplay(display); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment