Compare commits

..

No commits in common. "7e6ff4bc48a9f08d4a336a348cb09e37f20da313" and "6f80224d6c3b187665d445da83057b8dabfcfa57" have entirely different histories.

5 changed files with 12 additions and 152 deletions

View file

@ -83,7 +83,7 @@ PanelWindow {
M.Memory { visible: M.Modules.memory } M.Memory { visible: M.Modules.memory }
M.Disk { visible: M.Modules.disk } M.Disk { visible: M.Modules.disk }
M.Battery {} M.Battery {}
M.Wlogout { bar: bar; visible: M.Modules.wlogout } M.Wlogout { visible: M.Modules.wlogout }
} }
} }
} }

View file

@ -1,131 +0,0 @@
import QtQuick
import Quickshell
import Quickshell.Io
import Quickshell.Wayland
import "." as M
PanelWindow {
id: menuWindow
required property var screen
required property real anchorX
signal menuClosed()
visible: true
color: "transparent"
WlrLayershell.layer: WlrLayer.Overlay
WlrLayershell.exclusiveZone: 0
WlrLayershell.namespace: "nova-powermenu"
anchors.top: true
anchors.left: true
anchors.right: true
anchors.bottom: true
MouseArea {
anchors.fill: parent
onClicked: menuWindow.menuClosed()
}
Item {
id: panel
x: Math.max(0, Math.min(
Math.round(menuWindow.anchorX - menuCol.width / 2),
menuWindow.width - menuCol.width
))
y: 0
width: menuCol.width
height: menuCol.height
MouseArea {
anchors.fill: parent
}
Rectangle {
anchors.fill: parent
color: M.Theme.base01
opacity: Math.max(M.Theme.barOpacity, 0.85)
topLeftRadius: 0
topRightRadius: 0
bottomLeftRadius: M.Theme.radius
bottomRightRadius: M.Theme.radius
}
Column {
id: menuCol
width: 180
topPadding: 4
bottomPadding: 4
spacing: 2
Repeater {
model: [
{ label: "Lock", icon: "\uF023", cmd: ["loginctl", "lock-session"], color: M.Theme.base0D },
{ label: "Suspend", icon: "\uF186", cmd: ["systemctl", "suspend"], color: M.Theme.base0E },
{ label: "Logout", icon: "\uF2F5", cmd: ["loginctl", "terminate-user", ""], color: M.Theme.base0A },
{ label: "Reboot", icon: "\uF021", cmd: ["systemctl", "reboot"], color: M.Theme.base09 },
{ label: "Shutdown", icon: "\uF011", cmd: ["systemctl", "poweroff"], color: M.Theme.base08 }
]
delegate: Item {
id: entry
required property var modelData
required property int index
width: menuCol.width
height: 32
Rectangle {
anchors.fill: parent
anchors.leftMargin: 4
anchors.rightMargin: 4
color: entryArea.containsMouse ? M.Theme.base02 : "transparent"
radius: M.Theme.radius
}
Text {
id: entryIcon
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 12
text: entry.modelData.icon
color: entry.modelData.color
font.pixelSize: M.Theme.fontSize + 1
font.family: M.Theme.iconFontFamily
}
Text {
anchors.verticalCenter: parent.verticalCenter
anchors.left: entryIcon.right
anchors.leftMargin: 10
text: entry.modelData.label
color: M.Theme.base05
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily
}
Process {
id: runner
command: entry.modelData.cmd
}
MouseArea {
id: entryArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
runner.running = true;
menuWindow.menuClosed();
}
}
}
}
}
}
}

View file

@ -1,27 +1,20 @@
import QtQuick import QtQuick
import Quickshell.Io
import "." as M import "." as M
M.BarIcon { M.BarIcon {
id: root
icon: "\uF011" icon: "\uF011"
color: M.Theme.base08 color: M.Theme.base08
tooltip: "Power menu" tooltip: "Open logout menu"
required property var bar Process {
id: proc
command: ["wlogout"]
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: menuLoader.active = !menuLoader.active onClicked: proc.running = true
}
Loader {
id: menuLoader
active: false
sourceComponent: M.PowerMenu {
screen: root.bar.screen
anchorX: root.mapToGlobal(root.width / 2, 0).x
onMenuClosed: menuLoader.active = false
}
} }
} }

View file

@ -11,7 +11,6 @@ Clock 1.0 Clock.qml
Volume 1.0 Volume.qml Volume 1.0 Volume.qml
Tray 1.0 Tray.qml Tray 1.0 Tray.qml
TrayMenu 1.0 TrayMenu.qml TrayMenu 1.0 TrayMenu.qml
PowerMenu 1.0 PowerMenu.qml
ThemedIcon 1.0 ThemedIcon.qml ThemedIcon 1.0 ThemedIcon.qml
Battery 1.0 Battery.qml Battery 1.0 Battery.qml
Mpris 1.0 Mpris.qml Mpris 1.0 Mpris.qml

View file

@ -111,6 +111,8 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
programs.nova-shell.theme = lib.mkIf stylixAvailable (lib.mkDefault stylixTheme);
home.packages = home.packages =
[ [
self.packages.${pkgs.stdenv.hostPlatform.system}.nova-shell-cli self.packages.${pkgs.stdenv.hostPlatform.system}.nova-shell-cli
@ -122,11 +124,8 @@ in
(pkgs.formats.json { }).generate "nova-shell-modules.json" cfg.modules; (pkgs.formats.json { }).generate "nova-shell-modules.json" cfg.modules;
xdg.configFile."nova-shell/theme.json".source = xdg.configFile."nova-shell/theme.json".source =
let (pkgs.formats.json { }).generate "nova-shell-theme.json"
stylixDefaults = if stylixAvailable then stylixTheme else { }; cfg.theme;
finalTheme = lib.recursiveUpdate stylixDefaults cfg.theme;
in
(pkgs.formats.json { }).generate "nova-shell-theme.json" finalTheme;
systemd.user.services.nova-shell = lib.mkIf cfg.systemd.enable { systemd.user.services.nova-shell = lib.mkIf cfg.systemd.enable {
Unit = { Unit = {