Merge branch 'Ly-sec:main' into main

This commit is contained in:
Jose Chasey Pratama 2025-07-30 14:09:23 +07:00 committed by GitHub
commit cb9cb0f4e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 167 additions and 87 deletions

View file

@ -51,9 +51,10 @@ Singleton {
// Initialize Hyprland integration // Initialize Hyprland integration
function initHyprland() { function initHyprland() {
try { try {
// Fixes the odd workspace issue.
Hyprland.refreshWorkspaces(); Hyprland.refreshWorkspaces();
hlWorkspaces = Hyprland.workspaces.values; // hlWorkspaces = Hyprland.workspaces.values;
updateHyprlandWorkspaces(); // updateHyprlandWorkspaces();
return true; return true;
} catch (e) { } catch (e) {
console.error("Error initializing Hyprland:", e); console.error("Error initializing Hyprland:", e);

View file

@ -6,28 +6,38 @@ import qs.Settings
ShellRoot { ShellRoot {
property string wallpaperSource: WallpaperManager.currentWallpaper !== "" && !Settings.settings.useSWWW ? WallpaperManager.currentWallpaper : "" property string wallpaperSource: WallpaperManager.currentWallpaper !== "" && !Settings.settings.useSWWW ? WallpaperManager.currentWallpaper : ""
PanelWindow {
visible: wallpaperSource !== "" Variants {
anchors { model: Quickshell.screens
bottom: true
top: true PanelWindow {
right: true required property ShellScreen modelData
left: true
}
margins {
top: 0
}
color: "transparent"
WlrLayershell.layer: WlrLayer.Background
WlrLayershell.exclusionMode: ExclusionMode.Ignore
WlrLayershell.namespace: "quickshell-wallpaper"
Image {
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
source: wallpaperSource
visible: wallpaperSource !== "" visible: wallpaperSource !== ""
cache: true anchors {
smooth: true bottom: true
top: true
right: true
left: true
}
margins {
top: 0
}
color: "transparent"
screen: modelData
WlrLayershell.layer: WlrLayer.Background
WlrLayershell.exclusionMode: ExclusionMode.Ignore
WlrLayershell.namespace: "quickshell-wallpaper"
Image {
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
source: wallpaperSource
visible: wallpaperSource !== ""
cache: true
smooth: true
}
} }
} }
} }

View file

@ -141,9 +141,16 @@ WlSessionLock {
FastBlur { FastBlur {
anchors.fill: parent anchors.fill: parent
source: lockBgImage source: lockBgImage
radius: 48 // Adjust blur strength as needed radius: 22 // Adjust blur strength as needed
transparentBorder: true transparentBorder: true
} }
Rectangle {
anchors.fill: parent
color: Qt.rgba(
Theme.backgroundPrimary.r,
Theme.backgroundPrimary.g,
Theme.backgroundPrimary.b, 0.6)
}
// Main content container (moved up, Rectangle removed) // Main content container (moved up, Rectangle removed)
ColumnLayout { ColumnLayout {
anchors.centerIn: parent anchors.centerIn: parent

View file

@ -7,33 +7,48 @@ import qs.Settings
ShellRoot { ShellRoot {
property string wallpaperSource: WallpaperManager.currentWallpaper !== "" && !Settings.settings.useSWWW ? WallpaperManager.currentWallpaper : "" property string wallpaperSource: WallpaperManager.currentWallpaper !== "" && !Settings.settings.useSWWW ? WallpaperManager.currentWallpaper : ""
PanelWindow {
visible: wallpaperSource !== "" Variants {
anchors { model: Quickshell.screens
top: true
bottom: true PanelWindow {
right: true required property ShellScreen modelData
left: true
}
color: "transparent"
WlrLayershell.layer: WlrLayer.Background
WlrLayershell.exclusionMode: ExclusionMode.Ignore
WlrLayershell.namespace: "quickshell-overview"
Image {
id: bgImage
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
source: wallpaperSource
cache: true
smooth: true
visible: wallpaperSource !== "" // Show the original for FastBlur input
}
FastBlur {
anchors.fill: parent
visible: wallpaperSource !== "" visible: wallpaperSource !== ""
source: bgImage anchors {
radius: 24 // Adjust blur strength as needed top: true
transparentBorder: true bottom: true
right: true
left: true
}
color: "transparent"
screen: modelData
WlrLayershell.layer: WlrLayer.Background
WlrLayershell.exclusionMode: ExclusionMode.Ignore
WlrLayershell.namespace: "quickshell-overview"
Image {
id: bgImage
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
source: wallpaperSource
cache: true
smooth: true
visible: wallpaperSource !== "" // Show the original for FastBlur input
}
FastBlur {
anchors.fill: parent
visible: wallpaperSource !== ""
source: bgImage
radius: 18 // Adjust blur strength as needed
transparentBorder: true
}
Rectangle {
anchors.fill: parent
color: Qt.rgba(
Theme.backgroundPrimary.r,
Theme.backgroundPrimary.g,
Theme.backgroundPrimary.b, 0.6)
}
} }
} }
} }

View file

@ -214,6 +214,45 @@ Rectangle {
} }
} }
// Suspend button
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 36
radius: 6
color: suspendButtonArea.containsMouse ? Theme.accentPrimary : "transparent"
RowLayout {
anchors.fill: parent
anchors.margins: 12
spacing: 8
Text {
text: "bedtime"
font.family: "Material Symbols Outlined"
font.pixelSize: 16
color: suspendButtonArea.containsMouse ? Theme.onAccent : Theme.textPrimary
}
Text {
text: "Suspend"
font.pixelSize: 14
color: suspendButtonArea.containsMouse ? Theme.onAccent : Theme.textPrimary
Layout.fillWidth: true
}
}
MouseArea {
id: suspendButtonArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
suspend();
systemMenu.visible = false;
}
}
}
// Reboot button // Reboot button
Rectangle { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
@ -366,7 +405,15 @@ Rectangle {
command: ["niri", "msg", "action", "quit", "--skip-confirmation"] command: ["niri", "msg", "action", "quit", "--skip-confirmation"]
running: false running: false
} }
Process {
id: suspendProcess
command: ["systemctl", "suspend"]
running: false
}
function suspend() {
suspendProcess.running = true;
}
function shutdown() { function shutdown() {
shutdownProcess.running = true; shutdownProcess.running = true;
} }

View file

@ -90,14 +90,12 @@ Item {
property string connectSecurity: "" property string connectSecurity: ""
property var pendingConnect: null property var pendingConnect: null
property string detectedInterface: "" property string detectedInterface: ""
property var connectionsToDelete: []
function profileNameForSsid(ssid) { function profileNameForSsid(ssid) {
return "quickshell-" + ssid.replace(/[^a-zA-Z0-9]/g, "_"); return "quickshell-" + ssid.replace(/[^a-zA-Z0-9]/g, "_");
} }
function disconnectAndDeleteNetwork(ssid) { function disconnectNetwork(ssid) {
var profileName = wifiLogic.profileNameForSsid(ssid); var profileName = wifiLogic.profileNameForSsid(ssid);
console.log('WifiPanel: disconnectAndDeleteNetwork called for SSID', ssid, 'profile', profileName);
disconnectProfileProcess.connectionName = profileName; disconnectProfileProcess.connectionName = profileName;
disconnectProfileProcess.running = true; disconnectProfileProcess.running = true;
} }
@ -129,6 +127,9 @@ Item {
wifiLogic.pendingConnect = null; wifiLogic.pendingConnect = null;
} }
} }
function isSecured(security) {
return security && security.trim() !== "" && security.trim() !== "--";
}
} }
// Disconnect, delete profile, refresh // Disconnect, delete profile, refresh
@ -137,18 +138,6 @@ Item {
property string connectionName: "" property string connectionName: ""
running: false running: false
command: ["nmcli", "connection", "down", "id", connectionName] command: ["nmcli", "connection", "down", "id", connectionName]
onRunningChanged: {
if (!running) {
deleteProfileProcess.connectionName = connectionName;
deleteProfileProcess.running = true;
}
}
}
Process {
id: deleteProfileProcess
property string connectionName: ""
running: false
command: ["nmcli", "connection", "delete", "id", connectionName]
onRunningChanged: { onRunningChanged: {
if (!running) { if (!running) {
wifiLogic.refreshNetworks(); wifiLogic.refreshNetworks();
@ -159,24 +148,43 @@ Item {
Process { Process {
id: listConnectionsProcess id: listConnectionsProcess
running: false running: false
command: ["nmcli", "-t", "-f", "NAME,SSID", "connection", "show"] command: ["nmcli", "-t", "-f", "NAME", "connection", "show"]
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: { onStreamFinished: {
var params = wifiLogic.pendingConnect; var params = wifiLogic.pendingConnect;
var lines = text.split("\n"); var lines = text.split("\n");
var toDelete = []; var expectedProfile = wifiLogic.profileNameForSsid(params.ssid);
var foundProfile = null;
for (var i = 0; i < lines.length; ++i) { for (var i = 0; i < lines.length; ++i) {
var parts = lines[i].split(":"); if (lines[i] === expectedProfile) {
if (parts.length === 2 && parts[1] === params.ssid) { foundProfile = lines[i];
toDelete.push(parts[0]); break;
} }
} }
wifiLogic.connectionsToDelete = toDelete; if (foundProfile) {
if (toDelete.length > 0) { // Profile exists, just bring it up (no password prompt)
deleteProfileProcess.connectionName = toDelete[0]; upConnectionProcess.profileName = foundProfile;
deleteProfileProcess.running = true; upConnectionProcess.running = true;
} else { } else {
wifiLogic.doConnect(); // No profile: check if secured
if (wifiLogic.isSecured(params.security)) {
if (params.password && params.password.length > 0) {
// Password provided, proceed to connect
wifiLogic.doConnect();
} else {
// No password yet, prompt for it
wifiLogic.passwordPromptSsid = params.ssid;
wifiLogic.passwordInput = "";
wifiLogic.showPasswordPrompt = true;
wifiLogic.connectStatus = "";
wifiLogic.connectStatusSsid = "";
wifiLogic.connectError = "";
wifiLogic.connectSecurity = params.security;
}
} else {
// Open, connect directly
wifiLogic.doConnect();
}
} }
} }
} }
@ -565,17 +573,9 @@ Item {
hoverEnabled: true hoverEnabled: true
onClicked: { onClicked: {
if (modelData.connected) { if (modelData.connected) {
wifiLogic.disconnectAndDeleteNetwork(modelData.ssid); wifiLogic.disconnectNetwork(modelData.ssid);
} else if (modelData.security && modelData.security !== "--") {
wifiLogic.passwordPromptSsid = modelData.ssid;
wifiLogic.passwordInput = "";
wifiLogic.showPasswordPrompt = true;
wifiLogic.connectStatus = "";
wifiLogic.connectStatusSsid = "";
wifiLogic.connectError = "";
wifiLogic.connectSecurity = modelData.security;
} else { } else {
wifiLogic.connectNetwork(modelData.ssid, modelData.security) wifiLogic.connectNetwork(modelData.ssid, modelData.security);
} }
} }
} }