Compare commits
5 Commits
0.2.0
...
renovate/c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27c122696c | ||
|
fa37ff76a2
|
|||
|
dfe7cd590c
|
|||
|
db0587c942
|
|||
|
a7df2c1bac
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
.git
|
||||
screenshot
|
||||
*.png
|
||||
|
||||
6
renovate.json
Normal file
6
renovate.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"config:recommended"
|
||||
]
|
||||
}
|
||||
@@ -31,7 +31,7 @@ func notify(body, title string) {
|
||||
if title == "" {
|
||||
title = scriptName
|
||||
}
|
||||
cmd := exec.Command("notify-send", "-a", "Screenshot", title, body)
|
||||
cmd := exec.Command("notify-send", "-a", "Screenshot", "-i", "camera", title, body)
|
||||
if err := cmd.Run(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "notify error: %v\n", err)
|
||||
}
|
||||
@@ -102,9 +102,9 @@ func main() {
|
||||
{"1. Select a region and save", []string{"sh", "-c", fmt.Sprintf("slurp | grim -g - '%s'", tmpScreenshot)}},
|
||||
{"2. Select a region and copy to clipboard", []string{"sh", "-c", fmt.Sprintf("slurp | grim -g - '%s' && wl-copy < '%s'", tmpScreenshot, tmpScreenshot)}},
|
||||
{"3. Whole screen", []string{"grim", tmpScreenshot}},
|
||||
{"4. Current window", []string{"current-window"}},
|
||||
{"5. Edit", []string{"sh", "-c", "slurp | grim -g - - | swappy -f -"}},
|
||||
{"6. Quit", []string{"true"}},
|
||||
{"4. Current monitor", []string{"sh", "-c", fmt.Sprintf("grim -o \"$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name')\" '%s'", tmpScreenshot)}},
|
||||
{"5. Current window", []string{"current-window"}},
|
||||
{"6. Edit", []string{"sh", "-c", "slurp | grim -g - - | swappy -f -"}},
|
||||
}
|
||||
|
||||
var menu bytes.Buffer
|
||||
@@ -113,7 +113,7 @@ func main() {
|
||||
menu.WriteByte('\n')
|
||||
}
|
||||
|
||||
rofi := exec.Command("rofi", "-dmenu", "-i", "-p", "Enter option or select from the list", "-mesg", "Select a Screenshot Option", "-format", "i", "-theme-str", "listview {columns: 2; lines: 3;} window {width: 55%;}", "-yoffset", "30", "-xoffset", "30", "-a", "0", "-no-custom", "-location", "0")
|
||||
rofi := exec.Command("rofi", "-dmenu", "-i", "-p", "Select option", "-mesg", "Select a Screenshot Option", "-format", "i", "-theme-str", "listview {columns: 1; lines: 6;} window {width: 25%;}", "-yoffset", "30", "-xoffset", "30", "-no-custom", "-location", "0", "-theme", "~/.config/rofi/launchers/type-2/style-2.rasi")
|
||||
rofi.Stdin = &menu
|
||||
out, err := rofi.Output()
|
||||
if err != nil {
|
||||
@@ -145,7 +145,6 @@ func main() {
|
||||
notify(fmt.Sprintf("Failed to get current window geometry: %v", err), "")
|
||||
os.Exit(1)
|
||||
}
|
||||
notify(fmt.Sprintf("Debug: grim -g '%s' %s", geom, tmpScreenshot), "")
|
||||
if err := exec.Command("grim", "-g", geom, tmpScreenshot).Run(); err != nil {
|
||||
notify(fmt.Sprintf("An error occurred while taking the screenshot (grim -g '%s'): %v", geom, err), "")
|
||||
os.Exit(1)
|
||||
|
||||
Reference in New Issue
Block a user