change import script

Signed-off-by: Hadi <hadi@example.fr>
This commit is contained in:
Hadi
2026-08-17 14:14:01 +02:00
parent 2affa2a8ec
commit 6a2adfb338
6 changed files with 31 additions and 29 deletions
+1 -1
View File
@@ -2,10 +2,10 @@
pkgs,
lib,
config,
scripts,
...
}: let
colors = config.lib.stylix.colors;
scripts = import ../waybar/scripts.nix {inherit pkgs config;};
border-size = config.theme.border-size;
mkMenu = menu: let
+1 -1
View File
@@ -1,9 +1,9 @@
{
config,
pkgs,
scripts,
...
}: let
scripts = import ../waybar/scripts.nix {inherit pkgs config;};
c = config.lib.stylix.colors;
font = config.stylix.fonts.sansSerif.name;
monofont = config.stylix.fonts.monospace.name;
+2 -4
View File
@@ -1,10 +1,8 @@
{
pkgs,
config,
scripts,
...
}: let
scripts = import ../waybar/scripts.nix {inherit pkgs config;};
in {
}: {
xdg.desktopEntries = {
focus-toggle = {
name = "Focus Mode";
+2
View File
@@ -10,6 +10,8 @@ in {
./style.nix
];
_module.args.scripts = scripts;
_module.args.osdPath = scripts.osdPath;
_module.args.networkScript = scripts.networkScript;
_module.args.bluetoothScript = scripts.bluetoothScript;
_module.args.volMuteScript = scripts.vol-mute;
+23 -22
View File
@@ -6,7 +6,7 @@
name = "waybar-osd";
runtimeInputs = with pkgs; [procps coreutils];
text = ''
printf '%s' "$1" > /tmp/waybar-osd
printf '%s' "$1" > "$XDG_RUNTIME_DIR/waybar-osd"
pkill -f -RTMIN+8 '^waybar$' 2>/dev/null || true
'';
};
@@ -15,7 +15,7 @@
name = "waybar-osd-status";
runtimeInputs = with pkgs; [coreutils];
text = ''
file=/tmp/waybar-osd
file="$XDG_RUNTIME_DIR/waybar-osd"
[ -f "$file" ] || exit 1
mtime=$(stat -c %Y "$file" 2>/dev/null) || exit 1
age=$(( $(date +%s) - mtime ))
@@ -86,8 +86,9 @@
jq -r 'to_entries[] | select(.key != "METADATA") | "\(.value.char) \(.key)"' \
${nerdFontGlyphnames} > "$out"
'';
osdPath = "$XDG_RUNTIME_DIR/waybar-osd";
in {
inherit waybar-osd waybar-osd-status battery-monitor;
inherit waybar-osd waybar-osd-status battery-monitor osdPath;
bluetoothScript = pkgs.writeShellScript "waybar-bluetooth" ''
jq=${pkgs.jq}/bin/jq
@@ -234,19 +235,19 @@ in {
'';
wifi-toggle = pkgs.writeShellScriptBin "wifi-toggle" ''
if nmcli radio wifi | grep -q enabled; then
nmcli radio wifi off
if ${pkgs.networkmanager}/bin/nmcli radio wifi | grep -q enabled; then
${pkgs.networkmanager}/bin/nmcli radio wifi off
else
nmcli radio wifi on
${pkgs.networkmanager}/bin/nmcli radio wifi on
fi
${updateOsd}
'';
bluetooth-toggle = pkgs.writeShellScriptBin "bluetooth-toggle" ''
if bluetoothctl show | grep -q "Powered: yes"; then
bluetoothctl power off
if ${pkgs.bluez}/bin/bluetoothctl show | grep -q "Powered: yes"; then
${pkgs.bluez}/bin/bluetoothctl power off
else
bluetoothctl power on
${pkgs.bluez}/bin/bluetoothctl power on
fi
${updateOsd}
'';
@@ -260,7 +261,7 @@ in {
'';
nightshift-toggle = pkgs.writeShellScriptBin "nightshift-toggle" ''
if pidof "hyprsunset" > /dev/null; then
if ${pkgs.procps}/bin/pidof "hyprsunset" > /dev/null; then
pkill hyprsunset
OSD_TEXT="󰖔 Night Shift Off"
else
@@ -271,23 +272,23 @@ in {
'';
focus-toggle = pkgs.writeShellScriptBin "focus-toggle" ''
if test -f /tmp/hypr-focus-mode; then
rm /tmp/hypr-focus-mode
if test -f "$XDG_RUNTIME_DIR/hypr-focus-mode"; then
rm "$XDG_RUNTIME_DIR/hypr-focus-mode"
OSD_TEXT="󰈈 Focus Off"
${updateOsd}
hyprctl reload
hyprctl dispatch exec waybar
${pkgs.hyprland}/bin/hyprctl reload
${pkgs.hyprland}/bin/hyprctl dispatch exec waybar
else
touch /tmp/hypr-focus-mode
touch "$XDG_RUNTIME_DIR/hypr-focus-mode"
OSD_TEXT="󰈈 Focus On"
${updateOsd}
pkill waybar || true
hyprctl keyword animations:enabled false
hyprctl keyword general:gaps_in 0
hyprctl keyword general:gaps_out 0
hyprctl keyword decoration:active_opacity 1
hyprctl keyword decoration:inactive_opacity 1
hyprctl keyword decoration:rounding 0
${pkgs.procps}/bin/pkill waybar || true
${pkgs.hyprland}/bin/hyprctl keyword animations:enabled false
${pkgs.hyprland}/bin/hyprctl keyword general:gaps_in 0
${pkgs.hyprland}/bin/hyprctl keyword general:gaps_out 0
${pkgs.hyprland}/bin/hyprctl keyword decoration:active_opacity 1
${pkgs.hyprland}/bin/hyprctl keyword decoration:inactive_opacity 1
${pkgs.hyprland}/bin/hyprctl keyword decoration:rounding 0
fi
'';
+2 -1
View File
@@ -1,6 +1,7 @@
{
config,
pkgs,
osdPath,
networkScript,
bluetoothScript,
caffeineToggleScript,
@@ -76,7 +77,7 @@ in {
};
"custom/osd" = {
exec = "cat /tmp/waybar-osd";
exec = "cat ${osdPath}";
exec-if = "${osdStatusScript}/bin/waybar-osd-status";
signal = 8;
interval = 1;