summaryrefslogtreecommitdiff
path: root/common/modules/mango/scripts.nix
diff options
context:
space:
mode:
authorbrustybee <beebeeb5k@gmail.com>2026-04-13 03:04:59 +0530
committerbrustybee <beebeeb5k@gmail.com>2026-04-13 03:04:59 +0530
commit1bb49481dbec223e68df4f60fa1d425525e16cff (patch)
tree66e87c01c39054b7abb51d04bfc50f63b201aaf4 /common/modules/mango/scripts.nix
parentf5b78ff561eff75c803ed1ef6e736a6c991cd135 (diff)
This is like that one dream you don't know how to describe
Diffstat (limited to 'common/modules/mango/scripts.nix')
-rw-r--r--common/modules/mango/scripts.nix261
1 files changed, 0 insertions, 261 deletions
diff --git a/common/modules/mango/scripts.nix b/common/modules/mango/scripts.nix
deleted file mode 100644
index d330211..0000000
--- a/common/modules/mango/scripts.nix
+++ /dev/null
@@ -1,261 +0,0 @@
-{
- pkgs,
- config,
- lib,
- ...
-}:
-let
- volume-control = pkgs.writeShellScriptBin "volume-control" ''
- TAG="audio-volume"
-
- function get_vol {
- ${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print int($2 * 100)}'
- }
-
- case $1 in
- up) ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+ ;;
- down) ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- ;;
- mute) ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ;;
- esac
-
- vol=$(get_vol)
- is_muted=$(${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep "MUTED")
-
- if [ -n "$is_muted" ]; then
- ${pkgs.dunst}/bin/dunstify -a "Volume" -u low \
- -h string:x-canonical-private-synchronous:$TAG \
- "Volume: Muted"
- else
- ${pkgs.dunst}/bin/dunstify -a "Volume" -u low \
- -h string:x-canonical-private-synchronous:$TAG \
- -h int:value:"$vol" \
- "Volume: $vol%"
- fi
- '';
-
- brightness-control = pkgs.writeShellScriptBin "brightness-control" ''
- TAG="screen-brightness"
-
- case $1 in
- up) ${pkgs.brightnessctl}/bin/brightnessctl set +5% ;;
- down) ${pkgs.brightnessctl}/bin/brightnessctl set 5%- ;;
- esac
-
- # Get current percentage
- current=$(${pkgs.brightnessctl}/bin/brightnessctl info | grep -oP '\(\K[0-9]+(?=%\))')
-
- ${pkgs.dunst}/bin/dunstify -a "Brightness" -u low \
- -h string:x-canonical-private-synchronous:$TAG \
- -h int:value:"$current" \
- "Brightness: $current%"
- '';
-
- mic-control = pkgs.writeShellScriptBin "mic-control" ''
- TAG="audio-mic"
-
- case $1 in
- toggle) ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle ;;
- esac
-
- is_muted=$(${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | grep "MUTED")
-
- if [ -n "$is_muted" ]; then
- ${pkgs.dunst}/bin/dunstify -a "Microphone" -u low \
- -h string:x-canonical-private-synchronous:$TAG \
- "Microphone: Muted"
- else
- ${pkgs.dunst}/bin/dunstify -a "Microphone" -u low \
- -h string:x-canonical-private-synchronous:$TAG \
- "Microphone: On"
- fi
- '';
- beesettings = pkgs.writeShellScriptBin "beesettings" ''
- CONFIG_FILE="$HOME/.config/beeSettings"
- WALL_DIR="$HOME/Pictures/Wallpapers"
-
- init_settings() {
- if [ ! -f "$CONFIG_FILE" ]; then
- mkdir -p "$(dirname "$CONFIG_FILE")"
- echo -e "theme=dark\nnightlight=off\nwallpaper=$WALL_DIR/default.jpg\ncolor_type=scheme-tonal-spot" > "$CONFIG_FILE"
- fi
- }
-
- get_val() { grep "^$1=" "$CONFIG_FILE" | cut -d'=' -f2; }
- set_val() { sed -i "s|^$1=.*|$1=$2|" "$CONFIG_FILE"; }
- set_layout() { mmsg -l "$1"; }
-
- apply_all() {
- local theme=$(get_val "theme")
- local wall=$(get_val "wallpaper")
- local color_type=$(get_val "color_type")
- local mode_flag="dark"
- [ "$theme" == "light" ] && mode_flag="light"
-
- matugen image "$wall" -m "$mode_flag" -t "$color_type" --source-color-index 0 2>/dev/null
- wallust -q -s run -p "''${mode_flag}16" "$wall" 2>/dev/null
-
- systemctl --user restart xdg-desktop-portal-gtk
- if [ "$mode_flag" = "dark" ]; then
- dconf write /org/gnome/desktop/interface/color-scheme "'prefer-light'"
- else
- dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'"
- fi
-
- dconf write /org/gnome/desktop/interface/color-scheme "'prefer-$mode_flag'"
-
- if [ -z "$WAYLAND_DISPLAY" ] && [ -n "$DISPLAY" ]; then
- xrdb -merge "$HOME/.Xresources"
- fi
-
- ${lib.optionalString
- (config.beeMods.terminal.default == "foot" || config.beeMods.terminal.default == "ghostty")
- ''
- [ -f "$HOME/.config/sequences" ] && sh "$HOME/.config/sequences"
- ''
- }
- }
-
- cmd_wall() {
- list_walls() {
- for wall in "$WALL_DIR"/*.{jpg,jpeg,png,webp}; do
- [ -f "$wall" ] && echo -en "$(basename "$wall")\0icon\x1f$wall\n"
- done
- }
-
- SELECTED=$(list_walls | rofi -dmenu -i -p "Wallpaper" \
- -show-icons \
- -theme-str 'element { orientation: vertical; padding: 15px; }' \
- -theme-str 'element-icon { size: 10em; horizontal-align: 0.5; }' \
- -theme-str 'listview { columns: 3; lines: 2; }' \
- -theme-str 'window { width: 50%; }')
-
- if [ -n "$SELECTED" ]; then
- FULL_PATH="$WALL_DIR/$SELECTED"
- set_val "wallpaper" "$FULL_PATH"
-
- if [ -n "$WAYLAND_DISPLAY" ]; then
- if command -v awww >/dev/null 2>&1; then
- awww img "$FULL_PATH" --transition-type grow --transition-fps 120 --transition-step 60 --transition-duration 1.5
- else
- pkill swaybg; swaybg -i "$FULL_PATH" -m fill &
- fi
- else
- feh --no-fehbg --bg-fill "$FULL_PATH"
- fi
-
- apply_all
- fi
- }
-
- clr_type() {
- local types=(
- "scheme-tonal-spot"
- "scheme-content"
- "scheme-expressive"
- "scheme-fidelity"
- "scheme-fruit-salad"
- "scheme-monochrome"
- "scheme-neutral"
- "scheme-rainbow"
- "scheme-vibrant"
- )
-
- local selection
- selection=$(printf "%s\n" "''${types[@]}" | rofi -dmenu -i -p "Coloscheme Types")
-
- if [[ -n "$selection" ]]; then
- set_val "color_type" "$selection"
- apply_all
- fi
- }
-
- cmd_layout() {
- declare -A layouts=(
- ["tile"]="T"
- ["monocle"]="M"
- ["scroller"]="S"
- ["tgmix"]="TG"
- ["grid"]="G"
- ["deck"]="K"
- ["center tile"]="CT"
- ["right tile"]="RT"
- ["vertical scroller"]="VS"
- ["vertical tile"]="VT"
- ["vertical grid"]="VG"
- ["vertical deck"]="VK"
- )
-
- local selection
- selection=$(printf "%s\n" "''${!layouts[@]}" | sort | rofi -dmenu -i -p "Layout")
-
- if [[ -n "''${layouts[$selection]}" ]]; then
- set_layout "''${layouts[$selection]}"
- fi
- }
-
- cmd_settings() {
- local theme=$(get_val "theme")
- local nl=$(get_val "nightlight")
- local ct=$(get_val "color_type")
-
- local options=(
- "Mode: $theme"
- "Night Light: $nl"
- "Wallpaper"
- "Colorscheme Type: $ct"
- "Layouts"
- )
-
- local choice
- choice=$(printf "%s\n" "''${options[@]}" | rofi -dmenu -p "Settings" -i)
-
- case "$choice" in
- "Mode: "*)
- [[ "$theme" == "dark" ]] && set_val "theme" "light" || set_val "theme" "dark"
- apply_all
- ;;
- "Night Light: "*)
- if [[ "$nl" == "on" ]]; then
- set_val "nightlight" "off"
-
- if [[ "$XDG_SESSION_TYPE" == "wayland" ]]; then
- pkill wlsunset
- else
- redshift -x
- fi
- else
- set_val "nightlight" "on"
-
- if [[ "$XDG_SESSION_TYPE" == "wayland" ]]; then
- wlsunset -T 4500 &
- else
- redshift -O 4500
- fi
- fi
- ;;
- "Wallpaper") cmd_wall ;;
- "Colorscheme Type:"*) clr_type ;;
- "Layouts") cmd_layout ;;
- esac
- }
-
-
- init_settings
- case "$1" in
- wall) cmd_wall ;;
- settings) cmd_settings ;;
- layout) cmd_layout ;;
- apply) apply_all ;;
- *) echo "Usage: bee {wall|settings|apply}" ;;
- esac
- '';
-
-in
-{
- home.packages = [
- volume-control
- brightness-control
- mic-control
- beesettings
- ];
-}