mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-24 23:51:54 -05:00
waybar: setup binPath
This commit is contained in:
parent
8c791a1773
commit
bfa8d772d0
0
homeManagerModules/services/randomWallpaper/script.rb
Normal file → Executable file
0
homeManagerModules/services/randomWallpaper/script.rb
Normal file → Executable file
|
@ -50,8 +50,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
"hyprland/submap" = {
|
"hyprland/submap" = {
|
||||||
on-click = ''${lib.getExe'
|
on-click = ''hyprctl dispatch submap reset'';
|
||||||
config.wayland.windowManager.hyprland.package "hyprctl"} dispatch submap reset'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
"sway/workspaces" = {
|
"sway/workspaces" = {
|
||||||
|
@ -68,21 +67,20 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
"sway/mode" = {
|
"sway/mode" = {
|
||||||
on-click = ''${lib.getExe' config.wayland.windowManager.sway.package "swaymsg"} mode default'';
|
on-click = ''swaymsg mode default'';
|
||||||
};
|
};
|
||||||
|
|
||||||
"sway/scratchpad" = {
|
"sway/scratchpad" = {
|
||||||
format = "{icon} {count}";
|
format = "{icon} {count}";
|
||||||
format-icons = ["" ""];
|
format-icons = ["" ""];
|
||||||
on-click = "${lib.getExe' config.wayland.windowManager.sway.package "swaymsg"} scratchpad show";
|
on-click = "swaymsg scratchpad show";
|
||||||
show-empty = false;
|
show-empty = false;
|
||||||
tooltip = true;
|
tooltip = true;
|
||||||
tooltip-format = "{app}: {title}";
|
tooltip-format = "{app}: {title}";
|
||||||
};
|
};
|
||||||
|
|
||||||
"custom/app-close" = {
|
"custom/app-close" = {
|
||||||
on-click = ''${lib.getExe'
|
on-click = ''hyprctl dispatch killactive || swaymsg kill'';
|
||||||
config.wayland.windowManager.hyprland.package "hyprctl"} dispatch killactive || ${lib.getExe' config.wayland.windowManager.sway.package "swaymsg"} kill'';
|
|
||||||
format = "";
|
format = "";
|
||||||
tooltip-format = "Close the focused window.";
|
tooltip-format = "Close the focused window.";
|
||||||
};
|
};
|
||||||
|
@ -94,25 +92,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
battery = let
|
battery = let
|
||||||
checkBattery = pkgs.writeShellScript "check-battery" ''
|
checkBattery = pkgs.writeShellScript "check-battery" (builtins.readFile ./scripts/check-battery.sh);
|
||||||
if [ -d /sys/class/power_supply/BAT0 ]; then
|
|
||||||
BAT=/sys/class/power_supply/BAT0
|
|
||||||
elif [ -d /sys/class/power_supply/BAT1 ]; then
|
|
||||||
BAT=/sys/class/power_supply/BAT1
|
|
||||||
else
|
|
||||||
echo "No battery found."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
CRIT=''${1:-10}
|
|
||||||
NOTIFY=${lib.getExe' pkgs.libnotify "notify-send"}
|
|
||||||
|
|
||||||
stat=$(${lib.getExe' pkgs.coreutils "cat"} $BAT/status)
|
|
||||||
perc=$(${lib.getExe' pkgs.coreutils "cat"} $BAT/capacity)
|
|
||||||
|
|
||||||
if [[ $perc -le $CRIT ]] && [[ $stat == "Discharging" ]]; then
|
|
||||||
$NOTIFY --urgency=critical --icon=dialog-error "Battery Critical" "Current charge: $perc%".
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
in {
|
in {
|
||||||
format = "{icon}";
|
format = "{icon}";
|
||||||
format-icons = ["" "" "" "" "" "" "" "" "" ""];
|
format-icons = ["" "" "" "" "" "" "" "" "" ""];
|
||||||
|
@ -148,7 +128,7 @@ in {
|
||||||
format = "";
|
format = "";
|
||||||
format-connected = " {num_connections}";
|
format-connected = " {num_connections}";
|
||||||
format-disabled = ""; # an empty format will hide the module
|
format-disabled = ""; # an empty format will hide the module
|
||||||
on-clic = lib.getExe' pkgs.blueberry "blueberry";
|
on-click = "blueberry";
|
||||||
tooltip-format = "{controller_alias} {controller_address}";
|
tooltip-format = "{controller_alias} {controller_address}";
|
||||||
|
|
||||||
tooltip-format-connected = ''
|
tooltip-format-connected = ''
|
||||||
|
@ -172,7 +152,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
ignored-sinks = ["Easy Effects Sink"];
|
ignored-sinks = ["Easy Effects Sink"];
|
||||||
on-click = "${lib.getExe pkgs.pavucontrol} -t 3";
|
on-click = "pavucontrol -t 3";
|
||||||
scroll-step = 5;
|
scroll-step = 5;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -182,7 +162,7 @@ in {
|
||||||
format-ethernet = "";
|
format-ethernet = "";
|
||||||
format-icons = ["" "" "" ""];
|
format-icons = ["" "" "" ""];
|
||||||
format-wifi = "{icon}";
|
format-wifi = "{icon}";
|
||||||
on-click = "${lib.getExe pkgs.networkmanager_dmenu} -i";
|
on-click = "networkmanager_dmenu -i";
|
||||||
tooltip-format = "{ifname} via {gwaddr} ";
|
tooltip-format = "{ifname} via {gwaddr} ";
|
||||||
tooltip-format-disconnected = "Disconnected";
|
tooltip-format-disconnected = "Disconnected";
|
||||||
tooltip-format-ethernet = "{ifname} ";
|
tooltip-format-ethernet = "{ifname} ";
|
||||||
|
@ -192,23 +172,8 @@ in {
|
||||||
tray = {spacing = 15;};
|
tray = {spacing = 15;};
|
||||||
|
|
||||||
"custom/dnd" = let
|
"custom/dnd" = let
|
||||||
mako-dnd = pkgs.writeShellScript "mako-dnd" ''
|
mako-dnd =
|
||||||
show() {
|
pkgs.writeShellScript "mako-dnd" (builtins.readFile ./scripts/mako-dnd.sh);
|
||||||
MAKO_MODE=$(${lib.getExe' pkgs.mako "makoctl"} mode)
|
|
||||||
if ${lib.getExe' pkgs.coreutils "echo"} "$MAKO_MODE" | ${lib.getExe' pkgs.gnugrep "grep"} -q "do-not-disturb"; then
|
|
||||||
${lib.getExe' pkgs.coreutils "printf"} '{"text": "", "class": "on", "tooltip": "Notifications snoozed."}\n'
|
|
||||||
else
|
|
||||||
${lib.getExe' pkgs.coreutils "printf"} '{"text": "", "class": "off","tooltip": "Notifications enabled."}\n'
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
toggle() {
|
|
||||||
${lib.getExe' pkgs.mako "makoctl"} mode -t do-not-disturb
|
|
||||||
${lib.getExe' pkgs.procps "pkill"} -SIGRTMIN+2 .waybar-wrapped
|
|
||||||
}
|
|
||||||
|
|
||||||
[ $# -gt 0 ] && toggle || show
|
|
||||||
'';
|
|
||||||
in {
|
in {
|
||||||
exec = "${mako-dnd}";
|
exec = "${mako-dnd}";
|
||||||
interval = "once";
|
interval = "once";
|
||||||
|
@ -219,13 +184,13 @@ in {
|
||||||
|
|
||||||
"custom/logout" = {
|
"custom/logout" = {
|
||||||
format = "";
|
format = "";
|
||||||
on-click = ''${lib.getExe config.programs.rofi.package} -i -show power-menu -modi "power-menu:${lib.getExe pkgs.rofi-power-menu} --choices=logout/lockscreen/suspend/shutdown/reboot"'';
|
on-click = ''rofi -i -show power-menu -modi "power-menu:rofi-power-menu --choices=logout/lockscreen/suspend/shutdown/reboot"'';
|
||||||
tooltip-format = "Manage your session.";
|
tooltip-format = "Manage your session.";
|
||||||
};
|
};
|
||||||
|
|
||||||
"custom/menu" = {
|
"custom/menu" = {
|
||||||
format = "";
|
format = "";
|
||||||
on-click = "${lib.getExe pkgs.nwg-drawer}";
|
on-click = "nwg-drawer";
|
||||||
tooltip-format = "Touch-friendly application menu.";
|
tooltip-format = "Touch-friendly application menu.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -354,7 +319,37 @@ in {
|
||||||
|
|
||||||
systemd.user.services.waybar = {
|
systemd.user.services.waybar = {
|
||||||
Install.WantedBy = lib.mkForce (lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (cfg.desktop.sway.enable) "sway-session.target");
|
Install.WantedBy = lib.mkForce (lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (cfg.desktop.sway.enable) "sway-session.target");
|
||||||
Service.Restart = lib.mkForce "no";
|
|
||||||
|
Service = {
|
||||||
|
Environment = lib.mkForce [
|
||||||
|
"PATH=${
|
||||||
|
lib.makeBinPath ([
|
||||||
|
config.programs.rofi.package
|
||||||
|
config.wayland.windowManager.hyprland.package
|
||||||
|
config.wayland.windowManager.sway.package
|
||||||
|
]
|
||||||
|
++ (with pkgs; [
|
||||||
|
blueberry
|
||||||
|
bluez
|
||||||
|
coreutils
|
||||||
|
getopt
|
||||||
|
gnugrep
|
||||||
|
libnotify
|
||||||
|
mako
|
||||||
|
networkmanager
|
||||||
|
networkmanager_dmenu
|
||||||
|
nwg-drawer
|
||||||
|
pavucontrol
|
||||||
|
procps
|
||||||
|
rofi-power-menu
|
||||||
|
systemd
|
||||||
|
]))
|
||||||
|
}"
|
||||||
|
];
|
||||||
|
|
||||||
|
Restart = lib.mkForce "no";
|
||||||
|
};
|
||||||
|
|
||||||
Unit.BindsTo = lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (cfg.desktop.sway.enable) "sway-session.target";
|
Unit.BindsTo = lib.optional (cfg.desktop.hyprland.enable) "hyprland-session.target" ++ lib.optional (cfg.desktop.sway.enable) "sway-session.target";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
18
homeManagerModules/services/waybar/scripts/check-battery.sh
Executable file
18
homeManagerModules/services/waybar/scripts/check-battery.sh
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [ -d /sys/class/power_supply/BAT0 ]; then
|
||||||
|
BAT=/sys/class/power_supply/BAT0
|
||||||
|
elif [ -d /sys/class/power_supply/BAT1 ]; then
|
||||||
|
BAT=/sys/class/power_supply/BAT1
|
||||||
|
else
|
||||||
|
echo "No battery found."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CRIT=''${1:-10}
|
||||||
|
STAT=$(cat $BAT/status)
|
||||||
|
PERC=$(cat $BAT/capacity)
|
||||||
|
|
||||||
|
if [[ $PERC -le $CRIT ]] && [[ $STAT == "Discharging" ]]; then
|
||||||
|
notify-send --urgency=critical --icon=dialog-error "Battery Critical" "Current charge: $PERC%".
|
||||||
|
fi
|
17
homeManagerModules/services/waybar/scripts/mako-dnd.sh
Executable file
17
homeManagerModules/services/waybar/scripts/mako-dnd.sh
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
show() {
|
||||||
|
MAKO_MODE=$(makoctl mode)
|
||||||
|
if echo "$MAKO_MODE" | grep -q "do-not-disturb"; then
|
||||||
|
printf '{"text": "", "class": "on", "tooltip": "Notifications snoozed."}\n'
|
||||||
|
else
|
||||||
|
printf '{"text": "", "class": "off","tooltip": "Notifications enabled."}\n'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
toggle() {
|
||||||
|
makoctl mode -t do-not-disturb
|
||||||
|
pkill -SIGRTMIN+2 .waybar-wrapped
|
||||||
|
}
|
||||||
|
|
||||||
|
[ $# -gt 0 ] && toggle || show
|
Loading…
Reference in a new issue