mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 07:22:50 -05:00
unified SessionService to support elogind equivalents of systemd
commands
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtCore
|
import QtCore
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtCore
|
import QtCore
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtCore
|
import QtCore
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import qs.Services
|
import qs.Services
|
||||||
pragma Singleton
|
|
||||||
|
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtCore
|
import QtCore
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ DankModal {
|
|||||||
CompositorService.logout()
|
CompositorService.logout()
|
||||||
break
|
break
|
||||||
case "suspend":
|
case "suspend":
|
||||||
Quickshell.execDetached(["systemctl", "suspend"])
|
SessionService.suspend()
|
||||||
break
|
break
|
||||||
case "reboot":
|
case "reboot":
|
||||||
Quickshell.execDetached(["systemctl", "reboot"])
|
SessionService.reboot()
|
||||||
break
|
break
|
||||||
case "poweroff":
|
case "poweroff":
|
||||||
Quickshell.execDetached(["systemctl", "poweroff"])
|
SessionService.poweroff()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import qs.Common
|
|||||||
import qs.Modules.Settings
|
import qs.Modules.Settings
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
DankModal {
|
DankModal {
|
||||||
id: settingsModal
|
id: settingsModal
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import qs.Common
|
|||||||
import qs.Modals
|
import qs.Modals
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
@@ -966,8 +965,7 @@ Item {
|
|||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
powerDialog.close()
|
powerDialog.close()
|
||||||
Quickshell.execDetached(
|
SessionService.poweroff()
|
||||||
["systemctl", "poweroff"])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1077,7 +1075,7 @@ Item {
|
|||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
rebootDialog.close()
|
rebootDialog.close()
|
||||||
Quickshell.execDetached(["systemctl", "reboot"])
|
SessionService.reboot()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ DankOSD {
|
|||||||
enableMouseInteraction: false
|
enableMouseInteraction: false
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: IdleInhibitorService
|
target: SessionService
|
||||||
function onInhibitorChanged() {
|
function onInhibitorChanged() {
|
||||||
root.show()
|
root.show()
|
||||||
}
|
}
|
||||||
@@ -20,8 +20,8 @@ DankOSD {
|
|||||||
|
|
||||||
content: DankIcon {
|
content: DankIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
name: IdleInhibitorService.idleInhibited ? "motion_sensor_active" : "motion_sensor_idle"
|
name: SessionService.idleInhibited ? "motion_sensor_active" : "motion_sensor_idle"
|
||||||
size: Theme.iconSize
|
size: Theme.iconSize
|
||||||
color: IdleInhibitorService.idleInhibited ? Theme.primary : Theme.outline
|
color: SessionService.idleInhibited ? Theme.primary : Theme.outline
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ Rectangle {
|
|||||||
height: 30
|
height: 30
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: {
|
color: {
|
||||||
const baseColor = mouseArea.containsMouse ? Theme.primaryPressed : (IdleInhibitorService.idleInhibited ? Theme.primaryHover : Theme.secondaryHover)
|
const baseColor = mouseArea.containsMouse ? Theme.primaryPressed : (SessionService.idleInhibited ? Theme.primaryHover : Theme.secondaryHover)
|
||||||
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b,
|
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b,
|
||||||
baseColor.a * Theme.widgetTransparency)
|
baseColor.a * Theme.widgetTransparency)
|
||||||
}
|
}
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
name: IdleInhibitorService.idleInhibited ? "motion_sensor_active" : "motion_sensor_idle"
|
name: SessionService.idleInhibited ? "motion_sensor_active" : "motion_sensor_idle"
|
||||||
size: Theme.iconSize - 6
|
size: Theme.iconSize - 6
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ Rectangle {
|
|||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
IdleInhibitorService.toggleIdleInhibit()
|
SessionService.toggleIdleInhibit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# DankMaterialShell
|
# DankMaterialShell (dms)
|
||||||
|
|
||||||
<div align=center>
|
<div align=center>
|
||||||
|
|
||||||
@@ -136,11 +136,12 @@ For detailed Hyprland installation instructions, see the [Hyprland wiki](https:/
|
|||||||
|
|
||||||
### Quick Start
|
### Quick Start
|
||||||
|
|
||||||
|
We don't have a nice install setup yet to just isntall everything with some nice default dotfiles, but it's coming soon™ (it's pretty easy though, especially with niri)
|
||||||
|
|
||||||
\*If you do not already have niri or Hyprland, see the Compositor Setup section below
|
\*If you do not already have niri or Hyprland, see the Compositor Setup section below
|
||||||
|
|
||||||
**Dependencies:**
|
**Dependencies:**
|
||||||
|
|
||||||
|
|
||||||
# Arch Linux
|
# Arch Linux
|
||||||
```bash
|
```bash
|
||||||
paru -S quickshell-git ttf-material-symbols-variable-git inter-font ttf-fira-code
|
paru -S quickshell-git ttf-material-symbols-variable-git inter-font ttf-fira-code
|
||||||
@@ -163,7 +164,6 @@ fc-cache -f
|
|||||||
|
|
||||||
**Get the shell:**
|
**Get the shell:**
|
||||||
|
|
||||||
|
|
||||||
# Arch linux available via AUR
|
# Arch linux available via AUR
|
||||||
```bash
|
```bash
|
||||||
paru -S dankmaterialshell-git
|
paru -S dankmaterialshell-git
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import qs.Common
|
import qs.Common
|
||||||
pragma Singleton
|
|
||||||
|
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import qs.Common
|
import qs.Common
|
||||||
pragma Singleton
|
|
||||||
|
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
@@ -501,8 +501,8 @@ Singleton {
|
|||||||
|
|
||||||
function getProcessIcon(command) {
|
function getProcessIcon(command) {
|
||||||
const cmd = command.toLowerCase()
|
const cmd = command.toLowerCase()
|
||||||
if (cmd.includes("firefox") || cmd.includes("chrome") || cmd.includes(
|
if (cmd.includes("firefox") || cmd.includes("chrome") ||
|
||||||
"browser"))
|
cmd.includes("browser") || cmd.includes("chromium"))
|
||||||
return "web"
|
return "web"
|
||||||
if (cmd.includes("code") || cmd.includes("editor")
|
if (cmd.includes("code") || cmd.includes("editor")
|
||||||
|| cmd.includes("vim"))
|
|| cmd.includes("vim"))
|
||||||
@@ -515,8 +515,9 @@ Singleton {
|
|||||||
return "music_note"
|
return "music_note"
|
||||||
if (cmd.includes("video") || cmd.includes("vlc") || cmd.includes("mpv"))
|
if (cmd.includes("video") || cmd.includes("vlc") || cmd.includes("mpv"))
|
||||||
return "play_circle"
|
return "play_circle"
|
||||||
if (cmd.includes("systemd") || cmd.includes("kernel") || cmd.includes(
|
if (cmd.includes("systemd") || cmd.includes("elogind") ||
|
||||||
"kthread"))
|
cmd.includes("kernel") || cmd.includes("kthread") ||
|
||||||
|
cmd.includes("kworker"))
|
||||||
return "settings"
|
return "settings"
|
||||||
return "memory"
|
return "memory"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,18 +1,47 @@
|
|||||||
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import qs.Common
|
import qs.Common
|
||||||
pragma Singleton
|
|
||||||
|
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property bool isElogind: false
|
||||||
property bool inhibitorAvailable: true
|
property bool inhibitorAvailable: true
|
||||||
property bool idleInhibited: false
|
property bool idleInhibited: false
|
||||||
property string inhibitReason: "Keep system awake"
|
property string inhibitReason: "Keep system awake"
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
detectElogindProcess.running = true
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: detectElogindProcess
|
||||||
|
running: false
|
||||||
|
command: ["sh", "-c", "ps -eo comm= | grep -Fx elogind"]
|
||||||
|
|
||||||
|
onExited: function (exitCode) {
|
||||||
|
console.log("SessionService: Elogind detection exited with code", exitCode)
|
||||||
|
isElogind = (exitCode === 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function suspend() {
|
||||||
|
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "suspend"])
|
||||||
|
}
|
||||||
|
|
||||||
|
function reboot() {
|
||||||
|
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "reboot"])
|
||||||
|
}
|
||||||
|
|
||||||
|
function poweroff() {
|
||||||
|
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "poweroff"])
|
||||||
|
}
|
||||||
|
|
||||||
|
// * Idle Inhibitor
|
||||||
signal inhibitorChanged
|
signal inhibitorChanged
|
||||||
|
|
||||||
function enableIdleInhibit() {
|
function enableIdleInhibit() {
|
||||||
@@ -59,7 +88,7 @@ Singleton {
|
|||||||
return ["true"]
|
return ["true"]
|
||||||
}
|
}
|
||||||
|
|
||||||
return ["systemd-inhibit", "--what=idle", "--who=quickshell", "--why="
|
return [isElogind ? "elogind-inhibit" : "systemd-inhibit", "--what=idle", "--who=quickshell", "--why="
|
||||||
+ inhibitReason, "--mode=block", "sleep", "infinity"]
|
+ inhibitReason, "--mode=block", "sleep", "infinity"]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +96,7 @@ Singleton {
|
|||||||
|
|
||||||
onExited: function (exitCode) {
|
onExited: function (exitCode) {
|
||||||
if (idleInhibited && exitCode !== 0) {
|
if (idleInhibited && exitCode !== 0) {
|
||||||
console.warn("IdleInhibitorService: Inhibitor process crashed with exit code:",
|
console.warn("SessionService: Inhibitor process crashed with exit code:",
|
||||||
exitCode)
|
exitCode)
|
||||||
idleInhibited = false
|
idleInhibited = false
|
||||||
ToastService.showWarning("Idle inhibitor failed")
|
ToastService.showWarning("Idle inhibitor failed")
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
pragma ComponentBehavior
|
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
|
|||||||
Reference in New Issue
Block a user