quickshell: init config
This commit is contained in:
parent
cbb594395a
commit
5e9c4e8e4c
20 changed files with 1650 additions and 0 deletions
49
modules/style/quickshell/shell/services/Hover.qml
Normal file
49
modules/style/quickshell/shell/services/Hover.qml
Normal file
|
@ -0,0 +1,49 @@
|
|||
import Quickshell
|
||||
import QtQuick
|
||||
import "../config"
|
||||
|
||||
MouseArea {
|
||||
id: root
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
|
||||
required property ShellScreen screen
|
||||
// required property Panels panels
|
||||
required property Item bar
|
||||
|
||||
property bool showVolumeMenu: false
|
||||
property bool isInRightPanel: false
|
||||
|
||||
// function withinPanelHeight(panel: Item, x: real, y: real): bool {
|
||||
// const panelY = Config.border.thickness + panel.y;
|
||||
// return y >= panelY - Config.border.rounding && y <= panelY + panel.height + Config.border.rounding;
|
||||
// }
|
||||
|
||||
// function inLeftBorder(x: real, y: real): bool {
|
||||
// return x <= Config.border.thickness;
|
||||
// }
|
||||
|
||||
function inRightPanel(x: real, y: real): bool {
|
||||
// Cursor is in middle veritcal third of screen
|
||||
// Cursor is in the right border
|
||||
return y >= root.screen.height / 3 && y <= (root.screen.height / 3) * 2 && x >= root.screen.width - Config.border.thickness;
|
||||
}
|
||||
|
||||
// Update on mouse cursor movement
|
||||
onPositionChanged: event => {
|
||||
const x = event.x;
|
||||
const y = event.y;
|
||||
|
||||
root.isInRightPanel = inRightPanel(x, y);
|
||||
|
||||
console.log("In right panel: " + root.isInRightPanel);
|
||||
|
||||
console.log("x:" + x + " y: " + y);
|
||||
}
|
||||
onContainsMouseChanged: {
|
||||
if (!containsMouse) {
|
||||
root.isInRightPanel = false;
|
||||
}
|
||||
}
|
||||
}
|
20
modules/style/quickshell/shell/services/Notification.qml
Normal file
20
modules/style/quickshell/shell/services/Notification.qml
Normal file
|
@ -0,0 +1,20 @@
|
|||
pragma Singleton
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Services.Notifications
|
||||
|
||||
/**
|
||||
* Provides extra features not in Quickshell.Services.Notifications:
|
||||
* - Persistent storage
|
||||
* - Popup notifications, with timeout
|
||||
* - Notification groups by app
|
||||
*/
|
||||
Singleton {
|
||||
id: root
|
||||
NotificationServer {
|
||||
|
||||
}
|
||||
}
|
94
modules/style/quickshell/shell/services/niri/Niri.qml
Normal file
94
modules/style/quickshell/shell/services/niri/Niri.qml
Normal file
|
@ -0,0 +1,94 @@
|
|||
// Kind thanks to https://github.com/MapoMagpie/nixos-flakes/blob/main/home/ui/quickshell/config/Data/Niri.qml
|
||||
// This file was taken from there and further modified.
|
||||
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
// property var data
|
||||
property var workspaces: []
|
||||
property var activeWorkspace: "VOID"
|
||||
property var activeWorkspaceIndex: 0
|
||||
property var windows: []
|
||||
// property var activedWindowId: 0
|
||||
|
||||
Process {
|
||||
id: proc
|
||||
command: ["niri", "msg", "-j", "event-stream"]
|
||||
|
||||
running: true
|
||||
stdout: SplitParser {
|
||||
onRead: data => {
|
||||
var event = JSON.parse(data);
|
||||
let workspaces = [];
|
||||
if (event.WorkspacesChanged) {
|
||||
root.workspaces = event.WorkspacesChanged.workspaces;
|
||||
root.workspaces = root.workspaces.sort((a, b) => a.id - b.id);
|
||||
root.activeWorkspaceIndex = root.workspaces.findIndex(w => w.is_focused);
|
||||
if (root.activeWorkspaceIndex < 0) {
|
||||
root.activeWorkspaceIndex = 0;
|
||||
}
|
||||
root.activeWorkspace = root.workspaces[root.activeWorkspaceIndex].name;
|
||||
}
|
||||
if (event.WindowsChanged) {
|
||||
root.windows = [...event.WindowsChanged.windows].sort((a, b) => a.id - b.id);
|
||||
}
|
||||
if (event.WindowOpenedOrChanged) {
|
||||
const window = event.WindowOpenedOrChanged.window;
|
||||
const index = root.windows.findIndex(w => w.id === window.id);
|
||||
// console.log("window opened or changed: ", index, ", win id: ", window.id);
|
||||
if (index >= 0) {
|
||||
// console.log("replace window, old: ", root.windows[index].id, ", new: ", window.id);
|
||||
root.windows[index] = window;
|
||||
} else {
|
||||
// console.log("push window, new: ", window.id);
|
||||
root.windows.push(window);
|
||||
}
|
||||
root.windows = [...root.windows.sort((a, b) => a.id - b.id)];
|
||||
}
|
||||
if (event.WindowClosed) {
|
||||
const index = root.windows.findIndex(w => w.id === event.WindowClosed.id);
|
||||
// console.log("window closed: ", index, ", win id: ", event.WindowClosed.id);
|
||||
if (index >= 0) {
|
||||
root.windows.splice(index, 1);
|
||||
}
|
||||
root.windows = [...root.windows.sort((a, b) => a.id - b.id)];
|
||||
}
|
||||
if (event.WorkspaceActivated) {
|
||||
root.activeWorkspaceIndex = root.workspaces.findIndex(w => w.id === event.WorkspaceActivated.id);
|
||||
if (root.activeWorkspaceIndex < 0) {
|
||||
root.activeWorkspaceIndex = 0;
|
||||
}
|
||||
root.activeWorkspace = root.workspaces[root.activeWorkspaceIndex].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// component Workspace: QtObject {
|
||||
// required property int id
|
||||
// property int idx
|
||||
// property string name: "VOID"
|
||||
// required property string output
|
||||
// property bool is_active
|
||||
// property bool is_focused
|
||||
// property int active_window_id
|
||||
// }
|
||||
}
|
||||
|
||||
// {
|
||||
// "workspaces": [
|
||||
// {
|
||||
// "id": 5,
|
||||
// "idx": 4,
|
||||
// "name": "GAME",
|
||||
// "output": "DP-3",
|
||||
// "is_active": false,
|
||||
// "is_focused": false,
|
||||
// "active_window_id": null
|
||||
// },
|
||||
// ]
|
||||
// }
|
Loading…
Add table
Add a link
Reference in a new issue