GithubHelp home page GithubHelp logo

hang and start cmatrix about cmatrix HOT 4 CLOSED

abishekvashok avatar abishekvashok commented on September 18, 2024
hang and start cmatrix

from cmatrix.

Comments (4)

llabhishekll avatar llabhishekll commented on September 18, 2024

In which platform Linux/Windows ?

from cmatrix.

RanchoCooper avatar RanchoCooper commented on September 18, 2024

Linux, my temporary way was set a shortcuts run cmatrix with terminal's arguments '--full-screen'

but it's not safe enought, any key-input will enter my desktop without passwd

I wanna be safe, with enter passwd

from cmatrix.

abishekvashok avatar abishekvashok commented on September 18, 2024

leaving computer

Do you mean shutting it down or in sleep as a screen saver?
@RanchoCooper

from cmatrix.

livibetter avatar livibetter commented on September 18, 2024

Since @pipeseroni got me, I have been trying to find a way to do something like this, a way that you can actually have a terminal screensaver using any programs that draw stuff in terminal window.

I was thinking someone might have written a special terminal emulator that also works as screen locker, like a merged program of st + xlock's locking, but I couldn't find one. Or a locker that can grab all the inputs, and leave X's screen as is, then when any inputs come in, popping up a dialog, but no such thing exists. I wonder if we can simply hack xlock for its password input screen.


When I read @RanchoCooper's words a few hours ago:

any key-input will enter my desktop

A terribly bad idea came to me: what if that triggers lock screen?

It's not perfect, because once entering the lock screen, we stay with it, but it's an idea, although a crappy one. Nonetheless, I was wondering if I could somehow achieve it only using simple shell script without any library/tool to interact with X.

So I wrote this script:

#!/bin/bash

# monitor any input device plugging in and unplugging
ICMD="ls /dev/input/by-id/"
ILST="$($ICMD)"
# () to suppress job control message
( while [[ "$($ICMD)" == "$ILST" ]]; do sleep 0.1; done & )

# monitor all inputs
# note: PS/2 won't be in by-*/*, so listening to all input*
for i in /dev/input/event*; do
    # just read one byte and exits.
    # when unplugging an input device, cat throws "No such device" to stderr
    cat "$i" 2>/dev/null | read -n 1 &
done

# wait here until any job exits
wait -n

# kill all the remaining jobs
kill $(jobs -p)

su -c xlock $SUDO_USER

Unfortunately, this has to be run by root, if using tools like xinput or any that can listen to whole X, it doesn't require root. Also, you don't want any power saving with this script, or maybe let mouse input passes, so it can bring computer out of saving mode without triggering lock screen, if switching windows can't be done with mouse.

Anyway, any sane people wouldn't want to use this, I am just throwing the script here for insane people who like insecure stuff.

from cmatrix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.