user/{eww,hypridle,hyprlock}: configure based on options.me
This commit is contained in:
parent
f33525f565
commit
1a62545c3c
5 changed files with 78 additions and 37 deletions
|
|
@ -1,18 +1,43 @@
|
||||||
{ config, lib, ... }: {
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkOption
|
||||||
|
types;
|
||||||
|
in {
|
||||||
options.me = {
|
options.me = {
|
||||||
environment = lib.mkOption {
|
environment = mkOption {
|
||||||
type = lib.types.enum [ "desktop" "laptop" "headless" ];
|
type = types.enum [ "desktop" "laptop" "headless" ];
|
||||||
default = "desktop";
|
default = "desktop";
|
||||||
};
|
};
|
||||||
|
|
||||||
fprint = lib.mkOption {
|
fprint = mkOption {
|
||||||
type = lib.types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
gui = lib.mkOption {
|
gui = mkOption {
|
||||||
type = lib.types.bool;
|
type = types.bool;
|
||||||
default = config.me.environment != "headless";
|
default = config.me.environment != "headless";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
batteryDevice = mkOption {
|
||||||
|
type = types.nullOr types.string;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
kbBacklightDevice = mkOption {
|
||||||
|
type = types.nullOr types.string;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
hasBluetooth = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = config.me.environment == "laptop";
|
||||||
|
};
|
||||||
|
|
||||||
|
hasWifi = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = config.me.environment == "laptop";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,17 @@ let
|
||||||
dontUnpack = true;
|
dontUnpack = true;
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
cp -r ${../../res/eww} $out
|
cp -r ${../../res/eww} $out
|
||||||
|
|
||||||
|
substituteInPlace $out/eww.yuck \
|
||||||
|
--replace-fail "_BAT_ENABLED_" "${config.me.batteryPath != null}" \
|
||||||
|
--replace-fail "_BAT_PATH_" "${config.me.batteryPATH}" \
|
||||||
|
--replace-fail "_BT_ENABLED_" "${config.me.hasBluetooth}" \
|
||||||
|
--replace-fail "_WIFI_ENABLED_" "${config.me.hasWifi}"
|
||||||
|
|
||||||
substituteInPlace $out/eww.scss \
|
substituteInPlace $out/eww.scss \
|
||||||
--replace-warn "EWW_BACKGROUND" "${config.catppuccin.hexcolors.crust}" \
|
--replace-fail "EWW_BACKGROUND" "${config.catppuccin.hexcolors.crust}" \
|
||||||
--replace-warn "EWW_TEXT" "${config.catppuccin.hexcolors.text}" \
|
--replace-fail "EWW_TEXT" "${config.catppuccin.hexcolors.text}" \
|
||||||
--replace-warn "EWW_ACCENT" "${config.catppuccin.hexcolors.${config.catppuccin.accent}}"
|
--replace-fail "EWW_ACCENT" "${config.catppuccin.hexcolors.${config.catppuccin.accent}}"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
kblight = "light -s sysfs/leds/asus::kbd_backlight";
|
kblight = "light -s sysfs/leds/${config.me.kbBacklightDevice}";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
home.packages = [ config.services.hypridle.package ];
|
home.packages = [ config.services.hypridle.package ];
|
||||||
|
|
@ -13,12 +13,13 @@ in
|
||||||
after_sleep_cmd = "hyprctl dispatch dpms on";
|
after_sleep_cmd = "hyprctl dispatch dpms on";
|
||||||
};
|
};
|
||||||
|
|
||||||
listener = [
|
listener = lib.optionals (config.me.kbBacklightDevice != null) [
|
||||||
{
|
{
|
||||||
timeout = 120;
|
timeout = 120;
|
||||||
on-timeout = "${kblight} -O && ${kblight} -S 0";
|
on-timeout = "${kblight} -O && ${kblight} -S 0";
|
||||||
on-resume = "${kblight} -I";
|
on-resume = "${kblight} -I";
|
||||||
}
|
}
|
||||||
|
] ++ [
|
||||||
{
|
{
|
||||||
timeout = 150;
|
timeout = 150;
|
||||||
on-timeout = "light -O && light -T 0.5";
|
on-timeout = "light -O && light -T 0.5";
|
||||||
|
|
@ -33,6 +34,7 @@ in
|
||||||
on-timeout = "hyprctl dispatch dpms off";
|
on-timeout = "hyprctl dispatch dpms off";
|
||||||
on-resume = "hyprctl dispatch dpms on";
|
on-resume = "hyprctl dispatch dpms on";
|
||||||
}
|
}
|
||||||
|
] ++ lib.optionals (config.me.environment == "laptop") [
|
||||||
{
|
{
|
||||||
timeout = 600;
|
timeout = 600;
|
||||||
on-timeout = "systemctl suspend";
|
on-timeout = "systemctl suspend";
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
{ ... }: {
|
{ config, lib, ... }: {
|
||||||
programs.hyprlock = {
|
programs.hyprlock = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
};
|
};
|
||||||
auth = {
|
auth = {
|
||||||
fingerprint = {
|
fingerprint = {
|
||||||
enabled = true;
|
enabled = config.me.fprint;
|
||||||
ready_message = "Scan fingerprint to unlock";
|
ready_message = "Scan fingerprint to unlock";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
position = "-40,-10";
|
position = "-40,-10";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
label = [
|
label = lib.optionals config.me.fprint [
|
||||||
# Fingerprint icon
|
# Fingerprint icon
|
||||||
{
|
{
|
||||||
monitor = "";
|
monitor = "";
|
||||||
|
|
@ -61,17 +61,7 @@
|
||||||
halign = "center";
|
halign = "center";
|
||||||
valign = "top";
|
valign = "top";
|
||||||
}
|
}
|
||||||
# Fail text under input
|
] ++ lib.optionals (config.me.batteryDevice != null) [
|
||||||
{
|
|
||||||
monitor = "";
|
|
||||||
color = "$red";
|
|
||||||
font_family = "Open Sans";
|
|
||||||
font_size = 25;
|
|
||||||
text = "$FAIL $ATTEMPTS[]";
|
|
||||||
position = "0, -200";
|
|
||||||
halign = "center";
|
|
||||||
valign = "center";
|
|
||||||
}
|
|
||||||
# Battery icon
|
# Battery icon
|
||||||
{
|
{
|
||||||
monitor = "";
|
monitor = "";
|
||||||
|
|
@ -86,7 +76,7 @@
|
||||||
# Battery percentage
|
# Battery percentage
|
||||||
{
|
{
|
||||||
monitor = "";
|
monitor = "";
|
||||||
text = ''cmd[update:60000] echo "<span weight='700'>$(cat /sys/class/power_supply/BATT/capacity)%</span>"'';
|
text = ''cmd[update:60000] echo "<span weight='700'>$(cat /sys/class/power_supply/${config.me.batteryDevice}/capacity)%</span>"'';
|
||||||
color = "$text";
|
color = "$text";
|
||||||
font_size = 23;
|
font_size = 23;
|
||||||
font_family = "Open Sans";
|
font_family = "Open Sans";
|
||||||
|
|
@ -94,6 +84,7 @@
|
||||||
halign = "right";
|
halign = "right";
|
||||||
valign = "top";
|
valign = "top";
|
||||||
}
|
}
|
||||||
|
] ++ [
|
||||||
# Time and Date
|
# Time and Date
|
||||||
{
|
{
|
||||||
monitor = "";
|
monitor = "";
|
||||||
|
|
@ -105,6 +96,18 @@
|
||||||
position = "-70, -20";
|
position = "-70, -20";
|
||||||
text = ''cmd[update:1000] echo "<span alpha='70%' weight='550'>$(date '+%A, %d %B %Y')</span> <span weight='700'>$(date +%H:%M)</span><span alpha='70%' weight='550'>$(date +:%S)</span>"'';
|
text = ''cmd[update:1000] echo "<span alpha='70%' weight='550'>$(date '+%A, %d %B %Y')</span> <span weight='700'>$(date +%H:%M)</span><span alpha='70%' weight='550'>$(date +:%S)</span>"'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Fail text under input
|
||||||
|
{
|
||||||
|
monitor = "";
|
||||||
|
color = "$red";
|
||||||
|
font_family = "Open Sans";
|
||||||
|
font_size = 25;
|
||||||
|
text = "$FAIL $ATTEMPTS[]";
|
||||||
|
position = "0, -200";
|
||||||
|
halign = "center";
|
||||||
|
valign = "center";
|
||||||
|
}
|
||||||
];
|
];
|
||||||
input-field = {
|
input-field = {
|
||||||
monitor = "";
|
monitor = "";
|
||||||
|
|
|
||||||
|
|
@ -20,27 +20,31 @@
|
||||||
:focusable false
|
:focusable false
|
||||||
(bar))
|
(bar))
|
||||||
|
|
||||||
|
(defvar bat-enabled _BAT_ENABLED_)
|
||||||
|
(defvar bt-enabled _BT_ENABLED_)
|
||||||
|
(defvar wifi-enabled _WIFI_ENABLED_)
|
||||||
|
|
||||||
(defvar bat-extended true)
|
(defvar bat-extended true)
|
||||||
(defvar bluetooth-extended false)
|
(defvar bluetooth-extended false)
|
||||||
(defvar network-extended false)
|
(defvar network-extended false)
|
||||||
(defvar time-extended false)
|
(defvar time-extended false)
|
||||||
|
|
||||||
(defpoll ptime :interval "1s"
|
(defpoll ptime :interval "1s"
|
||||||
`date +%H:%M`)
|
`date +%H:%M`)
|
||||||
(defpoll petimea :interval "1s" :run-while time-extended
|
(defpoll petimea :interval "1s" :run-while time-extended
|
||||||
`date "+%A, %d %B %Y "`)
|
`date "+%A, %d %B %Y "`)
|
||||||
(defpoll petimeb :interval "1s" :run-while time-extended
|
(defpoll petimeb :interval "1s" :run-while time-extended
|
||||||
`date "+:%S"`)
|
`date "+:%S"`)
|
||||||
(defpoll pbat_cap :interval "5s"
|
(defpoll pbat_cap :interval "5s" :run-while bat-enabled
|
||||||
`cat /sys/class/power_supply/BATT/capacity`)
|
`cat /sys/class/power_supply/_BAT_PATH_/capacity`)
|
||||||
(defpoll pbat_status :interval "1s"
|
(defpoll pbat_status :interval "1s" :run-while bat-enabled
|
||||||
`cat /sys/class/power_supply/BATT/status`)
|
`cat /sys/class/power_supply/_BAT_PATH_/status`)
|
||||||
(defpoll network_strength :interval "1s"
|
(defpoll network_strength :interval "1s" :run-while wifi-enabled
|
||||||
`nmcli -f IN-USE,SIGNAL device wifi | grep '*' | tr -d -c 0-9`)
|
`nmcli -f IN-USE,SIGNAL device wifi | grep '*' | tr -d -c 0-9`)
|
||||||
(defpoll bluetooth_device :interval "1s"
|
(defpoll bluetooth_device :interval "1s" :run-while bt-enabled
|
||||||
`bluetoothctl devices Connected | grep Device | cut -d" " -f3-`)
|
`bluetoothctl devices Connected | grep Device | cut -d" " -f3-`)
|
||||||
|
|
||||||
(deflisten lnetwork :initial "" "./scripts/network.sh")
|
(deflisten lnetwork :initial "" :run-while wifi-enabled "./scripts/network.sh")
|
||||||
(deflisten ltitle :initial "" "./scripts/title.sh")
|
(deflisten ltitle :initial "" "./scripts/title.sh")
|
||||||
(deflisten lworkspaces :initial "[]" "./scripts/workspaces.sh")
|
(deflisten lworkspaces :initial "[]" "./scripts/workspaces.sh")
|
||||||
(deflisten lcurrent_workspace :initial "1" "./scripts/active-workspace.sh")
|
(deflisten lcurrent_workspace :initial "1" "./scripts/active-workspace.sh")
|
||||||
|
|
@ -79,9 +83,9 @@
|
||||||
(box :orientation "horizontal"
|
(box :orientation "horizontal"
|
||||||
:space-evenly false
|
:space-evenly false
|
||||||
:halign "end"
|
:halign "end"
|
||||||
(bluetooth)
|
(box :visible {bt-enabled} (bluetooth))
|
||||||
(network)
|
(box :visible {wifi-enabled} (network))
|
||||||
(battery)
|
(box :visible {bat-enabled} (battery))
|
||||||
(time)))
|
(time)))
|
||||||
|
|
||||||
(defwidget bluetooth []
|
(defwidget bluetooth []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue