Compare commits

..

No commits in common. "a53616523b63ea87db99f48f6e75d3fa55939951" and "d6d108ee7ce45208b43ba5d9953d52b881cc2efa" have entirely different histories.

4 changed files with 65 additions and 71 deletions

View file

@ -27,8 +27,6 @@ QtObject {
property bool battery: true property bool battery: true
property bool wlogout: true property bool wlogout: true
property var weatherArgs: ["--nerd"]
property FileView _file: FileView { property FileView _file: FileView {
path: (Quickshell.env("XDG_CONFIG_HOME") || (Quickshell.env("HOME") + "/.config")) + "/nova-shell/modules.json" path: (Quickshell.env("XDG_CONFIG_HOME") || (Quickshell.env("HOME") + "/.config")) + "/nova-shell/modules.json"
watchChanges: true watchChanges: true
@ -47,7 +45,5 @@ QtObject {
if (k in root && typeof root[k] === "boolean") if (k in root && typeof root[k] === "boolean")
root[k] = data[k]; root[k] = data[k];
} }
if (Array.isArray(data.weatherArgs))
root.weatherArgs = data.weatherArgs;
} }
} }

View file

@ -3,8 +3,10 @@ import Quickshell
import Quickshell.Wayland import Quickshell.Wayland
import "." as M import "." as M
// Empty region = no input area clicks pass through to windows below
// Draws rounded black corners at the edges of each screen. // Draws rounded black corners at the edges of each screen.
// Disabled when screenRadius is 0. // Disabled when screenRadius is 0 (the default).
Item { Item {
id: root id: root
@ -12,66 +14,74 @@ Item {
readonly property int _r: M.Theme.screenRadius readonly property int _r: M.Theme.screenRadius
component Corner: PanelWindow { Repeater {
id: win model: root._r > 0 ? [
{ top: true, left: true, right: false, bottom: false, corner: 0 },
{ top: true, left: false, right: true, bottom: false, corner: 1 },
{ top: false, left: true, right: false, bottom: true, corner: 2 },
{ top: false, left: false, right: true, bottom: true, corner: 3 }
] : []
property int corner: 0 delegate: PanelWindow {
id: cornerWindow
screen: root.screen required property var modelData
visible: root._r > 0
color: "transparent"
WlrLayershell.layer: WlrLayer.Overlay screen: root.screen
WlrLayershell.exclusiveZone: 0 color: "transparent"
WlrLayershell.namespace: "nova-corners"
mask: Region {}
implicitWidth: root._r WlrLayershell.layer: WlrLayer.Overlay
implicitHeight: root._r WlrLayershell.exclusiveZone: 0
WlrLayershell.namespace: "nova-corners"
mask: Region {}
Canvas { anchors.top: cornerWindow.modelData.top
anchors.fill: parent anchors.left: cornerWindow.modelData.left
onPaint: { anchors.right: cornerWindow.modelData.right
const r = root._r; anchors.bottom: cornerWindow.modelData.bottom
const ctx = getContext("2d");
ctx.clearRect(0, 0, r, r);
ctx.fillStyle = "black";
ctx.beginPath();
switch (win.corner) { implicitWidth: root._r
case 0: // top-left implicitHeight: root._r
ctx.moveTo(0, 0);
ctx.lineTo(r, 0); Canvas {
ctx.arc(r, r, r, -Math.PI / 2, Math.PI, true); anchors.fill: parent
ctx.closePath(); onPaint: {
break; const r = root._r;
case 1: // top-right const ctx = getContext("2d");
ctx.moveTo(r, 0); ctx.clearRect(0, 0, r, r);
ctx.lineTo(0, 0); ctx.fillStyle = "black";
ctx.arc(0, r, r, -Math.PI / 2, 0, false); ctx.beginPath();
ctx.closePath();
break; switch (cornerWindow.modelData.corner) {
case 2: // bottom-left case 0: // top-left
ctx.moveTo(0, r); ctx.moveTo(0, 0);
ctx.lineTo(0, 0); ctx.lineTo(r, 0);
ctx.arc(r, 0, r, Math.PI, Math.PI / 2, true); ctx.arc(r, r, r, -Math.PI / 2, Math.PI, true);
ctx.closePath(); ctx.closePath();
break; break;
case 3: // bottom-right case 1: // top-right
ctx.moveTo(r, r); ctx.moveTo(r, 0);
ctx.lineTo(r, 0); ctx.lineTo(0, 0);
ctx.arc(0, 0, r, 0, Math.PI / 2, false); ctx.arc(0, r, r, -Math.PI / 2, 0, false);
ctx.closePath(); ctx.closePath();
break; break;
case 2: // bottom-left
ctx.moveTo(0, r);
ctx.lineTo(0, 0);
ctx.arc(r, 0, r, Math.PI, Math.PI / 2, true);
ctx.closePath();
break;
case 3: // bottom-right
ctx.moveTo(r, r);
ctx.lineTo(r, 0);
ctx.arc(0, 0, r, 0, Math.PI / 2, false);
ctx.closePath();
break;
}
ctx.fill();
} }
ctx.fill();
} }
} }
} }
Corner { corner: 0; anchors.top: true; anchors.left: true }
Corner { corner: 1; anchors.top: true; anchors.right: true }
Corner { corner: 2; anchors.bottom: true; anchors.left: true }
Corner { corner: 3; anchors.bottom: true; anchors.right: true }
} }

View file

@ -12,7 +12,7 @@ M.BarSection {
Process { Process {
id: proc id: proc
running: true running: true
command: ["wttrbar"].concat(M.Modules.weatherArgs) command: ["wttrbar", "--nerd"]
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: { onStreamFinished: {
try { try {

View file

@ -86,17 +86,6 @@ in
}; };
}; };
weatherArgs = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ "--nerd" ];
description = "Arguments passed to wttrbar.";
example = [
"--nerd"
"--location"
"Berlin"
];
};
theme = lib.mkOption { theme = lib.mkOption {
type = lib.types.attrsOf lib.types.anything; type = lib.types.attrsOf lib.types.anything;
default = { }; default = { };
@ -131,8 +120,7 @@ in
++ lib.optional cfg.modules.weather pkgs.wttrbar; ++ lib.optional cfg.modules.weather pkgs.wttrbar;
xdg.configFile."nova-shell/modules.json".source = xdg.configFile."nova-shell/modules.json".source =
(pkgs.formats.json { }).generate "nova-shell-modules.json" (pkgs.formats.json { }).generate "nova-shell-modules.json" cfg.modules;
(cfg.modules // { weatherArgs = cfg.weatherArgs; });
xdg.configFile."nova-shell/theme.json".source = xdg.configFile."nova-shell/theme.json".source =
let let