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({
|
const name = Widget.Entry({
|
||||||
placeholder_text: 'Username',
|
placeholder_text: 'Username',
|
||||||
on_accept: () => password.grab_focus(),
|
on_accept: () => password.grab_focus(),
|
||||||
})
|
});
|
||||||
|
|
||||||
const password = Widget.Entry({
|
const password = Widget.Entry({
|
||||||
placeholder_text: 'Password',
|
placeholder_text: 'Password',
|
||||||
visibility: false,
|
visibility: false,
|
||||||
on_accept: () => {
|
on_accept: () => {
|
||||||
greetd.login(name.text || '', password.text || '', 'Hyprland')
|
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({
|
const win = Widget.Window({
|
||||||
css: 'background-color: transparent;',
|
css: 'background-color: transparent;',
|
|
@ -32,7 +32,9 @@ export const transpileTypeScript = async(host) => {
|
||||||
'--external', '*/fzf.es.js',
|
'--external', '*/fzf.es.js',
|
||||||
]).catch(print);
|
]).catch(print);
|
||||||
|
|
||||||
watchAndCompileSass(host);
|
if (host !== 'greeter') {
|
||||||
|
watchAndCompileSass(host);
|
||||||
|
}
|
||||||
|
|
||||||
// The file is going to be there after transpilation
|
// The file is going to be there after transpilation
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
|
@ -11,45 +11,40 @@
|
||||||
isNvidia = config.hardware.nvidia.modesetting.enable;
|
isNvidia = config.hardware.nvidia.modesetting.enable;
|
||||||
isTouchscreen = config.hardware.sensor.iio.enable;
|
isTouchscreen = config.hardware.sensor.iio.enable;
|
||||||
|
|
||||||
hyprland =
|
hyprland = config.home-manager.users.${mainUser}.wayland.windowManager.hyprland.finalPackage;
|
||||||
config
|
|
||||||
.home-manager
|
|
||||||
.users
|
|
||||||
.${mainUser}
|
|
||||||
.wayland
|
|
||||||
.windowManager
|
|
||||||
.hyprland
|
|
||||||
.finalPackage;
|
|
||||||
hyprBin = "${hyprland}/bin";
|
|
||||||
|
|
||||||
ags = config.home-manager.users.${mainUser}.programs.ags.package;
|
ags = config.home-manager.users.${mainUser}.programs.ags.package;
|
||||||
agsBin = "${ags}/bin";
|
|
||||||
|
|
||||||
# Show Regreet on all monitors
|
# Show Regreet on all monitors
|
||||||
dupeMonitors = pkgs.writeShellScriptBin "dupeMonitors" ''
|
dupeMonitors = pkgs.writeShellApplication {
|
||||||
main="${mainMonitor}"
|
name = "dupeMonitors";
|
||||||
names=($(${hyprBin}/hyprctl -j monitors | ${pkgs.jq}/bin/jq -r '.[] .description'))
|
runtimeInputs = [hyprland pkgs.jq];
|
||||||
|
text = ''
|
||||||
|
main="${mainMonitor}"
|
||||||
|
names="($(hyprctl -j monitors | jq -r '.[] .description'))"
|
||||||
|
|
||||||
if [[ "$main" == "null" ]]; then
|
if [[ "$main" == "null" ]]; then
|
||||||
main="''${names[0]}"
|
main="''${names[0]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for (( i=0; i<''${#names[@]}; i++ )); do
|
for (( i=0; i<''${#names[@]}; i++ )); do
|
||||||
|
|
||||||
name=$(echo "''${names[$i]}" | sed 's/.*(\(.*\))/\1/')
|
# shellcheck disable=SC2001
|
||||||
desc=$(echo "''${names[$i]}" | sed 's/ (.*//')
|
name=$(echo "''${names[$i]}" | sed 's/.*(\(.*\))/\1/')
|
||||||
|
# shellcheck disable=SC2001
|
||||||
|
desc=$(echo "''${names[$i]}" | sed 's/ (.*//')
|
||||||
|
|
||||||
if [[ "$name" != "$main" && "desc:$desc" != "$main" ]]; then
|
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
|
fi
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
# Check if user wants the greeter only on main monitor
|
# Check if user wants the greeter only on main monitor
|
||||||
setupMonitors =
|
setupMonitors =
|
||||||
if (mainMonitor != "null" && !greetdDupe)
|
if (mainMonitor != "null" && !greetdDupe)
|
||||||
then "${hyprBin}/hyprctl dispatch focusmonitor ${mainMonitor}"
|
then "hyprctl dispatch focusmonitor ${mainMonitor}"
|
||||||
else "${dupeMonitors}/bin/dupeMonitors";
|
else "dupeMonitors";
|
||||||
|
|
||||||
# Setup Hyprland as the greeter's compositor
|
# Setup Hyprland as the greeter's compositor
|
||||||
hyprConf =
|
hyprConf =
|
||||||
|
@ -68,8 +63,7 @@
|
||||||
|
|
||||||
"${readFile ./hyprland.conf}\n"
|
"${readFile ./hyprland.conf}\n"
|
||||||
|
|
||||||
"exec-once = ${agsBin}/ags -b greeter --config ${./greetd.js};"
|
"exec-once = ags -b greeter; hyprctl dispatch exit"
|
||||||
" ${hyprBin}/hyprctl dispatch exit"
|
|
||||||
]));
|
]));
|
||||||
in {
|
in {
|
||||||
# Add home folder for home-manager to work
|
# Add home folder for home-manager to work
|
||||||
|
@ -84,11 +78,35 @@ in {
|
||||||
../../home/theme.nix
|
../../home/theme.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home = {
|
||||||
swww
|
packages = [
|
||||||
gtk3
|
hyprland
|
||||||
glib
|
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;
|
vars = config.vars;
|
||||||
home.stateVersion = "24.05";
|
home.stateVersion = "24.05";
|
||||||
|
@ -108,12 +126,12 @@ in {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
default_session = {
|
default_session = {
|
||||||
command = "${hyprBin}/Hyprland --config ${hyprConf}";
|
command = "Hyprland --config ${hyprConf}";
|
||||||
user = "greeter";
|
user = "greeter";
|
||||||
};
|
};
|
||||||
|
|
||||||
initial_session = {
|
initial_session = {
|
||||||
command = "${hyprBin}/Hyprland";
|
command = "Hyprland";
|
||||||
user = mainUser;
|
user = mainUser;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue