
Security News
Free Certified Patch for Critical Rails Active Storage Vulnerability
Socket has released a free Certified Patch for a critical Rails Active Storage vulnerability, giving developers time to upgrade to a secure Rails version.
@jcbhmr/getdesktopenv
Advanced tools
getDesktopEnv() for Node.js🖼️ Which desktop environment is available, if any?
💡 Inspired by t1st3/desktop-env
🎨 Lets you know if the user can open a GUI or not
🐧 Supports Linux, macOS, and Windows
📦 Works in Node.js, Deno, and Bun
🚫 Has a sham for the browser (returns null)
👩💻 Includes a basic CLI
🙌 I need your help! What does your development environment return? What desktop environment are you using? Open an Issue and let me know! 😊 I want to make this package more robust and accurate! 🎉
You can install this package using npm, Yarn, or pnpm.
npm install @jcbhmr/getdesktopenv
If you're using this in the browser, don't worry! There's a stub implementation
just for you that always returns null. 😊
This package exports a single function, getDesktopEnv(), which returns a
Promise<string | null>. The string that it resolves to is the name of the
desktop environment that was detected. If no desktop environment was detected,
it will resolve to null.
import getDesktopEnv from "@jcbhmr/getdesktopenv";
console.log(getDesktopEnv());
//=> 'Windows shell'
You can also use the CLI directly if you just want to check your desktop env in CI or something. I don't judge. 😜
npx @jcbhmr/getdesktopenv
#=> 'Windows shell'
When using a headless Linux OS (like you might in, say GitHub Actions or GitHub
Codespaces), this function will return null. If no desktop environment was
matched (an unknown desktop environment) this function will return null. If
you're in the browser, this function will also return null.
🐛 If you are using a desktop environment that's not in the list, open an Issue! We want to support as many desktop environments as possible. 😊
This project uses plain JavaScript. It's so simple that we can get away with this! 😄 We also don't have any tests, because this is a very simple package. You are expected to manually make sure that this package works before doing anything major. 😉 Testing is also a bit unfeasible, because there's not a lot of CI providers that support desktop environments. 😅
Here's how you might manually test this package in Node.js:
$ node
Welcome to Node.js v19.9.0.
Type ".help" for more information.
> let m; m = await import("@jcbhmr/getdesktopenv")
[Module: null prototype] { default: [AsyncFunction: getDesktopEnv] }
> await m.default()
'Windows shell'
ℹ There's currently a quirk with JSDoc and TypeScript. TypeScript still wants to
look for a @types/* package even though we provide JSDoc types. 🤷♂️ #1
FAQs
🖼️ Which desktop environment is available, if any?
We found that @jcbhmr/getdesktopenv demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.

Security News
Socket has released a free Certified Patch for a critical Rails Active Storage vulnerability, giving developers time to upgrade to a secure Rails version.

Security News
/Threat Research
A malicious Ruby gem runs a credential-stealing worm during installation, poisons AI coding tools, and can wipe files when a stolen GitHub token is revoked.

Security News
GitHub is tightening GitHub Actions security with new restrictions on privileged pull request workflows. Here's what changes and how maintainers are affected.