Skip to content

Commit 201fc69

Browse files
Switched to a better progressbar and the first non-beta release
1 parent 7a1057e commit 201fc69

File tree

4 files changed

+17
-42
lines changed

4 files changed

+17
-42
lines changed

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ require (
77
github.com/JamesHovious/w32 v1.2.0
88
github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4
99
github.com/go-vgo/robotgo v0.110.8
10+
github.com/hedzr/progressbar v1.2.8
1011
github.com/robotn/gohook v0.42.2
11-
github.com/schollz/progressbar/v3 v3.18.0
1212
github.com/tailscale/win v0.0.0-20250627215312-f4da2b8ee071
1313
golang.design/x/clipboard v0.7.1
1414
golang.design/x/hotkey v0.4.1
@@ -26,12 +26,10 @@ require (
2626
github.com/mattn/go-colorable v0.1.2 // indirect
2727
github.com/mattn/go-isatty v0.0.20 // indirect
2828
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
29-
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
3029
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
3130
github.com/otiai10/gosseract v2.2.1+incompatible // indirect
3231
github.com/otiai10/mint v1.6.3 // indirect
3332
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
34-
github.com/rivo/uniseg v0.4.7 // indirect
3533
github.com/robotn/xgb v0.10.0 // indirect
3634
github.com/robotn/xgbutil v0.10.0 // indirect
3735
github.com/shirou/gopsutil/v4 v4.25.7 // indirect

go.sum

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ github.com/JamesHovious/w32 v1.2.0 h1:UZWv2ea6y4Kylzs7DGXWcSCaUH+OxH8q7aCFmMUqwa
66
github.com/JamesHovious/w32 v1.2.0/go.mod h1:L6LTHMKvhtpGUkIYGTo4U9PKancYKpGS/+naYtTs8Ys=
77
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s=
88
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w=
9-
github.com/chengxilo/virtualterm v1.0.4 h1:Z6IpERbRVlfB8WkOmtbHiDbBANU7cimRIof7mk9/PwM=
10-
github.com/chengxilo/virtualterm v1.0.4/go.mod h1:DyxxBZz/x1iqJjFxTFcr6/x+jSpqN0iwWCOK1q10rlY=
119
github.com/creack/pty v1.1.17 h1:QeVUsEDNrLBW4tMgZHvxy18sKtr6VI492kBhUfhDJNI=
1210
github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
1311
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -30,6 +28,8 @@ github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
3028
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
3129
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
3230
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
31+
github.com/hedzr/progressbar v1.2.8 h1:k7Hgm+lBjPqWnKe9N/FnN8xJo9xJGT+ECfm2SyVtfX8=
32+
github.com/hedzr/progressbar v1.2.8/go.mod h1:vgFeDJkh6N5iO6TmkmkoTLazbpjcj/uroVVw3P6R2zc=
3333
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog=
3434
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
3535
github.com/jezek/xgb v1.1.1 h1:bE/r8ZZtSv7l9gk6nU0mYx51aXrvnyb44892TwSaqS4=
@@ -43,12 +43,8 @@ github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc
4343
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
4444
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
4545
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
46-
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
47-
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
4846
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=
4947
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
50-
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
51-
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
5248
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
5349
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
5450
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ=
@@ -61,17 +57,13 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
6157
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
6258
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU=
6359
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
64-
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
65-
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
6660
github.com/robotn/gohook v0.42.2 h1:AI9OVh5o59c76jp9Xcc4NpIvze2YeKX1Rn8JvflAUXY=
6761
github.com/robotn/gohook v0.42.2/go.mod h1:PYgH0f1EaxhCvNSqIVTfo+SIUh1MrM2Uhe2w7SvFJDE=
6862
github.com/robotn/xgb v0.0.0-20190912153532-2cb92d044934/go.mod h1:SxQhJskUJ4rleVU44YvnrdvxQr0tKy5SRSigBrCgyyQ=
6963
github.com/robotn/xgb v0.10.0 h1:O3kFbIwtwZ3pgLbp1h5slCQ4OpY8BdwugJLrUe6GPIM=
7064
github.com/robotn/xgb v0.10.0/go.mod h1:SxQhJskUJ4rleVU44YvnrdvxQr0tKy5SRSigBrCgyyQ=
7165
github.com/robotn/xgbutil v0.10.0 h1:gvf7mGQqCWQ68aHRtCxgdewRk+/KAJui6l3MJQQRCKw=
7266
github.com/robotn/xgbutil v0.10.0/go.mod h1:svkDXUDQjUiWzLrA0OZgHc4lbOts3C+uRfP6/yjwYnU=
73-
github.com/schollz/progressbar/v3 v3.18.0 h1:uXdoHABRFmNIjUfte/Ex7WtuyVslrw2wVPQmCN62HpA=
74-
github.com/schollz/progressbar/v3 v3.18.0/go.mod h1:IsO3lpbaGuzh8zIMzgY3+J8l4C8GjO0Y9S69eFvNsec=
7567
github.com/shirou/gopsutil/v4 v4.25.7 h1:bNb2JuqKuAu3tRlPv5piSmBZyMfecwQ+t/ILq+1JqVM=
7668
github.com/shirou/gopsutil/v4 v4.25.7/go.mod h1:XV/egmwJtd3ZQjBpJVY5kndsiOO4IRqy9TQnmm6VP7U=
7769
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

main.go

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import (
66
"flag"
77
"fmt"
88
"io"
9-
"net/http"
9+
1010
"os"
1111
"os/exec"
1212
"path/filepath"
1313
"runtime"
1414
"strings"
1515

16-
"github.com/schollz/progressbar/v3"
1716
"github.com/AlecAivazis/survey/v2"
17+
"github.com/hedzr/progressbar"
1818
)
1919

2020
var (
@@ -61,6 +61,7 @@ func extractFFmpegExe(zipPath, destDir string) error {
6161
defer outFile.Close()
6262

6363
_, err = io.Copy(outFile, rc)
64+
os.Remove(zipPath)
6465
return err
6566
}
6667
}
@@ -178,30 +179,14 @@ func initDownloads() {
178179
os.Exit(1)
179180
}
180181
if i == 0 {
181-
resp, err := http.Get("https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n7.1-latest-win64-gpl-7.1.zip")
182-
if err != nil {
183-
fmt.Println("Couldn't download ffmpeg")
184-
os.Exit(1)
185-
}
186-
defer resp.Body.Close()
187-
bar := progressbar.DefaultBytes(
188-
resp.ContentLength,
189-
"Downloading ffmpeg",
190-
)
182+
tasks := progressbar.NewDownloadTasks(progressbar.New())
183+
defer tasks.Close()
184+
os.MkdirAll(dwnPath, 0755)
185+
186+
tasks.Add("https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n7.1-latest-win64-gpl-7.1.zip", filepath.Join(dwnPath, "ffmpeg_captr.zip"), progressbar.WithBarSpinner(51))
187+
tasks.Wait()
191188

192-
out, err := os.Create(filepath.Join(os.TempDir(), "ffmpeg_captr.zip"))
193-
if err != nil {
194-
fmt.Println("Couldn't download ffmpeg")
195-
os.Exit(1)
196-
}
197-
defer out.Close()
198-
199-
_, err = io.Copy(io.MultiWriter(out, bar), resp.Body)
200-
if err != nil {
201-
fmt.Printf("Couldn't download ffmpeg.")
202-
os.Exit(1)
203-
}
204-
extractFFmpegExe(filepath.Join(os.TempDir(), "ffmpeg_captr.zip"), dwnPath)
189+
extractFFmpegExe(filepath.Join(dwnPath, "ffmpeg_captr.zip"), dwnPath)
205190
fmt.Printf("FFMPEG has been downloaded to %s", dwnPath)
206191
} else {
207192
setConfig("record_func_enabled", false)
@@ -274,7 +259,7 @@ ________/\\\\\\\\\__________________________________________________________
274259
____\////\\\\\\\\\_\//\\\\\\\\/\\_\/\\\____________\//\\\\\___\/\\\_________
275260
_______\/////////___\////////\//__\///______________\/////____\///__________
276261
277-
v1.0.1-beta
262+
v1.0.2
278263
279264
`)
280265
fmt.Println("Open config file by passing the --config flag")

readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
**Captr** is a lightweight screen capturing and recording tool written in Go. It's designed for speed, simplicity, and minimal resource usage.
44
(Windows OS Only)
55

6-
> **Status:** Beta
6+
> **Status:** Release
77
> Currently supports full-screen, window-specific screenshots and full-screen recording. Window specific recording is still in development.
88
99
## Features
1010

1111
- 📸 Capture full-screen screenshots
1212
- 🖼️ Capture specific window screenshots
13-
- 🎥 Screen recording (coming soon)
13+
- 🎥 Screen recording
1414

1515
## Installation
1616
**It's a portable executable file. Doesn't need any installation.**<br><br>
@@ -30,7 +30,7 @@ For recording functionaility, you must have `ffmpeg` installed and added to path
3030
- [x] Full-Screen Screenshots
3131
- [x] Window-Specific Screenshots
3232
- [x] Screen Recording
33-
- [ ] Window Recording
33+
- [ ] Window Recording [DELAYED]
3434

3535
## Build Yourself
3636
### Prerequisites

0 commit comments

Comments
 (0)