feat(greetd): use ags greetd example
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-02-05 12:00:25 -05:00
parent 47d1642e2e
commit fb9e26dc66
5 changed files with 55 additions and 64 deletions

View file

@ -1,13 +0,0 @@
diff --git a/src/gui/component.rs b/src/gui/component.rs
index 692309c..f2fb9c0 100644
--- a/src/gui/component.rs
+++ b/src/gui/component.rs
@@ -371,7 +371,7 @@ impl AsyncComponent for Greeter {
if let Some(monitor) = &model.updates.monitor {
// The window needs to be manually fullscreened, since the monitor is `None` at widget
// init.
- root.fullscreen_on_monitor(monitor);
+ // root.fullscreen_on_monitor(monitor);
} else {
// Couldn't choose a monitor, so let the compositor choose it for us.
root.fullscreen();

View file

@ -4,7 +4,7 @@
config,
...
}: let
inherit (lib) getExe optionals readFile;
inherit (lib) optionals readFile;
inherit (config.vars) mainUser greetdDupe mainMonitor;
# Nix stuff
@ -20,9 +20,10 @@
.windowManager
.hyprland
.finalPackage;
# Executables' paths
hyprBin = "${hyprland}/bin";
regreetBin = "${getExe config.programs.regreet.package}";
ags = config.home-manager.users.${mainUser}.programs.ags.package;
agsBin = "${ags}/bin";
# Show Regreet on all monitors
dupeMonitors = pkgs.writeShellScriptBin "dupeMonitors" ''
@ -44,16 +45,13 @@
done
'';
# Check if user wants Regreet only on main monitor
# Check if user wants the greeter only on main monitor
setupMonitors =
if (mainMonitor != "null" && !greetdDupe)
then "${hyprBin}/hyprctl dispatch focusmonitor ${mainMonitor}"
else "${dupeMonitors}/bin/dupeMonitors";
# Get css for regreet
style = pkgs.writeText "style.css" ''${readFile ./style.css}'';
# Setup Hyprland as regreet's compositor
# Setup Hyprland as the greeter's compositor
hyprConf =
pkgs.writeText "greetd-hypr-config"
(lib.strings.concatStrings ((optionals isNvidia [
@ -65,38 +63,32 @@
])
++ [
"exec-once = ${setupMonitors} &&"
" sleep 1; swww init --no-cache &&"
" swww init --no-cache &&"
" swww img -t none ${pkgs.dracula-theme}/wallpapers/waves.png\n"
"${readFile ./hyprland.conf}\n"
"exec-once = ${regreetBin} -s ${style};"
"exec-once = ${agsBin}/ags --config ${./greetd.js};"
" ${hyprBin}/hyprctl dispatch exit"
]));
in {
imports = [./regreet.nix];
# Add home folder for home-manager to work
users.users.greeter.home = "/var/lib/greetd";
users.users.greeter = {
packages = with pkgs; [
dracula-theme
flat-remix-icon-theme
home-manager.users.greeter = {
imports = [
../../common/vars
../../home/theme.nix
];
home.packages = with pkgs; [
swww
gtk3
glib
];
};
# See overlay
programs.regreet = {
enable = true;
settings = {
GTK = {
cursor_theme_name = "Dracula-cursors";
font_name = "Sans Serif";
icon_theme_name = "Flat-Remix-Violet-Dark";
theme_name = "Dracula";
};
};
vars = config.vars;
home.stateVersion = "24.05";
};
services = {

36
modules/greetd/greetd.js Normal file
View file

@ -0,0 +1,36 @@
const greetd = await Service.import('greetd');
const name = Widget.Entry({
placeholder_text: 'Username',
on_accept: () => password.grab_focus(),
})
const password = Widget.Entry({
placeholder_text: 'Password',
visibility: false,
on_accept: () => {
greetd.login(name.text || '', password.text || '', 'Hyprland')
.catch(err => response.label = JSON.stringify(err))
},
})
const response = Widget.Label()
const win = Widget.Window({
css: 'background-color: transparent;',
anchor: ['top', 'left', 'right', 'bottom'],
child: Widget.Box({
vertical: true,
hpack: 'center',
vpack: 'center',
hexpand: true,
vexpand: true,
children: [
name,
password,
response,
],
}),
});
export default { windows: [win] };

View file

@ -1,21 +0,0 @@
{pkgs, ...}: {
# TODO: try other greeters https://git.sr.ht/~kennylevinsen/gtkgreet
programs.regreet = {
package = pkgs.greetd.regreet.overrideAttrs (self: super: rec {
version = "0.1.1-patched";
src = pkgs.fetchFromGitHub {
owner = "rharish101";
repo = "ReGreet";
rev = "61d871a0ee5c74230dfef8100d0c9bc75b309203";
hash = "sha256-PkQTubSm/FN3FXs9vBB3FI4dXbQhv/7fS1rXkVsTAAs=";
};
cargoDeps = super.cargoDeps.overrideAttrs (_: {
inherit src;
outputHash = "sha256-dR6veXCGVMr5TbCvP0EqyQKTG2XM65VHF9U2nRWyzfA=";
});
# temp fix until https://github.com/rharish101/ReGreet/issues/32 is solved
patches = [./crash-fix.patch];
});
};
}

View file

@ -1,3 +0,0 @@
window {
background-color: rgba(0, 0, 0, 0);
}