Compare commits

...

2 Commits

Author SHA1 Message Date
91484b5edd added tablet mode for mobile03 2026-08-26 17:46:03 +01:00
1d4bc15c63 fixed battery width nonsense 2026-08-26 17:45:48 +01:00
5 changed files with 198 additions and 7 deletions

View File

@@ -23,7 +23,7 @@ Scope {
PanelWindow {
id: win
property double barExclusionZone: 15
property double barExclusionZone: IpcManager.tabletMode ? 35 : 15
property double barMaxHeight: modelData.height
required property var modelData
property HyprlandMonitor monitor: Hyprland.monitorFor(modelData)

View File

@@ -22,7 +22,7 @@ Container {
boxHeightOpened: root.batteryDisplayHeight
boxRadius: radius
boxWidth: 60
boxWidthOpened: 410
boxWidthOpened: 450
defaultItem: icon
exclusiveMonitor: root.monitor
exclusiveToScreen: true

View File

@@ -29,7 +29,8 @@ Container {
property bool notified: false
boxColor: Colors.mauve
defaultItem: time
boxWidth: IpcManager.tabletMode ? 600 : 100
defaultItem: IpcManager.tabletMode ? tabletTime : time
exclusiveMonitor: root.monitor
exclusiveToScreen: true
@@ -330,6 +331,141 @@ Container {
}
}
Component {
id: tabletTime
Item {
property string component: "tabletTime"
Rectangle {
color: Colors.surface1
radius: root.boxRadius - 2
anchors {
fill: parent
margins: 3
}
Row {
anchors {
bottom: parent.bottom
bottomMargin: 3
left: parent.left
leftMargin: 4
top: parent.top
topMargin: 3
}
Rectangle {
color: Colors.overlay0
implicitWidth: 25
radius: root.boxRadius - 4
anchors {
bottom: parent.bottom
top: parent.top
}
TapHandler {
onTapped: {
console.log("kando");
}
}
StyledText {
anchors.fill: parent
color: Colors.mauve
fontSize: 14
fontWeight: 10
horizontalAlignment: Qt.AlignHCenter
propo: true
text: "󱗿"
verticalAlignment: Qt.AlignVCenter
}
}
}
CenteredText {
color: Colors.mauve
text: TimeManager.time
}
}
Row {
spacing: 3
anchors {
bottom: parent.bottom
bottomMargin: 3
right: parent.right
rightMargin: 7
top: parent.top
topMargin: 3
}
Rectangle {
color: Colors.overlay0
implicitWidth: 25
radius: root.boxRadius - 4
anchors {
bottom: parent.bottom
bottomMargin: 3
top: parent.top
topMargin: 3
}
TapHandler {
onTapped: {
WorkspaceManager.activateWorkspaceById("-1");
}
}
StyledText {
anchors.fill: parent
color: Colors.mauve
fontSize: 14
fontWeight: 10
horizontalAlignment: Qt.AlignHCenter
propo: true
text: ""
verticalAlignment: Qt.AlignVCenter
}
}
Rectangle {
color: Colors.overlay0
implicitWidth: 25
radius: root.boxRadius - 4
anchors {
bottom: parent.bottom
bottomMargin: 3
top: parent.top
topMargin: 3
}
TapHandler {
onTapped: {
Hyprland.dispatch(`hl.dsp.focus({workspace = "+1"})`);
}
}
StyledText {
anchors.fill: parent
color: Colors.mauve
fontSize: 14
fontWeight: 10
horizontalAlignment: Qt.AlignHCenter
propo: true
text: ""
verticalAlignment: Qt.AlignVCenter
}
}
}
}
}
Component {
id: notification

View File

@@ -5,6 +5,7 @@ import Quickshell
import Quickshell.Hyprland
import "../Color.js" as Colors
import "../Services/"
Item {
id: root
@@ -78,6 +79,7 @@ Item {
State {
name: "closed"
when: root.hovered == false && root.boxOpened == false && root.overriden == false
&& IpcManager.tabletMode == false
PropertyChanges {
container.radius: root.boxRadius
@@ -91,19 +93,38 @@ Item {
}
}
},
State {
name: "tablet"
when: root.hovered == false && root.boxOpened == false && root.overriden == false
&& IpcManager.tabletMode == true
PropertyChanges {
container.radius: root.boxRadius
root.implicitHeight: 33
root.implicitWidth: root.boxWidth
}
StateChangeScript {
script: {
stack.replace(root.defaultItem);
}
}
},
State {
name: "hovered"
when: root.hovered == true && root.boxOpened == false && root.overriden == false
PropertyChanges {
container.radius: root.boxRadius + 3
root.implicitHeight: root.boxHeight + 2
root.implicitHeight: IpcManager.tabletMode ? 35 : root.boxHeight + 2
root.implicitWidth: root.boxWidth + 2
}
StateChangeScript {
script: {
stack.replace(root.defaultItem);
if (IpcManager.tabletMode == false) {
stack.replace(root.defaultItem);
}
}
}
},
@@ -182,8 +203,11 @@ Item {
} else {
root.hovered = false;
root.boxOpened = false;
if (root.state == "closed") {
root.stack.replace(root.defaultItem);
if (root.state == "closed" || root.state == "tablet") {
if (IpcManager.tabletMode == false) {
root.stack.replace(root.defaultItem);
console.log("some");
}
}
}
}
@@ -199,6 +223,24 @@ Item {
}
}
TapHandler {
id: touchScreenTapHandler
acceptedDevices: PointerDevice.TouchScreen
onGrabChanged: state => {
if (state == 1) {
if (root.openedItem) {
root.hovered = true;
root.boxOpened = true;
}
} else if (state == 2) {
root.hovered = false;
root.boxOpened = false;
}
}
}
Rectangle {
id: container

View File

@@ -10,9 +10,12 @@ Singleton {
property var focusState: WlrKeyboardFocus.None
property bool logoutMenuOpen: false
property bool tabletMode: true
signal closeLogoutMenu
signal enableTabletMode
signal logoutMenu
signal normalMode
onCloseLogoutMenu: {
root.focusState = WlrKeyboardFocus.None;
@@ -20,6 +23,16 @@ Singleton {
}
IpcHandler {
function disableTabletMode(): void {
root.normalMode();
root.tabletMode = false;
}
function enableTabletMode(): void {
root.enableTabletMode();
root.tabletMode = true;
}
function openLogoutMenu(): void {
root.logoutMenu();
root.focusState = WlrKeyboardFocus.Exclusive;