bg mode
This commit is contained in:
1 parent
70a6437c7f
commit
ed75fa0db9
4 files changed
+35
-8
No files matched your search
@@ -8,6 +8,7 @@ Item {
|
||||
readonly property string appConfigPath: Quickshell.env("SKYG_APP_CAROUSEL")
|
||||
property list<var> appConfig: []
|
||||
property bool enableCacheFolder: false
|
||||
property bool backgroundMode: false
|
||||
|
||||
FileView {
|
||||
id: configFile
|
||||
@@ -48,7 +49,9 @@ Item {
|
||||
}
|
||||
isBoolean('autoStart', parsed.autoStart, true)
|
||||
isBoolean('enableCacheFolder', parsed.enableCacheFolder, true)
|
||||
isBoolean('backgroundMode', parsed.backgroundMode, true)
|
||||
root.enableCacheFolder = !!parsed.enableCacheFolder
|
||||
root.backgroundMode = !!parsed.backgroundMode
|
||||
for (const elm of apps) {
|
||||
isString('name', elm.name)
|
||||
isString('image', elm.image)
|
||||
|
||||
@@ -8,18 +8,19 @@ PanelWindow {
|
||||
id: root
|
||||
|
||||
required property bool shellOpen
|
||||
required property bool backgroundMode
|
||||
required property list<var> apps
|
||||
required property bool enableCacheFolder
|
||||
|
||||
signal requestClose
|
||||
|
||||
visible: root.shellOpen
|
||||
visible: root.backgroundMode || root.shellOpen
|
||||
|
||||
color: "transparent"
|
||||
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
WlrLayershell.namespace: "quickshell:launcher"
|
||||
WlrLayershell.layer: WlrLayer.Overlay
|
||||
WlrLayershell.exclusiveZone: -1
|
||||
WlrLayershell.layer: root.backgroundMode ? WlrLayer.Bottom : WlrLayer.Overlay
|
||||
WlrLayershell.keyboardFocus: root.visible ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
||||
|
||||
anchors {
|
||||
@@ -53,6 +54,7 @@ PanelWindow {
|
||||
function activateSelection() {
|
||||
const app = root.apps[root.selectedIndex];
|
||||
if (!app) {
|
||||
if (!root.backgroundMode)
|
||||
root.requestClose();
|
||||
return;
|
||||
}
|
||||
@@ -63,6 +65,7 @@ PanelWindow {
|
||||
launcher.command = app.exec;
|
||||
launcher.running = true;
|
||||
}
|
||||
if (!root.backgroundMode)
|
||||
root.requestClose();
|
||||
}
|
||||
|
||||
@@ -86,9 +89,9 @@ PanelWindow {
|
||||
|
||||
HyprlandFocusGrab {
|
||||
windows: [root]
|
||||
active: root.visible
|
||||
active: root.visible && !root.backgroundMode
|
||||
onCleared: {
|
||||
if (root.visible)
|
||||
if (root.visible && !root.backgroundMode)
|
||||
root.requestClose();
|
||||
}
|
||||
}
|
||||
@@ -99,7 +102,10 @@ PanelWindow {
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: root.requestClose()
|
||||
onClicked: {
|
||||
if (!root.backgroundMode)
|
||||
root.requestClose()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,6 +127,7 @@ PanelWindow {
|
||||
root.activateSelection();
|
||||
break;
|
||||
case Qt.Key_Escape:
|
||||
if (!root.backgroundMode)
|
||||
root.requestClose();
|
||||
break;
|
||||
default:
|
||||
|
||||
+17
-1
@@ -1,6 +1,7 @@
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import Quickshell.Io
|
||||
import Quickshell.Hyprland
|
||||
|
||||
ShellRoot {
|
||||
id: shell
|
||||
@@ -8,23 +9,38 @@ ShellRoot {
|
||||
property bool launcherOpen: true
|
||||
property AppConfig config: AppConfig {}
|
||||
|
||||
function goToEmptyWorkspace(): void {
|
||||
Hyprland.dispatch("workspace empty");
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
target: "launcher"
|
||||
|
||||
function toggle(): void {
|
||||
if (shell.config.backgroundMode)
|
||||
shell.goToEmptyWorkspace();
|
||||
else
|
||||
shell.launcherOpen = !shell.launcherOpen;
|
||||
}
|
||||
function open(): void {
|
||||
if (shell.config.backgroundMode)
|
||||
shell.goToEmptyWorkspace();
|
||||
else
|
||||
shell.launcherOpen = true;
|
||||
}
|
||||
function close(): void {
|
||||
if (!shell.config.backgroundMode)
|
||||
shell.launcherOpen = false;
|
||||
}
|
||||
}
|
||||
|
||||
LauncherWindow {
|
||||
shellOpen: shell.launcherOpen
|
||||
onRequestClose: shell.launcherOpen = false
|
||||
backgroundMode: shell.config.backgroundMode
|
||||
onRequestClose: {
|
||||
if (!shell.config.backgroundMode)
|
||||
shell.launcherOpen = false
|
||||
}
|
||||
apps: shell.config.appConfig
|
||||
enableCacheFolder: shell.config.enableCacheFolder
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"autoStart": true,
|
||||
"enableCacheFolder": true,
|
||||
"enableCacheFolder": false,
|
||||
"backgroundMode": true,
|
||||
"apps": [
|
||||
{
|
||||
"name": "Chromium",
|
||||
|
||||
Reference in new issue
Block a user