Configure screen locker

This commit is contained in:
Alex Kotov 2021-12-05 15:16:00 +05:00
parent f0182e8d49
commit 30bc46a7d0
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
5 changed files with 122 additions and 6 deletions

View File

@ -3,6 +3,13 @@ CPPFLAGS += -DENABLE_XINERAMA
PKGS += xinerama
.endif
.if "$(WITH_LOCKER)" == "i3lock"
CPPFLAGS += -DWITH_LOCKER -DWITH_LOCKER_I3LOCK
.endif
.if "$(WITH_LOCKER)" == "i3lock-color"
CPPFLAGS += -DWITH_LOCKER -DWITH_LOCKER_I3LOCK_COLOR
.endif
.if "$(WITH_TERMINAL)" == "alacritty"
CPPFLAGS += -DWITH_TERMINAL -DWITH_TERMINAL_ALACRITTY
.endif

View File

@ -3,6 +3,13 @@ CPPFLAGS += -DENABLE_XINERAMA
PKGS += xinerama
endif
ifeq (i3lock,$(WITH_LOCKER))
CPPFLAGS += -DWITH_LOCKER -DWITH_LOCKER_I3LOCK
endif
ifeq (i3lock-color,$(WITH_LOCKER))
CPPFLAGS += -DWITH_LOCKER -DWITH_LOCKER_I3LOCK_COLOR
endif
ifeq (alacritty,$(WITH_TERMINAL))
CPPFLAGS += -DWITH_TERMINAL -DWITH_TERMINAL_ALACRITTY
endif

54
configure vendored
View File

@ -45,6 +45,9 @@ Optional Features:
Optional Packages:
--with-PACKAGE[ ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE no)
--with-locker [i3lock|i3lock-color]
use ARG as screen locker [i3lock]
--without-locker do not use screen locker at all
--with-terminal [alacritty|gnome|st|xterm]
use ARG as terminal [alacritty]
--without-terminal do not use terminal at all
@ -58,6 +61,7 @@ bindir=''
datarootdir=''
mandir=''
enable_xinerama=''
with_locker=''
with_terminal=''
while [ $# -gt 0 ]; do
@ -90,6 +94,13 @@ while [ $# -gt 0 ]; do
--disable-xinerama)
enable_xinerama='no'
;;
--without-locker)
if [ "$with_locker" = '' ]; then
with_locker='no'
elif [ "$with_locker" != 'no' ]; then
usage
fi
;;
--without-terminal)
if [ "$with_terminal" = '' ]; then
with_terminal='no'
@ -97,6 +108,43 @@ while [ $# -gt 0 ]; do
usage
fi
;;
--with-locker)
shift
case "$1" in
yes)
if [ "$with_locker" = '' ]; then
with_locker='yes'
elif [ "$with_locker" != 'yes' ]; then
usage
fi
;;
no)
if [ "$with_locker" = '' ]; then
with_locker='no'
elif [ "$with_locker" != 'no' ]; then
usage
fi
;;
i3lock)
if [ "$with_locker" = '' ]; then
with_locker='i3lock'
elif [ "$with_locker" != 'i3lock' ]; then
usage
fi
;;
i3lock-color)
if [ "$with_locker" = '' ]; then
with_locker='i3lock-color'
elif [ "$with_locker" != 'i3lock-color' ]; then
usage
fi
;;
*)
do_shift='no'
;;
esac
;;
--with-terminal)
shift
@ -176,6 +224,10 @@ if [ "$enable_xinerama" = '' ]; then
enable_xinerama='yes'
fi
if [ "$with_locker" = '' -o "$with_locker" = 'yes' ]; then
with_locker='i3lock'
fi
if [ "$with_terminal" = '' -o "$with_terminal" = 'yes' ]; then
with_terminal='alacritty'
fi
@ -186,6 +238,7 @@ echo "BINDIR = $bindir"
echo "DATAROOTDIR = $datarootdir"
echo "MANDIR = $mandir"
echo "ENABLE_XINERAMA = $enable_xinerama"
echo "WITH_LOCKER = $with_locker"
echo "WITH_TERMINAL = $with_terminal"
cat > 'config/1-generated.mk' << MAKE
@ -195,6 +248,7 @@ BINDIR = $bindir
DATAROOTDIR = $datarootdir
MANDIR = $mandir
ENABLE_XINERAMA = $enable_xinerama
WITH_LOCKER = $with_locker
WITH_TERMINAL = $with_terminal
MAKE

View File

@ -33,6 +33,9 @@ for launching other programs.
.B Mod1\-Shift\-/
Start terminal.
.TP
.B Mod1\-z
Lock screen.
.TP
.B Mod1\-,
Focus previous screen, if any.
.TP

View File

@ -6,10 +6,19 @@
#include <string.h>
#include <unistd.h>
#define MAX_ARGS_COUNT 20
#define MAX_ARGS_COUNT 25
#define ARGS_SIZE (MAX_ARGS_COUNT + 1)
#define MON_ARG_SIZE 2
#ifdef WITH_LOCKER_I3LOCK_COLOR
#define COLOR_BLANK "#00000000"
#define COLOR_CLEAR "#ffffff22"
#define COLOR_DEFAULT "#ff00ffcc"
#define COLOR_TEXT "#ee00eeee"
#define COLOR_WRONG "#880000bb"
#define COLOR_VERIFYING "#bb00bbbb"
#endif // WITH_LOCKER_I3LOCK_COLOR
struct Command {
const char *name;
size_t monitor_arg_index;
@ -17,11 +26,47 @@ struct Command {
};
static struct Command commands[] = {
#ifdef WITH_LOCKER
{
.name = "lock",
.monitor_arg_index = 0,
#ifdef WITH_LOCKER_I3LOCK
.args = { "i3lock", NULL },
#endif // WITH_LOCKER_I3LOCK
#ifdef WITH_LOCKER_I3LOCK_COLOR
.args = {
"i3lock",
"--insidever-color="COLOR_CLEAR,
"--ringver-color="COLOR_VERIFYING,
"--insidewrong-color="COLOR_CLEAR,
"--ringwrong-color="COLOR_WRONG,
"--inside-color="COLOR_BLANK,
"--ring-color="COLOR_DEFAULT,
"--line-color="COLOR_BLANK,
"--separator-color="COLOR_DEFAULT,
"--verif-color="COLOR_TEXT,
"--wrong-color="COLOR_TEXT,
"--time-color="COLOR_TEXT,
"--date-color="COLOR_TEXT,
"--layout-color="COLOR_TEXT,
"--keyhl-color="COLOR_WRONG,
"--bshl-color="COLOR_WRONG,
"--screen=1",
"--blur=5",
"--clock",
"--indicator",
"--time-str=%H:%M:%S",
"--date-str=%a, %e %b %Y",
"--keylayout=1",
NULL,
},
#endif // WITH_LOCKER_I3LOCK_COLOR
},
#endif // WITH_LOCKER
{
.name = "menu",
.monitor_arg_index = 6,
@ -43,18 +88,18 @@ static struct Command commands[] = {
.monitor_arg_index = 0,
#ifdef WITH_TERMINAL_ALACRITTY
.args = { "alacritty", NULL },
#endif
#endif // WITH_TERMINAL_ALACRITTY
#ifdef WITH_TERMINAL_GNOME
.args = { "gnome-terminal", "--wait", NULL },
#endif
#endif // WITH_TERMINAL_GNOME
#ifdef WITH_TERMINAL_ST
.args = { "st", NULL },
#endif
#endif // WITH_TERMINAL_ST
#ifdef WITH_TERMINAL_XTERM
.args = { "xterm", NULL },
#endif
#endif // WITH_TERMINAL_XTERM
},
#endif
#endif // WITH_TERMINAL
{
.name = "firefox",
.monitor_arg_index = 0,