|
2 | 2 |
|
3 | 3 | Detects and executes commands when the computer switches to and from tablet mode.
|
4 | 4 |
|
5 |
| -## Usage |
| 5 | +## Setup |
| 6 | + |
| 7 | +Download the [latest release](https://github.com/yehuthi/linuxflip/releases/latest), and add your user to the `input` group (unless you want to run it as root -- not recommended). |
| 8 | +Then you can simply run it or hook it to a desktop session startup script. |
| 9 | + |
| 10 | +> [!TIP] |
| 11 | +> <details> |
| 12 | +> <summary>⌨ Add yourself to <code>input</code> group</summary> |
| 13 | +> |
| 14 | +> Open the terminal (press <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>T</kbd> or find it as you would any other program), and enter: |
| 15 | +> |
| 16 | +> ```sh |
| 17 | +> sudo usermod -a input $USER |
| 18 | +> ``` |
| 19 | +> </details> |
6 | 20 |
|
7 |
| -Download the [latest release](https://github.com/yehuthi/linuxflip/releases/latest), and add your user to the `input` group (unless you want to run it as root). |
8 |
| -Then you can simply run it or hook it to your system (e.g. in `~/.xinitrc`). |
| 21 | +## Usage |
9 | 22 |
|
10 | 23 | Run `linuxflip --help` for usage options. The one you're probably interested in is:
|
11 | 24 | ```
|
12 | 25 | linuxflip <tablet-cmd> <laptop-cmd>
|
13 | 26 | Runs <tablet-cmd> in a shell when the mode changes to tablet, and <laptop-cmd> when the mode changes to laptop.
|
14 | 27 | ```
|
15 | 28 |
|
16 |
| -The commands run in a shell, so shell features are supported. If you'll run as root even through `sudo`, remember to not assume `~` will be substituted for your user's home directory; it's probably going to be `/root`. The commands run asynchronously. |
17 |
| - |
18 |
| -> [!CAUTION] |
19 |
| -> Your commands will run with elevated privileges inherited from the program. |
| 29 | +- [x] The commands run in a shell, so shell features are supported (such as [tilde expansion](https://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html)). |
| 30 | +- [x] The commands run asynchronously. |
20 | 31 |
|
21 |
| -### Example |
| 32 | +### Examples |
22 | 33 |
|
23 | 34 | #### Scripts
|
24 |
| -A typical example is running scripts from files. You can place them wherever you want and to run them, the command is simply their path (and as mentioned above, be careful with `~`). Set up those scripts however you want and make sure they're executable (`chmod +x`), then run: |
| 35 | +A typical example is running script files. You can place them wherever you want and to run them, the command is simply their path. Set up those scripts however you want and make sure they're executable (`chmod +x`), then run: |
25 | 36 |
|
26 | 37 | ```bash
|
27 |
| -linuxflip "/home/myuser/linuxflip_tablet" "/home/myuser/linuxflip_laptop" |
| 38 | +linuxflip "~/.config/linuxflip/tablet" "~/.config/linuxflip/laptop" |
28 | 39 | ```
|
29 | 40 |
|
30 | 41 | #### Commands
|
|
0 commit comments