Nxhshlib » History » Version 1
Stefan Mark, 03/07/2021 09:12 AM
| 1 | 1 | Stefan Mark | h2. Bash library nxhshlib |
|---|---|---|---|
| 2 | |||
| 3 | <pre> |
||
| 4 | prime_user |
||
| 5 | </pre> |
||
| 6 | |||
| 7 | Returns the username of the first user having an X session running. This is used in various nxhelper tools, for example for screen locking or messegae sending. |
||
| 8 | |||
| 9 | > This is kind of stub.\ |
||
| 10 | > Screen locking should happen for all X session, all logged in VTs and even for all Wayland sessions.\ |
||
| 11 | > Messages should also go to all users. Or maybe not, because of security.\ |
||
| 12 | > This is all kind of a mess to be sorted out. For now, it works for me in a single seat scenario. It most certainly will NOT work in a multi-seat setup. |
||
| 13 | > **WARNING** this is probably a security issue. At least for multi seat and/or multi user setups. |
||
| 14 | |||
| 15 | <pre> |
||
| 16 | mount_dev_is_blocked dev |
||
| 17 | </pre> |
||
| 18 | |||
| 19 | Returns 0 if `dev` is blocked by key _mount_block_ in either system or session config. 1 otherwise. |
||
| 20 | |||
| 21 | > This is buggy: The user should be able to block additional devices, but not mask devices blocked by system. But right now, any user blocked device masks all system blocked devices. |
||
| 22 | |||
| 23 | <pre> |
||
| 24 | umount_dev_is_auto_blocked dev |
||
| 25 | </pre> |
||
| 26 | |||
| 27 | Returns 0 if `dev` is blocked for auto-mount by key umount_auto_skip in either system or session config. 1 otherwise. |
||
| 28 | |||
| 29 | > This is buggy: The user should be able to block additional devices, but not mask devices blocked by system. But right now, any user blocked device masks all system blocked devices. |
||
| 30 | |||
| 31 | <pre> |
||
| 32 | dev_is_mountable dev mounted |
||
| 33 | </pre> |
||
| 34 | |||
| 35 | Returns 0 if `dev` is mountable, eg its neither blocked nor already mounted (as by the list of mounted deviced `mounted`). |
||
| 36 | |||
| 37 | <pre> |
||
| 38 | get_mountable_devs |
||
| 39 | </pre> |
||
| 40 | |||
| 41 | Stores a list of "mountable devices" in `$devices`. This list is dependant on the type of mounter which is configured by key _mount_method_: udiskie or pmount. |
||
| 42 | * For udiskie, those are all devices reported by `udiskie-info -a -f is_filesystem` which are mountable according to **dev_is_mountable** |
||
| 43 | * For pmount, those are all devices stated in key _mount_devs_ which are mountable according to **dev_is_mountable** |
||
| 44 | |||
| 45 | <pre> |
||
| 46 | get_unmountable_devs |
||
| 47 | </pre> |
||
| 48 | |||
| 49 | Stores a list of "unmountable devices" in `$devices`. This list is dependant on the type of mounter which is configured by key _mount_method_: udiskie or pmount. |
||
| 50 | * For udiskie, those are all devices mounted under _/run/media/USER_ |
||
| 51 | * For pmount, those are all devices mounted under _/media_ |
||
| 52 | |||
| 53 | <pre> |
||
| 54 | display_by_username user |
||
| 55 | </pre> |
||
| 56 | |||
| 57 | Echoes the X11 Display (as in `$DISPLAY`) for `user` (if any). Returns 0 if `user` has one, 1 otherwise. |
||
| 58 | |||
| 59 | > This is not much tested and may fail. |
||
| 60 | |||
| 61 | <pre> |
||
| 62 | is_docked |
||
| 63 | </pre> |
||
| 64 | |||
| 65 | Return 0 if the system is docked, 1 otherwise. Does (in theory) the same as **is_docked** from nxhclib (Parameter `pseudo_dock` is read as value of key _pseudo_dock_. |