forked from Shinonome/dots-hyprland
Merge remote-tracking branch 'origin/main' into addon-i18n
This commit is contained in:
@@ -21,10 +21,12 @@ Singleton {
|
||||
property bool isCriticalAndNotCharging: isCritical && !isCharging
|
||||
|
||||
onIsLowAndNotChargingChanged: {
|
||||
if (available && isLowAndNotCharging) Hyprland.dispatch(`exec notify-send "Low battery" "Consider plugging in your device" -u critical -a "Shell"`)
|
||||
if (available && isLowAndNotCharging)
|
||||
Quickshell.execDetached(["bash", "-c", `notify-send "Low battery" "Consider plugging in your device" -u critical -a "Shell"`]);
|
||||
}
|
||||
|
||||
onIsCriticalAndNotChargingChanged: {
|
||||
if (available && isCriticalAndNotCharging) Hyprland.dispatch(`exec notify-send "Critically low battery" "🙏 I beg for pleas charg\nAutomatic suspend triggers at ${ConfigOptions.battery.suspend}%" -u critical -a "Shell"`)
|
||||
if (available && isCriticalAndNotCharging)
|
||||
Quickshell.execDetached(["bash", "-c", `notify-send "Critically low battery" "🙏 I beg for pleas charg\nAutomatic suspend triggers at ${ConfigOptions.battery.suspend}%" -u critical -a "Shell"`]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,9 +44,8 @@ Singleton {
|
||||
} catch (e) {
|
||||
console.error("[ConfigLoader] Error reading file:", e);
|
||||
console.log("[ConfigLoader] File content was:", fileContent);
|
||||
Hyprland.dispatch(`exec notify-send "${Translation.tr("Shell configuration failed to load")}" "${root.filePath}"`)
|
||||
Quickshell.execDetached(["bash", "-c", `notify-send '${Translation.tr("Shell configuration failed to load")}' '${root.filePath}'`])
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +81,7 @@ Singleton {
|
||||
|
||||
function saveConfig() {
|
||||
const plainConfig = ObjectUtils.toPlainObject(ConfigOptions)
|
||||
Hyprland.dispatch(`exec echo '${StringUtils.shellSingleQuoteEscape(JSON.stringify(plainConfig, null, 2))}' > '${root.filePath}'`)
|
||||
Quickshell.execDetached(["bash", "-c", `echo '${StringUtils.shellSingleQuoteEscape(JSON.stringify(plainConfig, null, 2))}' > '${FileUtils.trimFileProtocol(root.filePath)}'`])
|
||||
}
|
||||
|
||||
function setConfigValueAndSave(nestedKey, value, preventNextNotification = true) {
|
||||
@@ -105,7 +104,7 @@ Singleton {
|
||||
} else {
|
||||
root.applyConfig(configFileView.text())
|
||||
if (!root.preventNextNotification) {
|
||||
// Hyprland.dispatch(`exec notify-send "${Translation.tr("Shell configuration reloaded")}" "${root.filePath}"`)
|
||||
// Quickshell.execDetached(["bash", "-c", `notify-send '${qsTr("Shell configuration reloaded")}' '${root.filePath}'`])
|
||||
} else {
|
||||
root.preventNextNotification = false;
|
||||
}
|
||||
@@ -129,9 +128,9 @@ Singleton {
|
||||
if(error == FileViewError.FileNotFound) {
|
||||
console.log("[ConfigLoader] File not found, creating new file.")
|
||||
root.saveConfig()
|
||||
Hyprland.dispatch(`exec notify-send "${Translation.tr("Shell configuration created")}" "${root.filePath}"`)
|
||||
Quickshell.execDetached(["bash", "-c", `notify-send '${Translation.tr("Shell configuration created")}' '${root.filePath}'`])
|
||||
} else {
|
||||
Hyprland.dispatch(`exec notify-send "${Translation.tr("Shell configuration failed to load")}" "${root.filePath}"`)
|
||||
Quickshell.execDetached(["bash", "-c", `notify-send '${Translation.tr("Shell configuration failed to load")}' '${root.filePath}'`])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ pragma ComponentBehavior: Bound
|
||||
* A nice wrapper for date and time strings.
|
||||
*/
|
||||
Singleton {
|
||||
property string time: Qt.formatDateTime(clock.date, ConfigOptions?.time.format ?? "hh:mm")
|
||||
property string date: Qt.formatDateTime(clock.date, ConfigOptions?.time.dateFormat ?? "dddd, dd/MM")
|
||||
property string collapsedCalendarFormat: Qt.formatDateTime(clock.date, "dd MMMM yyyy")
|
||||
property string time: Qt.locale().toString(clock.date, ConfigOptions?.time.format ?? "hh:mm")
|
||||
property string date: Qt.locale().toString(clock.date, ConfigOptions?.time.dateFormat ?? "dddd, dd/MM")
|
||||
property string collapsedCalendarFormat: Qt.locale().toString(clock.date, "dd MMMM yyyy")
|
||||
property string uptime: "0h, 0m"
|
||||
|
||||
SystemClock {
|
||||
|
||||
@@ -20,15 +20,15 @@ Singleton {
|
||||
}
|
||||
|
||||
function enableNextTime() {
|
||||
Hyprland.dispatch(`exec rm -f '${root.firstRunFilePath}'`)
|
||||
Quickshell.execDetached(["rm", "-f", root.firstRunFilePath])
|
||||
}
|
||||
function disableNextTime() {
|
||||
Hyprland.dispatch(`exec echo '${root.firstRunFileContent}' > '${root.firstRunFilePath}'`)
|
||||
Quickshell.execDetached(["bash", "-c", `echo '${root.firstRunFileContent}' > '${root.firstRunFilePath}'`])
|
||||
}
|
||||
|
||||
function handleFirstRun() {
|
||||
Hyprland.dispatch(`exec swww query | grep 'image' || '${Directories.wallpaperSwitchScriptPath}' '${root.defaultWallpaperPath}'`)
|
||||
Hyprland.dispatch(`exec qs -p '${root.welcomeQmlPath}'`)
|
||||
Quickshell.execDetached(["bash", "-c", `swww query | grep 'image' || '${Directories.wallpaperSwitchScriptPath}' '${root.defaultWallpaperPath}'`])
|
||||
Quickshell.execDetached(["bash", "-c", `qs -p '${root.welcomeQmlPath}'`])
|
||||
}
|
||||
|
||||
FileView {
|
||||
|
||||
@@ -243,7 +243,7 @@ Singleton {
|
||||
root.list = JSON.parse(fileContents).map((notif) => {
|
||||
return notifComponent.createObject(root, {
|
||||
"id": notif.id,
|
||||
"actions": notif.actions,
|
||||
"actions": [], // Notification actions are meaningless if they're not tracked by the server or the sender is dead
|
||||
"appIcon": notif.appIcon,
|
||||
"appName": notif.appName,
|
||||
"body": notif.body,
|
||||
|
||||
@@ -9,10 +9,17 @@ import Quickshell.Io
|
||||
* Provides some system info: distro, username.
|
||||
*/
|
||||
Singleton {
|
||||
id: root
|
||||
property string distroName: "Unknown"
|
||||
property string distroId: "unknown"
|
||||
property string distroIcon: "linux-symbolic"
|
||||
property string username: "user"
|
||||
property string homeUrl: ""
|
||||
property string documentationUrl: ""
|
||||
property string supportUrl: ""
|
||||
property string bugReportUrl: ""
|
||||
property string privacyPolicyUrl: ""
|
||||
property string logo: ""
|
||||
|
||||
Timer {
|
||||
triggeredOnStart: true
|
||||
@@ -33,6 +40,20 @@ Singleton {
|
||||
const logoMatch = textOsRelease.match(/^LOGO=(.+)$/m)
|
||||
distroId = logoMatch ? logoMatch[1].replace(/"/g, "") : "unknown"
|
||||
|
||||
// Extract additional URLs and logo
|
||||
const homeUrlMatch = textOsRelease.match(/^HOME_URL="(.+?)"/m)
|
||||
homeUrl = homeUrlMatch ? homeUrlMatch[1] : ""
|
||||
const documentationUrlMatch = textOsRelease.match(/^DOCUMENTATION_URL="(.+?)"/m)
|
||||
documentationUrl = documentationUrlMatch ? documentationUrlMatch[1] : ""
|
||||
const supportUrlMatch = textOsRelease.match(/^SUPPORT_URL="(.+?)"/m)
|
||||
supportUrl = supportUrlMatch ? supportUrlMatch[1] : ""
|
||||
const bugReportUrlMatch = textOsRelease.match(/^BUG_REPORT_URL="(.+?)"/m)
|
||||
bugReportUrl = bugReportUrlMatch ? bugReportUrlMatch[1] : ""
|
||||
const privacyPolicyUrlMatch = textOsRelease.match(/^PRIVACY_POLICY_URL="(.+?)"/m)
|
||||
privacyPolicyUrl = privacyPolicyUrlMatch ? privacyPolicyUrlMatch[1] : ""
|
||||
const logoFieldMatch = textOsRelease.match(/^LOGO="?(.+?)"?$/m)
|
||||
logo = logoFieldMatch ? logoFieldMatch[1] : ""
|
||||
|
||||
// Update the distroIcon property based on distroId
|
||||
switch (distroId) {
|
||||
case "arch": distroIcon = "arch-symbolic"; break;
|
||||
@@ -57,7 +78,7 @@ Singleton {
|
||||
command: ["whoami"]
|
||||
stdout: SplitParser {
|
||||
onRead: data => {
|
||||
username = data.trim()
|
||||
root.username = data.trim()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,23 +20,36 @@ Singleton {
|
||||
|
||||
function releaseAllKeys() {
|
||||
const keycodes = Array.from(Array(249).keys());
|
||||
const releaseCommand = `ydotool key --key-delay 0 ${keycodes.map(keycode => `${keycode}:0`).join(" ")}`
|
||||
Hyprland.dispatch(`exec ${releaseCommand}`)
|
||||
Quickshell.execDetached([
|
||||
"ydotool",
|
||||
"key", "--key-delay", "0",
|
||||
...keycodes.map(keycode => `${keycode}:0`)
|
||||
])
|
||||
root.shiftMode = 0; // Reset shift mode
|
||||
}
|
||||
|
||||
function releaseShiftKeys() {
|
||||
const releaseCommand = `ydotool key --key-delay 0 ${root.shiftKeys.map(keycode => `${keycode}:0`).join(" ")}`
|
||||
Hyprland.dispatch(`exec ${releaseCommand}`)
|
||||
Quickshell.execDetached([
|
||||
"ydotool",
|
||||
"key", "--key-delay", "0",
|
||||
...root.shiftKeys.map(keycode => `${keycode}:0`)
|
||||
])
|
||||
root.shiftMode = 0; // Reset shift mode
|
||||
}
|
||||
|
||||
function press(keycode) {
|
||||
Hyprland.dispatch(`exec ydotool key --key-delay 0 ${keycode}:1`);
|
||||
Quickshell.execDetached([
|
||||
"ydotool",
|
||||
"key", "--key-delay", "0",
|
||||
`${keycode}:1`
|
||||
]);
|
||||
}
|
||||
|
||||
function release(keycode) {
|
||||
Hyprland.dispatch(`exec ydotool key --key-delay 0 ${keycode}:0`);
|
||||
Quickshell.execDetached([
|
||||
"ydotool",
|
||||
"key", "--key-delay", "0",
|
||||
`${keycode}:0`
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user