Skip to content

Commit 79fae0a

Browse files
authored
Merge pull request #98 from int2001/sleepable
Respect ENV-Param WLGATE_SLEEP to enable sleeping/snooze
2 parents 1464a0f + e51cca6 commit 79fae0a

File tree

3 files changed

+42
-24
lines changed

3 files changed

+42
-24
lines changed

README.md

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@ As an example for Icom transceivers like the IC-7300, you can use `rigctld` (Ham
121121
2. **Start rigctld for IC-7300**:
122122
```bash
123123
# Basic configuration for IC-7300 on USB serial port
124-
rigctld -m 306 -r /dev/ttyUSB0 -s 38400 -T localhost -t 4532
124+
rigctld -m 3073 -r /dev/ttyUSB0 -s 38400 -T localhost -t 4532
125125

126126
# Windows example (replace COM3 with your actual port)
127-
rigctld.exe -m 306 -r COM3 -s 38400 -T localhost -t 4532
127+
rigctld.exe -m 3073 -r COM3 -s 38400 -T localhost -t 4532
128128
```
129129

130130
**Parameters explained**:
131-
- `-m 306`: Model number for - e.g. - Icom IC-7300 (use `rigctl -l` to see all models)
131+
- `-m 3073`: Model number for - e.g. - Icom IC-7300 (use `rigctl -l` to see all models)
132132
- `-r /dev/ttyUSB0`: Serial port device (adjust for your setup / on Windows its COMx)
133133
- `-s 38400`: Serial baud rate (IC-7300 default is 38400)
134134
- `-T localhost`: TCP host for rigctld daemon
@@ -139,20 +139,13 @@ As an example for Icom transceivers like the IC-7300, you can use `rigctld` (Ham
139139
- Host: `127.0.0.1`
140140
- Port: `4532` (must match rigctld port)
141141

142-
#### Common Hamlib Model Numbers
143-
- **Icom IC-7300**: `306`
144-
- **Icom IC-705**: `439`
145-
- **Icom IC-7610**: `378`
146-
- **Yaesu FT-891**: `161`
147-
- **Yaesu FT-991A**: `146`
148-
149142
#### Troubleshooting Hamlib
150143
```bash
151144
# List all supported radios
152145
rigctl -l
153146

154147
# Test connection (run after rigctld is running)
155-
rigctl -m 306 -r /dev/ttyUSB0 get_freq
148+
rigctl -m 3073 -r /dev/ttyUSB0 get_freq
156149
```
157150

158151
**Important**: `rigctld` must remain running in the background for WaveLogGate to control your radio.
@@ -188,26 +181,46 @@ ws.onmessage = (event) => {
188181
};
189182
```
190183

184+
### Environment Variables
185+
186+
WaveLogGate supports two environment variables to control specific behaviors:
191187

192-
## Advanced Settings
188+
#### WLGATE_RESIZABLE
189+
**Purpose**: Makes the application window resizable instead of fixed size
193190

194-
Access advanced settings by pressing **Ctrl+Shift+D** in the configuration window:
191+
**Use Case**: Useful for tiling window managers (i3, Hyprland, etc.) or when you need to resize the window manually
195192

196-
- **Force Hamlib**: Override FLRig and use Hamlib instead
197-
- **Disable Power Transfer**: Stop sending power readings to WaveLog
198-
- **Debug Options**: Additional logging and troubleshooting options
193+
**Linux/macOS Usage**:
194+
```bash
195+
export WLGATE_RESIZABLE=true
196+
./waveloggate
197+
```
199198

200-
**Note**: Advanced settings are in beta - restart the application after changes to ensure they're applied correctly.
199+
**Windows Usage**:
200+
```cmd
201+
set WLGATE_RESIZABLE=true
202+
WavelogGate.exe
203+
```
201204

202-
### Special: Tiling Window Managers like i3 or Hyprland
205+
#### WLGATE_SLEEP
206+
**Purpose**: Enables sleeping/snooze functionality for the application
203207

204-
With tiling window managers the window will be at it's fixed size which is usually okay for the normal user. In tiling WM this doesn't work properly. To fix that you can allow the window to resize by setting a env variable. This will only affect a handful of users and they will know how to handle it.
208+
**Use Case**: When set, allows WaveLogGate to enter sleep mode during inactivity, reducing system resource usage. **DANGER** Use with care. It may happen that CAT stops working with this setting.
205209

210+
**Linux/macOS Usage**:
206211
```bash
207-
export WLGATE_RESIZABLE=true
208-
./path_to_your_bin
212+
export WLGATE_SLEEP=true
213+
./waveloggate
209214
```
210215

216+
**Windows Usage**:
217+
```cmd
218+
set WLGATE_SLEEP=true
219+
WavelogGate.exe
220+
```
221+
222+
**Note**: Both environment variables are optional and only need to be set when the specific functionality is required.
223+
211224
## Development
212225

213226
### Prerequisites

main.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const WebSocket = require('ws');
99
// In some cases we need to make the WLgate window resizable (for example for tiling window managers)
1010
// Default: false
1111
const resizable = process.env.WLGATE_RESIZABLE === 'true' || false;
12+
const sleepable = process.env.WLGATE_SLEEP === 'true' || false;
1213

1314
const gotTheLock = app.requestSingleInstanceLock();
1415

@@ -259,7 +260,9 @@ process.on('SIGINT', () => {
259260

260261
app.on('will-quit', () => {
261262
try {
262-
powerSaveBlocker.stop(powerSaveBlockerId);
263+
if (!sleepable) {
264+
powerSaveBlocker.stop(powerSaveBlockerId);
265+
}
263266
} catch(e) {
264267
console.log(e);
265268
}
@@ -270,7 +273,9 @@ if (!gotTheLock) {
270273
} else {
271274
startserver();
272275
app.whenReady().then(() => {
273-
powerSaveBlockerId = powerSaveBlocker.start('prevent-app-suspension');
276+
if (!sleepable) {
277+
powerSaveBlockerId = powerSaveBlocker.start('prevent-app-suspension');
278+
}
274279
s_mainWindow=createWindow();
275280
globalShortcut.register('Control+Shift+I', () => { return false; });
276281
app.on('activate', function () {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"@electron-forge/maker-zip": "^7.10.2",
3535
"@electron-forge/plugin-auto-unpack-natives": "^7.10.2",
3636
"@electron-forge/publisher-github": "^7.10.2",
37-
"electron": "^36.9.2",
37+
"electron": "^36.9.5",
3838
"electron-rebuild": "^3.2.9"
3939
}
4040
}

0 commit comments

Comments
 (0)