tvrzna / emptty

Dead simple CLI Display Manager on TTY
MIT License
696 stars 26 forks source link

Accept TTY name parameter for `--tty` #90

Closed edmonds closed 1 year ago

edmonds commented 1 year ago

This commit adds a --tty-name command-line argument for specifying the TTY by name, e.g. tty7 instead of just 7.

This may be a little superfluous since --tty already exists, but it allows using a systemd template unit something like the following without using a bare number for the instance name (similar to how the getty unit instances are named getty@tty1.service, etc.):

# /lib/systemd/system/emptty@.service
[Unit]
Description=emptty display manager on %I
Documentation=man:emptty(1)
After=systemd-user-sessions.service plymouth-quit-wait.service
After=getty@%i.service display-manager.service
Conflicts=getty@%i.service display-manager.service
ConditionPathExists=/dev/%I

[Service]
Type=idle
EnvironmentFile=-/etc/emptty/conf.%I
ExecStart=/usr/bin/emptty --daemon --tty-name %I
Restart=always
KillMode=process
IgnoreSIGPIPE=no
SendSIGHUP=yes
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes

Then one can do systemctl start emptty@tty7.service, systemctl start emptty@tty8.service, etc. to create multiple instances of the emptty service for several terminals.

Thanks!

tvrzna commented 1 year ago

Hello, this is very nice feature! However I don't think new argument needs to be introduced, it could be handled in original --tty with both variants. The reason is some BSD uses different TTY names conventions and for them --tty would be useless, if it would support only numbers.

edmonds commented 1 year ago

OK, updated it to accept either a name or number for --tty.