Skip to content

Latest commit

 

History

History
158 lines (137 loc) · 7.39 KB

File metadata and controls

158 lines (137 loc) · 7.39 KB

BetterXsecurelock

a wrapper to xsecurelock

screenshot 1 screenshot 2 screenshot 3 screenshot 4 screenshot 5 screenshot 6 screenshot 7 screenshot 8

this provides wrapping for xss-lock, xsecurelock and multiple programs to use as screensavers, mpv, nsxiv, xterm with terminal screensavers, integration with pywal, a status bar inside the screensaver that only shows when the auth dialog is on screen and shows day, time and battery, a proxy for dbus so that programs can use the org.freedesktop.ScreenSaver dbus interface to request to lock, unlock and inhibit the screensaver.

more features are to come but for now this is very alpha software that has been wrangled to work on my setup.

how do i use this

you don't, at least for now as this hasn't even had a v0.0.0 release, but if you insist be warned i'm still in the process of implementing config options and what is available now in the sample config file is what is available, everything else you'll have to use this almost like suckless software, ie: modifying the source code directly.

first and foremost satisfy the dependencies, you need to have the following software installed:

software use
xsecurelock: the program doing the hard work.
xss-lock: for launching xsecurelock and listening to screen and suspend events
nsxiv: for displaying images.
mpv: for video
xterm: statusbar and terminal screensavers
xdotool: statusbar
unimatrix: matrix screensaver (optional)
cmatrix: matrix screensaver
pipes.sh: pipes screensaver (optional)
sssnake: snake screensaver (optional)
fire: for the fire screensaver (optional)
btop: for the btop screensaver
pywal16: for the theme
on_ac_power: show the charge icon on the statusbar
xdg-screensaver: very necessary
brightness-udev: udev rules to allow access to the /sys/class/backlight/*/brightness subsystem
systemact automatic system suspend some time after lock
psmisc: for pstree
noto sans cjk jp: font for the auth dialog
python dbus dbus-screenlock-freedesktop.py
python xlib dbus-screenlock-freedesktop.py

Once you have everything run make install and the makefile will copy all the scripts to your path, for xdg-screensaver just use the bundled one, for on_ac_power if you are not on a debian based distro this repo bundles the script into the tree just run make install_on_ac_power, on debian and derivates just install the powermgmt-base package if not already installed, you need to have a pywal colorscheme or edit the code to change the color definitions as those colors will be used for the auth dialog and statusbar, i will eventually add proper themes support just need to define a format. Then you have to copy the sample config file to ´"${XDG_CONFIG_HOME:-${HOME}/.config}/better-xsecurelock/config"´ and edit the options to your liking, the config is outright sourced by every script like any other shell script file despite the lack of extension or shebang, it however has a vim modeline just to be explicit about the syntax

now you just have to run lockerd for the screen locker daemon and dbus-screenlock-freedesktop.py if you want to allow programs that only speak dbus to inhibit the screensaver. add them to either your autostart programs or run them somewehre in your xinitrc or xsessionrc.

If all goes well you should have a xsecurelock similar to the one on my screenshots.

quick start

git clone https://github.com/eylles/betterxsecurelock
cd betterxsecurelock
# check config.mk and edit as needed
make
make install
# extras
# to install on_ac_power if not available in your distro
make install_on_ac_power
# to install the vendored version of xdg-screensaver
make install_xdg-screensaver
# if your distro does not have a package like brightness-udev then
make install_bright-helper
make install_blight.rules

Contents

What is actually in this repo? Well to list the things off:

  • lockerd: the locker daemon, a wrapper over xss-lock that solves configuration into a single file, also wrangles xserver screensaver and dpms settings.
  • dim-screen: a screen dimmer to be used by xss-lock, leverages the libbacklight from this same repo.
  • screenlocker: wrapper around xsecurelock, handles starting of xsecurelock as well as managing the screen dimmer and delaysleep utilities, also sets which screensaver list to use.
  • saver: the screen saver program, a wrapper that randomly chooses one of the available screensavers from the current screensaver list, also initiates the screensaverbar when the auth dialog is present.
  • screensaverbar: content provider for the top bar of the screensaver when the auth dialog shows up, the actual bar is just text rendered inside a terminal emulator, at the time that is plain old xterm.
  • delaysleep: a small program that counts the seconds until the system can be suspended due to inactivity, by default 900 seconds, it leverages systemact to do the actual system suspend.
  • blight: a screen backlight setting program leveraging libbacklight, which sets backlight with the /sys/class/backlight interface, it supports 256 levels of brightness from 0 to 255 which are scaled for the present screen devices.
  • supporting shell libraries: all these programs being built on shell script have quite the amount of common repeated code which is contained within a set of libraries, every shell file with the lib prefix on this repo is one of the libraries needed by the programs.
  • dbus-screenlock-freedesktop.py: a proxy python script that provides the org.freedesktop.ScreenSaver interface, provides the methods Lock, Inhibit and UnInhibit, it leverages xdg-screensaver for the handling.

TODO

TODO:

  • wrap and use the screensaver modules provided by xsecurelock
  • add a generic xterm screensaver module to run the terminal based savers
  • define a proper theme format and parse the config for it
  • add the ability to configure auth and savers options (fonts, timeout, etc)
  • make the dbus-screenlock-freedesktop search window that inhibits the screensaver by caller name and pid instead of just using whatever is focused at the time
  • make lockerd set the x_screen_saver_extension and dpms times from config when the screensaver isn't being inhibited
  • eliminate usage of pgrep

LICENSE

This repository contains components under different licenses.

  • The main source files are licensed under the GNU GPLv2.0 or later (LICENSE-GPL-2.0).
  • Small libraries and utilities are licensed under the Apache License 2.0 (LICENSE-APACHE-2.0).
  • The bright-helper as well as the 90-blight.rules file which is a modified version of the debian patched version of the original brightnessctl repo are licensed under the Expat/MIT (LICENSE-MIT)
  • Files vendored from other projects such as on_ac_power and xdg-screensaver are available under their specific license terms mentioned on their identifiers.

Individual files contain explicit SPDX-License-Identifier headers indicating their respective license terms.