diff --git a/.config/elephant/station_background_selector.lua b/.config/elephant/station_background_selector.lua new file mode 100644 index 0000000..b7eced7 --- /dev/null +++ b/.config/elephant/station_background_selector.lua @@ -0,0 +1,63 @@ +Name = "stationBackgroundSelector" +NamePretty = "Station Background Selector" +Cache = false +HideFromProviderlist = true +SearchName = true + +local function ShellEscape(s) + return "'" .. s:gsub("'", "'\\''") .. "'" +end + +function FormatName(filename) + -- Remove leading number and dash + local name = filename:gsub("^%d+", ""):gsub("^%-", "") + -- Remove extension + name = name:gsub("%.[^%.]+$", "") + -- Replace dashes with spaces + name = name:gsub("-", " ") + -- Capitalize each word + name = name:gsub("%S+", function(word) + return word:sub(1, 1):upper() .. word:sub(2):lower() + end) + return name +end + +function GetEntries() + local entries = {} + local home = os.getenv("HOME") + + -- Directories to search + local dirs = { + home .. "/Tower/Library/Pictures/Wallpapers/3840x2160", + } + + -- Track added files to avoid duplicates + local seen = {} + + for _, wallpaper_dir in ipairs(dirs) do + local handle = io.popen( + "find " .. ShellEscape(wallpaper_dir) + .. " -maxdepth 1 -type f \\( -name '*.jpg' -o -name '*.jpeg' -o -name '*.png' -o -name '*.gif' -o -name '*.bmp' -o -name '*.webp' \\) 2>/dev/null | sort" + ) + if handle then + for background in handle:lines() do + local filename = background:match("([^/]+)$") + if filename and not seen[filename] then + seen[filename] = true + table.insert(entries, { + Text = FormatName(filename), + Value = background, + Actions = { + activate = "station-bg-set " .. ShellEscape(background), + }, + Preview = background, + PreviewType = "file", + }) + end + end + handle:close() + end + end + + return entries +end diff --git a/.config/hypr/bindings.conf b/.config/hypr/bindings.conf index 0842e51..ecc912c 100644 --- a/.config/hypr/bindings.conf +++ b/.config/hypr/bindings.conf @@ -169,7 +169,7 @@ bindd = SUPER ALT, code:14, Switch to group window 5, changegroupactive, 5 # ========================== # Utilities # ========================== -# bindd = SUPER, Slash, Cycle monitor scaling, exec, omarchy-hyprland-monitor-scaling-cycle +bindd = SUPER, Slash, Cycle monitor scaling, exec, station-hyprland-monitor-scaling-cycle # Menus bindd = SUPER, SPACE, Launch apps, exec, station-launch-walker diff --git a/.local/bin/station-bg-next b/.local/bin/station-bg-next new file mode 100755 index 0000000..0337162 --- /dev/null +++ b/.local/bin/station-bg-next @@ -0,0 +1,48 @@ +#!/bin/bash + +# Cycles through the background images available + +BACKGROUNDS_PATH="$HOME/Tower/Library/Pictures/Wallpapers/3840x2160/" +CURRENT_BACKGROUND_LINK="$HOME/.local/state/station/background" + +mapfile -d '' -t BACKGROUNDS < <(find -L "$BACKGROUNDS_PATH" -maxdepth 1 -type f -print0 2>/dev/null | sort -z) +TOTAL=${#BACKGROUNDS[@]} + +if (( TOTAL == 0 )); then + notify-send "No background was found" -t 2000 + pkill -x swaybg + setsid uwsm-app -- swaybg --color '#000000' >/dev/null 2>&1 & +else + # Get current background from symlink + if [[ -L $CURRENT_BACKGROUND_LINK ]]; then + CURRENT_BACKGROUND=$(readlink "$CURRENT_BACKGROUND_LINK") + else + # Default to first background if no symlink exists + CURRENT_BACKGROUND="" + fi + + # Find current background index + INDEX=-1 + for i in "${!BACKGROUNDS[@]}"; do + if [[ ${BACKGROUNDS[$i]} == $CURRENT_BACKGROUND ]]; then + INDEX=$i + break + fi + done + + # Get next background (wrap around) + if (( INDEX == -1 )); then + # Use the first background when no match was found + NEW_BACKGROUND="${BACKGROUNDS[0]}" + else + NEXT_INDEX=$(((INDEX + 1) % TOTAL)) + NEW_BACKGROUND="${BACKGROUNDS[$NEXT_INDEX]}" + fi + + # Set new background symlink + ln -nsf "$NEW_BACKGROUND" "$CURRENT_BACKGROUND_LINK" + + # Relaunch swaybg + pkill -x swaybg + setsid uwsm-app -- swaybg -i "$CURRENT_BACKGROUND_LINK" -m fill >/dev/null 2>&1 & +fi diff --git a/.local/bin/station-bg-set b/.local/bin/station-bg-set new file mode 100755 index 0000000..6500fc0 --- /dev/null +++ b/.local/bin/station-bg-set @@ -0,0 +1,18 @@ +#!/bin/bash + +# Sets the specified image as the current background + +if [[ -z $1 ]]; then + echo "Usage: station-bg-set " >&2 + exit 1 +fi + +BACKGROUND="$1" +CURRENT_BACKGROUND_LINK="$HOME/.local/state/station/background" + +# Create symlink to the new background +ln -nsf "$BACKGROUND" "$CURRENT_BACKGROUND_LINK" + +# Kill existing swaybg and start new one +pkill -x swaybg +setsid uwsm-app -- swaybg -i "$CURRENT_BACKGROUND_LINK" -m fill >/dev/null 2>&1 & diff --git a/.local/bin/station-cmd-share b/.local/bin/station-cmd-share new file mode 100755 index 0000000..45344f1 --- /dev/null +++ b/.local/bin/station-cmd-share @@ -0,0 +1,46 @@ +#!/bin/bash + +# Share clipboard, file, or folder using LocalSend. Bound to Super + Ctrl + S by default. + +if (($# == 0)); then + echo "Usage: station-cmd-share [clipboard|file|folder]" + exit 1 +fi + +MODE="$1" +shift + +if [[ $MODE == "clipboard" ]]; then + TEMP_FILE=$(mktemp --suffix=.txt) + wl-paste >"$TEMP_FILE" + FILES="$TEMP_FILE" +else + if (($# > 0)); then + FILES="$*" + else + if [[ $MODE == "folder" ]]; then + # Pick a single folder from home directory + FILES=$(find "$HOME" -type d 2>/dev/null | fzf) + else + # Pick one or more files from home directory + FILES=$(find "$HOME" -type f 2>/dev/null | fzf --multi) + fi + [[ -z $FILES ]] && exit 0 + fi +fi + +# Run LocalSend in its own systemd service (detached from terminal) +# Convert newline-separated files to space-separated arguments +if [[ $MODE != "clipboard" ]] && echo "$FILES" | grep -q $'\n'; then + # Multiple files selected - convert newlines to array + readarray -t FILE_ARRAY <<<"$FILES" + systemd-run --user --quiet --collect localsend --headless send "${FILE_ARRAY[@]}" +else + # Single file or clipboard mode + systemd-run --user --quiet --collect localsend --headless send "$FILES" +fi + +# Note: Temporary file will remain until system cleanup for clipboard mode +# This ensures the file content is available for the LocalSend GUI + +exit 0 diff --git a/.local/bin/station-drive-set-password b/.local/bin/station-drive-set-password new file mode 100755 index 0000000..0237eaa --- /dev/null +++ b/.local/bin/station-drive-set-password @@ -0,0 +1,23 @@ +#!/bin/bash + +# Set a new encryption password for a drive selected. + +encrypted_drives=$(blkid -t TYPE=crypto_LUKS -o device) + +if [[ -n $encrypted_drives ]]; then + if (( $(wc -l << HIBERNATION_IMAGE_SIZE )) ; then + exit 0 +else + exit 1 +fi diff --git a/.local/bin/station-hyprland-monitor-scaling-cycle b/.local/bin/station-hyprland-monitor-scaling-cycle new file mode 100755 index 0000000..c673fe5 --- /dev/null +++ b/.local/bin/station-hyprland-monitor-scaling-cycle @@ -0,0 +1,24 @@ +#!/bin/bash + +# Get the active monitor (the one with the cursor) +MONITOR_INFO=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true)') +ACTIVE_MONITOR=$(echo "$MONITOR_INFO" | jq -r '.name') +CURRENT_SCALE=$(echo "$MONITOR_INFO" | jq -r '.scale') +WIDTH=$(echo "$MONITOR_INFO" | jq -r '.width') +HEIGHT=$(echo "$MONITOR_INFO" | jq -r '.height') +REFRESH_RATE=$(echo "$MONITOR_INFO" | jq -r '.refreshRate') + +# Cycle through scales: 1 → 1.6 → 2 → 3 → 1 +CURRENT_INT=$(awk -v s="$CURRENT_SCALE" 'BEGIN { printf "%.0f", s * 10 }') + +case "$CURRENT_INT" in +10) NEW_SCALE=1.6 ;; +16) NEW_SCALE=2 ;; +20) NEW_SCALE=3 ;; +*) NEW_SCALE=1 ;; +esac + +hyprctl keyword misc:disable_scale_notification true +hyprctl keyword monitor "$ACTIVE_MONITOR,${WIDTH}x${HEIGHT}@${REFRESH_RATE},auto,$NEW_SCALE" +hyprctl keyword misc:disable_scale_notification false +notify-send "󰍹 Display scaling set to ${NEW_SCALE}x" diff --git a/.local/bin/station-hyprland-window-gaps-toggle b/.local/bin/station-hyprland-window-gaps-toggle new file mode 100755 index 0000000..d49e096 --- /dev/null +++ b/.local/bin/station-hyprland-window-gaps-toggle @@ -0,0 +1,15 @@ +#!/bin/bash + +# Toggles the window gaps globally between no gaps and the default 10/5/2. + +gaps=$(hyprctl getoption general:gaps_out -j | jq -r '.custom' | awk '{print $1}') + +if [[ $gaps == "0" ]]; then + hyprctl keyword general:gaps_out 10 + hyprctl keyword general:gaps_in 5 + hyprctl keyword general:border_size 2 +else + hyprctl keyword general:gaps_out 0 + hyprctl keyword general:gaps_in 0 + hyprctl keyword general:border_size 0 +fi diff --git a/.local/bin/station-hyprland-window-single-square-aspect-toggle b/.local/bin/station-hyprland-window-single-square-aspect-toggle new file mode 100755 index 0000000..917b2ca --- /dev/null +++ b/.local/bin/station-hyprland-window-single-square-aspect-toggle @@ -0,0 +1,13 @@ +#!/bin/bash + +# Check current single_window_aspect_ratio setting +CURRENT_VALUE=$(hyprctl getoption "layout:single_window_aspect_ratio" 2>/dev/null | head -1) + +# Parse vec2 output: "vec2: [1, 1]" or "vec2: [0, 0]" +if [[ $CURRENT_VALUE == *"[1, 1]"* ]]; then + hyprctl keyword layout:single_window_aspect_ratio "0 0" + notify-send " Disable single-window square aspect ratio" +else + hyprctl keyword layout:single_window_aspect_ratio "1 1" + notify-send " Enable single-window square aspect" +fi diff --git a/.local/bin/station-menu b/.local/bin/station-menu index 865eb51..958aa48 100755 --- a/.local/bin/station-menu +++ b/.local/bin/station-menu @@ -57,11 +57,10 @@ open_in_editor() { } show_trigger_menu() { - case $(menu "Trigger" " Capture\n Share\n󰔎 Toggle\n Hardware") in + case $(menu "Trigger" " Capture\n Share\n󰔎 Toggle") in *Capture*) show_capture_menu ;; *Share*) show_share_menu ;; *Toggle*) show_toggle_menu ;; - *Hardware*) show_hardware_menu ;; *) show_main_menu ;; esac } @@ -120,200 +119,135 @@ show_screenrecord_menu() { esac } - # show_share_menu() { - # case $(menu "Share" " Clipboard\n File \n Folder") in - # *Clipboard*) station-cmd-share clipboard ;; - # *File*) terminal bash -c "station-cmd-share file" ;; - # *Folder*) terminal bash -c "station-cmd-share folder" ;; - # *) back_to show_trigger_menu ;; - # esac - # } -# -# show_toggle_menu() { -# case $(menu "Toggle" "󱄄 Screensaver\n󰔎 Nightlight\n󱫖 Idle Lock\n󰍜 Top Bar\n󱂬 Workspace Layout\n Window Gaps\n 1-Window Ratio\n󰍹 Display Scaling") in -# -# *Screensaver*) station-toggle-screensaver ;; -# *Nightlight*) station-toggle-nightlight ;; -# *Idle*) station-toggle-idle ;; -# *Bar*) station-toggle-waybar ;; -# *Layout*) station-hyprland-workspace-layout-toggle ;; -# *Ratio*) station-hyprland-window-single-square-aspect-toggle ;; -# *Gaps*) station-hyprland-window-gaps-toggle ;; -# *Scaling*) station-hyprland-monitor-scaling-cycle ;; -# *) back_to show_trigger_menu ;; -# esac -# } -# -# show_hardware_menu() { -# case $(menu "Toggle" " Hybrid GPU") in -# *"Hybrid GPU"*) present_terminal station-toggle-hybrid-gpu ;; -# *) show_trigger_menu ;; -# esac -# } -# -# show_style_menu() { -# case $(menu "Style" " Background\n Hyprland\n󱄄 Screensaver") in -# *Background*) show_background_menu ;; -# *Hyprland*) open_in_editor ~/.config/hypr/looknfeel.conf ;; -# *Screensaver*) open_in_editor ~/.config/station/branding/screensaver.txt ;; -# *) show_main_menu ;; -# esac -# } -# -# show_background_menu() { -# station-launch-walker -m menus:stationBackgroundSelector --width 800 --minheight 400 -# } -# -# show_setup_menu() { -# local options=" Audio\n Wifi\n󰂯 Bluetooth\n󱐋 Power Profile\n System Sleep\n󰍹 Monitors" -# [[ -f ~/.config/hypr/bindings.conf ]] && options="$options\n Keybindings" -# [[ -f ~/.config/hypr/input.conf ]] && options="$options\n Input" -# options="$options\n󰱔 DNS\n Security\n Config" -# -# case $(menu "Setup" "$options") in -# *Audio*) station-launch-audio ;; -# *Wifi*) station-launch-wifi ;; -# *Bluetooth*) station-launch-bluetooth ;; -# *Power*) show_setup_power_menu ;; -# *System*) show_setup_system_menu ;; -# *Monitors*) open_in_editor ~/.config/hypr/monitors.conf ;; -# *Keybindings*) open_in_editor ~/.config/hypr/bindings.conf ;; -# *Input*) open_in_editor ~/.config/hypr/input.conf ;; -# *DNS*) present_terminal station-setup-dns ;; -# *Security*) show_setup_security_menu ;; -# *Config*) show_setup_config_menu ;; -# *) show_main_menu ;; -# esac -# } -# -# show_setup_power_menu() { -# profile=$(menu "Power Profile" "$(station-powerprofiles-list)" "" "$(powerprofilesctl get)") -# -# if [[ $profile == "CNCLD" || -z $profile ]]; then -# back_to show_setup_menu -# else -# powerprofilesctl set "$profile" -# fi -# } -# -# show_setup_security_menu() { -# case $(menu "Setup" "󰈷 Fingerprint\n Fido2") in -# *Fingerprint*) present_terminal station-setup-fingerprint ;; -# *Fido2*) present_terminal station-setup-fido2 ;; -# *) show_setup_menu ;; -# esac -# } -# -# show_setup_config_menu() { -# case $(menu "Setup" " Defaults\n Hyprland\n Hypridle\n Hyprlock\n Hyprsunset\n Swayosd\n󰌧 Walker\n󰍜 Waybar\n󰞅 XCompose") in -# *Defaults*) open_in_editor ~/.config/uwsm/default ;; -# *Hyprland*) open_in_editor ~/.config/hypr/hyprland.conf ;; -# *Hypridle*) open_in_editor ~/.config/hypr/hypridle.conf && station-restart-hypridle ;; -# *Hyprlock*) open_in_editor ~/.config/hypr/hyprlock.conf ;; -# *Hyprsunset*) open_in_editor ~/.config/hypr/hyprsunset.conf && station-restart-hyprsunset ;; -# *Swayosd*) open_in_editor ~/.config/swayosd/config.toml && station-restart-swayosd ;; -# *Walker*) open_in_editor ~/.config/walker/config.toml && station-restart-walker ;; -# *Waybar*) open_in_editor ~/.config/waybar/config.jsonc && station-restart-waybar ;; -# *XCompose*) open_in_editor ~/.config/xcompose && station-restart-xcompose ;; -# *) show_setup_menu ;; -# esac -# } -# -# show_setup_system_menu() { -# local options="" -# -# if [[ -f ~/.local/state/station/toggles/suspend-off ]]; then -# options="$options󰒲 Enable Suspend" -# else -# options="$options󰒲 Disable Suspend" -# fi -# -# if station-hibernation-available; then -# options="$options\n󰤁 Disable Hibernate" -# else -# options="$options\n󰤁 Enable Hibernate" -# fi -# -# case $(menu "System" "$options") in -# *Suspend*) station-toggle-suspend ;; -# *"Enable Hibernate"*) present_terminal station-hibernation-setup ;; -# *"Disable Hibernate"*) present_terminal station-hibernation-remove ;; -# *) show_setup_menu ;; -# esac -# } -# -# show_update_menu() { -# case $(menu "Update" " Config\n Process\n󰇅 Hardware\n Firmware\n Password\n Timezone\n Time") in -# *Config*) show_update_config_menu ;; -# *Process*) show_update_process_menu ;; -# *Hardware*) show_update_hardware_menu ;; -# *Firmware*) present_terminal station-update-firmware ;; -# *Timezone*) present_terminal station-tz-select ;; -# *Time*) present_terminal station-update-time ;; -# *Password*) show_update_password_menu ;; -# *) show_main_menu ;; -# esac -# } -# -# show_update_process_menu() { -# case $(menu "Restart" " Hypridle\n Hyprsunset\n Swayosd\n󰌧 Walker\n󰍜 Waybar") in -# *Hypridle*) station-restart-hypridle ;; -# *Hyprsunset*) station-restart-hyprsunset ;; -# *Swayosd*) station-restart-swayosd ;; -# *Walker*) station-restart-walker ;; -# *Waybar*) station-restart-waybar ;; -# *) show_update_menu ;; -# esac -# } -# -# show_update_config_menu() { -# case $(menu "Use default config" " Hyprland\n Hypridle\n Hyprlock\n Hyprsunset\n󱣴 Plymouth\n Swayosd\n Tmux\n󰌧 Walker\n󰍜 Waybar") in -# *Hyprland*) present_terminal station-refresh-hyprland ;; -# *Hypridle*) present_terminal station-refresh-hypridle ;; -# *Hyprlock*) present_terminal station-refresh-hyprlock ;; -# *Hyprsunset*) present_terminal station-refresh-hyprsunset ;; -# *Plymouth*) present_terminal station-refresh-plymouth ;; -# *Swayosd*) present_terminal station-refresh-swayosd ;; -# *Tmux*) present_terminal station-refresh-tmux ;; -# *Walker*) present_terminal station-refresh-walker ;; -# *Waybar*) present_terminal station-refresh-waybar ;; -# *) show_update_menu ;; -# esac -# } -# -# show_update_hardware_menu() { -# case $(menu "Restart" " Audio\n󱚾 Wi-Fi\n󰂯 Bluetooth") in -# *Audio*) present_terminal station-restart-pipewire ;; -# *Wi-Fi*) present_terminal station-restart-wifi ;; -# *Bluetooth*) present_terminal station-restart-bluetooth ;; -# *) show_update_menu ;; -# esac -# } -# -# show_update_password_menu() { -# case $(menu "Update Password" " Drive Encryption\n User") in -# *Drive*) present_terminal station-drive-set-password ;; -# *User*) present_terminal passwd ;; -# *) show_update_menu ;; -# esac -# } -# -# show_system_menu() { -# local options="󱄄 Screensaver\n Lock\n󰒲 Suspend" -# station-hibernation-available && options="$options\n󰤁 Hibernate" -# options="$options\n󰍃 Logout\n󰜉 Restart\n󰐥 Shutdown" -# -# case $(menu "System" "$options") in -# *Screensaver*) station-launch-screensaver force ;; -# *Lock*) station-lock-screen ;; -# *Suspend*) systemctl suspend ;; -# *Hibernate*) systemctl hibernate ;; -# *Logout*) station-system-logout ;; -# *Restart*) station-system-reboot ;; -# *Shutdown*) station-system-shutdown ;; -# *) back_to show_main_menu ;; -# esac -# } +show_share_menu() { + case $(menu "Share" " Clipboard\n File \n Folder") in + *Clipboard*) station-cmd-share clipboard ;; + *File*) terminal bash -c "station-cmd-share file" ;; + *Folder*) terminal bash -c "station-cmd-share folder" ;; + *) back_to show_trigger_menu ;; + esac +} + +show_toggle_menu() { + case $(menu "Toggle" "󱄄 Screensaver\n󰔎 Nightlight\n󱫖 Idle Lock\n󰍜 Top Bar\n󱂬 Workspace Layout\n Window Gaps\n 1-Window Ratio\n󰍹 Display Scaling") in + + *Screensaver*) station-toggle-screensaver ;; + *Nightlight*) station-toggle-nightlight ;; + *Idle*) station-toggle-idle ;; + *Bar*) station-toggle-waybar ;; + *Layout*) station-hyprland-workspace-layout-toggle ;; + *Ratio*) station-hyprland-window-single-square-aspect-toggle ;; + *Gaps*) station-hyprland-window-gaps-toggle ;; + *Scaling*) station-hyprland-monitor-scaling-cycle ;; + *) back_to show_trigger_menu ;; + esac +} + +show_background_menu() { + station-launch-walker -m menus:stationBackgroundSelector --width 800 --minheight 400 +} + +show_setup_menu() { + local options=" Audio\n Wifi\n󰂯 Bluetooth\n󱐋 Power Profile\n󰍹 Monitors" + [[ -f ~/.config/hypr/bindings.conf ]] && options="$options\n Keybindings" + [[ -f ~/.config/hypr/input.conf ]] && options="$options\n Input" + options="$options\n Config" + + case $(menu "Setup" "$options") in + *Audio*) station-launch-audio ;; + *Wifi*) station-launch-wifi ;; + *Bluetooth*) station-launch-bluetooth ;; + *Power*) show_setup_power_menu ;; + *Monitors*) open_in_editor ~/.config/hypr/monitors.conf ;; + *Keybindings*) open_in_editor ~/.config/hypr/bindings.conf ;; + *Input*) open_in_editor ~/.config/hypr/input.conf ;; + *Config*) show_setup_config_menu ;; + *) show_main_menu ;; + esac +} + +show_setup_power_menu() { + profile=$(menu "Power Profile" "$(station-powerprofiles-list)" "" "$(powerprofilesctl get)") + + if [[ $profile == "CNCLD" || -z $profile ]]; then + back_to show_setup_menu + else + powerprofilesctl set "$profile" + fi +} + +show_setup_config_menu() { + case $(menu "Setup" " Defaults\n Hyprland\n Hypridle\n Hyprlock\n Hyprsunset\n Swayosd\n󰌧 Walker\n󰍜 Waybar\n󰞅 XCompose") in + *Defaults*) open_in_editor ~/.config/uwsm/default ;; + *Hyprland*) open_in_editor ~/.config/hypr/hyprland.conf ;; + *Hypridle*) open_in_editor ~/.config/hypr/hypridle.conf && station-restart-app hypridle ;; + *Hyprlock*) open_in_editor ~/.config/hypr/hyprlock.conf ;; + *Hyprsunset*) open_in_editor ~/.config/hypr/hyprsunset.conf && station-restart-app hyprsunset ;; + *Swayosd*) open_in_editor ~/.config/swayosd/config.toml && station-restart-app swayosd-server ;; + *Walker*) open_in_editor ~/.config/walker/config.toml && station-restart-walker ;; + *Waybar*) open_in_editor ~/.config/waybar/config.jsonc && station-restart-app waybar ;; + *XCompose*) open_in_editor ~/.config/xcompose && station-restart-app fcitx5 --disable notificationitem ;; + *) show_setup_menu ;; + esac +} + +show_update_menu() { + case $(menu "Update" "  Station\n Process\n󰇅 Hardware\n Firmware\n Password\n Timezone\n Time") in + *Station*) present_terminal station-update-system ;; + *Process*) show_update_process_menu ;; + *Hardware*) show_update_hardware_menu ;; + *Firmware*) present_terminal station-update-firmware ;; + *Timezone*) present_terminal station-tz-select ;; + *Time*) present_terminal station-update-time ;; + *Password*) show_update_password_menu ;; + *) show_main_menu ;; + esac +} + +show_update_process_menu() { + case $(menu "Restart" " Hypridle\n Hyprsunset\n Swayosd\n󰌧 Walker\n󰍜 Waybar") in + *Hypridle*) station-restart-app hypridle ;; + *Hyprsunset*) station-restart-app hyprsunset ;; + *Swayosd*) station-restart-app swayosd-server ;; + *Walker*) station-restart-walker ;; + *Waybar*) station-restart-app waybar ;; + *) show_update_menu ;; + esac +} + +show_update_hardware_menu() { + case $(menu "Restart" " Audio\n󱚾 Wi-Fi\n󰂯 Bluetooth") in + *Audio*) present_terminal station-restart-pipewire ;; + *Wi-Fi*) present_terminal station-restart-wifi ;; + *Bluetooth*) present_terminal station-restart-bluetooth ;; + *) show_update_menu ;; + esac +} + +show_update_password_menu() { + case $(menu "Update Password" " Drive Encryption\n User") in + *Drive*) present_terminal station-drive-set-password ;; + *User*) present_terminal passwd ;; + *) show_update_menu ;; + esac +} + +show_system_menu() { + local options="󱄄 Screensaver\n Lock\n󰒲 Suspend" + station-hibernation-available && options="$options\n󰤁 Hibernate" + options="$options\n󰍃 Logout\n󰜉 Restart\n󰐥 Shutdown" + + case $(menu "System" "$options") in + *Screensaver*) station-launch-screensaver force ;; + *Lock*) station-lock-screen ;; + *Suspend*) systemctl suspend ;; + *Hibernate*) systemctl hibernate ;; + *Logout*) station-system-logout ;; + *Restart*) station-system-reboot ;; + *Shutdown*) station-system-shutdown ;; + *) back_to show_main_menu ;; + esac +} show_main_menu() { go_to_menu "$(menu "Go" "󰀻 Apps\n󱓞 Trigger\n Setup\n Update\n About\n System")" @@ -323,16 +257,10 @@ go_to_menu() { case "${1,,}" in *apps*) walker -p "Launch…" ;; *trigger*) show_trigger_menu ;; - # *toggle*) show_toggle_menu ;; - # *share*) show_share_menu ;; - # *background*) show_background_menu ;; - # *capture*) show_capture_menu ;; - # *theme*) show_theme_menu ;; - # *screenrecord*) show_screenrecord_menu ;; - # *setup*) show_setup_menu ;; - # *power*) show_setup_power_menu ;; - # *update*) show_update_menu ;; - # *system*) show_system_menu ;; + *background*) show_background_menu ;; + *setup*) show_setup_menu ;; + *update*) show_update_menu ;; + *system*) show_system_menu ;; esac } diff --git a/.local/bin/station-powerprofiles-list b/.local/bin/station-powerprofiles-list new file mode 100755 index 0000000..dd26fea --- /dev/null +++ b/.local/bin/station-powerprofiles-list @@ -0,0 +1,8 @@ +#!/bin/bash + +# Returns a list of all the available power profiles on the system. +# Used by the Station Menu under Setup > Power Profile. + +powerprofilesctl list | + awk '/^\s*[* ]\s*[a-zA-Z0-9\-]+:$/ { gsub(/^[*[:space:]]+|:$/,""); print }' | + tac diff --git a/.local/bin/station-rebuild-system b/.local/bin/station-rebuild-system new file mode 100755 index 0000000..5b15104 --- /dev/null +++ b/.local/bin/station-rebuild-system @@ -0,0 +1,4 @@ +#!/bin/bash + +echo "Rebuilding system..." +sudo nixos rebuild switch --flake ~/.config/nixos/ diff --git a/.local/bin/station-restart-bluetooth b/.local/bin/station-restart-bluetooth new file mode 100755 index 0000000..57530d1 --- /dev/null +++ b/.local/bin/station-restart-bluetooth @@ -0,0 +1,7 @@ +#!/bin/bash + +# Unblock and restart the bluetooth service. + +echo -e "Unblocking bluetooth...\n" +rfkill unblock bluetooth +rfkill list bluetooth diff --git a/.local/bin/station-restart-pipewire b/.local/bin/station-restart-pipewire new file mode 100755 index 0000000..a222ad1 --- /dev/null +++ b/.local/bin/station-restart-pipewire @@ -0,0 +1,6 @@ +#!/bin/bash + +# Restart the PipeWire audio service to fix audio issues or apply new configuration. + +echo -e "Restarting pipewire audio service...\n" +systemctl --user restart pipewire.service diff --git a/.local/bin/station-restart-walker b/.local/bin/station-restart-walker new file mode 100755 index 0000000..20b05e1 --- /dev/null +++ b/.local/bin/station-restart-walker @@ -0,0 +1,22 @@ +#!/bin/bash + +restart_services() { + if systemctl --user is-enabled elephant.service &>/dev/null; then + systemctl --user restart elephant.service + fi + + if systemctl --user is-enabled app-walker@autostart.service &>/dev/null; then + systemctl --user restart app-walker@autostart.service + else + echo -e "\e[31mUnable to restart Walker -- RESTART MANUALLY\e[0m" + fi +} + +if (( EUID == 0 )); then + SCRIPT_OWNER=$(stat -c '%U' "$0") + USER_UID=$(id -u "$SCRIPT_OWNER") + systemd-run --uid="$SCRIPT_OWNER" --setenv=XDG_RUNTIME_DIR="/run/user/$USER_UID" \ + bash -c "$(declare -f restart_services); restart_services" +else + restart_services +fi diff --git a/.local/bin/station-restart-wifi b/.local/bin/station-restart-wifi new file mode 100755 index 0000000..5cf35dd --- /dev/null +++ b/.local/bin/station-restart-wifi @@ -0,0 +1,7 @@ +#!/bin/bash + +# Unblock and restart the Wi-Fi service. + +echo -e "Unblocking wifi...\n" +rfkill unblock wifi +rfkill list wifi diff --git a/.local/bin/station-state b/.local/bin/station-state new file mode 100755 index 0000000..4b5ca7f --- /dev/null +++ b/.local/bin/station-state @@ -0,0 +1,26 @@ +#!/bin/bash + +# Manage persistent state files for Station toggles and settings. +# Usage: station-state +# Used to track whether features like suspend, idle lock, etc are enabled or disabled. + +STATE_DIR="$HOME/.local/state/station" +mkdir -p "$STATE_DIR" + +COMMAND="$1" +STATE_NAME="$2" + +if [[ -z $COMMAND ]]; then + echo "Usage: station-state " + exit 1 +fi + +if [[ -z $STATE_NAME ]]; then + echo "Usage: station-state $COMMAND " + exit 1 +fi + +case "$COMMAND" in + set) touch "$STATE_DIR/$STATE_NAME" ;; + clear) find "$STATE_DIR" -maxdepth 1 -type f -name "$STATE_NAME" -delete ;; +esac diff --git a/.local/bin/station-system-logout b/.local/bin/station-system-logout new file mode 100755 index 0000000..5fa8ba5 --- /dev/null +++ b/.local/bin/station-system-logout @@ -0,0 +1,11 @@ +#!/bin/bash + +# Logout command that first closes all application windows (thus giving them a chance to save state), +# then stops the session, returning to the SDDM login screen. + +# Schedule the session stop after closing windows (detached from terminal) +nohup bash -c "sleep 2 && uwsm stop" >/dev/null 2>&1 & + +# Now close all windows +station-hyprland-window-close-all +sleep 1 # Allow apps like Chrome to shutdown correctly diff --git a/.local/bin/station-system-reboot b/.local/bin/station-system-reboot new file mode 100755 index 0000000..0db3da4 --- /dev/null +++ b/.local/bin/station-system-reboot @@ -0,0 +1,13 @@ +#!/bin/bash + +# Reboot command that first closes all application windows (thus giving them a chance to save state). +# This is particularly helpful for applications like Chromium that otherwise won't shutdown cleanly. + +station-state clear re*-required + +# Schedule the reboot to happen after closing windows (detached from terminal) +nohup bash -c "sleep 2 && systemctl reboot --no-wall" >/dev/null 2>&1 & + +# Now close all windows +station-hyprland-window-close-all +sleep 1 # Allow apps like Chrome to shutdown correctly diff --git a/.local/bin/station-system-shutdown b/.local/bin/station-system-shutdown new file mode 100755 index 0000000..6cf205c --- /dev/null +++ b/.local/bin/station-system-shutdown @@ -0,0 +1,13 @@ +#,!/bin/bash + +# Shutdown command that first closes all application windows (thus giving them a chance to save state). +# This is particularly helpful for applications like Chromium that otherwise won't shutdown cleanly. + +station-state clear re*-required + +# Schedule the shutdown to happen after closing windows (detached from terminal) +nohup bash -c "sleep 2 && systemctl poweroff --no-wall" >/dev/null 2>&1 & + +# Now close all windows +station-hyprland-window-close-all +sleep 1 # Allow apps like Chrome to shutdown correctly!/bin/bash diff --git a/.local/bin/station-toggle-idle b/.local/bin/station-toggle-idle new file mode 100755 index 0000000..a31c387 --- /dev/null +++ b/.local/bin/station-toggle-idle @@ -0,0 +1,11 @@ +#!/bin/bash + +if pgrep -x hypridle >/dev/null; then + pkill -x hypridle + notify-send "󱫖 Stop locking computer when idle" +else + uwsm-app -- hypridle >/dev/null 2>&1 & + notify-send "󱫖 Now locking computer when idle" +fi + +pkill -RTMIN+9 waybar diff --git a/.local/bin/station-toggle-nightlight b/.local/bin/station-toggle-nightlight new file mode 100755 index 0000000..f0277ad --- /dev/null +++ b/.local/bin/station-toggle-nightlight @@ -0,0 +1,30 @@ +#!/bin/bash + +# Default temperature values +ON_TEMP=4000 +OFF_TEMP=6000 + +# Ensure hyprsunset is running +if ! pgrep -x hyprsunset; then + setsid uwsm-app -- hyprsunset & + sleep 1 # Give it time to register +fi + +# Query the current temperature +CURRENT_TEMP=$(hyprctl hyprsunset temperature 2>/dev/null | grep -oE '[0-9]+') + +restart_nightlighted_waybar() { + if grep -q "custom/nightlight" ~/.config/waybar/config.jsonc; then + station-restart-waybar # restart waybar in case user has waybar module for hyprsunset + fi +} + +if [[ $CURRENT_TEMP == $OFF_TEMP ]]; then + hyprctl hyprsunset temperature $ON_TEMP + notify-send " Nightlight screen temperature" + restart_nightlighted_waybar +else + hyprctl hyprsunset temperature $OFF_TEMP + notify-send " Daylight screen temperature" + restart_nightlighted_waybar +fi diff --git a/.local/bin/station-toggle-screensaver b/.local/bin/station-toggle-screensaver new file mode 100755 index 0000000..af095f5 --- /dev/null +++ b/.local/bin/station-toggle-screensaver @@ -0,0 +1,12 @@ +#!/bin/bash + +STATE_FILE=~/.local/state/station/toggles/screensaver-off + +if [[ -f $STATE_FILE ]]; then + rm -f $STATE_FILE + notify-send "󱄄 Screensaver enabled" +else + mkdir -p "$(dirname $STATE_FILE)" + touch $STATE_FILE + notify-send "󱄄 Screensaver disabled" +fi diff --git a/.local/bin/station-toggle-waybar b/.local/bin/station-toggle-waybar new file mode 100755 index 0000000..7b8dfcc --- /dev/null +++ b/.local/bin/station-toggle-waybar @@ -0,0 +1,7 @@ +#!/bin/bash + +if pgrep -x waybar >/dev/null; then + pkill -x waybar +else + uwsm-app -- waybar >/dev/null 2>&1 & +fi diff --git a/.local/bin/station-tz-select b/.local/bin/station-tz-select new file mode 100755 index 0000000..cfc3de0 --- /dev/null +++ b/.local/bin/station-tz-select @@ -0,0 +1,6 @@ +#!/bin/bash + +timezone=$(timedatectl list-timezones | gum filter --height 20 --header "Set timezone") || exit 1 +sudo timedatectl set-timezone "$timezone" +echo "Timezone is now set to $timezone" +station-restart-app waybar diff --git a/.local/bin/station-update-firmware b/.local/bin/station-update-firmware new file mode 100755 index 0000000..21afda6 --- /dev/null +++ b/.local/bin/station-update-firmware @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e +echo -e "\e[32mUpdate Firmware\e[0m" + +fwupdmgr refresh --force +sudo fwupdmgr update diff --git a/.local/bin/station-update-system b/.local/bin/station-update-system new file mode 100755 index 0000000..f123312 --- /dev/null +++ b/.local/bin/station-update-system @@ -0,0 +1,4 @@ +#!/bin/bash + +echo "Updating system..." +sudo nixos rebuild switch --flake ~/.config/nixos/ --update diff --git a/.local/bin/station-update-time b/.local/bin/station-update-time new file mode 100755 index 0000000..14fc8b6 --- /dev/null +++ b/.local/bin/station-update-time @@ -0,0 +1,4 @@ +#!/bin/bash + +echo "Updating time..." +sudo systemctl restart systemd-timesyncd