Project

General

Profile

Hcommands » History » Version 1

Stefan Mark, 03/07/2021 09:04 AM

1 1 Stefan Mark
h1. nxhelper Commands
2
3
4
h2. nxbacklightctrl
5
6
<pre>
7
nxbacklightctrl [up, down, cur, set value]
8
</pre>
9
10
11
Manipulates the display backlight. The Display used is either the first in _/sys/class/backlight/_ or the value of key _bright_path_.
12
* **cur** echos the current brightness
13
* **set value** sets the current brightness to `cur`
14
* **up**, **down** increases or decreases the brightness by value of key _bright_steps_
15
> Later additional commands will be added: **bright** (sets macimum brightness), **dark** (sets minimum (key _dark_brightness_) brightness), **max** (echos max brightness)\
16
> Currently only usable as root (directly accessing backlight in sys). Later, it shall become usable for users by utilizing **nxsysdaemon**
17
18
h2. nxdisplaydaemon
19
20
<pre>
21
nxdisplaydaemon [-d[d]] [-t]`
22
</pre>
23
24
Manages brightness (using **nxsysdaemon** ) and screen locking (with **nxulock**). Does _not_ do power management. Leave that to dpms! When startet with `-d` or `-dd` prints out some or many debug messages. When start with `-t` (implies `-d`), sets darken timeouts to 5 Seconds.
25
26
Keys:
27
* _darken_timeout_ (default: 30s): inactivity time untils brightnes is reduced
28
* _darken_ac_timeout_ (default: 2 * _darken_timeout_): same but when connected to mains
29
* _lock_timeout_ (default: 300s): inactivity time until screen is locked
30
* _lock_ac_timeout_ (default: cfg.lock_timeout): same but when connected to mains
31
* _lock_save_timeout_ (default: 0): same but when docked or connected to a safe network
32
* _save_networks_ (default: ""): ESSID considered to be safe (see above), for example at home.
33
* _dock_is_save_ (default: false): Being docked is considered to be safe
34
* _pseudo_dock_, (default: ""): "VENDOR:DEVICE" string of a USB device which indicates safeness (eg a USB dock)
35
* _fade_step_duration_ (default: 0.1): duration of a step when fading the brightness up or down
36
* _dark_brightness_ (default: 1): darkest brightness when dimming down after inactivity
37
* _bright_fade_steps_ (default: 20): Amout of steps from maximum to minimal brightness
38
> There are many things to do. Both save_networks and pseudo_dock shall become arrays. Default values for _fade_step_duration_ and _bright_fade_steps_ shall be calculated suitably to the displays maximum brightness and possible amount of steps and a new key _fade_time_.\
39
> Also, i will investigate how Gnome and KDE make it so that many videos will disable screen locking. At least some very common cases shall be supported.
40
41
h2. nxlid
42
43
<pre>
44
nxlid open/close
45
</pre>
46
47
Should be run by acpid for "button.*(LID).*close" and *open. For open, sends signal SIGHUP to **nxrandrd** (see there). For close sends SIGHUP to **nxrandrd** (see there) when docked (see `is_docked` in **nxhshlib**), otherwise calls `nxsuspend mem`.
48
> This is totally a stub
49
50
h2. nxrandr
51
52
<pre>
53
nxrandr [initialize] [silent] [debug]
54
</pre>
55
56
Automagically initializes multihead setups using xrandr. By default, nxrandr iterates through all connected displays, sets them to `--auto` and `--left-of` the one before. As that is boring, it tries to load _$NX_CONFIG_HOME/nxrandr.rc, which is supposed to be a bash script. See the examples one, it is pretty well documented.
57
As nxrandr is supposed to be called by **nxrandrd** upon changes to the connected displays, it tries to detect misfirings. Those usually happen as multiple, indistuingishable firings after connecteing or disconnecting a display. These multiple firings are detected by simply ignoring events in short succession.
58
59
> Note: The handling of multiple / misleading / wrong xrandr-events can become quite tricky. More on that in the example nxrandr.rc. Those events are may also be bugs in **nxrandrd** (see there)
60
61
h2. nxsdwhisper
62
63
<pre>
64
nxsdwhisper message
65
</pre>
66
67
Echos what **nxsysdaemon** answers to `message`. Returns 0 on success, 1 otherwise.
68
69
h2. nxsysdaemon
70
71
<pre>
72
nxsysdaemon [-d] [-g GID]
73
</pre>
74
75
A user-accessible interface to (a very small part of) /sys. Debug mode (`-d`) prints out all communication and disables daemonizing. Communications happens through a named pipe (/run/nxsysdaemon_fifo), by default the group 998 has write access. The group can be set by `-g GID`.
76
77
Protocoll:
78
* gpv [string]: returns the protocol version
79
* gcb [number]: returns current brightness
80
* gmb [number]: returns maximum brightness
81
* scbNUMBER [boolean]: sets current brightness to NUMBER, returns success
82
* iac [boolean]: returns 1 when connected to mains
83
84
> Note: This should probably provide much more features. For example batteries. And more.\
85
> Note: Currently only support ONE display for brightness. Should support many.\
86
> Note: Currently only support ONE power source for iac. Should support many.\
87
> Note: The named pipes location should be configurable.\
88
89
> Side note: this does not use DBus. Not because we find DBus particulary evil, but to keep the number of dependencies small.\
90
> A future feature might be optional DBus support. Maybe implementing (part) of upower or something like that.
91
92
> This project is _especially_ open for more features. But keep in mind that this shall always remain a pretty thin layer. And look at the protocol. Its primitive, and shall remain so.
93
94
h2. nxulock
95
96
<pre>
97
nxulock -t
98
</pre>
99
100
Locks the screen. Uses value of key _lockApp_ if set, otherwise: csxlock, sxlock, slock xscreensaver. Uses **nxhshlibs** `prime_user` to find the current user owning an X11 session (see there). If the current user is neither that nor root, screen locking fails.
101
When `-t` is set returns 0 when the screen was already locked by nxulock and echos the PID of the current screen locker. Return 1 otherwise.
102
> Note: Screen locking should work at least also when the current user is not the prime_user but has an X11 session nontheless. The whole thing is somewhat b0rky. See **nxhshlibs** `prime_user` for more on that. Anyway. _Works for me_
103
104
h2. nxunotify
105
106
<pre>
107
nxunotify
108
</pre>
109
110
A wrapper for notify-send. When called as root, uses **nxhshlibs** `prime_user` to get the current X11 user and use notify-send as that user. Sets notify-send's `-a` parameter to the calling processes' name. All parameters are send through.
111
> Use with care (as root user), as one can never be quite sure which user gets the message.
112
113
h2. nxurandr
114
115
<pre>
116
nxrandr
117
</pre>
118
119
Execs the value of key _randrApp_. When called as root, uses **nxhshlibs** `prime_user` to get the current X11 user and exec the value of key _randrApp_ in that users X session. Used to bind a xrandr-GUI-tool to an ACPI-key.
120
> This is a stub. Should rather become universal.
121
122
h2. nxwall
123
124
<pre>
125
nxwall path setter
126
</pre>
127
128
Randomly pics an image from `path` (recursive), and sets that as X-wallpaper using `setter`.
129
130
h2. nxxdg
131
132
<pre>
133
nxxdg [get file] [set aplication file]
134
</pre>
135
136
Either `get`s `file`s mimetype (via xdg-mime) or `set`s `application` as handler for `file`s mimetype (via xdg-mime). Makes working with xdg-open a wee bit less painfull. Stull hurts. A lot.
137
> Total stub. WIP. More an idea. Dont look.
138
139
h2. nxxsel
140
141
<pre>
142
nxxsel
143
</pre>
144
145
Displays a menu to select the X session to start.
146
> Now THIS is most stubby stub of all. Its literally just the menu I use. Completly static. Well, one can copy and modify it. But no worries, i intend to improve this.\
147
> Might be moved to nxinit
148
149
h2. wait_wm
150
151
<pre>
152
wait_wm
153
</pre>
154
155
Simply waits until there is window manager present. Usefull for X initialization. Some thing to not like to be started before a window manager appears.
156
> Might be moved to nxinit