mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-12-18 22:24:04 +01:00
improve randomwallpaper.zig
This commit is contained in:
parent
e28746aebe
commit
bdbde45b2d
1 changed files with 2 additions and 5 deletions
|
@ -9,8 +9,7 @@ const Display = c.struct__XDisplay;
|
||||||
|
|
||||||
pub fn main() !void {
|
pub fn main() !void {
|
||||||
var alloc = std.heap.GeneralPurposeAllocator(.{}){};
|
var alloc = std.heap.GeneralPurposeAllocator(.{}){};
|
||||||
const maybe_display = c.XOpenDisplay(null);
|
if (c.XOpenDisplay(null)) |display| {
|
||||||
if (maybe_display) |display| {
|
|
||||||
defer _ = c.XCloseDisplay(display);
|
defer _ = c.XCloseDisplay(display);
|
||||||
|
|
||||||
var dummy1: c_int = undefined;
|
var dummy1: c_int = undefined;
|
||||||
|
@ -24,8 +23,6 @@ pub fn main() !void {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn updateWallpapers(display: *Display, alloc: mem.Allocator) !void {
|
fn updateWallpapers(display: *Display, alloc: mem.Allocator) !void {
|
||||||
const stdout = std.io.getStdOut().writer();
|
|
||||||
|
|
||||||
var heads: c_int = 0;
|
var heads: c_int = 0;
|
||||||
const info = c.XineramaQueryScreens(display, &heads);
|
const info = c.XineramaQueryScreens(display, &heads);
|
||||||
defer _ = c.XFree(info);
|
defer _ = c.XFree(info);
|
||||||
|
@ -37,7 +34,7 @@ fn updateWallpapers(display: *Display, alloc: mem.Allocator) !void {
|
||||||
while (i < heads) {
|
while (i < heads) {
|
||||||
const head = info[i];
|
const head = info[i];
|
||||||
|
|
||||||
try stdout.print("Setting wallpaper for screen {} with size {}x{}\n", .{ i, head.width, head.height });
|
std.log.info("Setting wallpaper for screen {} with size {}x{}\n", .{ i, head.width, head.height });
|
||||||
|
|
||||||
var buf: [10]u8 = undefined;
|
var buf: [10]u8 = undefined;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue