LID-STATE(1)

πŸ“¦ version 0.1.0, in alpine 3.24

πŸ’… LID-STATE(1) β€” the manual page, but make it cute πŸŽ€

okay so bestie, welcome to lid-state(1) β€” the little script that tells you whether your laptop lid is open or closed. yes, that's literally it. and it ate. ✨


🌸 NAME 🌸

lid-state β€” query state of the device's lid

like, it queries. the state. of the lid. icon behavior honestly.


πŸ¦‹ SYNOPSIS πŸ¦‹

lid-state
lid-state (--open | --closed) [-- <cmd...>]
lid-state (--version | --help)

three whole modes, all main character energy πŸ‘‘


πŸ’– DESCRIPTION πŸ’–

so here's the tea, and there are three whole vibes depending on how you invoke it:

  • lid-state, if invoked without any arguments β€” prints the current state of the lid: open or closed. that's it. that's the whole job. 🫢
  • lid-state, invoked with --open or --closed and no cmd β€” exits with status 0 if the current lid state corresponds to the specified option, otherwise exits with status 1. so it's basically a vibe check for your lid. βœ… / ❌
  • lid-state, invoked with cmd β€” runs the cmd if the current lid state corresponds to the specified option, otherwise just exits with status 0. no drama, no error, it simply does nothing and leaves. πŸ’€

✨ OPTIONS ✨

  • -o, --open β€” if cmd is given: execute cmd if the lid is open, otherwise do nothing and exit with 0. if cmd is not given: exit with 0 if the lid is open, otherwise exit with 1. open lid = slay, closed lid = not slay (in this mode anyway). 🌈
  • -c, --closed β€” analogous to --open. literally the same energy, just flipped. πŸ¦‹
  • -V, --version β€” print script name & version and exit. a little "hi, it's me" moment. πŸ‘‘
  • -h, --help β€” print the help message and exit. your bestie when you're lost. 🫢

πŸ“ FILES πŸ“

  • /proc/acpi/button/lid/LID/state β€” state of the lid exported by the ACPI subsystem. this is the source of truth, the blueprint, the oracle. ngl it's where all the answers live. πŸ”₯

πŸ’œ EXIT CODES πŸ’œ

  • 0 β€” clean exit, no error has encountered. we love a peaceful ending. ✨
  • 1 β€” see DESCRIPTION. (iykyk 😭)
  • 100 β€” invalid usage. you did it wrong bestie, no cap. πŸ™ˆ
  • 101 β€” failed to read /proc/acpi/button/lid/LID/state. the file ghosted us. πŸ’€
and heads up: if cmd is given and the condition (--open or --closed) is met, lid-state exits with the exit status of the cmd. so whatever cmd says, that's the final word. periodt. πŸ‘‘

🌺 AUTHORS 🌺

Jakub Jirutka β€” the icon, the legend, the main character who wrote this. πŸ‘‘πŸ’–


🧚 REPORTING BUGS 🧚

found a bug? don't suffer in silence, bestie β€” report bugs to the project's issue tracker at https://github.com/jirutka/acpi-utils/issues. that's the group chat for problems. 🫢


and that's the whole page, babe πŸ’…βœ¨ β€” this is lid-state(1), dated 2021-10-19, from the acpi-utils source, and it's giving iconic. now go check that lid. πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from