Implement passcode-based fullscreen phone locker (locker.so / xlocker)

This commit is contained in:
Luxferre committed 2026-10-29 21:31:00 +02:00
1 parent 32d5d2f2b4
commit 0656042f7f
56 files changed
+1264 -120

No files matched your search

+46
View File
@@ -480,6 +480,32 @@ inline char mapDialKey(KeySym sym, unsigned int keycode, unsigned int state) {
return '\0';
}
inline bool isLeftSoftkey(KeySym sym, unsigned int keycode) {
return sym == XK_Menu || sym == XF86XK_KbdLcdMenu1 || keycode == 135;
}
inline bool isRightSoftkey(KeySym sym, unsigned int keycode) {
return sym == XF86XK_Back || sym == XF86XK_KbdLcdMenu2 || keycode == 166;
}
inline bool isStarKey(KeySym sym, unsigned int keycode) {
return keycode == 63 || keycode == 530 || sym == XK_asterisk ||
sym == XK_KP_Multiply || static_cast<uint32_t>(sym) == 0x1008ffaa;
}
inline bool isPoundKey(KeySym sym, unsigned int keycode) {
return keycode == 106 || keycode == 531 || sym == XK_numbersign ||
sym == XK_KP_Divide || static_cast<uint32_t>(sym) == 0x1008ffab;
}
inline std::string getHomeDir() {
return getHomeDirPath();
}
inline bool isPhonePasscodeLocked() {
return ::access("/tmp/bananarchy_screen_locked", F_OK) == 0;
}
inline std::string trimStr(const std::string& s) {
size_t b = 0;
while (b < s.size() && std::isspace(static_cast<unsigned char>(s[b]))) {
@@ -1794,6 +1820,12 @@ inline void closeOtherPlugins(const char* selfPluginName) {
{"xringtones.pid", "ringtones"},
{"xwallpapers.pid", "wallpapers"},
{"xmusic.pid", "music"},
{"xsip.pid", "sip"},
{"xemail.pid", "email"},
{"xirc.pid", "irc"},
{"xtox.pid", "tox"},
{"xsmallweb.pid", "smallweb"},
{"xgps.pid", "gps"},
};
for (const auto& p : kAllPlugins) {
if (selfPluginName && std::strcmp(p.name, selfPluginName) == 0) {
@@ -1815,6 +1847,7 @@ inline bool isAnotherPluginActive(const char* selfPluginName) {
const char* name;
};
static const PluginRef kAllPlugins[] = {
{"xlocker.pid", "locker"},
{"xdrawer.pid", "xdrawer"},
{"xdialer.pid", "dialer"},
{"xcalllog.pid", "calllog"},
@@ -1829,6 +1862,12 @@ inline bool isAnotherPluginActive(const char* selfPluginName) {
{"xringtones.pid", "ringtones"},
{"xwallpapers.pid", "wallpapers"},
{"xmusic.pid", "music"},
{"xsip.pid", "sip"},
{"xemail.pid", "email"},
{"xirc.pid", "irc"},
{"xtox.pid", "tox"},
{"xsmallweb.pid", "smallweb"},
{"xgps.pid", "gps"},
};
for (const auto& p : kAllPlugins) {
if (selfPluginName && std::strcmp(p.name, selfPluginName) == 0) {
@@ -1859,6 +1898,7 @@ inline void grabPluginKeyboard(Display* dpy, Window win) {
inline void broadcastThemeReload(const char* selfPluginName = nullptr) {
static const char* kPlugins[] = {
"dmenu",
"locker",
"xdrawer",
"dialer",
"calllog",
@@ -1873,6 +1913,12 @@ inline void broadcastThemeReload(const char* selfPluginName = nullptr) {
"ringtones",
"wallpapers",
"music",
"sip",
"email",
"irc",
"tox",
"smallweb",
"gps",
};
for (const char* name : kPlugins) {
if (selfPluginName && std::strcmp(name, selfPluginName) == 0) {