Skip to content

Commit f548d25

Browse files
committed
Save screenshots in ~/Desktop instead of home dir
1 parent 7dad96c commit f548d25

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

main.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"log"
1010
"math"
1111
"os"
12+
"path/filepath"
1213
"time"
1314

1415
"gioui.org/app"
@@ -167,7 +168,13 @@ func cropScreenshot(img image.Image, selection *selectionState) image.Image {
167168
newImg := img.(SubImager).SubImage(cropSize)
168169

169170
now := time.Now().Format("2006-01-02_15-04-05")
170-
file, err := os.Create(now + ".png")
171+
homeDir, err := os.UserHomeDir()
172+
if err != nil {
173+
panic(err)
174+
}
175+
desktopPath := filepath.Join(homeDir, "Desktop", now+".png")
176+
177+
file, err := os.Create(desktopPath)
171178
if err != nil {
172179
panic(err)
173180
}

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ drag to draw boxes drag to draw arrows |
4141
and saved to disk
4242
```
4343

44-
Your screenshot is available on the clipboard, and a file is output to your Home directory on Linux (and probably Mac as well). On Windows I have no idea. If you happen to stumble across this repo and install it on Windows, let me know how it goes!
44+
Your screenshot is available on the clipboard, and a file is output to your `~/Desktop` directory on Linux (and probably Mac as well). On Windows I have no idea. If you happen to stumble across this repo and install it on Windows, let me know how it goes!

0 commit comments

Comments
 (0)