Lots of scripts
This commit is contained in:
48
.local/bin/station-bg-next
Executable file
48
.local/bin/station-bg-next
Executable file
@@ -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
|
||||
18
.local/bin/station-bg-set
Executable file
18
.local/bin/station-bg-set
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Sets the specified image as the current background
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
echo "Usage: station-bg-set <path-to-image>" >&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 &
|
||||
46
.local/bin/station-cmd-share
Executable file
46
.local/bin/station-cmd-share
Executable file
@@ -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
|
||||
23
.local/bin/station-drive-set-password
Executable file
23
.local/bin/station-drive-set-password
Executable file
@@ -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 <<<encrypted_drives) == 1 )); then
|
||||
drive_to_change="$encrypted_drives"
|
||||
else
|
||||
drive_to_change="$(omarchy-drive-select "$encrypted_drives")"
|
||||
fi
|
||||
|
||||
if [[ -n $drive_to_change ]]; then
|
||||
echo "Changing full-disk encryption password for $drive_to_change"
|
||||
sudo cryptsetup luksChangeKey --pbkdf argon2id --iter-time 2000 "$drive_to_change"
|
||||
else
|
||||
echo "No drive selected."
|
||||
fi
|
||||
else
|
||||
echo "No encrypted drives available."
|
||||
exit 1
|
||||
fi
|
||||
18
.local/bin/station-hibernation-available
Executable file
18
.local/bin/station-hibernation-available
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if hibernation is supported
|
||||
if [[ ! -f /sys/power/image_size ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Sum all swap sizes (excluding zram)
|
||||
SWAPSIZE_KB=$(awk '!/Filename|zram/ {sum += $3} END {print sum+0}' /proc/swaps)
|
||||
SWAPSIZE=$(( 1024 * ${SWAPSIZE_KB:-0} ))
|
||||
|
||||
HIBERNATION_IMAGE_SIZE=$(cat /sys/power/image_size)
|
||||
|
||||
if (( SWAPSIZE > HIBERNATION_IMAGE_SIZE )) ; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
24
.local/bin/station-hyprland-monitor-scaling-cycle
Executable file
24
.local/bin/station-hyprland-monitor-scaling-cycle
Executable file
@@ -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"
|
||||
15
.local/bin/station-hyprland-window-gaps-toggle
Executable file
15
.local/bin/station-hyprland-window-gaps-toggle
Executable file
@@ -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
|
||||
13
.local/bin/station-hyprland-window-single-square-aspect-toggle
Executable file
13
.local/bin/station-hyprland-window-single-square-aspect-toggle
Executable file
@@ -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
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
8
.local/bin/station-powerprofiles-list
Executable file
8
.local/bin/station-powerprofiles-list
Executable file
@@ -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
|
||||
4
.local/bin/station-rebuild-system
Executable file
4
.local/bin/station-rebuild-system
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Rebuilding system..."
|
||||
sudo nixos rebuild switch --flake ~/.config/nixos/
|
||||
7
.local/bin/station-restart-bluetooth
Executable file
7
.local/bin/station-restart-bluetooth
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Unblock and restart the bluetooth service.
|
||||
|
||||
echo -e "Unblocking bluetooth...\n"
|
||||
rfkill unblock bluetooth
|
||||
rfkill list bluetooth
|
||||
6
.local/bin/station-restart-pipewire
Executable file
6
.local/bin/station-restart-pipewire
Executable file
@@ -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
|
||||
22
.local/bin/station-restart-walker
Executable file
22
.local/bin/station-restart-walker
Executable file
@@ -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
|
||||
7
.local/bin/station-restart-wifi
Executable file
7
.local/bin/station-restart-wifi
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Unblock and restart the Wi-Fi service.
|
||||
|
||||
echo -e "Unblocking wifi...\n"
|
||||
rfkill unblock wifi
|
||||
rfkill list wifi
|
||||
26
.local/bin/station-state
Executable file
26
.local/bin/station-state
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Manage persistent state files for Station toggles and settings.
|
||||
# Usage: station-state <set|clear> <state-name-or-pattern>
|
||||
# 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 <set|clear> <state-name-or-pattern>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z $STATE_NAME ]]; then
|
||||
echo "Usage: station-state $COMMAND <state-name>"
|
||||
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
|
||||
11
.local/bin/station-system-logout
Executable file
11
.local/bin/station-system-logout
Executable file
@@ -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
|
||||
13
.local/bin/station-system-reboot
Executable file
13
.local/bin/station-system-reboot
Executable file
@@ -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
|
||||
13
.local/bin/station-system-shutdown
Executable file
13
.local/bin/station-system-shutdown
Executable file
@@ -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
|
||||
11
.local/bin/station-toggle-idle
Executable file
11
.local/bin/station-toggle-idle
Executable file
@@ -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
|
||||
30
.local/bin/station-toggle-nightlight
Executable file
30
.local/bin/station-toggle-nightlight
Executable file
@@ -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
|
||||
12
.local/bin/station-toggle-screensaver
Executable file
12
.local/bin/station-toggle-screensaver
Executable file
@@ -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
|
||||
7
.local/bin/station-toggle-waybar
Executable file
7
.local/bin/station-toggle-waybar
Executable file
@@ -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
|
||||
6
.local/bin/station-tz-select
Executable file
6
.local/bin/station-tz-select
Executable file
@@ -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
|
||||
7
.local/bin/station-update-firmware
Executable file
7
.local/bin/station-update-firmware
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
echo -e "\e[32mUpdate Firmware\e[0m"
|
||||
|
||||
fwupdmgr refresh --force
|
||||
sudo fwupdmgr update
|
||||
4
.local/bin/station-update-system
Executable file
4
.local/bin/station-update-system
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Updating system..."
|
||||
sudo nixos rebuild switch --flake ~/.config/nixos/ --update
|
||||
4
.local/bin/station-update-time
Executable file
4
.local/bin/station-update-time
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Updating time..."
|
||||
sudo systemctl restart systemd-timesyncd
|
||||
Reference in New Issue
Block a user