Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions screenshot/Main.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import QtQuick
import Quickshell
import Quickshell.Io
import qs.Commons
import qs.Services.UI
import qs.Services.Noctalia
import qs.Services.Compositor

Item {
IpcHandler {
target: "plugin:screenshot"

function takeScreenshot(mode: string): bool {
if (CompositorService.isHyprland) {
Quickshell.execDetached([
"hyprshot",
"--freeze",
"--clipboard-only",
"--mode", mode,
"--silent"
])
} else if (CompositorService.isNiri) {
Quickshell.execDetached([
"niri", "msg", "action", "screenshot"
])
}
return true
}
}
}
13 changes: 13 additions & 0 deletions screenshot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ When clicked, the plugin will:
3. Copy the screenshot to clipboard
4. Run silently without notifications

### IPC Commands
Control the plugin via command line:
```bash
# Screenshot of screen
qs -c noctalia-shell ipc call plugin:screenshot takeScreenshot output

# Screenshot of window
qs -c noctalia-shell ipc call plugin:screenshot takeScreenshot window

# Screenshot of region
qs -c noctalia-shell ipc call plugin:screenshot takeScreenshot region
```

## License

MIT License
1 change: 1 addition & 0 deletions screenshot/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"Utility"
],
"entryPoints": {
"main": "Main.qml",
"barWidget": "BarWidget.qml",
"settings": "Settings.qml"
},
Expand Down