Skip to content

Instantly share code, notes, and snippets.

@supechicken
Created March 30, 2025 18:46
Show Gist options
  • Save supechicken/301f10eacaecdf72fb455edf0e4e8d1f to your computer and use it in GitHub Desktop.
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
#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