Compare commits
5 Commits
1b60860354
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 63e360d427 | |||
| 7a324e6119 | |||
| 8abc848325 | |||
| 8c7ecc1b14 | |||
| 82d045d4df |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,3 +10,4 @@ devenv.local.yaml
|
|||||||
|
|
||||||
# pre-commit
|
# pre-commit
|
||||||
.pre-commit-config.yaml
|
.pre-commit-config.yaml
|
||||||
|
/.qmlls.ini
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
/run/user/1000/quickshell/vfs/feb6ddef68a55c1886b9c19683c71793/.qmlls.ini
|
|
||||||
34
Bar.qml
34
Bar.qml
@@ -1,8 +1,9 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Effects
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Hyprland
|
import Quickshell.Hyprland
|
||||||
|
import Quickshell.Io
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import "./Services/"
|
||||||
import "Bar"
|
import "Bar"
|
||||||
import "Color.js" as Colors
|
import "Color.js" as Colors
|
||||||
|
|
||||||
@@ -19,6 +20,15 @@ Scope {
|
|||||||
required property var modelData
|
required property var modelData
|
||||||
property HyprlandMonitor monitor: Hyprland.monitorFor(modelData)
|
property HyprlandMonitor monitor: Hyprland.monitorFor(modelData)
|
||||||
|
|
||||||
|
function refocus() {
|
||||||
|
if (WlrLayershell == null)
|
||||||
|
return;
|
||||||
|
WlrLayershell.keyboardFocus = WlrKeyboardFocus.None;
|
||||||
|
Qt.callLater(() => {
|
||||||
|
WlrLayershell.keyboardFocus = WlrKeyboardFocus.Exclusive;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
exclusionMode: ExclusionMode.Normal
|
exclusionMode: ExclusionMode.Normal
|
||||||
exclusiveZone: barExclusionZone
|
exclusiveZone: barExclusionZone
|
||||||
@@ -39,6 +49,26 @@ Scope {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (this.WlrLayershell != null) {
|
||||||
|
this.WlrLayershell.keyboardFocus = WlrKeyboardFocus.OnDemand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
function onRaiseCancelled() {
|
||||||
|
win.WlrLayershell.keyboardFocus = WlrKeyboardFocus.OnDemand;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onRaiseRequested() {
|
||||||
|
// win.WlrLayershell.keyboardFocus = WlrKeyboardFocus.Exclusive;
|
||||||
|
win.refocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
target: FocusManager
|
||||||
|
}
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
left: true
|
left: true
|
||||||
right: true
|
right: true
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import QtQuick
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Hyprland
|
import Quickshell.Hyprland
|
||||||
|
import Quickshell.Io
|
||||||
import Quickshell.Services.Mpris
|
import Quickshell.Services.Mpris
|
||||||
import Quickshell.Services.Notifications
|
import Quickshell.Services.Notifications
|
||||||
import "../Color.js" as Colors
|
import "../Color.js" as Colors
|
||||||
@@ -119,6 +120,23 @@ Container {
|
|||||||
root.previousState = "notified";
|
root.previousState = "notified";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
name: "logout"
|
||||||
|
|
||||||
|
PropertyChanges {
|
||||||
|
root.boxHeight: 90
|
||||||
|
root.boxRadius: 30
|
||||||
|
root.boxWidth: 330
|
||||||
|
root.visibleTopMargin: 20
|
||||||
|
}
|
||||||
|
|
||||||
|
StateChangeScript {
|
||||||
|
script: {
|
||||||
|
root.stack.replace(logout);
|
||||||
|
root.previousState = "logout";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -127,6 +145,8 @@ Container {
|
|||||||
if (root.state == "notified") {
|
if (root.state == "notified") {
|
||||||
root.state = "notified";
|
root.state = "notified";
|
||||||
notificationViewTimer.stop();
|
notificationViewTimer.stop();
|
||||||
|
} else if (root.state == "logout") {
|
||||||
|
root.state = "logout";
|
||||||
} else if (MprisManager.getPlaying() == true) {
|
} else if (MprisManager.getPlaying() == true) {
|
||||||
root.state = "mprisToast";
|
root.state = "mprisToast";
|
||||||
} else {
|
} else {
|
||||||
@@ -134,13 +154,14 @@ Container {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
root.state = "";
|
root.state = "";
|
||||||
|
FocusManager.exitRaise();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onLatestNotificationChanged: {
|
onLatestNotificationChanged: {
|
||||||
if (latestNotification != null && Hyprland.focusedMonitor == monitor) {
|
if (latestNotification != null && Hyprland.focusedMonitor == monitor) {
|
||||||
if (root.latestNotification.lastGeneration == false) {
|
if (root.latestNotification.lastGeneration == false) {
|
||||||
root.state = "notified";
|
root.state = "notified";
|
||||||
notificationViewTimer.start();
|
notificationViewTimer.restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -148,6 +169,32 @@ Container {
|
|||||||
root.state == "hovered" ? root.state = "expanded" : undefined;
|
root.state == "hovered" ? root.state = "expanded" : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
function onactivated() {
|
||||||
|
console.log("some", root.state);
|
||||||
|
}
|
||||||
|
|
||||||
|
target: root.stack
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
function onLogoutTriggered() {
|
||||||
|
if (Hyprland.focusedMonitor == root.exclusiveMonitor) {
|
||||||
|
root.state = "logout";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
target: IpcManager
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
function onRaiseCancelled() {
|
||||||
|
root.state = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
target: FocusManager
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
function onTrackChanged() {
|
function onTrackChanged() {
|
||||||
if (Hyprland.focusedMonitor == root.monitor) {
|
if (Hyprland.focusedMonitor == root.monitor) {
|
||||||
@@ -182,7 +229,6 @@ Container {
|
|||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (!root.hover.hovered) {
|
if (!root.hover.hovered) {
|
||||||
console.log("some");
|
|
||||||
root.state = "";
|
root.state = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -261,4 +307,10 @@ Container {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: logout
|
||||||
|
|
||||||
|
Logout {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
18
Bar/Center/Logout.qml
Normal file
18
Bar/Center/Logout.qml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import QtQuick
|
||||||
|
import "../../Components/"
|
||||||
|
import "../../Services/"
|
||||||
|
|
||||||
|
Item {
|
||||||
|
CenteredText {
|
||||||
|
text: "some"
|
||||||
|
}
|
||||||
|
|
||||||
|
Shortcut {
|
||||||
|
sequence: "Escape"
|
||||||
|
|
||||||
|
onActivated: {
|
||||||
|
console.log("shortcut triggered");
|
||||||
|
FocusManager.exitRaise();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,9 +34,11 @@ Item {
|
|||||||
StyledText {
|
StyledText {
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
maximumLineCount: 2
|
||||||
text: root.body
|
text: root.body
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
width: root.width - 20
|
width: root.width - 20
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
|
||||||
font {
|
font {
|
||||||
pointSize: 10
|
pointSize: 10
|
||||||
|
|||||||
@@ -10,13 +10,16 @@ import "Bluetooth"
|
|||||||
Container {
|
Container {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property bool shown: false
|
||||||
|
|
||||||
animOffset: 200
|
animOffset: 200
|
||||||
boxColor: Colors.peach
|
boxColor: Colors.peach
|
||||||
boxHeight: 25
|
boxHeight: 25
|
||||||
boxWidth: 30
|
boxWidth: 30
|
||||||
defaultItem: icon
|
defaultItem: icon
|
||||||
exclusiveToScreen: true
|
exclusiveToScreen: true
|
||||||
forceHidden: BluetoothManager.getConnected()
|
forceHidden: !(root.shown || BluetoothManager.getConnected())
|
||||||
|
hoverableWhenHidden: true
|
||||||
state: ""
|
state: ""
|
||||||
|
|
||||||
states: [
|
states: [
|
||||||
@@ -46,20 +49,43 @@ Container {
|
|||||||
StateChangeScript {
|
StateChangeScript {
|
||||||
script: {
|
script: {
|
||||||
root.stack.replace(expanded);
|
root.stack.replace(expanded);
|
||||||
|
root.shown = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
hover.onHoveredChanged: hover.hovered == false ? state = "" : undefined
|
hover.onHoveredChanged: {
|
||||||
|
if (hover.hovered == false) {
|
||||||
|
root.state = "";
|
||||||
|
hoverIntervalTimer.start();
|
||||||
|
} else {
|
||||||
|
root.shown = true;
|
||||||
|
hoverIntervalTimer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
tap.onTapped: state = "expanded"
|
tap.onTapped: state = "expanded"
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: hoverIntervalTimer
|
||||||
|
|
||||||
|
interval: 500
|
||||||
|
repeat: false
|
||||||
|
running: false
|
||||||
|
|
||||||
|
onTriggered: {
|
||||||
|
if (root.hover.hovered == false) {
|
||||||
|
root.shown = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: icon
|
id: icon
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
CenteredText {
|
CenteredText {
|
||||||
text: ""
|
text: BluetoothManager.getConnected() == true ? "" : ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,21 +15,26 @@ Item {
|
|||||||
property double boxRadius: 9
|
property double boxRadius: 9
|
||||||
property double boxWidth: 100
|
property double boxWidth: 100
|
||||||
readonly property double calculatedTopMargin: {
|
readonly property double calculatedTopMargin: {
|
||||||
if (root.exclusiveToScreen) {
|
if (!root.exclusiveToScreen) {
|
||||||
if (Hyprland.focusedMonitor != root.exclusiveMonitor || forceHidden == true) {
|
return visibleTopMargin;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Hyprland.focusedMonitor == root.exclusiveMonitor) {
|
||||||
|
if (!root.forceHidden) {
|
||||||
|
return visibleTopMargin;
|
||||||
|
} else if (root.hoverableWhenHidden) {
|
||||||
|
return 7 - root.boxHeight - 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return -4 - root.boxHeight - 5;
|
return -4 - root.boxHeight - 5;
|
||||||
} else {
|
|
||||||
return visibleTopMargin;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return visibleTopMargin;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
property Component defaultItem
|
property Component defaultItem
|
||||||
required property HyprlandMonitor exclusiveMonitor
|
required property HyprlandMonitor exclusiveMonitor
|
||||||
property bool exclusiveToScreen: false
|
property bool exclusiveToScreen: false
|
||||||
property bool forceHidden: false
|
property bool forceHidden: false
|
||||||
property alias hover: hoverHandler
|
property alias hover: hoverHandler
|
||||||
|
property bool hoverableWhenHidden: false
|
||||||
property alias rect: container
|
property alias rect: container
|
||||||
property alias stack: containerContent
|
property alias stack: containerContent
|
||||||
property alias tap: tapHandler
|
property alias tap: tapHandler
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ Singleton {
|
|||||||
for (let device in deviceList) {
|
for (let device in deviceList) {
|
||||||
let currentDevice = deviceList[device];
|
let currentDevice = deviceList[device];
|
||||||
if (currentDevice.connected == true) {
|
if (currentDevice.connected == true) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function getDevicesList() {
|
function getDevicesList() {
|
||||||
return root.defaultAdapter.devices.values;
|
return root.defaultAdapter.devices.values;
|
||||||
|
|||||||
19
Services/FocusManager.qml
Normal file
19
Services/FocusManager.qml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
pragma Singleton
|
||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
signal raiseCancelled
|
||||||
|
signal raiseRequested
|
||||||
|
|
||||||
|
function exitRaise() {
|
||||||
|
console.log("exiting raise");
|
||||||
|
root.raiseCancelled();
|
||||||
|
}
|
||||||
|
|
||||||
|
function requestRaise() {
|
||||||
|
root.raiseRequested();
|
||||||
|
}
|
||||||
|
}
|
||||||
18
Services/IpcManager.qml
Normal file
18
Services/IpcManager.qml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
pragma Singleton
|
||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
|
Singleton {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
signal logoutTriggered()
|
||||||
|
|
||||||
|
IpcHandler {
|
||||||
|
function logout() {
|
||||||
|
root.logoutTriggered();
|
||||||
|
}
|
||||||
|
|
||||||
|
target: "main"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,3 +4,5 @@ singleton NotificationManager 1.0 NotificationManager.qml
|
|||||||
singleton WorkspaceManager 1.0 WorkspaceManager.qml
|
singleton WorkspaceManager 1.0 WorkspaceManager.qml
|
||||||
singleton BluetoothManager 1.0 BluetoothManager.qml
|
singleton BluetoothManager 1.0 BluetoothManager.qml
|
||||||
singleton MprisManager 1.0 MprisManager.qml
|
singleton MprisManager 1.0 MprisManager.qml
|
||||||
|
singleton IpcManager 1.0 IpcManager.qml
|
||||||
|
singleton FocusManager 1.0 FocusManager.qml
|
||||||
|
|||||||
Reference in New Issue
Block a user