added comment for context on execvp, with relevant codeberg issue link associated. fixed inconsistency on movestack, and utilized .real vs .awake for clock
Browse files
+2 −2 build.zig.zon
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | .{ |
| 2 | 2 | .name = .oxwm, |
| 3 | - .version = "0.11.4", | |
| 3 | + .version = "0.12.0", | |
| 4 | 4 | .fingerprint = 0x4b9ef3753914924d, // Changing this has security and trust implications. |
| 5 | - .minimum_zig_version = "0.15.2", | |
| 5 | + .minimum_zig_version = "0.16.0", | |
| 6 | 6 | .dependencies = .{ |
| 7 | 7 | .lua = .{ |
| 8 | 8 | .url = "https://www.lua.org/ftp/lua-5.4.8.tar.gz", |
+3 −3 flake.lock
| @@ -2,11 +2,11 @@ | ||
| 2 | 2 | "nodes": { |
| 3 | 3 | "nixpkgs": { |
| 4 | 4 | "locked": { |
| 5 | - "lastModified": 1771008912, | |
| 6 | - "narHash": "sha256-gf2AmWVTs8lEq7z/3ZAsgnZDhWIckkb+ZnAo5RzSxJg=", | |
| 5 | + "lastModified": 1778443072, | |
| 6 | + "narHash": "sha256-zi7/fsqM/kFdNuED//4WOCUtezGtKKqRNORjMvfwjnA=", | |
| 7 | 7 | "owner": "NixOS", |
| 8 | 8 | "repo": "nixpkgs", |
| 9 | - "rev": "a82ccc39b39b621151d6732718e3e250109076fa", | |
| 9 | + "rev": "da5ad661ba4e5ef59ba743f0d112cbc30e474f32", | |
| 10 | 10 | "type": "github" |
| 11 | 11 | }, |
| 12 | 12 | "original": { |
+2 −1 src/bar/blocks/blocks.zig
| @@ -108,7 +108,8 @@ pub const Block = struct { | ||
| 108 | 108 | const interval_secs = self.interval(); |
| 109 | 109 | if (interval_secs == 0) return false; |
| 110 | 110 | |
| 111 | - const now = std.Io.Timestamp.now(io, .real).toSeconds(); | |
| 111 | + // .awake (monotonic) for interval bookkeeping, not .real (wall-clock) — std.Io rework gives us a clock enum now, and a wall-clock backstep would stretch intervals. | |
| 112 | + const now = std.Io.Timestamp.now(io, .awake).toSeconds(); | |
| 112 | 113 | if (now - self.last_update < @as(i64, @intCast(interval_secs))) { |
| 113 | 114 | return false; |
| 114 | 115 | } |
+5 −2 src/bar/blocks/cpu_temp.zig
| @@ -8,6 +8,7 @@ pub const CpuTemp = struct { | ||
| 8 | 8 | color: c_ulong, |
| 9 | 9 | cached_path: [128]u8, |
| 10 | 10 | cached_path_len: usize, |
| 11 | + detection_attempted: bool, | |
| 11 | 12 | |
| 12 | 13 | pub fn init( |
| 13 | 14 | format: []const u8, |
| @@ -22,6 +23,7 @@ pub const CpuTemp = struct { | ||
| 22 | 23 | .color = color, |
| 23 | 24 | .cached_path = undefined, |
| 24 | 25 | .cached_path_len = 0, |
| 26 | + .detection_attempted = false, | |
| 25 | 27 | }; |
| 26 | 28 | } |
| 27 | 29 | |
| @@ -82,10 +84,11 @@ pub const CpuTemp = struct { | ||
| 82 | 84 | } |
| 83 | 85 | |
| 84 | 86 | pub fn content(self: *CpuTemp, io: std.Io, buffer: []u8) []const u8 { |
| 85 | - if (self.cached_path_len == 0) { | |
| 87 | + if (!self.detection_attempted) { | |
| 86 | 88 | self.detectPath(io); |
| 87 | - if (self.cached_path_len == 0) return buffer[0..0]; | |
| 89 | + self.detection_attempted = true; | |
| 88 | 90 | } |
| 91 | + if (self.cached_path_len == 0) return buffer[0..0]; | |
| 89 | 92 | |
| 90 | 93 | const path = self.cached_path[0..self.cached_path_len]; |
| 91 | 94 | const file = std.Io.Dir.openFileAbsolute(io, path, .{}) catch return buffer[0..0]; |
+3 −2 src/wm/actions.zig
| @@ -16,6 +16,7 @@ const WindowManager = wm_mod.WindowManager; | ||
| 16 | 16 | |
| 17 | 17 | const snap_distance: i32 = 32; |
| 18 | 18 | |
| 19 | +// execvpeZ removed in zig 0.16 std lib rework (codeberg.org/ziglang/zig/issues/31694) with no replacement | |
| 19 | 20 | extern "c" fn execvp(file: [*:0]const u8, argv: [*:null]const ?[*:0]const u8) c_int; |
| 20 | 21 | |
| 21 | 22 | pub fn spawnChildSetup(wm: *WindowManager) void { |
| @@ -801,9 +802,9 @@ pub fn executeAction(action: config_mod.Action, int_arg: i32, str_arg: ?[]const | ||
| 801 | 802 | } |
| 802 | 803 | } |
| 803 | 804 | }, |
| 804 | - .focus_next => focusstack(int_arg, wm), | |
| 805 | + .focus_next => focusstack(if (int_arg == 0) 1 else int_arg, wm), | |
| 805 | 806 | .focus_prev => focusstack(-1, wm), |
| 806 | - .move_next => movestack(int_arg, wm), | |
| 807 | + .move_next => movestack(if (int_arg == 0) 1 else int_arg, wm), | |
| 807 | 808 | .move_prev => movestack(-1, wm), |
| 808 | 809 | .resize_master => setmfact(@as(f32, @floatFromInt(int_arg)) / 1000.0, wm), |
| 809 | 810 | .inc_master => incnmaster(1, wm), |