Skip to content

Commit

Permalink
network close connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier Orfo committed Jan 13, 2025
1 parent 3579010 commit 0a4a42b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

## Caveats
- Zig version **0.13.0**
- Dependencies: `xorg-xsetroot`, `curl`, `alsa`
- C lib dependencies: `xorg-xsetroot`, `curl`, `alsa`
- This library has been developed on and for Linux following open source philosophy.

## Installation
Expand Down
14 changes: 7 additions & 7 deletions config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
separator = "|"

[cpu]
time = 1000
time = 2000
name = "CPU"
icon = ""

[memory]
time = 1000
time = 2000
name = "RAM"
icon = ""

[temperature]
time = 1000
time = 2000
name = "TEMP"
icon = "󰏈 "
zone = 1

[disk]
time = 2000
time = 5000
name = "DISK"
icon = "󰋊 "
unit = "/"
Expand All @@ -30,21 +30,21 @@ icon = " "
icon_muted = "󰖁 "

[network]
time = 5000
time = 7000
name = "NET"
icon = "󰀂 "
icon_down = "󰯡 "

[battery]
time = 5000
time = 7000
name = "BAT"
icon_full = "󰁹"
icon_medium = "󰁿"
icon_low = "󰁺"
path = "/sys/class/power_supply/BAT0/uevent"

[script]
time = 1000
time = 2000
name = "SCR" # Use a suitable nam
icon = "󰯁 " # Use a suitable icon
path = "/path/to/script.sh"
Expand Down
5 changes: 3 additions & 2 deletions src/device.zig
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,11 @@ pub const Network = struct {
}

var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer if (gpa.deinit() != .ok) @panic("leak script");
defer if (gpa.deinit() != .ok) @panic("leak network");
const allocator = gpa.allocator();

if (std.net.tcpConnectToHost(allocator, "google.com", 443)) |_| {
if (std.net.tcpConnectToHost(allocator, "google.com", 443)) |stream| {
defer stream.close();
self.section = .{
.icon = self.icon,
.name = "",
Expand Down

0 comments on commit 0a4a42b

Please sign in to comment.