Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nwg-bar: init at unstable-2021-09-23 #155129

Merged
merged 1 commit into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions pkgs/applications/misc/nwg-bar/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{ lib, buildGoModule, fetchFromGitHub, pkg-config, gtk3, gtk-layer-shell }:

buildGoModule rec {
pname = "nwg-bar";
version = "unstable-2021-09-23";

src = fetchFromGitHub {
owner = "nwg-piotr";
repo = pname;
rev = "7dd7df3cd9a9e78fe477e88e0f3cb97309d50ff5";
sha256 = "sha256-piysF19WDjb/EGI9MBepYrOrQL9C1fsoq05AP8CYN58=";
};

patches = [ ./fix-paths.patch ];
postPatch = ''
substituteInPlace config/bar.json --subst-var out
substituteInPlace tools.go --subst-var out
'';

vendorSha256 = "sha256-dgOwflNRb+11umFykozL8DQ50dLbhbMCmCyKmLlW7rw=";

nativeBuildInputs = [ pkg-config ];

buildInputs = [ gtk3 gtk-layer-shell ];

preInstall = ''
mkdir -p $out/share/nwg-bar
cp -r config/* images $out/share/nwg-bar
'';

meta = with lib; {
description =
"GTK3-based button bar for sway and other wlroots-based compositors";
homepage = "https://github.com/nwg-piotr/nwg-bar";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [ sei40kr ];
};
}
47 changes: 47 additions & 0 deletions pkgs/applications/misc/nwg-bar/fix-paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
diff --git a/config/bar.json b/config/bar.json
index 6c456e7..98527cb 100644
--- a/config/bar.json
+++ b/config/bar.json
@@ -2,21 +2,21 @@
{
"label": "Lock",
"exec": "swaylock -f -c 000000",
- "icon": "/usr/share/nwg-bar/images/system-lock-screen.svg"
+ "icon": "@out@/share/nwg-bar/images/system-lock-screen.svg"
},
{
"label": "Logout",
"exec": "swaymsg exit",
- "icon": "/usr/share/nwg-bar/images/system-log-out.svg"
+ "icon": "@out@/share/nwg-bar/images/system-log-out.svg"
},
{
"label": "Reboot",
"exec": "systemctl reboot",
- "icon": "/usr/share/nwg-bar/images/system-reboot.svg"
+ "icon": "@out@/share/nwg-bar/images/system-reboot.svg"
},
{
"label": "Shutdown",
"exec": "systemctl -i poweroff",
- "icon": "/usr/share/nwg-bar/images/system-shutdown.svg"
+ "icon": "@out@/share/nwg-bar/images/system-shutdown.svg"
}
]
\ No newline at end of file
diff --git a/tools.go b/tools.go
index f97751e..987163e 100644
--- a/tools.go
+++ b/tools.go
@@ -45,10 +45,7 @@ func configDir() string {
}

func getDataHome() string {
- if os.Getenv("XDG_DATA_HOME") != "" {
- return os.Getenv("XDG_DATA_HOME")
- }
- return "/usr/share/"
+ return "@out@/share/"
}

func createDir(dir string) {
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27744,6 +27744,8 @@ with pkgs;

novnc = callPackage ../applications/networking/novnc { };

nwg-bar = callPackage ../applications/misc/nwg-bar { };

nwg-drawer = callPackage ../applications/misc/nwg-drawer { };

nwg-launchers = callPackage ../applications/misc/nwg-launchers { };
Expand Down