Add real quick controls to Rofi settings menu
This commit is contained in:
parent
320deb1101
commit
51c3ff6d9f
3 changed files with 120 additions and 56 deletions
|
|
@ -40,3 +40,5 @@
|
|||
## Settings / Quick Controls
|
||||
- `$mod + S` -> Öffnet das zentrale Rofi-Settings-Menü
|
||||
- Waybar-Module für Netzwerk, Bluetooth, Audio und Akku können dieses Menü direkt öffnen
|
||||
|
||||
- `$mod + S` -> Öffnet Rofi Quick Settings mit echten Controls für Audio, Netzwerk, Bluetooth, Monitor, Input, Theme und Power
|
||||
|
|
|
|||
11
README.md
11
README.md
|
|
@ -74,3 +74,14 @@ Für ein stimmigeres Hyprland-Setup als klassische Standard-Tools:
|
|||
|
||||
Aktuell öffnet das Rofi-Settings-Menü auf `$mod + S` diese Bereiche zentral.
|
||||
Die Waybar-Module für Netzwerk, Bluetooth, Audio und Akku können darauf ebenfalls verweisen.
|
||||
|
||||
|
||||
## Rofi Quick Settings
|
||||
`$mod + S` öffnet ein zentrales Rofi-Settings-Menü mit echten Quick Controls für:
|
||||
- Audio: Mixer, Output-Auswahl, Mute, Lautstärke
|
||||
- Netzwerk: WLAN an/aus, WLAN-Auswahl, Verbindungseditor, nmtui
|
||||
- Bluetooth: Power Toggle, Geräteübersicht, Blueman
|
||||
- Monitor: wdisplays, Monitor-Info, Kanshi-Config
|
||||
- Input: Input-Config und Helligkeit
|
||||
- Anzeige / Theme: Wallpaper, GTK-Theme, Waybar-Config
|
||||
- Power: bestehendes Power-Menü
|
||||
|
|
|
|||
|
|
@ -11,87 +11,138 @@ pick() {
|
|||
' "$@" | rofi -dmenu -i -p "$prompt" -theme "$ROFI_THEME"
|
||||
}
|
||||
|
||||
open_audio() {
|
||||
local audio_choice
|
||||
audio_choice=$(pick "Audio" " Lautstärke-Mixer" " Audio-Info" " Mikrofon umschalten")
|
||||
case "${audio_choice:-}" in
|
||||
" Lautstärke-Mixer")
|
||||
if command -v pwvucontrol >/dev/null 2>&1; then
|
||||
pwvucontrol & disown
|
||||
else
|
||||
pavucontrol & disown
|
||||
notify() {
|
||||
if command -v notify-send >/dev/null 2>&1; then
|
||||
notify-send "Settings" "$1"
|
||||
else
|
||||
rofi -e "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
get_default_sink() {
|
||||
wpctl status | awk '/Sinks:/{flag=1;next}/Sources:/{flag=0}flag && /\*/{print $3; exit}' | tr -d '.'
|
||||
}
|
||||
|
||||
audio_menu() {
|
||||
local choice sink_id
|
||||
choice=$(pick "Audio" " Mixer öffnen" " Standard-Ausgabe wählen" " Mikrofon mute toggeln" " Lautstärke +5%" " Lautstärke -5%" " Audio mute toggeln")
|
||||
case "${choice:-}" in
|
||||
" Mixer öffnen")
|
||||
if command -v pwvucontrol >/dev/null 2>&1; then pwvucontrol & disown; else pavucontrol & disown; fi
|
||||
;;
|
||||
" Standard-Ausgabe wählen")
|
||||
mapfile -t sinks < <(wpctl status | awk '/Sinks:/{flag=1;next}/Sources:/{flag=0}flag && /[0-9]+\./{sub(/^.*[0-9]+\. /, ""); print}')
|
||||
selected=$(pick "Output" "${sinks[@]}")
|
||||
if [[ -n "${selected:-}" ]]; then
|
||||
sink_id=$(wpctl status | awk -v sel="$selected" '/Sinks:/{flag=1;next}/Sources:/{flag=0}flag && $0 ~ sel {gsub(/[^0-9]/, "", $2); print $2; exit}')
|
||||
[[ -n "${sink_id:-}" ]] && wpctl set-default "$sink_id"
|
||||
fi
|
||||
;;
|
||||
" Audio-Info")
|
||||
wpctl status | rofi -dmenu -i -p "Audio Info" -theme "$ROFI_THEME" || true
|
||||
" Mikrofon mute toggeln") wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle ;;
|
||||
" Lautstärke +5%") wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+ ;;
|
||||
" Lautstärke -5%") wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- ;;
|
||||
" Audio mute toggeln") wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ;;
|
||||
esac
|
||||
}
|
||||
|
||||
network_toggle_wifi() {
|
||||
state=$(nmcli radio wifi)
|
||||
if [[ "$state" == "enabled" ]]; then
|
||||
nmcli radio wifi off
|
||||
notify "WLAN deaktiviert"
|
||||
else
|
||||
nmcli radio wifi on
|
||||
notify "WLAN aktiviert"
|
||||
fi
|
||||
}
|
||||
|
||||
network_pick_wifi() {
|
||||
nmcli radio wifi on >/dev/null 2>&1 || true
|
||||
mapfile -t nets < <(nmcli -t -f SSID,SIGNAL,SECURITY dev wifi list | awk -F: '!seen[$1]++ && $1 != "" {printf " %s (%s%%) [%s]
|
||||
", $1, $2, ($3==""?"open":$3)}')
|
||||
selected=$(pick "WLAN" "${nets[@]}")
|
||||
if [[ -n "${selected:-}" ]]; then
|
||||
ssid=$(sed -E 's/^ (.*) \([0-9]+%\) \[.*\]$//' <<< "$selected")
|
||||
kitty -e bash -lc "nmcli dev wifi connect "$ssid"; echo; read -n1 -r -p 'Taste drücken...'" & disown
|
||||
fi
|
||||
}
|
||||
|
||||
network_menu() {
|
||||
choice=$(pick "Netzwerk" " WLAN an/aus" " WLAN wählen" " Netzwerk-Info" " Verbindungen bearbeiten" " nmtui")
|
||||
case "${choice:-}" in
|
||||
" WLAN an/aus") network_toggle_wifi ;;
|
||||
" WLAN wählen") network_pick_wifi ;;
|
||||
" Netzwerk-Info") nmcli general status | rofi -dmenu -i -p "Netzwerk Info" -theme "$ROFI_THEME" || true ;;
|
||||
" Verbindungen bearbeiten") nm-connection-editor & disown ;;
|
||||
" nmtui") kitty -e nmtui & disown ;;
|
||||
esac
|
||||
}
|
||||
|
||||
bluetooth_menu() {
|
||||
powered=$(bluetoothctl show | awk -F': ' '/Powered:/ {print $2}')
|
||||
choice=$(pick "Bluetooth" " Bluetooth an/aus" " Geräte anzeigen" " Blueman öffnen")
|
||||
case "${choice:-}" in
|
||||
" Bluetooth an/aus")
|
||||
if [[ "$powered" == "yes" ]]; then bluetoothctl power off; notify "Bluetooth deaktiviert"; else bluetoothctl power on; notify "Bluetooth aktiviert"; fi
|
||||
;;
|
||||
" Mikrofon umschalten")
|
||||
wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
|
||||
" Geräte anzeigen") bluetoothctl devices | rofi -dmenu -i -p "Bluetooth Geräte" -theme "$ROFI_THEME" || true ;;
|
||||
" Blueman öffnen")
|
||||
if command -v blueman-manager >/dev/null 2>&1; then blueman-manager & disown; else rofi -e "blueman ist nicht installiert."; fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
open_network() {
|
||||
local net_choice
|
||||
net_choice=$(pick "Netzwerk" " Verbindungen bearbeiten" " Text-UI Netzwerk (nmtui)")
|
||||
case "${net_choice:-}" in
|
||||
" Verbindungen bearbeiten") nm-connection-editor & disown ;;
|
||||
" Text-UI Netzwerk (nmtui)") kitty -e nmtui & disown ;;
|
||||
monitor_menu() {
|
||||
choice=$(pick "Monitor" " Monitor-Tool öffnen" " Monitor-Info" " Kanshi Config öffnen")
|
||||
case "${choice:-}" in
|
||||
" Monitor-Tool öffnen")
|
||||
if command -v wdisplays >/dev/null 2>&1; then wdisplays & disown; else rofi -e "wdisplays ist nicht installiert."; fi
|
||||
;;
|
||||
" Monitor-Info") hyprctl monitors | rofi -dmenu -i -p "Monitore" -theme "$ROFI_THEME" || true ;;
|
||||
" Kanshi Config öffnen") kitty -e bash -lc "${EDITOR:-nano} ~/.config/kanshi/config" & disown ;;
|
||||
esac
|
||||
}
|
||||
|
||||
open_bluetooth() {
|
||||
if command -v blueman-manager >/dev/null 2>&1; then
|
||||
blueman-manager & disown
|
||||
else
|
||||
rofi -e "Tipp: installiere blueman für eine schönere Bluetooth-GUI."
|
||||
fi
|
||||
input_menu() {
|
||||
choice=$(pick "Input" " Input Config öffnen" " Helligkeit +10%" " Helligkeit -10%")
|
||||
case "${choice:-}" in
|
||||
" Input Config öffnen") kitty -e bash -lc "${EDITOR:-nano} ~/.config/hypr/conf.d/input.conf" & disown ;;
|
||||
" Helligkeit +10%") brightnessctl s +10% ;;
|
||||
" Helligkeit -10%") brightnessctl s 10%- ;;
|
||||
esac
|
||||
}
|
||||
|
||||
open_monitor() {
|
||||
if command -v wdisplays >/dev/null 2>&1; then
|
||||
wdisplays & disown
|
||||
else
|
||||
rofi -e "Tipp: installiere wdisplays für eine Wayland-native Monitor-GUI."
|
||||
fi
|
||||
}
|
||||
|
||||
open_input() {
|
||||
kitty -e bash -lc "${EDITOR:-nano} ~/.config/hypr/conf.d/input.conf" & disown
|
||||
}
|
||||
|
||||
open_theme() {
|
||||
local theme_choice
|
||||
theme_choice=$(pick "Anzeige / Theme" " Wallpaper wählen" " GTK Theme anwenden" " Waybar Config öffnen")
|
||||
case "${theme_choice:-}" in
|
||||
theme_menu() {
|
||||
choice=$(pick "Anzeige / Theme" " Wallpaper wählen" " GTK Theme anwenden" " Waybar Config öffnen")
|
||||
case "${choice:-}" in
|
||||
" Wallpaper wählen") ~/.config/hypr-nepharius/scripts/choose-wallpaper.sh ;;
|
||||
" GTK Theme anwenden") kitty -e bash -lc "~/.config/hypr-nepharius/scripts/apply-gtk-theme.sh; read -n1 -r -p 'Fertig. Taste drücken...'" & disown ;;
|
||||
" Waybar Config öffnen") kitty -e bash -lc "${EDITOR:-nano} ~/.config/waybar/config.jsonc" & disown ;;
|
||||
esac
|
||||
}
|
||||
|
||||
open_power() {
|
||||
power_menu() {
|
||||
~/.config/hypr-nepharius/scripts/power-menu.sh
|
||||
}
|
||||
|
||||
case "$section" in
|
||||
audio) open_audio; exit 0 ;;
|
||||
network) open_network; exit 0 ;;
|
||||
bluetooth) open_bluetooth; exit 0 ;;
|
||||
monitor) open_monitor; exit 0 ;;
|
||||
input) open_input; exit 0 ;;
|
||||
theme) open_theme; exit 0 ;;
|
||||
power) open_power; exit 0 ;;
|
||||
audio) audio_menu; exit 0 ;;
|
||||
network) network_menu; exit 0 ;;
|
||||
bluetooth) bluetooth_menu; exit 0 ;;
|
||||
monitor) monitor_menu; exit 0 ;;
|
||||
input) input_menu; exit 0 ;;
|
||||
theme) theme_menu; exit 0 ;;
|
||||
power) power_menu; exit 0 ;;
|
||||
esac
|
||||
|
||||
main_choice=$(pick "Settings" " Audio" " Netzwerk" " Bluetooth" " Monitor" " Maus & Tastatur" " Anzeige / Theme" " Power")
|
||||
|
||||
case "${main_choice:-}" in
|
||||
" Audio") open_audio ;;
|
||||
" Netzwerk") open_network ;;
|
||||
" Bluetooth") open_bluetooth ;;
|
||||
" Monitor") open_monitor ;;
|
||||
" Maus & Tastatur") open_input ;;
|
||||
" Anzeige / Theme") open_theme ;;
|
||||
" Power") open_power ;;
|
||||
" Audio") audio_menu ;;
|
||||
" Netzwerk") network_menu ;;
|
||||
" Bluetooth") bluetooth_menu ;;
|
||||
" Monitor") monitor_menu ;;
|
||||
" Maus & Tastatur") input_menu ;;
|
||||
" Anzeige / Theme") theme_menu ;;
|
||||
" Power") power_menu ;;
|
||||
esac
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue