Update snapshot functionality and add notification for it.

This commit is contained in:
Jas Singh
2024-07-09 01:13:20 -07:00
parent c14d2b21df
commit a28bde6e3f
7 changed files with 33 additions and 3 deletions

View File

@@ -157,8 +157,12 @@ const Shortcuts = () => {
children: [ children: [
Widget.Button({ Widget.Button({
class_name: "dashboard-button snapshot top-button", class_name: "dashboard-button snapshot top-button",
on_primary_click: () => on_primary_click: () => {
handleClick("grimblast --notify copysave area"), App.closeWindow("dashboardmenu");
return Utils.execAsync(
`${App.configDir}/services/snapshot.sh`,
).catch((err) => console.error(err));
},
child: Widget.Label({ child: Widget.Label({
class_name: "button-label", class_name: "button-label",
label: "󰄀", label: "󰄀",

View File

@@ -140,6 +140,9 @@ export default () => {
class_name: class_name:
"notification-action-buttons-label menu", "notification-action-buttons-label menu",
hexpand: true, hexpand: true,
max_width_chars: 15,
truncate: "end",
wrap: true,
label: action.label, label: action.label,
}), }),
], ],

View File

@@ -74,6 +74,9 @@ export default () => {
class_name: "notification-action-buttons-label", class_name: "notification-action-buttons-label",
hexpand: true, hexpand: true,
label: action.label, label: action.label,
max_width_chars: 15,
truncate: "end",
wrap: true,
}), }),
], ],
}), }),

View File

@@ -29,6 +29,7 @@
.notification-card.menu { .notification-card.menu {
background: $base; background: $base;
min-width: 23.5em;
border: 0.15em solid $base; border: 0.15em solid $base;
border-radius: 0em; border-radius: 0em;
border-bottom-left-radius: 0.4em; border-bottom-left-radius: 0.4em;

18
services/snapshot.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/bash
outputDir="$HOME/Pictures/Screenshots/"
outputFile="snapshot_$(date +%Y-%m-%d_%H-%M-%S).png"
outputPath="$outputDir/$outputFile"
mkdir -p "$outputDir"
grimblast copysave area "$outputPath"
recentFile=$(ls -t "$outputDir"/snapshot_*.png | head -n 1)
notify-send "Grimblast" "Your snapshot has been saved." \
-i video-x-generic \
-a "Grimblast" \
-t 7000 \
-u normal \
--action="scriptAction:-dolphin $outputDir=Directory" \
--action="scriptAction:-xdg-open $recentFile=View"

View File

@@ -1096,6 +1096,7 @@ window#powermenu .powermenu.box {
} }
.notification-card-container.menu .notification-card.menu { .notification-card-container.menu .notification-card.menu {
background: #1e1e2e; background: #1e1e2e;
min-width: 23.5em;
border: 0.15em solid #1e1e2e; border: 0.15em solid #1e1e2e;
border-radius: 0em; border-radius: 0em;
border-bottom-left-radius: 0.4em; border-bottom-left-radius: 0.4em;

File diff suppressed because one or more lines are too long