~leon_plickat/nfm

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH nfm v3] Set window title using OSC 2

Details
Message ID
<20220616203550.16712-1-mail@hmachet.com>
DKIM signature
pass
Download raw message
Patch: +14 -1
Views title:
  * nav => "nfm: $CWD"
  * bm, fs => "nfm: <view name>"

Implements: https://todo.sr.ht/~leon_plickat/nfm/26
---
v2 -> v3:
  Update zig-spoon to use new setWindowTitle()

 deps/zig-spoon |  2 +-
 src/nfm.zig    | 10 ++++++++++
 src/view.zig   |  3 +++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/deps/zig-spoon b/deps/zig-spoon
index 64d0536d01af..41657f29002c 160000
--- a/deps/zig-spoon
+++ b/deps/zig-spoon
@@ -1 +1 @@
Subproject commit 64d0536d01afa3ad8cd7da05d952b2ed355547db
Subproject commit 41657f29002c74473fb7b5dafd7341bbe73e3150
diff --git a/src/nfm.zig b/src/nfm.zig
index bc5fe5870bc6..74f8a5543adf 100644
--- a/src/nfm.zig
+++ b/src/nfm.zig
@@ -100,10 +100,20 @@ pub const Context = struct {
            }
        };

        try self.updateWindowTitle();

        self.ui.list_dirty = true;
        self.ui.title_dirty = true;
    }

    pub fn updateWindowTitle(self: *Context) !void {
        switch (self.view) {
            .nav => try self.ui.term.setWindowTitle("nfm: {s}", .{self.dirmap.cwd.name}),
            .fs => try self.ui.term.setWindowTitle("nfm: Filesystem", .{}),
            .bm => try self.ui.term.setWindowTitle("nfm: Bookmarks", .{}),
        }
    }

    pub fn runU21(self: *Context, command: []const u21, comptime name: []const u8) !void {
        const cmd = try util.codepointSliceToUtf8SlizeZAlloc(self.gpa, command);
        defer self.gpa.free(cmd);
diff --git a/src/view.zig b/src/view.zig
index 8a89406a9c50..3ae90fe0e37d 100644
--- a/src/view.zig
+++ b/src/view.zig
@@ -43,6 +43,7 @@ pub const View = union(enum) {
    pub fn setNav(self: *Self) void {
        self.reset();
        self.* = .nav;
        context.updateWindowTitle() catch return;
    }

    pub fn setFs(self: *Self) !void {
@@ -52,11 +53,13 @@ pub const View = union(enum) {
            .cursor = 0,
            .scroll_offset = 0,
        } };
        try context.updateWindowTitle();
    }

    pub fn setBm(self: *Self) void {
        self.reset();
        self.* = .bm;
        context.updateWindowTitle() catch return;
    }

    fn reset(self: *Self) void {
-- 
2.36.1

[nfm/patches] build failed

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CKRUIGE045ZH.1UX0WBEUOXXX@cirno2>
In-Reply-To
<20220616203550.16712-1-mail@hmachet.com> (view parent)
DKIM signature
missing
Download raw message
nfm/patches: FAILED in 52s

[Set window title using OSC 2][0] v3 from [Hugo Machet][1]

[0]: https://lists.sr.ht/~leon_plickat/nfm/patches/33062
[1]: mail@hmachet.com

✗ #781975 FAILED nfm/patches/alpine.yml  https://builds.sr.ht/~leon_plickat/job/781975
✗ #781976 FAILED nfm/patches/freebsd.yml https://builds.sr.ht/~leon_plickat/job/781976
Details
Message ID
<CKRV2OR9K6BD.1SUGXRTOM8IHP@m5>
In-Reply-To
<20220616203550.16712-1-mail@hmachet.com> (view parent)
DKIM signature
missing
Download raw message
Thanks!


Friendly greetings,
Leon Henrik Plickat
Reply to thread Export thread (mbox)