Compare commits
9 commits
Author | SHA1 | Date | |
---|---|---|---|
1b5b96a10f | |||
64629c2d23 | |||
Simon Vieille | 64908e4eb4 | ||
Simon Vieille | 7057a29f6d | ||
Simon Vieille | 7dded95ca0 | ||
Simon Vieille | b395a13e00 | ||
Simon Vieille | b8ad31e366 | ||
Simon Vieille | bc2a4b3453 | ||
Simon Vieille | fcd69a98a0 |
|
@ -1,4 +1,4 @@
|
||||||
pipeline:
|
steps:
|
||||||
vendor:
|
vendor:
|
||||||
image: golang:1.18
|
image: golang:1.18
|
||||||
commands:
|
commands:
|
||||||
|
@ -8,6 +8,9 @@ pipeline:
|
||||||
image: golang:1.18
|
image: golang:1.18
|
||||||
commands:
|
commands:
|
||||||
- make
|
- make
|
||||||
|
- mkdir release
|
||||||
|
- tar -c -z -f release/build-amd64.tar.gz build/linux-amd64/
|
||||||
|
- tar -c -z -f release/build-arm64.tar.gz build/linux-arm64/
|
||||||
|
|
||||||
release:
|
release:
|
||||||
image: plugins/gitea-release
|
image: plugins/gitea-release
|
||||||
|
@ -16,6 +19,6 @@ pipeline:
|
||||||
from_secret: gitnet_api_key
|
from_secret: gitnet_api_key
|
||||||
base_url: https://gitnet.fr
|
base_url: https://gitnet.fr
|
||||||
note:
|
note:
|
||||||
files: build/*
|
files: release/*
|
||||||
when:
|
when:
|
||||||
event: [tag]
|
event: [tag]
|
||||||
|
|
14
Makefile
14
Makefile
|
@ -1,8 +1,16 @@
|
||||||
|
all: linux-amd64 linux-arm64
|
||||||
|
|
||||||
.ONESHELL:
|
.ONESHELL:
|
||||||
all:
|
linux-amd64:
|
||||||
for i in blocks/*; do
|
for i in blocks/*; do
|
||||||
go build -ldflags '-s -w' -v -o "build/$$(basename "$$i")" "$$i/main.go"
|
GOARCH=amd64 GOOS=linux go build -ldflags '-s -w' -v -o "build/linux-amd64/$$(basename "$$i")" "$$i/main.go"
|
||||||
|
done
|
||||||
|
|
||||||
|
.ONESHELL:
|
||||||
|
linux-arm64:
|
||||||
|
for i in blocks/*; do
|
||||||
|
GOARCH=arm64 GOOS=linux go build -ldflags '-s -w' -v -o "build/linux-arm64/$$(basename "$$i")" "$$i/main.go"
|
||||||
done
|
done
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm build/* 2>/dev/null || true
|
rm -fr build/* 2>/dev/null || true
|
||||||
|
|
26
README.md
26
README.md
|
@ -83,18 +83,6 @@ markup=pango
|
||||||
interval=30
|
interval=30
|
||||||
```
|
```
|
||||||
|
|
||||||
### Weather
|
|
||||||
|
|
||||||
Show the weather of the given location ([https://fr.wttr.in/](https://fr.wttr.in/)).
|
|
||||||
|
|
||||||
```
|
|
||||||
[weather]
|
|
||||||
command=/path/to/weather -loc=Paris -lang=fr
|
|
||||||
format=json
|
|
||||||
markup=pango
|
|
||||||
interval=1800
|
|
||||||
```
|
|
||||||
|
|
||||||
### IP
|
### IP
|
||||||
|
|
||||||
Show the IP of the given iface.
|
Show the IP of the given iface.
|
||||||
|
@ -199,6 +187,18 @@ markup=pango
|
||||||
interval=1
|
interval=1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Weather
|
||||||
|
|
||||||
|
Show the weather of the given location ([https://fr.wttr.in/](https://fr.wttr.in/)).
|
||||||
|
|
||||||
|
```
|
||||||
|
[weather]
|
||||||
|
command=/path/to/weather -loc=Paris -lang=fr
|
||||||
|
format=json
|
||||||
|
markup=pango
|
||||||
|
interval=1800
|
||||||
|
```
|
||||||
|
|
||||||
### Wireguard toggler
|
### Wireguard toggler
|
||||||
|
|
||||||
Toggler for wireguard.
|
Toggler for wireguard.
|
||||||
|
@ -217,7 +217,7 @@ markup=pango
|
||||||
interval=2
|
interval=2
|
||||||
```
|
```
|
||||||
|
|
||||||
### Task bar
|
### Workspace Apps (task bar)
|
||||||
|
|
||||||
Add blocks that represent opened apps and create a task bar.
|
Add blocks that represent opened apps and create a task bar.
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,16 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
r "gitnet.fr/deblan/i3-blocks-go/rendering"
|
sos"
|
||||||
"os"
|
"os/"
|
||||||
"os/exec"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
r "gitnet.fr/deblan/i3-blocks-gsrrindg
|
||||||
|
r "gitnet.fr/deblan/i3-blocks-gsrrindg
|
||||||
|
r "gitnet.fr/deblan/i3-blocks-gsrrindg
|
||||||
|
r "gitnet.fr/deblan/i3-blocks-gsrrindg
|
||||||
|
r "gitnet.fr/deblan/i3-blocks-gsrrindg
|
||||||
|
r "gitnet.fr/deblan/i3-blocks-go/rendering"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetMetadata(metadata string) string {
|
func GetMetadata(metadata string) string {
|
||||||
|
@ -20,11 +26,15 @@ func GetMetadata(metadata string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetTitle() string {
|
func GetTitle() string {
|
||||||
return GetMetadata("xesam:title")
|
data := GetMetadata("xesam:title")
|
||||||
|
|
||||||
|
return strings.Trim(string(data), "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetArtist() string {
|
func GetArtist() string {
|
||||||
return GetMetadata("xesam:artist")
|
data := GetMetadata("xesam:artist")
|
||||||
|
|
||||||
|
return strings.Trim(string(data), "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetStatus() string {
|
func GetStatus() string {
|
||||||
|
@ -41,6 +51,8 @@ func main() {
|
||||||
|
|
||||||
if status == "Not available" {
|
if status == "Not available" {
|
||||||
return
|
return
|
||||||
|
} else if status == "Stopped" {
|
||||||
|
return
|
||||||
} else if status == "Paused" {
|
} else if status == "Paused" {
|
||||||
stmt = r.TextWithPadding(r.FontAwesome("\uf04c"), r.FB{
|
stmt = r.TextWithPadding(r.FontAwesome("\uf04c"), r.FB{
|
||||||
Background: r.Color("black3"),
|
Background: r.Color("black3"),
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package rendering
|
package rendering
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
// "bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
// "strconv"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -31,6 +33,7 @@ func Block(name string, options BlockOptions) string {
|
||||||
|
|
||||||
block = strings.ReplaceAll(block, `\u003c`, "<")
|
block = strings.ReplaceAll(block, `\u003c`, "<")
|
||||||
block = strings.ReplaceAll(block, `\u003e`, ">")
|
block = strings.ReplaceAll(block, `\u003e`, ">")
|
||||||
|
block = strings.ReplaceAll(block, `\u0026`, "et")
|
||||||
|
|
||||||
return block
|
return block
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue