diff --git a/.gitignore b/.gitignore deleted file mode 100644 index fae8187..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -Assets/ diff --git a/Modules/Areapicker.qml b/Modules/Areapicker.qml new file mode 100644 index 0000000..7ff051f --- /dev/null +++ b/Modules/Areapicker.qml @@ -0,0 +1,83 @@ +pragma ComponentBehavior: Bound + +import qs.components.containers +import qs.components.misc +import Quickshell +import Quickshell.Wayland +import Quickshell.Io + +Scope { + LazyLoader { + id: root + + property bool freeze + property bool closing + + Variants { + model: Quickshell.screens + + StyledWindow { + id: win + + required property ShellScreen modelData + + screen: modelData + name: "area-picker" + WlrLayershell.exclusionMode: ExclusionMode.Ignore + WlrLayershell.layer: WlrLayer.Overlay + WlrLayershell.keyboardFocus: root.closing ? WlrKeyboardFocus.None : WlrKeyboardFocus.Exclusive + mask: root.closing ? empty : null + + anchors.top: true + anchors.bottom: true + anchors.left: true + anchors.right: true + + Region { + id: empty + } + + Picker { + loader: root + screen: win.modelData + } + } + } + } + + IpcHandler { + target: "picker" + + function open(): void { + root.freeze = false; + root.closing = false; + root.activeAsync = true; + } + + function openFreeze(): void { + root.freeze = true; + root.closing = false; + root.activeAsync = true; + } + } + + CustomShortcut { + name: "screenshot" + description: "Open screenshot tool" + onPressed: { + root.freeze = false; + root.closing = false; + root.activeAsync = true; + } + } + + CustomShortcut { + name: "screenshotFreeze" + description: "Open screenshot tool (freeze mode)" + onPressed: { + root.freeze = true; + root.closing = false; + root.activeAsync = true; + } + } +} diff --git a/README.md b/README.md index 622673e..b0be2b6 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ ## Feature to-do list -- Hyprland keybind support - - ToggleLayer: swap layer between bottom and top - - ToggleOverlay: swap layer between bottom and overlay +- [] Hyprland keybind support + - [] ToggleLayer: swap layer between bottom and top + - [] ToggleOverlay: swap layer between bottom and overlay - Add multiple pets - Auto pet resize - Add moveability to pets with mouse inputs diff --git a/shell.qml b/shell.qml index 4a769d3..f652407 100755 --- a/shell.qml +++ b/shell.qml @@ -11,17 +11,18 @@ PanelWindow { WlrLayershell.layer: WlrLayer.Top color: "transparent" anchors { - bottom: true left: true + bottom: true } - surfaceFormat.opaque: false - implicitWidth: 320 - implicitHeight: 293 margins { left: 0 bottom: 9 } + surfaceFormat.opaque: false + implicitWidth: 320 + implicitHeight: 293 + property bool onTop: true IpcHandler { @@ -29,23 +30,23 @@ PanelWindow { // Keybind swap layer function toggleLayer(): void { - if (!onTop) { + if ( !mainWindow.onTop ) { mainWindow.WlrLayershell.layer = WlrLayer.Top - onTop = true + mainWindow.onTop = true } else { mainWindow.WlrLayershell.layer = WlrLayer.Bottom - onTop = false + mainWindow.onTop = false } } // Keybind swap overlay function toggleOverlay(): void { - if (!onTop) { + if (!mainWindow.onTop) { mainWindow.WlrLayershell.layer = WlrLayer.Overlay - onTop = true + mainWindow.onTop = true } else { mainWindow.WlrLayershell.layer = WlrLayer.Bottom - onTop = false + mainWindow.onTop = false } } } @@ -57,4 +58,6 @@ PanelWindow { PetMarch{ id:petMarch } + + Areapicker{} }