Skip to content

Commit 90f349b

Browse files
committed
Support Meson devenv
1 parent 2927869 commit 90f349b

File tree

2 files changed

+39
-23
lines changed

2 files changed

+39
-23
lines changed

README.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ The supported keys are listed above in [Features](#features)
3232

3333
### Through Meson
3434

35-
```zsh
35+
```sh
3636
# Please note that the command below might require `--prefix /usr` on some systems
3737
meson setup build --buildtype release
38-
ninja -C build
38+
meson compile -C build
3939
meson install -C build
4040
```
4141

4242
### Fedora
4343

4444
The package is available on COPR:
4545

46-
```zsh
46+
```sh
4747
dnf copr enable erikreider/swayosd
4848
dnf install swayosd
4949
```
@@ -52,7 +52,7 @@ dnf install swayosd
5252

5353
The package can be layered over the base image after adding the Copr repo as an ostree repo:
5454

55-
```zsh
55+
```sh
5656
sudo curl -sL -o /etc/yum.repos.d/_copr:copr.fedorainfracloud.org:erikreider:swayosd.repo https://copr.fedorainfracloud.org/coprs/erikreider/swayosd/repo/fedora-$(rpm -E %fedora)/erikreider-swayosd-fedora-$(rpm -E %fedora).repo
5757
rpm-ostree install swayosd
5858
```
@@ -87,14 +87,14 @@ Other users can run: `pkexec swayosd-libinput-backend`
8787

8888
#### Start Server
8989

90-
```zsh
90+
```sh
9191
# OSD server
9292
exec swayosd-server
9393
```
9494

9595
#### Add Client bindings
9696

97-
```zsh
97+
```ini
9898
# Sink volume raise optionally with --device
9999
bindsym XF86AudioRaiseVolume exec swayosd-client --output-volume raise
100100
# Sink volume lower optionally with --device
@@ -152,6 +152,7 @@ bindsym XF86AudioNext exec swayosd-client --playerctl next
152152

153153
- By default, without using --monitor the osd will be shown on all monitors
154154
- On setups with multiple monitors, if you only want to show the osd on the focused monitor, you can do so with the help of window manager specific commands:
155+
155156
```sh
156157
# Sway
157158
swayosd-client --monitor "$(swaymsg -t get_outputs | jq -r '.[] | select(.focused == true).name')" --output-volume raise
@@ -162,11 +163,28 @@ swayosd-client --monitor "$(hyprctl monitors -j | jq -r '.[] | select(.focused =
162163

163164
## Theming
164165

165-
Since SwayOSD uses GTK, its appearance can be changed. Initially scss is used, which GTK does not support, so we need to use plain css.
166+
Since SwayOSD uses GTK, its appearance can be changed. Initially scss is used, which GTK does not support, so we need to use plain css.
166167
The style conifg file is in `~/.config/swayosd/style.css` (it is not automatically generated). For reference you can check [this](https://github.com/ErikReider/SwayOSD/blob/main/data/style/style.scss) and [this](https://github.com/ErikReider/SwayOSD/issues/36).
167168

168169
## Brightness Control
169170

170171
Some devices may not have permission to write `/sys/class/backlight/*/brightness`.
171172
So using the provided packaged `udev` rules + adding the user to `video` group
172173
by running `sudo usermod -a -G video $USER`, everything should work as expected.
174+
175+
### Development
176+
177+
#### Setup and build
178+
179+
```sh
180+
meson setup build
181+
meson compile -C build
182+
```
183+
184+
#### Set the environment
185+
186+
```sh
187+
# Sets the correct environment variables
188+
meson devenv -C build -w .
189+
# Now you can start nvim, vscode, etc in the current shell to reduce duplicated builds
190+
```

src/meson.build

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
1+
cargo_opt = []
22

3-
cargo_bin = find_program('cargo')
4-
assert(cargo_bin.found())
5-
cargo_opt = [ '--manifest-path', meson.project_source_root() / 'Cargo.toml' ]
6-
cargo_opt += [ '--target-dir', meson.project_build_root() / 'src' ]
7-
cargo_env = [ 'CARGO_HOME=' + meson.project_build_root() / 'cargo-home' ]
3+
cargo_env = environment()
4+
cargo_env.set('CARGO_MANIFEST_PATH', meson.project_source_root() / 'Cargo.toml')
5+
cargo_env.set('CARGO_TARGET_DIR', meson.project_build_root() / 'src')
6+
cargo_env.set('CARGO_HOME', meson.project_build_root() / 'cargo-home')
7+
cargo_env.set('CARGO_PROFILE', 'debug')
8+
9+
meson.add_devenv(cargo_env)
810

911
if get_option('buildtype') == 'release'
1012
cargo_opt += [ '--release' ]
@@ -13,16 +15,15 @@ else
1315
rust_target = 'debug'
1416
endif
1517

16-
binaries = [
17-
'swayosd-server',
18-
'swayosd-client',
19-
'swayosd-libinput-backend'
20-
]
18+
binaries = ['swayosd-server', 'swayosd-client', 'swayosd-libinput-backend']
2119
binaries_path = []
2220
foreach prog : binaries
2321
binaries_path += '@OUTDIR@/@0@/@1@'.format(rust_target, prog)
2422
endforeach
2523

24+
cargo_bin = find_program('cargo')
25+
assert(cargo_bin.found())
26+
2627
custom_target(
2728
'Cargo Build',
2829
build_by_default: true,
@@ -31,9 +32,6 @@ custom_target(
3132
console: true,
3233
install: true,
3334
install_dir: join_paths(get_option('prefix'), get_option('bindir')),
34-
command: [
35-
'env', cargo_env,
36-
cargo_bin, 'build', cargo_opt, '&&',
37-
'cp', '-f', binaries_path, '@OUTDIR@'
38-
]
35+
env: cargo_env,
36+
command: [cargo_bin, 'build', cargo_opt, '&&', 'cp', '-f', binaries_path, '@OUTDIR@'],
3937
)

0 commit comments

Comments
 (0)