refactor(greetd): move ags conf into ags module
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
17a52bd460
commit
eb9ba2a7a4
3 changed files with 64 additions and 42 deletions
|
@ -3,18 +3,20 @@ 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))
|
||||
.catch((err) => {
|
||||
response.label = JSON.stringify(err);
|
||||
});
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
const response = Widget.Label()
|
||||
const response = Widget.Label();
|
||||
|
||||
const win = Widget.Window({
|
||||
css: 'background-color: transparent;',
|
|
@ -32,7 +32,9 @@ export const transpileTypeScript = async(host) => {
|
|||
'--external', '*/fzf.es.js',
|
||||
]).catch(print);
|
||||
|
||||
if (host !== 'greeter') {
|
||||
watchAndCompileSass(host);
|
||||
}
|
||||
|
||||
// The file is going to be there after transpilation
|
||||
// @ts-ignore
|
||||
|
|
|
@ -11,24 +11,16 @@
|
|||
isNvidia = config.hardware.nvidia.modesetting.enable;
|
||||
isTouchscreen = config.hardware.sensor.iio.enable;
|
||||
|
||||
hyprland =
|
||||
config
|
||||
.home-manager
|
||||
.users
|
||||
.${mainUser}
|
||||
.wayland
|
||||
.windowManager
|
||||
.hyprland
|
||||
.finalPackage;
|
||||
hyprBin = "${hyprland}/bin";
|
||||
|
||||
hyprland = config.home-manager.users.${mainUser}.wayland.windowManager.hyprland.finalPackage;
|
||||
ags = config.home-manager.users.${mainUser}.programs.ags.package;
|
||||
agsBin = "${ags}/bin";
|
||||
|
||||
# Show Regreet on all monitors
|
||||
dupeMonitors = pkgs.writeShellScriptBin "dupeMonitors" ''
|
||||
dupeMonitors = pkgs.writeShellApplication {
|
||||
name = "dupeMonitors";
|
||||
runtimeInputs = [hyprland pkgs.jq];
|
||||
text = ''
|
||||
main="${mainMonitor}"
|
||||
names=($(${hyprBin}/hyprctl -j monitors | ${pkgs.jq}/bin/jq -r '.[] .description'))
|
||||
names="($(hyprctl -j monitors | jq -r '.[] .description'))"
|
||||
|
||||
if [[ "$main" == "null" ]]; then
|
||||
main="''${names[0]}"
|
||||
|
@ -36,20 +28,23 @@
|
|||
|
||||
for (( i=0; i<''${#names[@]}; i++ )); do
|
||||
|
||||
# shellcheck disable=SC2001
|
||||
name=$(echo "''${names[$i]}" | sed 's/.*(\(.*\))/\1/')
|
||||
# shellcheck disable=SC2001
|
||||
desc=$(echo "''${names[$i]}" | sed 's/ (.*//')
|
||||
|
||||
if [[ "$name" != "$main" && "desc:$desc" != "$main" ]]; then
|
||||
${hyprBin}/hyprctl keyword monitor "$name",preferred,auto,1,mirror,"$main"
|
||||
hyprctl keyword monitor "$name",preferred,auto,1,mirror,"$main"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
};
|
||||
|
||||
# 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";
|
||||
then "hyprctl dispatch focusmonitor ${mainMonitor}"
|
||||
else "dupeMonitors";
|
||||
|
||||
# Setup Hyprland as the greeter's compositor
|
||||
hyprConf =
|
||||
|
@ -68,8 +63,7 @@
|
|||
|
||||
"${readFile ./hyprland.conf}\n"
|
||||
|
||||
"exec-once = ${agsBin}/ags -b greeter --config ${./greetd.js};"
|
||||
" ${hyprBin}/hyprctl dispatch exit"
|
||||
"exec-once = ags -b greeter; hyprctl dispatch exit"
|
||||
]));
|
||||
in {
|
||||
# Add home folder for home-manager to work
|
||||
|
@ -84,12 +78,36 @@ in {
|
|||
../../home/theme.nix
|
||||
];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
swww
|
||||
gtk3
|
||||
glib
|
||||
home = {
|
||||
packages = [
|
||||
hyprland
|
||||
ags
|
||||
dupeMonitors
|
||||
pkgs.bun
|
||||
pkgs.sassc
|
||||
pkgs.swww
|
||||
pkgs.gtk3
|
||||
pkgs.glib
|
||||
];
|
||||
|
||||
file = {
|
||||
".config/ags" = {
|
||||
source = ../ags/config;
|
||||
recursive = true;
|
||||
};
|
||||
|
||||
".config/ags/config.js".text =
|
||||
/*
|
||||
javascript
|
||||
*/
|
||||
''
|
||||
import { transpileTypeScript } from './js/utils.js';
|
||||
|
||||
export default (await transpileTypeScript('greeter')).default;
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
vars = config.vars;
|
||||
home.stateVersion = "24.05";
|
||||
};
|
||||
|
@ -108,12 +126,12 @@ in {
|
|||
enable = true;
|
||||
settings = {
|
||||
default_session = {
|
||||
command = "${hyprBin}/Hyprland --config ${hyprConf}";
|
||||
command = "Hyprland --config ${hyprConf}";
|
||||
user = "greeter";
|
||||
};
|
||||
|
||||
initial_session = {
|
||||
command = "${hyprBin}/Hyprland";
|
||||
command = "Hyprland";
|
||||
user = mainUser;
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue