README.md
1# nwg-bar
2
3This program is a part of the [nwg-shell](https://github.com/nwg-piotr/nwg-shell) project.
4
5nwg-bar is a Golang replacement to the `nwgbar` command (a part of
6[nwg-launchers](https://github.com/nwg-piotr/nwg-launchers)), with some improvements. Aimed at sway, works with
7wlroots-based compositors only.
8
9The `nwg-bar` command creates a button bar on the basis of a JSON template placed in the `~/.config/nwg-bar/` folder.
10By default the command displays a horizontal bar in the center
11of the screen. Use command line arguments to change the placement.
12
13![screenshot.png](https://scrot.cloud/images/2021/07/01/screenshot.png)
14
15## Installation
16
17### Requirements
18
19- `go` 1.16 (just to build)
20- `gtk3`
21- `gtk-layer-shell`
22
23### Steps
24
251. Clone the repository, cd into it.
262. Install golang libraries with `make get`. First time it may take ages, be patient.
273. `make build`
284. `sudo make install`
29
30If your machine is x86_64, you may skip 2 and 3, and just install the provided binary with `sudo make install`.
31
32## Running
33
34```text
35Usage of nwg-bar:
36 -a string
37 Alignment in full width/height: "start" or "end" (default "middle")
38 -f take Full screen width/height
39 -i int
40 Icon size (default 48)
41 -mb int
42 Margin Bottom
43 -ml int
44 Margin Left
45 -mr int
46 Margin Right
47 -mt int
48 Margin Top
49 -o string
50 name of Output to display the bar on
51 -p string
52 Position: "bottom", "top", "left" or "right" (default "center")
53 -s string
54 csS file name (default "style.css")
55 -t string
56 Template file name (default "bar.json")
57 -v display Version information
58 -x open on top layer witch eXclusive zone
59```
60
61*NOTE: for now the `-o` argument works on sway only.*
62
63## Templates
64
65Templates in JSON format should be placed in the `~/.config/nwg-bar` folder. The default `bar.json` template creates
66 sample Exit menu for sway on Arch Linux. You may adjust it to your system, and also add as many other templates,
67 as you need. Use the `-t somename.json` argument to specify the template name to use.
68
69 ```json
70 [
71 {
72 "label": "Lock",
73 "exec": "swaylock -f -c 000000",
74 "icon": "/usr/share/nwg-bar/images/system-lock-screen.svg"
75 },
76 {
77 "label": "Logout",
78 "exec": "swaymsg exit",
79 "icon": "/usr/share/nwg-bar/images/system-log-out.svg"
80 },
81 {
82 "label": "Reboot",
83 "exec": "systemctl reboot",
84 "icon": "/usr/share/nwg-bar/images/system-reboot.svg"
85 },
86 {
87 "label": "Shutdown",
88 "exec": "systemctl -i poweroff",
89 "icon": "/usr/share/nwg-bar/images/system-shutdown.svg"
90 }
91]
92 ```
93
94 - `label` field defines the button label;
95 - `exec` field defines the command to execute on button click;
96 - `icon` field specifies the button icon; you may use a system icon name, like e.g. `system-lock-screen`, or a path to .svg/.png file.
97
98 ## Styling
99
100 Edit the `~/.config/nwg-bar/style.css` file to change the bar appearance. You may also specify another .css file
101 (in the same folder) with the `-s somename.css` argument.
102