Skip to content

Commit

Permalink
[notification-volume] init
Browse files Browse the repository at this point in the history
  • Loading branch information
ioj4 committed May 11, 2024
1 parent 67a36e5 commit 6d0b782
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ https://ioj4.github.io/shelter-plugins/no-call-idle/
https://ioj4.github.io/shelter-plugins/revert-font/
```

### [Notification Volume](https://github.com/ioj4/shelter-plugins/tree/master/plugins/notification-volume/)

##### Allows you to set a volume for all notifications and sounds

<img src="static/notification-volume.png" width="320">

```
https://ioj4.github.io/shelter-plugins/notification-volume/
```

### [Timestamp File Names](https://github.com/ioj4/shelter-plugins/tree/master/plugins/timestamp-file-names/)

##### Replaces the name of files you upload to the current Unix timestamp
Expand Down
33 changes: 33 additions & 0 deletions plugins/notification-volume/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const {
ui: { Slider, Header },
plugin: { store, scoped },
patcher
} = shelter;

import classes from "./styles.jsx.scss";

export function onLoad() {
store.volume ??= 100;

scoped.patcher.after("Audio", window, (args, res) => {
patcher.before("play", res, function () {
this.volume = store.volume / 100;
});
});
}

export const settings = () => (
<div class={classes.container}>
<Header class={classes.header}>
Volume of notifications and sounds
</Header>
<Slider
min={0}
max={100}
value={store.volume}
step={5}
tick
onInput={(v) => (store.volume = v)}
/>
</div>
);
6 changes: 6 additions & 0 deletions plugins/notification-volume/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "Notification Volume",
"description": "Allows you to set a volume for all notifications and sounds",
"author": "ioj4",
"hash": "<HASH_PLACEHOLDER>"
}
15 changes: 15 additions & 0 deletions plugins/notification-volume/styles.jsx.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.header {
font-weight: 700;
margin-bottom: 8px;
letter-spacing: 0.02em;
line-height: 1.33333;
}

.container {
position: absolute;
margin: 0;
width: 80%;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
Binary file added static/notification-volume.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6d0b782

Please sign in to comment.