added tablet mode for mobile03
This commit is contained in:
2
Bar.qml
2
Bar.qml
@@ -23,7 +23,7 @@ Scope {
|
|||||||
PanelWindow {
|
PanelWindow {
|
||||||
id: win
|
id: win
|
||||||
|
|
||||||
property double barExclusionZone: 15
|
property double barExclusionZone: IpcManager.tabletMode ? 35 : 15
|
||||||
property double barMaxHeight: modelData.height
|
property double barMaxHeight: modelData.height
|
||||||
required property var modelData
|
required property var modelData
|
||||||
property HyprlandMonitor monitor: Hyprland.monitorFor(modelData)
|
property HyprlandMonitor monitor: Hyprland.monitorFor(modelData)
|
||||||
|
|||||||
138
Bar/Time.qml
138
Bar/Time.qml
@@ -29,7 +29,8 @@ Container {
|
|||||||
property bool notified: false
|
property bool notified: false
|
||||||
|
|
||||||
boxColor: Colors.mauve
|
boxColor: Colors.mauve
|
||||||
defaultItem: time
|
boxWidth: IpcManager.tabletMode ? 600 : 100
|
||||||
|
defaultItem: IpcManager.tabletMode ? tabletTime : time
|
||||||
exclusiveMonitor: root.monitor
|
exclusiveMonitor: root.monitor
|
||||||
exclusiveToScreen: true
|
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 {
|
Component {
|
||||||
id: notification
|
id: notification
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import Quickshell
|
|||||||
import Quickshell.Hyprland
|
import Quickshell.Hyprland
|
||||||
|
|
||||||
import "../Color.js" as Colors
|
import "../Color.js" as Colors
|
||||||
|
import "../Services/"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
@@ -78,6 +79,7 @@ Item {
|
|||||||
State {
|
State {
|
||||||
name: "closed"
|
name: "closed"
|
||||||
when: root.hovered == false && root.boxOpened == false && root.overriden == false
|
when: root.hovered == false && root.boxOpened == false && root.overriden == false
|
||||||
|
&& IpcManager.tabletMode == false
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
container.radius: root.boxRadius
|
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 {
|
State {
|
||||||
name: "hovered"
|
name: "hovered"
|
||||||
when: root.hovered == true && root.boxOpened == false && root.overriden == false
|
when: root.hovered == true && root.boxOpened == false && root.overriden == false
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
container.radius: root.boxRadius + 3
|
container.radius: root.boxRadius + 3
|
||||||
root.implicitHeight: root.boxHeight + 2
|
root.implicitHeight: IpcManager.tabletMode ? 35 : root.boxHeight + 2
|
||||||
root.implicitWidth: root.boxWidth + 2
|
root.implicitWidth: root.boxWidth + 2
|
||||||
}
|
}
|
||||||
|
|
||||||
StateChangeScript {
|
StateChangeScript {
|
||||||
script: {
|
script: {
|
||||||
stack.replace(root.defaultItem);
|
if (IpcManager.tabletMode == false) {
|
||||||
|
stack.replace(root.defaultItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -182,8 +203,11 @@ Item {
|
|||||||
} else {
|
} else {
|
||||||
root.hovered = false;
|
root.hovered = false;
|
||||||
root.boxOpened = false;
|
root.boxOpened = false;
|
||||||
if (root.state == "closed") {
|
if (root.state == "closed" || root.state == "tablet") {
|
||||||
root.stack.replace(root.defaultItem);
|
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 {
|
Rectangle {
|
||||||
id: container
|
id: container
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,12 @@ Singleton {
|
|||||||
|
|
||||||
property var focusState: WlrKeyboardFocus.None
|
property var focusState: WlrKeyboardFocus.None
|
||||||
property bool logoutMenuOpen: false
|
property bool logoutMenuOpen: false
|
||||||
|
property bool tabletMode: true
|
||||||
|
|
||||||
signal closeLogoutMenu
|
signal closeLogoutMenu
|
||||||
|
signal enableTabletMode
|
||||||
signal logoutMenu
|
signal logoutMenu
|
||||||
|
signal normalMode
|
||||||
|
|
||||||
onCloseLogoutMenu: {
|
onCloseLogoutMenu: {
|
||||||
root.focusState = WlrKeyboardFocus.None;
|
root.focusState = WlrKeyboardFocus.None;
|
||||||
@@ -20,6 +23,16 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
|
function disableTabletMode(): void {
|
||||||
|
root.normalMode();
|
||||||
|
root.tabletMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function enableTabletMode(): void {
|
||||||
|
root.enableTabletMode();
|
||||||
|
root.tabletMode = true;
|
||||||
|
}
|
||||||
|
|
||||||
function openLogoutMenu(): void {
|
function openLogoutMenu(): void {
|
||||||
root.logoutMenu();
|
root.logoutMenu();
|
||||||
root.focusState = WlrKeyboardFocus.Exclusive;
|
root.focusState = WlrKeyboardFocus.Exclusive;
|
||||||
|
|||||||
Reference in New Issue
Block a user