refactor: standardize config structure and consolidate modules

- Standardized apps/ directory by renaming all entry points (e.g., home.nix) to default.nix and updating imports to use directory paths.
- Consolidated system/ logic into modules/system/, eliminating the top-level system/ directory and redundant wrappers.
- Merged subsidiary utility scripts (e.g., hakase-popup.nix, switch-wallpaper.nix) into their parent default.nix files for better cohesion.
- Cleaned up unused files and updated all module references to reflect the new structure.
This commit is contained in:
kenji
2025-12-29 14:02:09 -06:00
parent 7278086b82
commit 3a146f39b7
57 changed files with 529 additions and 607 deletions
+11 -34
View File
@@ -1,38 +1,15 @@
{ {
myConfig, imports = [
inputs, ./hypr/binds.nix
pkgs, ./hypr/general.nix
... ./hypr/exec.nix
}: { ./hypr/rules.nix
programs.hyprland = { ./hypr/animation.nix
enable = true; ./hypr/misc.nix
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; ./hypr/input.nix
portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
withUWSM = true;
};
environment.systemPackages = [ ./scripts/movement.nix
pkgs.hyprpicker
pkgs.hyprlock
pkgs.hypridle
pkgs.hyprpaper
pkgs.hyprsunset
pkgs.hyprpolkitagent
]; ];
wayland.windowManager.hyprland.enable = true;
xdg.terminal-exec = { wayland.windowManager.hyprland.systemd.enable = false; # for UWSM support...
enable = true;
settings = {
default = ["${myConfig.terminal.default}"];
};
};
# systemd.user.services.hyprpolkitagent = {
# description = "Hyprland Polkit Agent";
# wantedBy = ["graphical-session.target"];
# serviceConfig = {
# ExecStart = "${pkgs.hyprpolkitagent}/libexec/hyprpolkitagent";
# Restart = "on-failure";
# };
# };
} }
-15
View File
@@ -1,15 +0,0 @@
{
imports = [
./hypr/binds.nix
./hypr/general.nix
./hypr/exec.nix
./hypr/rules.nix
./hypr/animation.nix
./hypr/misc.nix
./hypr/input.nix
./scripts/movement.nix
];
wayland.windowManager.hyprland.enable = true;
wayland.windowManager.hyprland.systemd.enable = false; # for UWSM support...
}
-9
View File
@@ -1,9 +0,0 @@
{pkgs, ...}: let
hakase-terminal-launch =
pkgs.writeShellScriptBin "hakase-terminal-launch" ''
'';
in {
home.packages = [
hakase-terminal-launch
];
}
+84
View File
@@ -0,0 +1,84 @@
{
pkgs,
config,
lib,
myConfig,
...
}: let
wallpaperDir = "${config.home.homeDirectory}/.config/nixos/assets/Wallpapers";
defaultWallpaper = "${wallpaperDir}/${myConfig.hyprland.wallpaper}";
cacheWallpaper = "${config.home.homeDirectory}/.cache/current_wallpaper";
switch-wallpaper = pkgs.writeShellScriptBin "hakase-wallpaper-switch" ''
if [[ "$1" != "run" ]]; then
if command -v ghostty &> /dev/null; then
ghostty --class="org.hakase.switch-wallpaper" --title="Wallpaper Selector" -e bash -c "hakase-wallpaper-switch run || read -p 'Hit Enter to close...'"
exit 0
elif command -v kitty &> /dev/null; then
kitty --class org.hakase.switch-wallpaper --title "Wallpaper Selector" -e bash -c "hakase-wallpaper-switch run || read -p 'Hit Enter to close...'"
exit 0
fi
fi
tmp_file=$(mktemp)
target_dir="$HOME/Pictures/Wallpapers"
if [ ! -d "$target_dir" ]; then
target_dir="$HOME"
fi
# Ensure we are in a terminal that supports yazi
${pkgs.yazi}/bin/yazi "$target_dir" --chooser-file="$tmp_file"
if [ ! -f "$tmp_file" ]; then
echo "No selection file created."
exit 1
fi
WALLPAPER=$(cat "$tmp_file")
rm -f "$tmp_file"
if [ -z "$WALLPAPER" ]; then
echo "No wallpaper selected."
exit 0
fi
# Persistence logic
CACHE_FILE="$HOME/.cache/current_wallpaper"
cp "$WALLPAPER" "$CACHE_FILE"
# Reload hyprpaper
${pkgs.hyprland}/bin/hyprctl hyprpaper unload all
${pkgs.hyprland}/bin/hyprctl hyprpaper preload "$CACHE_FILE"
${pkgs.hyprland}/bin/hyprctl hyprpaper wallpaper ",$CACHE_FILE"
exec matugen image "$CACHE_FILE"
'';
in {
services.hyprpaper = {
enable = true;
settings = {
preload = [cacheWallpaper];
wallpaper = [
",${cacheWallpaper}"
];
};
};
home.packages = [
switch-wallpaper
];
home.activation.setupWallpaper = lib.hm.dag.entryAfter ["writeBoundary"] ''
if [ ! -f "${cacheWallpaper}" ]; then
mkdir -p "$(dirname "${cacheWallpaper}")"
if [ -f "${defaultWallpaper}" ]; then
cp "${defaultWallpaper}" "${cacheWallpaper}"
else
echo "Default wallpaper not found at ${defaultWallpaper}"
touch "${cacheWallpaper}"
fi
fi
'';
systemd.user.startServices = "sd-switch";
}
-35
View File
@@ -1,35 +0,0 @@
{
pkgs,
config,
lib,
myConfig,
...
}: let
wallpaperDir = "${config.home.homeDirectory}/.config/nixos/assets/Wallpapers";
defaultWallpaper = "${wallpaperDir}/${myConfig.hyprland.wallpaper}";
cacheWallpaper = "${config.home.homeDirectory}/.cache/current_wallpaper";
in {
services.hyprpaper = {
enable = true;
settings = {
preload = [cacheWallpaper];
wallpaper = [
",${cacheWallpaper}"
];
};
};
home.activation.setupWallpaper = lib.hm.dag.entryAfter ["writeBoundary"] ''
if [ ! -f "${cacheWallpaper}" ]; then
mkdir -p "$(dirname "${cacheWallpaper}")"
if [ -f "${defaultWallpaper}" ]; then
cp "${defaultWallpaper}" "${cacheWallpaper}"
else
echo "Default wallpaper not found at ${defaultWallpaper}"
touch "${cacheWallpaper}"
fi
fi
'';
systemd.user.startServices = "sd-switch";
}
-57
View File
@@ -1,57 +0,0 @@
{pkgs, ...}: {
# FIXME: please revise to use uwsm and xdg-terminal-exec
# also, add features and fix the following:
# * multiple wallpapers
# * day/noon/night wallpaper
# * set first, default wallpaper to hyprland one-dark
# * be consistent in formatting!
# flow:
# Menu for options: 1. Single Wallpaper, 2. Multiple Wallpapers, 3. Timed Wallpapers
home.packages = with pkgs; [
(writeShellScriptBin "hakase-wallpaper-switch" ''
if [[ "$1" != "run" ]]; then
if command -v ghostty &> /dev/null; then
ghostty --class="org.hakase.switch-wallpaper" --title="Wallpaper Selector" -e bash -c "hakase-wallpaper-switch run || read -p 'Hit Enter to close...'"
exit 0
elif command -v kitty &> /dev/null; then
kitty --class org.hakase.switch-wallpaper --title "Wallpaper Selector" -e bash -c "hakase-wallpaper-switch run || read -p 'Hit Enter to close...'"
exit 0
fi
fi
tmp_file=$(mktemp)
target_dir="$HOME/Pictures/Wallpapers"
if [ ! -d "$target_dir" ]; then
target_dir="$HOME"
fi
# Ensure we are in a terminal that supports yazi
${pkgs.yazi}/bin/yazi "$target_dir" --chooser-file="$tmp_file"
if [ ! -f "$tmp_file" ]; then
echo "No selection file created."
exit 1
fi
WALLPAPER=$(cat "$tmp_file")
rm -f "$tmp_file"
if [ -z "$WALLPAPER" ]; then
echo "No wallpaper selected."
exit 0
fi
# Persistence logic
CACHE_FILE="$HOME/.cache/current_wallpaper"
cp "$WALLPAPER" "$CACHE_FILE"
# Reload hyprpaper
${pkgs.hyprland}/bin/hyprctl hyprpaper unload all
${pkgs.hyprland}/bin/hyprctl hyprpaper preload "$CACHE_FILE"
${pkgs.hyprland}/bin/hyprctl hyprpaper wallpaper ",$CACHE_FILE"
exec matugen image "$CACHE_FILE"
'')
];
}
+14
View File
@@ -0,0 +1,14 @@
{pkgs, ...}: let
hakase-screensaver-launch = pkgs.writeShellScriptBin "hakase-cmd-screensaver" ''
# Placeholder for actual screensaver logic if needed
echo "Screensaver placeholder"
'';
in {
home.packages = with pkgs; [
terminaltexteffects
hakase-screensaver-launch
];
home.file.".config/hakase/branding/screensaver.txt" = {
source = ../../assets/branding.txt;
};
}
-14
View File
@@ -1,14 +0,0 @@
{
pkgs,
lib,
...
}: let
#
hakase-screensaver-launch = pkgs.writeShellScriptBin "hakase-cmd-screensaver" ''
'';
in {
home.packages = with pkgs; [
hakase-screensaver-launch
];
}
-8
View File
@@ -1,8 +0,0 @@
{pkgs, ...}: {
home.packages = with pkgs; [
terminaltexteffects
];
home.file.".config/hakase/branding/screensaver.txt" = {
source = ../../assets/branding.txt;
};
}
+331
View File
@@ -0,0 +1,331 @@
{
config,
pkgs,
myConfig,
...
}: let
# --- POPUP SCRIPTS ---
hakase-launch-or-focus = pkgs.writeShellScriptBin "hakase-launch-or-focus" ''
if (($# == 0)); then
echo "Usage: hakase-launch-or-focus [window-pattern] [launch-command]"
exit 1
fi
WINDOW_PATTERN="$1"
# Escaped Nix interpolation for shell default value logic
LAUNCH_COMMAND="''${2:- \"uwsm-app -- $WINDOW_PATTERN\"}"
# Locate window address via hyprctl and jq
WINDOW_ADDRESS=$(${pkgs.hyprland}/bin/hyprctl clients -j | ${pkgs.jq}/bin/jq -r --arg p "$WINDOW_PATTERN"
'.[] | select((.class | test("\\b" + $p + "\\b"; "i")) or (.title | test("\\b" + $p + "\\b"; "i"))) | .address' | head -n1)
if [[ -n $WINDOW_ADDRESS ]]; then
# If found, focus the existing window
${pkgs.hyprland}/bin/hyprctl dispatch focuswindow "address:$WINDOW_ADDRESS"
else
# If not found, execute the launch command
eval exec setsid $LAUNCH_COMMAND
fi
'';
hakase-launch-tui = pkgs.writeShellScriptBin "hakase-launch-tui" ''
APP_NAME=$(basename "$1")
# Using org.hakase prefix so the focus script can find it via class name
exec setsid uwsm-app -- xdg-terminal-exec --app-id=org.hakase."$APP_NAME" -e "$@"
'';
hakase-focus-wrapper = pkgs.writeShellScriptBin "hakase-focus-wrapper" ''
APP_NAME=$(basename "$1")
WINDOW_PATTERN="org.hakase.$APP_NAME"
LAUNCH_CMD="hakase-launch-tui $*"
exec hakase-launch-or-focus "$WINDOW_PATTERN" "$LAUNCH_CMD"
'';
hakase-launch-wifi = pkgs.writeShellScriptBin "hakase-launch-wifi" ''
# Use the focus wrapper to launch or switch to Impala
exec hakase-focus-wrapper impala
'';
hakase-launch-bluetooth = pkgs.writeShellScriptBin "hakase-launch-bluetooth" ''
exec hakase-focus-wrapper bluetui
'';
hakase-launch-popup = pkgs.writeShellScriptBin "hakase-launch-popup" ''
if (($# < 3)); then
echo "Usage: hakase-launch-popup [width] [height] [command...]"
exit 1
fi
# --- ARGS & CONFIG ---
WIN_WIDTH="$1"
WIN_HEIGHT="$2"
shift 2
MARGIN=10
BAR_HEIGHT=40
# ---------------------
CMD_NAME=$(basename "$1")
TARGET_CLASS="org.hakase.popup.$CMD_NAME"
# 1. SINGLETON LOGIC: Check for ANY existing hakase popup
EXISTING_JSON=$(${pkgs.hyprland}/bin/hyprctl clients -j | ${pkgs.jq}/bin/jq -r '.[] | select(.class | startswith("org.hakase.popup."))')
if [[ -n "$EXISTING_JSON" ]]; then
OLD_ADDR=$(echo "$EXISTING_JSON" | ${pkgs.jq}/bin/jq -r '.address')
OLD_CLASS=$(echo "$EXISTING_JSON" | ${pkgs.jq}/bin/jq -r '.class')
# Close the existing popup
${pkgs.hyprland}/bin/hyprctl dispatch closewindow "address:$OLD_ADDR"
if [[ "$OLD_CLASS" == "$TARGET_CLASS" ]]; then
exit 0
fi
sleep 0.15
fi
# 2. Calculate Geometry
MONITOR_INFO=$(${pkgs.hyprland}/bin/hyprctl monitors -j | ${pkgs.jq}/bin/jq '.[] | select(.focused == true)')
MON_X=$(echo "$MONITOR_INFO" | ${pkgs.jq}/bin/jq '.x')
MON_Y=$(echo "$MONITOR_INFO" | ${pkgs.jq}/bin/jq '.y')
MON_WIDTH=$(echo "$MONITOR_INFO" | ${pkgs.jq}/bin/jq '.width')
TARGET_X=$((MON_X + MON_WIDTH - WIN_WIDTH - MARGIN))
TARGET_Y=$((MON_Y + BAR_HEIGHT + MARGIN))
# 3. Launch with Rules
RULE="[float;pin;size $WIN_WIDTH $WIN_HEIGHT;move $TARGET_X $TARGET_Y]"
${pkgs.hyprland}/bin/hyprctl dispatch exec "$RULE xdg-terminal-exec --app-id=$TARGET_CLASS -e $@"
# 4. Background Listener (Close on Blur)
(
TIMEOUT=0
WINDOW_ADDR=""
while [[ -z "$WINDOW_ADDR" && $TIMEOUT -lt 20 ]]; do
sleep 0.1
WINDOW_ADDR=$(${pkgs.hyprland}/bin/hyprctl clients -j | ${pkgs.jq}/bin/jq -r --arg c "$TARGET_CLASS" '.[] | select(.class == $c) | .address')
((TIMEOUT++))
done
if [[ -n "$WINDOW_ADDR" ]]; then
${pkgs.socat}/bin/socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" | while read -r line; do
if [[ "$line" == "activewindow>>"* ]]; then
NEW_FOCUS="0x$(echo "$line" | cut -d '>' -f3 | cut -d ',' -f1)"
if [[ "$WINDOW_ADDR" != "$NEW_FOCUS" ]]; then
${pkgs.hyprland}/bin/hyprctl dispatch closewindow "address:$WINDOW_ADDR"
break
fi
fi
done
fi
) &
exit 0
'';
hakase-popup-wifi = pkgs.writeShellScriptBin "hakase-popup-wifi" ''
exec hakase-launch-popup 800 500 impala
'';
hakase-popup-bluetooth = pkgs.writeShellScriptBin "hakase-popup-bluetooth" ''
exec hakase-launch-popup 600 500 bluetui
'';
hakase-popup-volume = pkgs.writeShellScriptBin "hakase-popup-volume" ''
exec hakase-launch-popup 800 300 wiremix
'';
in {
imports = [
./style.nix
];
home.packages = [
pkgs.jq
pkgs.socat
pkgs.util-linux
pkgs.bluetui
pkgs.impala
pkgs.wiremix
pkgs.pamixer
hakase-launch-popup
hakase-popup-wifi
hakase-popup-bluetooth
hakase-popup-volume
hakase-launch-or-focus
hakase-launch-tui
hakase-focus-wrapper
hakase-launch-wifi
hakase-launch-bluetooth
];
programs.waybar = {
enable = true;
settings = {
mainBar = {
reload_style_on_change = true;
layer = "top";
position = "top";
spacing = 0;
height = 26;
modules-left = ["custom/omarchy" "hyprland/workspaces" "hyprland/workspaces#special"];
modules-center = ["clock" "custom/update" "custom/screenrecording-indicator"];
modules-right = [
"group/tray-expander"
"bluetooth"
"network"
"pulseaudio"
"cpu"
"battery"
];
"hyprland/workspaces" = {
on-click = "activate";
show-special = false;
all-outputs = true;
format = "{icon}";
format-icons = {
"default" = "";
"1" = "1";
"2" = "2";
"3" = "3";
"4" = "4";
"5" = "5";
"6" = "6";
"7" = "7";
"8" = "8";
"9" = "9";
"10" = "0";
"active" = "󱓻";
};
persistent-workspaces = {
"1" = [];
"2" = [];
"3" = [];
"4" = [];
"5" = [];
};
};
"hyprland/workspaces#special" = {
on-click = "activate";
show-special = true;
special-visible-only = true;
all-outputs = true;
ignore-workspaces = ["1" "2" "3" "4" "5" "6" "7" "8" "9" "10"];
format = "{icon}";
format-icons = {
"special:youtube" = "󰗃";
"special:music" = "󰎆";
"special:steam" = "󰓓";
};
};
"custom/omarchy" = {
format = "";
on-click = "omarchy-menu";
on-click-right = "xdg-terminal-exec";
tooltip-format = "Omarchy Menu\n\nSuper + Alt + Space";
};
"cpu" = {
interval = 5;
format = "󰍛";
on-click = "hakase-focus-wrapper btop";
on-click-right = "xdg-terminal-exec";
};
"clock" = {
format = "{:%H:%M %a %b %d}";
format-alt = "{:L%d %B W%V %Y}";
tooltip = false;
on-click-right = "omarchy-launch-floating-terminal-with-presentation omarchy-tz-select";
};
"network" = {
format-icons = ["󰤯" "󰤟" "󰤢" "󰤥" "󰤨"];
format = "{icon}";
format-wifi = "{icon}";
format-ethernet = "󰀂";
format-disconnected = "󰤮";
tooltip-format-wifi = "{essid} ({frequency} GHz)\n{bandwidthDownBytes} {bandwidthUpBytes}";
tooltip-format-ethernet = "{bandwidthDownBytes} {bandwidthUpBytes}";
tooltip-format-disconnected = "Disconnected";
interval = 3;
spacing = 1;
on-click = "hakase-popup-wifi";
};
"battery" = {
format = "{capacity}% {icon}";
format-discharging = "{icon}";
format-charging = "{icon}";
format-plugged = "";
format-icons = {
charging = ["󰢜" "󰂆" "󰂇" "󰂈" "󰢝" "󰂉" "󰢞" "󰂊" "󰂋" "󰂅"];
default = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"];
};
format-full = "󰂅";
tooltip-format-discharging = "{power:>1.0f}W {capacity}%";
tooltip-format-charging = "{power:>1.0f}W {capacity}%";
interval = 5;
on-click = "omarchy-menu power";
states = {
warning = 20;
critical = 10;
};
};
"bluetooth" = {
format = "";
format-disabled = "󰂲";
format-connected = "󰂱";
format-no-controller = "";
tooltip-format = "Devices connected: {num_connections}";
on-click = "hakase-popup-bluetooth";
};
"pulseaudio" = {
format = "{icon}";
on-click = "hakase-popup-volume";
on-click-right = "pamixer -t";
tooltip-format = "Playing at {volume}%";
scroll-step = 5;
format-muted = "";
format-icons = {
default = ["" "" ""];
};
};
"group/tray-expander" = {
orientation = "inherit";
drawer = {
transition-duration = 600;
children-class = "tray-group-item";
};
modules = ["custom/expand-icon" "tray"];
};
"custom/expand-icon" = {
format = "";
tooltip = false;
};
"custom/screenrecording-indicator" = {
on-click = "omarchy-cmd-screenrecord";
exec = "$OMARCHY_PATH/default/waybar/indicators/screen-recording.sh";
signal = 8;
return-type = "json";
};
"tray" = {
icon-size = 12;
spacing = 17;
};
};
};
};
}
-169
View File
@@ -1,169 +0,0 @@
{pkgs, ...}: let
# 1. The Brain: Logic to find a window or launch a new one
hakase-launch-or-focus = pkgs.writeShellScriptBin "hakase-launch-or-focus" ''
if (($# == 0)); then
echo "Usage: hakase-launch-or-focus [window-pattern] [launch-command]"
exit 1
fi
WINDOW_PATTERN="$1"
# Escaped Nix interpolation for shell default value logic
LAUNCH_COMMAND="''${2:-"uwsm-app -- $WINDOW_PATTERN"}"
# Locate window address via hyprctl and jq
WINDOW_ADDRESS=$(${pkgs.hyprland}/bin/hyprctl clients -j | ${pkgs.jq}/bin/jq -r --arg p "$WINDOW_PATTERN" \
'.[] | select((.class | test("\\b" + $p + "\\b"; "i")) or (.title | test("\\b" + $p + "\\b"; "i"))) | .address' | head -n1)
if [[ -n $WINDOW_ADDRESS ]]; then
# If found, focus the existing window
${pkgs.hyprland}/bin/hyprctl dispatch focuswindow "address:$WINDOW_ADDRESS"
else
# If not found, execute the launch command
eval exec setsid $LAUNCH_COMMAND
fi
'';
hakase-launch-tui = pkgs.writeShellScriptBin "hakase-launch-tui" ''
APP_NAME=$(basename "$1")
# Using org.hakase prefix so the focus script can find it via class name
exec setsid uwsm-app -- xdg-terminal-exec --app-id=org.hakase."$APP_NAME" -e "$@"
'';
hakase-focus-wrapper = pkgs.writeShellScriptBin "hakase-focus-wrapper" ''
APP_NAME=$(basename "$1")
WINDOW_PATTERN="org.hakase.$APP_NAME"
LAUNCH_CMD="hakase-launch-tui $*"
exec hakase-launch-or-focus "$WINDOW_PATTERN" "$LAUNCH_CMD"
'';
hakase-launch-wifi = pkgs.writeShellScriptBin "hakase-launch-wifi" ''
# Unblock the WiFi radio (requires appropriate user groups/permissions)
# ${pkgs.util-linux}/bin/rfkill unblock wifi
# Use the focus wrapper to launch or switch to Impala
exec hakase-focus-wrapper impala
'';
hakase-launch-bluetooth =
pkgs.writeShellScriptBin "hakase-launch-bluetooth"
''
# ${pkgs.util-linux}/bin/rfkill unblock wifi
exec hakase-focus-wrapper bluetui
'';
hakase-launch-popup = pkgs.writeShellScriptBin "hakase-launch-popup" ''
if (($# < 3)); then
echo "Usage: hakase-launch-popup [width] [height] [command...]"
exit 1
fi
# --- ARGS & CONFIG ---
WIN_WIDTH="$1"
WIN_HEIGHT="$2"
shift 2
MARGIN=10
BAR_HEIGHT=40
# ---------------------
CMD_NAME=$(basename "$1")
TARGET_CLASS="org.hakase.popup.$CMD_NAME"
# 1. SINGLETON LOGIC: Check for ANY existing hakase popup
# We look for any client with a class starting with "org.hakase.popup."
EXISTING_JSON=$(${pkgs.hyprland}/bin/hyprctl clients -j | ${pkgs.jq}/bin/jq -r '.[] | select(.class | startswith("org.hakase.popup."))')
if [[ -n "$EXISTING_JSON" ]]; then
OLD_ADDR=$(echo "$EXISTING_JSON" | ${pkgs.jq}/bin/jq -r '.address')
OLD_CLASS=$(echo "$EXISTING_JSON" | ${pkgs.jq}/bin/jq -r '.class')
# Close the existing popup
${pkgs.hyprland}/bin/hyprctl dispatch closewindow "address:$OLD_ADDR"
# If the existing popup was the SAME one we are trying to launch, we are done (Toggle Off behavior)
if [[ "$OLD_CLASS" == "$TARGET_CLASS" ]]; then
exit 0
fi
# If it was a different popup, wait a tiny bit for Hyprland to process the close
# This prevents the new window from "merging" with the closing animation of the old one
sleep 0.15
fi
# 2. Calculate Geometry (Standard logic)
MONITOR_INFO=$(${pkgs.hyprland}/bin/hyprctl monitors -j | ${pkgs.jq}/bin/jq '.[] | select(.focused == true)')
MON_X=$(echo "$MONITOR_INFO" | ${pkgs.jq}/bin/jq '.x')
MON_Y=$(echo "$MONITOR_INFO" | ${pkgs.jq}/bin/jq '.y')
MON_WIDTH=$(echo "$MONITOR_INFO" | ${pkgs.jq}/bin/jq '.width')
TARGET_X=$((MON_X + MON_WIDTH - WIN_WIDTH - MARGIN))
TARGET_Y=$((MON_Y + BAR_HEIGHT + MARGIN))
# 3. Launch with Rules
RULE="[float;pin;size $WIN_WIDTH $WIN_HEIGHT;move $TARGET_X $TARGET_Y]"
${pkgs.hyprland}/bin/hyprctl dispatch exec "$RULE xdg-terminal-exec --app-id=$TARGET_CLASS -e $@"
# 4. Background Listener (Close on Blur)
(
TIMEOUT=0
WINDOW_ADDR=""
while [[ -z "$WINDOW_ADDR" && $TIMEOUT -lt 20 ]]; do
sleep 0.1
WINDOW_ADDR=$(${pkgs.hyprland}/bin/hyprctl clients -j | ${pkgs.jq}/bin/jq -r --arg c "$TARGET_CLASS" '.[] | select(.class == $c) | .address')
((TIMEOUT++))
done
if [[ -n "$WINDOW_ADDR" ]]; then
${pkgs.socat}/bin/socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" | while read -r line; do
if [[ "$line" == "activewindow>>"* ]]; then
NEW_FOCUS="0x$(echo "$line" | cut -d '>' -f3 | cut -d ',' -f1)"
# If focus is lost to another window, close this popup
if [[ "$WINDOW_ADDR" != "$NEW_FOCUS" ]]; then
${pkgs.hyprland}/bin/hyprctl dispatch closewindow "address:$WINDOW_ADDR"
break
fi
fi
done
fi
) &
exit 0
'';
# 1. WiFi (Impala) - Requires a larger view
hakase-popup-wifi = pkgs.writeShellScriptBin "hakase-popup-wifi" ''
exec hakase-launch-popup 800 500 impala
'';
# 2. Bluetooth (Bluetui) - Fits your specific test size
hakase-popup-bluetooth = pkgs.writeShellScriptBin "hakase-popup-bluetooth" ''
exec hakase-launch-popup 600 500 bluetui
'';
# 3. Volume (Wiremix) - Can be smaller
hakase-popup-volume = pkgs.writeShellScriptBin "hakase-popup-volume" ''
exec hakase-launch-popup 800 300 wiremix
'';
in {
home.packages = [
pkgs.jq
pkgs.socat # Required for the socket listener
pkgs.util-linux
pkgs.bluetui
pkgs.impala
pkgs.wiremix
pkgs.pamixer
hakase-launch-popup
hakase-popup-wifi
hakase-popup-bluetooth
hakase-popup-volume
hakase-launch-or-focus
hakase-launch-tui
hakase-focus-wrapper
hakase-launch-wifi
hakase-launch-bluetooth
];
}
-187
View File
@@ -1,187 +0,0 @@
{
config,
pkgs,
myConfig,
...
}: {
imports = [
./style.nix
];
programs.waybar = {
enable = true;
settings = {
mainBar = {
reload_style_on_change = true;
layer = "top";
position = "top";
spacing = 0;
height = 26;
modules-left = ["custom/omarchy" "hyprland/workspaces" "hyprland/workspaces#special"];
modules-center = ["clock" "custom/update" "custom/screenrecording-indicator"];
modules-right = [
"group/tray-expander"
"bluetooth"
"network"
"pulseaudio"
"cpu"
"battery"
];
"hyprland/workspaces" = {
on-click = "activate";
show-special = false;
all-outputs = true;
format = "{icon}";
format-icons = {
"default" = "";
"1" = "1";
"2" = "2";
"3" = "3";
"4" = "4";
"5" = "5";
"6" = "6";
"7" = "7";
"8" = "8";
"9" = "9";
"10" = "0";
"active" = "󱓻";
};
persistent-workspaces = {
"1" = [];
"2" = [];
"3" = [];
"4" = [];
"5" = [];
};
};
"hyprland/workspaces#special" = {
on-click = "activate";
show-special = true;
special-visible-only = true;
all-outputs = true;
ignore-workspaces = ["1" "2" "3" "4" "5" "6" "7" "8" "9" "10"];
format = "{icon}";
format-icons = {
"special:youtube" = "󰗃";
"special:music" = "󰎆";
"special:steam" = "󰓓";
};
};
"custom/omarchy" = {
format = "";
on-click = "omarchy-menu";
on-click-right = "xdg-terminal-exec";
tooltip-format = "Omarchy Menu\n\nSuper + Alt + Space";
};
# "custom/update" = {
# format = "";
# exec = "omarchy-update-available";
# on-click = "omarchy-launch-floating-terminal-with-presentation omarchy-update";
# tooltip-format = "Omarchy update available";
# signal = 7;
# interval = 21600;
# };
"cpu" = {
interval = 5;
format = "󰍛";
on-click = "hakase-focus-wrapper btop";
on-click-right = "xdg-terminal-exec";
};
"clock" = {
format = "{:%H:%M %a %b %d}";
format-alt = "{:L%d %B W%V %Y}";
tooltip = false;
on-click-right = "omarchy-launch-floating-terminal-with-presentation omarchy-tz-select";
};
"network" = {
format-icons = ["󰤯" "󰤟" "󰤢" "󰤥" "󰤨"];
format = "{icon}";
format-wifi = "{icon}";
format-ethernet = "󰀂";
format-disconnected = "󰤮";
tooltip-format-wifi = "{essid} ({frequency} GHz)\n{bandwidthDownBytes} {bandwidthUpBytes}";
tooltip-format-ethernet = "{bandwidthDownBytes} {bandwidthUpBytes}";
tooltip-format-disconnected = "Disconnected";
interval = 3;
spacing = 1;
on-click = "hakase-popup-wifi";
};
"battery" = {
format = "{capacity}% {icon}";
format-discharging = "{icon}";
format-charging = "{icon}";
format-plugged = "";
format-icons = {
charging = ["󰢜" "󰂆" "󰂇" "󰂈" "󰢝" "󰂉" "󰢞" "󰂊" "󰂋" "󰂅"];
default = ["󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"];
};
format-full = "󰂅";
tooltip-format-discharging = "{power:>1.0f}W {capacity}%";
tooltip-format-charging = "{power:>1.0f}W {capacity}%";
interval = 5;
on-click = "omarchy-menu power";
states = {
warning = 20;
critical = 10;
};
};
"bluetooth" = {
format = "";
format-disabled = "󰂲";
format-connected = "󰂱";
format-no-controller = "";
tooltip-format = "Devices connected: {num_connections}";
on-click = "hakase-popup-bluetooth";
};
"pulseaudio" = {
format = "{icon}";
on-click = "hakase-popup-volume";
on-click-right = "pamixer -t";
tooltip-format = "Playing at {volume}%";
scroll-step = 5;
format-muted = "";
format-icons = {
default = ["" "" ""];
};
};
"group/tray-expander" = {
orientation = "inherit";
drawer = {
transition-duration = 600;
children-class = "tray-group-item";
};
modules = ["custom/expand-icon" "tray"];
};
"custom/expand-icon" = {
format = "";
tooltip = false;
};
"custom/screenrecording-indicator" = {
on-click = "omarchy-cmd-screenrecord";
# Note: $OMARCHY_PATH must be defined in your environment
exec = "$OMARCHY_PATH/default/waybar/indicators/screen-recording.sh";
signal = 8;
return-type = "json";
};
"tray" = {
icon-size = 12;
spacing = 17;
};
};
};
};
}
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
imports = [ imports = [
../../apps/btop/home.nix ../../apps/btop
../../apps/jellyfin/home.nix ../../apps/jellyfin
]; ];
} }
+4 -4
View File
@@ -1,8 +1,8 @@
{ {
imports = [ imports = [
../../apps/yazi/home.nix ../../apps/yazi
../../apps/gemini/home.nix ../../apps/gemini
../../apps/firefox/home.nix ../../apps/firefox
# ../../apps/starship/home.nix # ../../apps/starship
]; ];
} }
+8 -10
View File
@@ -1,13 +1,11 @@
{ {
imports = [ imports = [
../../apps/tte/hakase-screensaver.nix ../../apps/hyprland
../../apps/hyprland/home.nix ../../apps/hypridle
../../apps/hypridle/home.nix ../../apps/hyprlock
../../apps/hyprlock/home.nix ../../apps/walker
../../apps/walker/home.nix # ../../apps/fsel
# ../../apps/fsel/home.nix ../../apps/hyprpaper
../../apps/hyprpaper/home.nix ../../apps/tte
../../apps/hyprpaper/switch-wallpaper.nix
../../apps/tte/home.nix
]; ];
} }
+2 -2
View File
@@ -24,8 +24,8 @@
''; '';
in { in {
imports = [ imports = [
../../apps/jellyfin-tui/home.nix ../../apps/jellyfin-tui
../../apps/cava/home.nix ../../apps/cava
]; ];
home.packages = [ home.packages = [
launch-music launch-music
+6 -6
View File
@@ -1,10 +1,10 @@
{ {
imports = [ imports = [
../../apps/neovim/neovim.nix ../../apps/neovim
../../apps/git/home.nix ../../apps/git
../../apps/zoxide/home.nix ../../apps/zoxide
../../apps/fish/home.nix ../../apps/fish
../../apps/ghostty/home.nix ../../apps/ghostty
../../apps/fastfetch/home.nix ../../apps/fastfetch
]; ];
} }
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
imports = [ imports = [
../../apps/stylix/home.nix ../../apps/stylix
../../apps/matugen/home.nix ../../apps/matugen
]; ];
} }
+2 -3
View File
@@ -1,6 +1,5 @@
{ {
imports = [ imports = [
../../apps/waybar/home.nix ../../apps/waybar
../../apps/waybar/hakase-popup.nix
]; ];
} }
+15 -15
View File
@@ -1,20 +1,20 @@
{pkgs, ...}: { {pkgs, ...}: {
imports = [ imports = [
../../system/time.nix ./time.nix
../../system/nix.nix ./nix.nix
../../system/backlight.nix ./backlight.nix
../../system/boot.nix ./boot.nix
../../system/amd.nix ./amd.nix
../../system/hardware.nix ./hardware.nix
../../system/home-manager.nix ./home-manager.nix
../../system/services.nix ./services.nix
../../system/user.nix ./user.nix
../../system/version.nix ./version.nix
../../system/fonts.nix ./fonts.nix
../../system/programs.nix ./programs.nix
../../system/security.nix ./security.nix
../../system/variables.nix ./variables.nix
../../system/kernel.nix ./kernel.nix
]; ];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# FIXME: must be on their own app # FIXME: must be on their own app
+21 -5
View File
@@ -1,5 +1,21 @@
{ {pkgs, ...}: {
imports = [ hardware.graphics = {
../../system/steam.nix enable = true;
]; enable32Bit = true; # For 32-bit games
} };
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
localNetworkGameTransfers.openFirewall = true;
extest.enable = true;
gamescopeSession.enable = true;
extraCompatPackages = with pkgs; [
proton-ge-bin
];
};
programs.gamemode.enable = true;
# Fix slow Steam Download speeds
services.resolved.enable = true;
}
+27 -3
View File
@@ -1,5 +1,29 @@
{ {
imports = [ myConfig,
../../apps/hyprland/default.nix inputs,
pkgs,
...
}: {
programs.hyprland = {
enable = true;
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
withUWSM = true;
};
environment.systemPackages = [
pkgs.hyprpicker
pkgs.hyprlock
pkgs.hypridle
pkgs.hyprpaper
pkgs.hyprsunset
pkgs.hyprpolkitagent
]; ];
}
xdg.terminal-exec = {
enable = true;
settings = {
default = ["${myConfig.terminal.default}"];
};
};
}
-6
View File
@@ -1,6 +0,0 @@
{pkgs, ...}: {
gtk.iconTheme = {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
}
-21
View File
@@ -1,21 +0,0 @@
{pkgs, ...}: {
hardware.graphics = {
enable = true;
enable32Bit = true; # For 32-bit games
};
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
localNetworkGameTransfers.openFirewall = true;
extest.enable = true;
gamescopeSession.enable = true;
extraCompatPackages = with pkgs; [
proton-ge-bin
];
};
programs.gamemode.enable = true;
# Fix slow Steam Download speeds
services.resolved.enable = true;
}