Skip to content

Commit

Permalink
improve code coloring
Browse files Browse the repository at this point in the history
  • Loading branch information
fohrloop committed Jan 31, 2024
1 parent 23f54b7 commit d4b7f9b
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
9 changes: 6 additions & 3 deletions docs/source/cli-api.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# CLI API

It is possibe to start wakepy from the command line either by running
```

```{code-block} text
wakepy
```

or
```

```{code-block} text
python -m wakepy
```

This starts wakepy in the *default mode* (`-k`), which corresponds to a call to `keep.running` with default arguments. The available options are:

```
```{code-block} output
wakepy [-h] [-k] [-p]
options:
Expand Down
2 changes: 2 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,6 @@
# Shows the landing page in the sidebar
# See: https://sphinx-book-theme.readthedocs.io/en/stable/sections/sidebar-primary.html#add-the-home-page-to-your-table-of-contents
"home_page_in_toc": True,
"pygment_light_style": "friendly",
"pygment_dark_style": "lightbulb",
}
3 changes: 2 additions & 1 deletion docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Wakepy supports Windows, MacOS and Linux flavours which Desktop Environment that
## Installing

To install wakepy from PyPI, run
```

```{code-block} text
pip install wakepy
```

Expand Down
2 changes: 1 addition & 1 deletion docs/source/methods-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ There are two ways how a Windows system might automatically set a screen lock
if you want to check if your system will sleep automatically when using this method, you may either check the `ScreenSaverIsSecure`, `ScreenSaveActive` and `ScreenSaveTimeout` from "HKCU:\Control Panel\Desktop" and "HKCU:\Software\Policies\Microsoft\Windows\Control Panel\Desktop", or use the following python snippet:
```python
```{code-block} python
import ctypes
SPI_GETSCREENSAVESECURE = 0x0076
Expand Down
20 changes: 10 additions & 10 deletions docs/source/test-manually.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ All wakepy Modes rely somehow on external software, library or dbus service. Thi
This is a test script for helping to determine if the wakepy modes work correctly on your system:

(code-wakepy-test-script)=
```python
```{code-block} python
import datetime as dt
import time
Expand All @@ -36,7 +36,7 @@ while True:

This will print something like:

```
```{code-block} output
Dec 25 12:28:34 | elapsed 0:00:00.000176 | delta: 2e-06s
Dec 25 12:28:36 | elapsed 0:00:02.000403 | delta: 2.000227s
Dec 25 12:28:38 | elapsed 0:00:04.001173 | delta: 2.00077s
Expand All @@ -63,14 +63,14 @@ In the above example, the delta (time between two prints) was 2 seconds, until 1

Either on CLI

```
```{code-block} text
wakepy
```

or in python


```python
```{code-block} python
import time
from wakepy import keep
with keep.running():
Expand All @@ -83,14 +83,14 @@ with keep.running():

Either on CLI

```
```{code-block} text
wakepy -p
```

or in python


```python
```{code-block} python
import time
from wakepy import keep
with keep.presenting():
Expand All @@ -110,23 +110,23 @@ with keep.presenting():

Before you start. Check the current timeout values (seconds), and write the number down somewhere. The first one (org.gnome.desktop.session idle-delay) is time until "screen blank", and the rest are timeouts for automatic sleep.

```
gsettings get org.gnome.desktop.session idle-delay
```{code-block} text
gsettings get org.gnome.desktop.session idle-delay
gsettings get org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout
gsettings get org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout
```

Then, set a low value to the timeouts (here, 15 seconds):

```
```{code-block} text
gsettings set org.gnome.desktop.session idle-delay 15
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 15
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 15
```

Test that your system sleeps automatically and blanks the screen after 15 seconds. Then, run the [wakepy test script](#code-wakepy-test-script) on one terminal window, and enter in the [keep.running](#enter-keep-running-script) or in the in another. After you're done, reset the timeout values to what they were (in this example, 1800 seconds):

```
```{code-block} text
gsettings set org.gnome.desktop.session idle-delay 1800
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 1800
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 1800
Expand Down
4 changes: 2 additions & 2 deletions docs/source/tests-and-ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ To force wakepy to fake a successful mode activation, you may set an environment

In tox, this would be:

```ini
```{code-block} ini
[testenv]
# ... other settings
setenv =
Expand All @@ -27,7 +27,7 @@ On Linux, wakepy uses D-Bus methods to inhibit screensaver or power management.

To pass the `DBUS_SESSION_BUS_ADDRESS` with tox, one would use:

```ini
```{code-block} ini
[testenv]
# ... other settings
passenv =
Expand Down

0 comments on commit d4b7f9b

Please sign in to comment.