gui: fix an issue with waybar~
This commit is contained in:
parent
cd2440df0f
commit
7f4bbdf8a1
5 changed files with 40 additions and 35 deletions
|
@ -11,9 +11,9 @@
|
||||||
imports = [
|
imports = [
|
||||||
|
|
||||||
# Imports that add additional functionality
|
# Imports that add additional functionality
|
||||||
|
./waybar
|
||||||
./niri.nix
|
./niri.nix
|
||||||
./mako.nix
|
./mako.nix
|
||||||
./waybar.nix
|
|
||||||
./nirilock-fancy.nix
|
./nirilock-fancy.nix
|
||||||
|
|
||||||
# Core niri import.
|
# Core niri import.
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
commit 86ce9f7278edd5a27467caf3749e8a07e4588260
|
||||||
|
Author: Kate Adkins <kate@deprekated.net>
|
||||||
|
Date: Fri Nov 15 12:04:56 2024 -0700
|
||||||
|
|
||||||
|
fix null-deref due to unconstructed PrivacyNodeInfo
|
||||||
|
|
||||||
|
This would cause Waybar to crash if the privacy module ever got
|
||||||
|
e.g. a empty (but properly null-terminated) string for the
|
||||||
|
application_name.
|
||||||
|
|
||||||
|
diff --git a/src/util/pipewire/pipewire_backend.cpp b/src/util/pipewire/pipewire_backend.cpp
|
||||||
|
index 5bb7c19a..3b897178 100644
|
||||||
|
--- a/src/util/pipewire/pipewire_backend.cpp
|
||||||
|
+++ b/src/util/pipewire/pipewire_backend.cpp
|
||||||
|
@@ -126,6 +126,7 @@ void PipewireBackend::handleRegistryEventGlobal(uint32_t id, uint32_t permission
|
||||||
|
if (proxy == nullptr) return;
|
||||||
|
|
||||||
|
auto *pNodeInfo = (PrivacyNodeInfo *)pw_proxy_get_user_data(proxy);
|
||||||
|
+ new(pNodeInfo) PrivacyNodeInfo{};
|
||||||
|
pNodeInfo->id = id;
|
||||||
|
pNodeInfo->data = this;
|
||||||
|
pNodeInfo->type = mediaType;
|
||||||
|
@@ -142,6 +143,7 @@ void PipewireBackend::handleRegistryEventGlobalRemove(uint32_t id) {
|
||||||
|
mutex_.lock();
|
||||||
|
auto iter = privacy_nodes.find(id);
|
||||||
|
if (iter != privacy_nodes.end()) {
|
||||||
|
+ privacy_nodes[id]->~PrivacyNodeInfo();
|
||||||
|
privacy_nodes.erase(id);
|
||||||
|
}
|
||||||
|
mutex_.unlock();
|
|
@ -5,7 +5,6 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
deprekages,
|
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
@ -93,37 +92,6 @@ in
|
||||||
};
|
};
|
||||||
colors = config.lib.stylix.colors;
|
colors = config.lib.stylix.colors;
|
||||||
|
|
||||||
# Create a TODO-list handler.
|
|
||||||
waybar-todos = pkgs.writeScriptBin "waybar-todos" ''
|
|
||||||
#!${pkgs.python3}/bin/python3
|
|
||||||
|
|
||||||
import subprocess
|
|
||||||
import json
|
|
||||||
|
|
||||||
def get_count(*filter):
|
|
||||||
return int(subprocess.run(['${pkgs.taskwarrior3}/bin/task', 'count', *filter], capture_output=True, text=True).stdout)
|
|
||||||
|
|
||||||
def get_tasks(*filter):
|
|
||||||
return subprocess.run(['${pkgs.taskwarrior3}/bin/task', 'ls', *filter], capture_output=True, text=True).stdout
|
|
||||||
|
|
||||||
priority = get_count("(+TODAY or +OVERDUE)", "priority:H")
|
|
||||||
due_today = get_count("+TODAY")
|
|
||||||
overdue = get_count("+OVERDUE")
|
|
||||||
|
|
||||||
overdue_color = ' color="#dc322f" ' if overdue else ' color="#93a1a1" '
|
|
||||||
overdue_text = "<span {overdue_color}> {overdue} </span>".format(overdue=overdue, overdue_color=overdue_color) if overdue else ""
|
|
||||||
|
|
||||||
priority_text = ' {priority} '.format(priority=priority) if priority else ""
|
|
||||||
|
|
||||||
today_color = "" if due_today else ' color="#93a1a1" '
|
|
||||||
|
|
||||||
data = {}
|
|
||||||
data['text'] = "{overdue_text}{priority_text}<span {today_color}> {due_today} </span>".format(overdue_text=overdue_text, due_today=due_today, today_color=today_color, priority_text=priority_text)
|
|
||||||
data['tooltip'] = get_tasks("(+TODAY or +OVERDUE)")
|
|
||||||
|
|
||||||
print(json.dumps(data))
|
|
||||||
'';
|
|
||||||
|
|
||||||
# From the Waybar wiki.
|
# From the Waybar wiki.
|
||||||
waybar-events = pkgs.writeScriptBin "waybar-events" ''
|
waybar-events = pkgs.writeScriptBin "waybar-events" ''
|
||||||
#!${pkgs.python3}/bin/python3
|
#!${pkgs.python3}/bin/python3
|
||||||
|
@ -226,7 +194,13 @@ in
|
||||||
programs.waybar = {
|
programs.waybar = {
|
||||||
enable = true;
|
enable = true;
|
||||||
systemd.enable = true;
|
systemd.enable = true;
|
||||||
|
|
||||||
|
# Replace the package with a patched one.
|
||||||
|
package = pkgs.waybar.overrideAttrs (prev: {
|
||||||
|
patches = prev.patches ++ [ ./01-fix-privacy-null-pointer-deref.patch ];
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.waybar.settings.mainBar = {
|
programs.waybar.settings.mainBar = {
|
||||||
layer = "top";
|
layer = "top";
|
||||||
#mode = "overlay";
|
#mode = "overlay";
|
||||||
|
@ -245,7 +219,7 @@ in
|
||||||
"custom/events"
|
"custom/events"
|
||||||
"privacy"
|
"privacy"
|
||||||
"custom/yubikey"
|
"custom/yubikey"
|
||||||
#"wireplumber"
|
"wireplumber"
|
||||||
"custom/puckdown"
|
"custom/puckdown"
|
||||||
"battery"
|
"battery"
|
||||||
];
|
];
|
||||||
|
@ -323,7 +297,7 @@ in
|
||||||
wireplumber = {
|
wireplumber = {
|
||||||
on-click = "${pkgs.pavucontrol}/bin/pavucontrol -t 1";
|
on-click = "${pkgs.pavucontrol}/bin/pavucontrol -t 1";
|
||||||
format = "{icon} {volume}%";
|
format = "{icon} {volume}%";
|
||||||
tooltip-format = "${icons.volume.source} {node_name}";
|
tooltip-format = "${icons.volume.source}";
|
||||||
format-muted = "${icons.volume.muted}";
|
format-muted = "${icons.volume.muted}";
|
||||||
format-icons = icons.volume.levels;
|
format-icons = icons.volume.levels;
|
||||||
reverse-scrolling = 1;
|
reverse-scrolling = 1;
|
|
@ -116,6 +116,7 @@ with pkgs;
|
||||||
qpdf
|
qpdf
|
||||||
rclone
|
rclone
|
||||||
ripgrep
|
ripgrep
|
||||||
|
rr
|
||||||
unzip
|
unzip
|
||||||
unar
|
unar
|
||||||
unrar
|
unrar
|
||||||
|
|
Loading…
Add table
Reference in a new issue