diff --git a/Config/Config.qml b/Config/Config.qml index 1697c6f..37eb4c0 100644 --- a/Config/Config.qml +++ b/Config/Config.qml @@ -23,6 +23,7 @@ Singleton { property alias osd: adapter.osd property alias overview: adapter.overview property bool recentlySaved: false + property alias screenshot: adapter.screenshot property alias services: adapter.services property alias sidebar: adapter.sidebar property alias utilities: adapter.utilities @@ -128,7 +129,8 @@ Singleton { background: serializeBackground(), launcher: serializeLauncher(), colors: serializeColors(), - dock: serializeDock() + dock: serializeDock(), + screenshot: serializeScreenshot() }; } @@ -275,6 +277,20 @@ Singleton { }; } + function serializeScreenshot(): var { + return { + enable_pp: screenshot.enable_pp, + mode: screenshot.mode, + corner_radius: screenshot.corner_radius, + drop_shadow: screenshot.drop_shadow, + rounded_corners: screenshot.rounded_corners, + shadow_blur_radius: screenshot.shadow_blur_radius, + shadow_color: screenshot.shadow_color, + shadow_offset_x: screenshot.shadow_offset_x, + shadow_offset_y: screenshot.shadow_offset_y + }; + } + function serializeServices(): var { return { weatherLocation: services.weatherLocation, @@ -430,6 +446,8 @@ Singleton { } property Overview overview: Overview { } + property Screenshot screenshot: Screenshot { + } property Services services: Services { } property SidebarConfig sidebar: SidebarConfig { diff --git a/Config/Screenshot.qml b/Config/Screenshot.qml new file mode 100644 index 0000000..7ea47bc --- /dev/null +++ b/Config/Screenshot.qml @@ -0,0 +1,13 @@ +import Quickshell.Io + +JsonObject { + property real corner_radius: 12.0 + property bool drop_shadow: true + property bool enable_pp: true + property string mode: "manual" + property bool rounded_corners: false + property real shadow_blur_radius: 22.0 + property list shadow_color: [0, 0, 0, 160] + property real shadow_offset_x: 5.0 + property real shadow_offset_y: 5.0 +} diff --git a/Helpers/Picker.qml b/Helpers/Picker.qml index 721f074..386702a 100644 --- a/Helpers/Picker.qml +++ b/Helpers/Picker.qml @@ -66,7 +66,8 @@ MouseArea { function save(): void { const tmpfile = Qt.resolvedUrl(`/tmp/zshell-picker-${Quickshell.processId}-${Date.now()}.png`); - ZShellIo.saveItem(screencopy, tmpfile, Qt.rect(Math.ceil(rsx), Math.ceil(rsy), Math.floor(sw), Math.floor(sh)), path => Quickshell.execDetached([Quickshell.shellDir + "/scripts/rs-pictures", path])); + const cmd = Config.screenshot.enable_pp ? [Quickshell.shellDir + "/scripts/rs-pictures"] : ["swappy", "-f"]; + ZShellIo.saveItem(screencopy, tmpfile, Qt.rect(Math.ceil(rsx), Math.ceil(rsy), Math.floor(sw), Math.floor(sh)), path => Quickshell.execDetached([...cmd, path])); closeAnim.start(); } diff --git a/Modules/Settings/Categories.qml b/Modules/Settings/Categories.qml index 1d8223c..d3b68ec 100644 --- a/Modules/Settings/Categories.qml +++ b/Modules/Settings/Categories.qml @@ -104,6 +104,12 @@ Item { key: "launcher" name: "Launcher" } + + ListElement { + icon: "screenshot_region" + key: "screenshot" + name: "Screenshot" + } } CustomClippingRect { diff --git a/Modules/Settings/Categories/Screenshot.qml b/Modules/Settings/Categories/Screenshot.qml new file mode 100644 index 0000000..3d69d93 --- /dev/null +++ b/Modules/Settings/Categories/Screenshot.qml @@ -0,0 +1,130 @@ +import qs.Modules.Settings.Controls +import qs.Config +import qs.Components + +SettingsPage { + SettingsSection { + sectionId: "Screenshot" + + SettingsHeader { + name: "Screenshot" + } + + SettingSwitch { + name: "Enable effects" + object: Config.screenshot + setting: "enable_pp" + } + + Separator { + } + + CustomSplitButtonRow { + // active: true + label: qsTr("Effects mode") + + menuItems: [ + MenuItem { + icon: "build" + text: qsTr("Manual") + value: "manual" + }, + MenuItem { + icon: "rotate_auto" + text: qsTr("Auto") + value: "auto" + } + ] + + onSelected: item => { + Config.screenshot.mode = item.value; + Config.save(); + } + } + + Separator { + visible: Config.screenshot.mode === "manual" + } + + SettingSpinBox { + min: 0 + name: "Corner radius" + object: Config.screenshot + setting: "corner_radius" + step: 1 + visible: Config.screenshot.mode === "manual" + } + + Separator { + visible: Config.screenshot.mode === "manual" + } + + SettingSwitch { + name: "Enable drop shadow" + object: Config.screenshot + setting: "drop_shadow" + visible: Config.screenshot.mode === "manual" + } + + Separator { + visible: Config.screenshot.mode === "manual" + } + + SettingSwitch { + name: "Enable rounded corners" + object: Config.screenshot + setting: "rounded_corners" + visible: Config.screenshot.mode === "manual" + } + + Separator { + visible: Config.screenshot.mode === "manual" + } + + SettingSpinBox { + min: 0 + name: "Shadow blur radius" + object: Config.screenshot + setting: "shadow_blur_radius" + step: 1 + visible: Config.screenshot.mode === "manual" + } + + Separator { + visible: Config.screenshot.mode === "manual" + } + + SettingSwitch { + name: "Shadow color broken atm" + object: Config.Screenshot + setting: "shadow_color" + visible: Config.screenshot.mode === "manual" + } + + Separator { + visible: Config.screenshot.mode === "manual" + } + + SettingSpinBox { + min: 0 + name: "Shadow offset X" + object: Config.screenshot + setting: "shadow_offset_x" + step: 1 + visible: Config.screenshot.mode === "manual" + } + + Separator { + visible: Config.screenshot.mode === "manual" + } + + SettingSpinBox { + min: 0 + name: "Shadow offset Y" + object: Config.screenshot + setting: "shadow_offset_y" + step: 1 + visible: Config.screenshot.mode === "manual" + } + } +} diff --git a/Modules/Settings/Content.qml b/Modules/Settings/Content.qml index 6efa266..eea0ac2 100644 --- a/Modules/Settings/Content.qml +++ b/Modules/Settings/Content.qml @@ -74,6 +74,8 @@ Item { stack.push(osd); else if (currentCategory === "launcher") stack.push(launcher); + else if (currentCategory === "screenshot") + stack.push(screenshot); } target: root @@ -225,4 +227,11 @@ Item { Cat.Launcher { } } + + Component { + id: screenshot + + Cat.Screenshot { + } + } } diff --git a/Modules/Settings/SettingsIndex.mjs b/Modules/Settings/SettingsIndex.mjs index 0f5f75f..8ba4b6c 100644 --- a/Modules/Settings/SettingsIndex.mjs +++ b/Modules/Settings/SettingsIndex.mjs @@ -951,6 +951,72 @@ export const settingsIndex = [ keywords: ["size", "osd", "height"], }, + // SCREENSHOT CATEGORY + // Screenshot section + { + name: "Enable effects", + category: "screenshot", + categoryName: "Screenshot", + section: "Screenshot", + keywords: ["effects", "shadow", "screenshot"], + }, + { + name: "Effects mode", + category: "screenshot", + categoryName: "Screenshot", + section: "Screenshot", + keywords: ["effects", "mode"], + }, + { + name: "Corner radius", + category: "screenshot", + categoryName: "Screenshot", + section: "Screenshot", + keywords: ["corner", "radius"], + }, + { + name: "Enable drop shadow", + category: "screenshot", + categoryName: "Screenshot", + section: "Screenshot", + keywords: ["drop", "shadow"], + }, + { + name: "Enable rounded corners", + category: "screenshot", + categoryName: "Screenshot", + section: "Screenshot", + keywords: ["rounded", "corners"], + }, + { + name: "Shadow blur radius", + category: "screenshot", + categoryName: "Screenshot", + section: "Screenshot", + keywords: ["blur", "shadow", "radius"], + }, + { + name: "Shadow color", + category: "screenshot", + categoryName: "Screenshot", + section: "Screenshot", + keywords: ["color", "shadow"], + }, + { + name: "Shadow offset X", + category: "screenshot", + categoryName: "Screenshot", + section: "Screenshot", + keywords: ["offset", "shadow"], + }, + { + name: "Shadow offset Y", + category: "screenshot", + categoryName: "Screenshot", + section: "Screenshot", + keywords: ["offset", "shadow"], + }, + // LAUNCHER CATEGORY // Launcher section { diff --git a/scripts/rs-pictures b/scripts/rs-pictures deleted file mode 100755 index e6efee3..0000000 Binary files a/scripts/rs-pictures and /dev/null differ