5
jestdotty
45d

ok I give up trying to make a screensaver for Linux

I don't even have anything to rant about

just everything I tried didn't work and nothing makes sense

I'm gonna find somewhere to bury my woes

this is so stupid, too. because I can just query the system if it's idle, run my app, and then ask my app to exit if there's any user input. but instead I'm trying to integrate it with the existing screensaver software. which evidently never runs my application for God knows what reason. and I'm tired of reading 100 pages hunting for the answer. where's my arch wiki page for how to make a screensaver =[

Comments
  • 1
    When I type "How to wtite a Screensaver for Linux" in gpt I get a nice answer
  • 1
    @jestdotty this is what mine says:

    #include <stdio.h>
    #include <X11/Xlib.h>
    #include <X11/extensions/scrnsaver.h>

    int main() {
    Display *display;
    Window root;
    XScreenSaverInfo *info;
    unsigned int delay;

    // Open the display
    display = XOpenDisplay(NULL);
    if (!display) {
    fprintf(stderr, "Unable to open display\n");
    return 1;
    }

    root = DefaultRootWindow(display);
    info = XScreenSaverAllocInfo();

    while (1) {
    XScreenSaverQueryInfo(display, root, info);
    delay = info->idle;

    printf("Idle time: %u seconds\n", delay);

    // Add your screensaver logic here
    // For example, draw something on the screen

    XFree(info);

    // Sleep for a while
    sleep(1);
    }

    // Close the display
    XCloseDisplay(display);
    return 0;
    }

    Seems legit and...

    xscreensaver-command -activate
    Or
    gnome-screensaver-command --activate

    sudo cp screensaver /usr/local/bin
  • 1
    And it recommends sdl for graphics. But sdl is hard.

    What will your Screensaver do?
  • 0
    i usually just used komorebi, and get some video background (or even rendered it myself via blender) with a bunch of layers n shit. works like a charm.

    currently i stopped using that in favor of a dual screen wallpaper via hydrapaper

    but to be fair, that's wallpaper, not screensaver 😅
Add Comment