forked from Shinonome/dots-hyprland
sidebar resizing
This commit is contained in:
@@ -228,6 +228,7 @@ Singleton {
|
|||||||
property int barCenterSideModuleWidth: 360
|
property int barCenterSideModuleWidth: 360
|
||||||
property int barPreferredSideSectionWidth: 400
|
property int barPreferredSideSectionWidth: 400
|
||||||
property int sidebarWidth: 450
|
property int sidebarWidth: 450
|
||||||
|
property int sidebarWidthExtended: 700
|
||||||
property int notificationPopupWidth: 410
|
property int notificationPopupWidth: 410
|
||||||
property int searchWidthCollapsed: 260
|
property int searchWidthCollapsed: 260
|
||||||
property int searchWidth: 450
|
property int searchWidth: 450
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ ToolTip {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: content
|
text: content
|
||||||
font.pixelSize: Appearance.font.pixelSize.smaller
|
font.pixelSize: Appearance.font.pixelSize.smaller
|
||||||
|
font.hintingPreference: Font.PreferNoHinting // Prevent shaky text
|
||||||
color: Appearance.colors.colOnTooltip
|
color: Appearance.colors.colOnTooltip
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import Quickshell.Hyprland
|
|||||||
|
|
||||||
Scope { // Scope
|
Scope { // Scope
|
||||||
id: root
|
id: root
|
||||||
property int sidebarWidth: Appearance.sizes.sidebarWidth
|
|
||||||
property int sidebarPadding: 15
|
property int sidebarPadding: 15
|
||||||
property var tabButtonList: [{"icon": "neurology", "name": qsTr("Intelligence")}, {"icon": "bookmark_heart", "name": qsTr("Anime")}]
|
property var tabButtonList: [{"icon": "neurology", "name": qsTr("Intelligence")}, {"icon": "bookmark_heart", "name": qsTr("Anime")}]
|
||||||
|
|
||||||
@@ -27,6 +26,8 @@ Scope { // Scope
|
|||||||
visible: false
|
visible: false
|
||||||
focusable: true
|
focusable: true
|
||||||
property int currentTab: 0
|
property int currentTab: 0
|
||||||
|
property bool extend: false
|
||||||
|
property real sidebarWidth: sidebarRoot.extend ? Appearance.sizes.sidebarWidthExtended : Appearance.sizes.sidebarWidth
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
GlobalStates.sidebarLeftOpenCount += visible ? 1 : -1
|
GlobalStates.sidebarLeftOpenCount += visible ? 1 : -1
|
||||||
@@ -36,7 +37,7 @@ Scope { // Scope
|
|||||||
|
|
||||||
screen: modelData
|
screen: modelData
|
||||||
exclusiveZone: 0
|
exclusiveZone: 0
|
||||||
width: sidebarWidth
|
width: Appearance.sizes.sidebarWidthExtended
|
||||||
WlrLayershell.namespace: "quickshell:sidebarLeft"
|
WlrLayershell.namespace: "quickshell:sidebarLeft"
|
||||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
@@ -47,6 +48,10 @@ Scope { // Scope
|
|||||||
bottom: true
|
bottom: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mask: Region {
|
||||||
|
item: sidebarLeftBackground
|
||||||
|
}
|
||||||
|
|
||||||
HyprlandFocusGrab { // Click outside to close
|
HyprlandFocusGrab { // Click outside to close
|
||||||
id: grab
|
id: grab
|
||||||
windows: [ sidebarRoot ]
|
windows: [ sidebarRoot ]
|
||||||
@@ -76,14 +81,26 @@ Scope { // Scope
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
id: sidebarLeftBackground
|
id: sidebarLeftBackground
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.top: parent.top
|
||||||
width: parent.width - Appearance.sizes.hyprlandGapsOut * 2
|
anchors.left: parent.left
|
||||||
|
anchors.topMargin: Appearance.sizes.hyprlandGapsOut
|
||||||
|
anchors.leftMargin: Appearance.sizes.hyprlandGapsOut
|
||||||
|
width: sidebarWidth - Appearance.sizes.hyprlandGapsOut * 2
|
||||||
height: parent.height - Appearance.sizes.hyprlandGapsOut * 2
|
height: parent.height - Appearance.sizes.hyprlandGapsOut * 2
|
||||||
color: Appearance.colors.colLayer0
|
color: Appearance.colors.colLayer0
|
||||||
radius: Appearance.rounding.screenRounding - Appearance.sizes.elevationMargin + 1
|
radius: Appearance.rounding.screenRounding - Appearance.sizes.elevationMargin + 1
|
||||||
focus: sidebarRoot.visible
|
focus: sidebarRoot.visible
|
||||||
|
|
||||||
|
Behavior on width {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.animation.elementMove.duration
|
||||||
|
easing.type: Appearance.animation.elementMove.type
|
||||||
|
easing.bezierCurve: Appearance.animation.elementMove.bezierCurve
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Keys.onPressed: (event) => {
|
Keys.onPressed: (event) => {
|
||||||
|
// console.log("Key pressed: " + event.key)
|
||||||
if (event.key === Qt.Key_Escape) {
|
if (event.key === Qt.Key_Escape) {
|
||||||
sidebarRoot.visible = false;
|
sidebarRoot.visible = false;
|
||||||
}
|
}
|
||||||
@@ -100,6 +117,10 @@ Scope { // Scope
|
|||||||
else if (event.key === Qt.Key_Backtab) {
|
else if (event.key === Qt.Key_Backtab) {
|
||||||
sidebarRoot.currentTab = (sidebarRoot.currentTab - 1 + root.tabButtonList.length) % root.tabButtonList.length;
|
sidebarRoot.currentTab = (sidebarRoot.currentTab - 1 + root.tabButtonList.length) % root.tabButtonList.length;
|
||||||
}
|
}
|
||||||
|
else if (event.key === Qt.Key_O) {
|
||||||
|
console.log("Extending sidebar")
|
||||||
|
sidebarRoot.extend = !sidebarRoot.extend;
|
||||||
|
}
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ Rectangle {
|
|||||||
RowLayout {
|
RowLayout {
|
||||||
id: nameRowLayout
|
id: nameRowLayout
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: 10
|
spacing: 5
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
|||||||
Reference in New Issue
Block a user