Krolyxon
Commit 7c0c226

Branches

Refs →

aurora7c0c226

scripts: add nvidia-run script, make bcn script more robust

Author
krolyxon
Date
2026-09-27 13:56 +0530
Parent
ace9df5
Commit
7c0c226ec5db91a090b0acd0487a3612301995ef

+52 −17

4 files changed

  1. M .config/hypr/source/appearance.lua +1 −1
  2. M .config/hypr/source/keybinds.lua +0 −1
  3. M .local/bin/bcn +42 −15
  4. A .local/bin/nvidia-run +9 −0
M .config/hypr/source/appearance.lua View
@@ -13,7 +13,7 @@ hl.config({
1313 layout = "master",
1414
1515 ["col.active_border"] = {
16− colors = { wal.colors.color14, wal.colors.color12 },
16+ colors = { wal.colors.color14, wal.colors.color14 },
1717 angle = 45,
1818 },
1919
M .config/hypr/source/keybinds.lua View
@@ -29,7 +29,6 @@ hl.bind(
2929
3030 hl.bind(mainMod .. " + R", hl.dsp.exec_cmd(menu))
3131 -- bind = $mainMod SHIFT, P, pseudo, # dwindle
32−-- (left commented out to mirror the original file)
3332 hl.bind(mainMod .. " + Tab", hl.dsp.window.cycle_next({ next = false }), { repeating = true })
3433 hl.bind(mainMod .. " + b", hl.dsp.exec_cmd("killall waybar || waybar"))
3534 hl.bind(mainMod .. " + grave", hl.dsp.exec_cmd("fuzzelunicode"))
M .local/bin/bcn View
@@ -1,24 +1,51 @@
11 #!/bin/bash
22
3−#bcn, Bluetooth Connect
3+# bcn, Bluetooth Connect
44
5+mapfile -t devices < <(bluetoothctl devices)
56
6−device_amount=$(bluetoothctl devices | wc -l)
7+if [[ ${#devices[@]} -eq 0 ]]; then
8+ notify-send "Bluetooth" "No devices found"
9+ exit 1
10+fi
711
8−if [[ $device_amount = 1 ]]; then
9− MAC=$(bluetoothctl devices | awk {'print $2'})
10− [ -z $MAC ] && MAC=NoDeviceFound # Prevents accidental disconnect error
12+if [[ ${#devices[@]} -eq 1 ]]; then
13+ line="${devices[0]}"
1114 else
12− select=$(bluetoothctl devices | awk {'print $3'} | fuzzel --dmenu -l 10 -fn Monospace-15)
13− MAC=$(bluetoothctl devices | grep $select | awk {'print $2'})
14− [ -z $MAC ] && MAC=NoDeviceFound # Prevents accidental disconnect error
15+ names=$(printf '%s\n' "${devices[@]}" | sed 's/^Device [^ ]* //')
16+
17+ selected=$(printf '%s\n' "$names" |
18+ fuzzel --dmenu -l 10 -fn Monospace-15)
19+
20+ [[ -z "$selected" ]] && exit 0
21+
22+ # Find MAC corresponding to selected full name
23+ for device in "${devices[@]}"; do
24+ name=$(echo "$device" | cut -d' ' -f3-)
25+
26+ if [[ "$name" == "$selected" ]]; then
27+ line="$device"
28+ break
29+ fi
30+ done
1531 fi
1632
17−connect=$(bluetoothctl info $MAC | grep Connected: | awk '{print $2}')
18−if [[ $connect = no ]]; then
19− notify-send "Attempting to connect to $select"
20− bluetoothctl connect $MAC || notify-send "Failed to Connect"
21−elif [[ $connect = yes ]]; then
22− notify-send "Attempting to disconnect $select"
23− bluetoothctl disconnect $MAC
33+MAC=$(echo "$line" | awk '{print $2}')
34+NAME=$(echo "$line" | cut -d' ' -f3-)
35+
36+connect=$(bluetoothctl info "$MAC" |
37+ awk '/Connected:/ {print $2}')
38+
39+if [[ "$connect" == "no" ]]; then
40+ notify-send "Bluetooth" "Connecting to $NAME..."
41+
42+ if bluetoothctl connect "$MAC"; then
43+ notify-send "Bluetooth" "Connected to $NAME"
44+ else
45+ notify-send "Bluetooth" "Failed to connect to $NAME"
46+ fi
47+
48+elif [[ "$connect" == "yes" ]]; then
49+ notify-send "Bluetooth" "Disconnecting from $NAME..."
50+ bluetoothctl disconnect "$MAC"
2451 fi
A .local/bin/nvidia-run View
@@ -0,0 +1,9 @@
1+#!/usr/bin/env bash
2+
3+export __NV_PRIME_RENDER_OFFLOAD=1
4+export __GLX_VENDOR_LIBRARY_NAME=nvidia
5+export __VK_LAYER_NV_optimus=NVIDIA_only
6+export GBM_BACKEND=nvidia-drm
7+export LIBVA_DRIVER_NAME=nvidia
8+
9+exec "$@"