Compare commits

...

3 Commits

Author SHA1 Message Date
Liam Galvin 62453daa17
Fix stupid input bug (#330)
* Fix stupid input bug

* Fix build
2021-12-17 09:27:35 +00:00
Qiu 97b6a41eb3
Make getting the up-time more portable across unix-like systems (#326)
* Make getting the up-time more portable across unix-like systems

* Fix the build on NetBSD

* Update Go version in workflows
2021-12-17 08:39:48 +00:00
Qiu 47c91e0002
Make build and install scripts more portable (#325) 2021-12-17 08:38:59 +00:00
9 changed files with 44 additions and 10 deletions

View File

@ -16,7 +16,7 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: '^1.16.6'
go-version: '^1.17'
- run: go version
- name: Release

View File

@ -4,7 +4,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.16.x]
go-version: [1.17.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
@ -16,5 +16,6 @@ jobs:
uses: actions/checkout@v2
- name: Test
run: |
sudo apt update
sudo apt install xorg-dev libgl1-mesa-dev
DISPLAY=:0 go test -mod=vendor ./...

View File

@ -35,7 +35,7 @@ var defaultTheme = Theme{
BrightMagenta: "#c397d8",
BrightCyan: "#70c0b1",
BrightWhite: "#eaeaea",
Background: "#1d1f21",
Background: "#000000",
Foreground: "#c5c8c6",
SelectionBackground: "#33aa33",
SelectionForeground: "#ffffff",

View File

@ -103,7 +103,7 @@ func (g *GUI) watchForUpdate() {
for range g.updateChan {
ebiten.ScheduleFrame()
go func() {
for g.keyState.AnythingPressed() {
if g.keyState.AnythingPressed() {
time.Sleep(time.Millisecond * 10)
ebiten.ScheduleFrame()
}

View File

@ -4,7 +4,6 @@ import (
"regexp"
"strconv"
"strings"
"syscall"
"time"
"github.com/liamg/darktile/internal/app/darktile/termutil"
@ -52,7 +51,5 @@ func (h *DmesgTimestampHinter) Click(api HintAPI) error {
}
func setSysStartTime() {
sysInfo := &syscall.Sysinfo_t{}
_ = syscall.Sysinfo(sysInfo)
sysStart = time.Now().Local().Add(time.Duration(int(sysInfo.Uptime*-1)) * time.Second)
sysStart = time.Now().Local().Add(time.Duration(int(getUptime()*-1)) * time.Second)
}

View File

@ -0,0 +1,23 @@
//go:build cgo && (freebsd || openbsd)
package hinters
/*
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/timespec.h>
time_t getuptime() {
struct timespec tp;
clock_gettime(CLOCK_UPTIME, &tp);
return tp.tv_sec;
}
*/
import "C"
func getUptime() int64 {
time := C.getuptime()
return int64(time)
}

View File

@ -0,0 +1,13 @@
//go:build cgo && (linux || netbsd)
package hinters
import (
"syscall"
)
func getUptime() int64 {
sysInfo := &syscall.Sysinfo_t{}
_ = syscall.Sysinfo(sysInfo)
return sysInfo.Uptime
}

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
version=$(git describe --exact-match --tags 2>/dev/null || git describe 2>/dev/null || echo "prerelease")
go build \

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e