diff options
| -rw-r--r-- | .config/hypr/source/appearance.lua | 2 | ||||
| -rw-r--r-- | .config/hypr/source/keybinds.lua | 1 | ||||
| -rwxr-xr-x | .local/bin/bcn | 57 | ||||
| -rwxr-xr-x | .local/bin/nvidia-run | 9 |
4 files changed, 52 insertions, 17 deletions
diff --git a/.config/hypr/source/appearance.lua b/.config/hypr/source/appearance.lua index c37ee44..5d42081 100644 --- a/.config/hypr/source/appearance.lua +++ b/.config/hypr/source/appearance.lua @@ -13,7 +13,7 @@ hl.config({ layout = "master", ["col.active_border"] = { - colors = { wal.colors.color14, wal.colors.color12 }, + colors = { wal.colors.color14, wal.colors.color14 }, angle = 45, }, diff --git a/.config/hypr/source/keybinds.lua b/.config/hypr/source/keybinds.lua index 7a1f11e..343abc4 100644 --- a/.config/hypr/source/keybinds.lua +++ b/.config/hypr/source/keybinds.lua @@ -29,7 +29,6 @@ hl.bind( hl.bind(mainMod .. " + R", hl.dsp.exec_cmd(menu)) -- bind = $mainMod SHIFT, P, pseudo, # dwindle --- (left commented out to mirror the original file) hl.bind(mainMod .. " + Tab", hl.dsp.window.cycle_next({ next = false }), { repeating = true }) hl.bind(mainMod .. " + b", hl.dsp.exec_cmd("killall waybar || waybar")) hl.bind(mainMod .. " + grave", hl.dsp.exec_cmd("fuzzelunicode")) diff --git a/.local/bin/bcn b/.local/bin/bcn index b87e2ab..340f6c0 100755 --- a/.local/bin/bcn +++ b/.local/bin/bcn @@ -1,24 +1,51 @@ #!/bin/bash -#bcn, Bluetooth Connect +# bcn, Bluetooth Connect +mapfile -t devices < <(bluetoothctl devices) -device_amount=$(bluetoothctl devices | wc -l) +if [[ ${#devices[@]} -eq 0 ]]; then + notify-send "Bluetooth" "No devices found" + exit 1 +fi -if [[ $device_amount = 1 ]]; then - MAC=$(bluetoothctl devices | awk {'print $2'}) - [ -z $MAC ] && MAC=NoDeviceFound # Prevents accidental disconnect error +if [[ ${#devices[@]} -eq 1 ]]; then + line="${devices[0]}" else - select=$(bluetoothctl devices | awk {'print $3'} | fuzzel --dmenu -l 10 -fn Monospace-15) - MAC=$(bluetoothctl devices | grep $select | awk {'print $2'}) - [ -z $MAC ] && MAC=NoDeviceFound # Prevents accidental disconnect error + names=$(printf '%s\n' "${devices[@]}" | sed 's/^Device [^ ]* //') + + selected=$(printf '%s\n' "$names" | + fuzzel --dmenu -l 10 -fn Monospace-15) + + [[ -z "$selected" ]] && exit 0 + + # Find MAC corresponding to selected full name + for device in "${devices[@]}"; do + name=$(echo "$device" | cut -d' ' -f3-) + + if [[ "$name" == "$selected" ]]; then + line="$device" + break + fi + done fi -connect=$(bluetoothctl info $MAC | grep Connected: | awk '{print $2}') -if [[ $connect = no ]]; then - notify-send "Attempting to connect to $select" - bluetoothctl connect $MAC || notify-send "Failed to Connect" -elif [[ $connect = yes ]]; then - notify-send "Attempting to disconnect $select" - bluetoothctl disconnect $MAC +MAC=$(echo "$line" | awk '{print $2}') +NAME=$(echo "$line" | cut -d' ' -f3-) + +connect=$(bluetoothctl info "$MAC" | + awk '/Connected:/ {print $2}') + +if [[ "$connect" == "no" ]]; then + notify-send "Bluetooth" "Connecting to $NAME..." + + if bluetoothctl connect "$MAC"; then + notify-send "Bluetooth" "Connected to $NAME" + else + notify-send "Bluetooth" "Failed to connect to $NAME" + fi + +elif [[ "$connect" == "yes" ]]; then + notify-send "Bluetooth" "Disconnecting from $NAME..." + bluetoothctl disconnect "$MAC" fi diff --git a/.local/bin/nvidia-run b/.local/bin/nvidia-run new file mode 100755 index 0000000..b5fca63 --- /dev/null +++ b/.local/bin/nvidia-run @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +export __NV_PRIME_RENDER_OFFLOAD=1 +export __GLX_VENDOR_LIBRARY_NAME=nvidia +export __VK_LAYER_NV_optimus=NVIDIA_only +export GBM_BACKEND=nvidia-drm +export LIBVA_DRIVER_NAME=nvidia + +exec "$@" |
