2zw

2zw - X11 Windowmanager

Files | Log | Commits | Refs | README


c074b3c

Author: erikbackman

Date: 2024-02-08

Subject: pointless stylistic change

Diff

commit c074b3c14afdf00342385a5c6e7cde7d572be3ee
Author: erikbackman <erikbackman@users.noreply.github.com>
Date:   Thu Feb 8 22:07:43 2024 +0100

    pointless stylistic change

diff --git a/src/main.zig b/src/main.zig
index 8136676..7bb66c7 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -5,6 +5,8 @@ const FOCUS_BORDER_COLOR = 0xffd787;
 const NORMAL_BORDER_COLOR = 0x333333;
 const BORDER_WIDTH = 2;
 
+const Direction = enum { Previous, Next };
+
 // Keybinds, currently every key is directly under Mod4Mask but I will probably add
 // the ability to specify modifiers.
 const keys = [_]Key{
@@ -319,20 +321,14 @@ fn quit() void {
 }
 
 fn winNext() void {
-    const c = cursor orelse return;
-    if (c.next) |next| {
-        focus(next);
-    } else if (list.first) |first| {
-        focus(first);
+    if (cursor) |c| {
+        if (c.next) |next| focus(next) else if (list.first) |first| focus(first);
     }
 }
 
 fn winPrev() void {
-    const c = cursor orelse return;
-    if (c.prev) |prev| {
-        focus(prev);
-    } else if (list.last) |last| {
-        focus(last);
+    if (cursor) |c| {
+        if (c.prev) |prev| focus(prev) else if (list.last) |last| focus(last);
     }
 }