this repo has no description
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

updating a bunch of shit

+488 -47
+317
home/profiles/desktop/bin/bluetoothmenu
··· 1 + #!/usr/bin/env bash 2 + # __ _ _ _ _ _ _ 3 + # _ __ ___ / _(_) | |__ | |_ _ ___| |_ ___ ___ | |_| |__ 4 + # | '__/ _ \| |_| |_____| '_ \| | | | |/ _ \ __/ _ \ / _ \| __| '_ \ 5 + # | | | (_) | _| |_____| |_) | | |_| | __/ || (_) | (_) | |_| | | | 6 + # |_| \___/|_| |_| |_.__/|_|\__,_|\___|\__\___/ \___/ \__|_| |_| 7 + # 8 + # Author: Nick Clyde (clydedroid) 9 + # 10 + # A script that generates a rofi menu that uses bluetoothctl to 11 + # connect to bluetooth devices and display status info. 12 + # 13 + # Inspired by networkmanager-dmenu (https://github.com/firecat53/networkmanager-dmenu) 14 + # Thanks to x70b1 (https://github.com/polybar/polybar-scripts/tree/master/polybar-scripts/system-bluetooth-bluetoothctl) 15 + # 16 + # Depends on: 17 + # Arch repositories: rofi, bluez-utils (contains bluetoothctl) 18 + 19 + # Constants 20 + divider="---------" 21 + goback="Back" 22 + 23 + # Checks if bluetooth controller is powered on 24 + power_on() { 25 + if bluetoothctl show | grep -q "Powered: yes"; then 26 + return 0 27 + else 28 + return 1 29 + fi 30 + } 31 + 32 + # Toggles power state 33 + toggle_power() { 34 + if power_on; then 35 + bluetoothctl power off 36 + show_menu 37 + else 38 + if rfkill list bluetooth | grep -q 'blocked: yes'; then 39 + rfkill unblock bluetooth && sleep 3 40 + fi 41 + bluetoothctl power on 42 + show_menu 43 + fi 44 + } 45 + 46 + # Checks if controller is scanning for new devices 47 + scan_on() { 48 + if bluetoothctl show | grep -q "Discovering: yes"; then 49 + echo "Scan: on" 50 + return 0 51 + else 52 + echo "Scan: off" 53 + return 1 54 + fi 55 + } 56 + 57 + # Toggles scanning state 58 + toggle_scan() { 59 + if scan_on; then 60 + kill $(pgrep -f "bluetoothctl scan on") 61 + bluetoothctl scan off 62 + show_menu 63 + else 64 + bluetoothctl scan on & 65 + echo "Scanning..." 66 + sleep 5 67 + show_menu 68 + fi 69 + } 70 + 71 + # Checks if controller is able to pair to devices 72 + pairable_on() { 73 + if bluetoothctl show | grep -q "Pairable: yes"; then 74 + echo "Pairable: on" 75 + return 0 76 + else 77 + echo "Pairable: off" 78 + return 1 79 + fi 80 + } 81 + 82 + # Toggles pairable state 83 + toggle_pairable() { 84 + if pairable_on; then 85 + bluetoothctl pairable off 86 + show_menu 87 + else 88 + bluetoothctl pairable on 89 + show_menu 90 + fi 91 + } 92 + 93 + # Checks if controller is discoverable by other devices 94 + discoverable_on() { 95 + if bluetoothctl show | grep -q "Discoverable: yes"; then 96 + echo "Discoverable: on" 97 + return 0 98 + else 99 + echo "Discoverable: off" 100 + return 1 101 + fi 102 + } 103 + 104 + # Toggles discoverable state 105 + toggle_discoverable() { 106 + if discoverable_on; then 107 + bluetoothctl discoverable off 108 + show_menu 109 + else 110 + bluetoothctl discoverable on 111 + show_menu 112 + fi 113 + } 114 + 115 + # Checks if a device is connected 116 + device_connected() { 117 + device_info=$(bluetoothctl info "$1") 118 + if echo "$device_info" | grep -q "Connected: yes"; then 119 + return 0 120 + else 121 + return 1 122 + fi 123 + } 124 + 125 + # Toggles device connection 126 + toggle_connection() { 127 + if device_connected $1; then 128 + bluetoothctl disconnect $1 129 + device_menu "$device" 130 + else 131 + bluetoothctl connect $1 132 + device_menu "$device" 133 + fi 134 + } 135 + 136 + # Checks if a device is paired 137 + device_paired() { 138 + device_info=$(bluetoothctl info "$1") 139 + if echo "$device_info" | grep -q "Paired: yes"; then 140 + echo "Paired: yes" 141 + return 0 142 + else 143 + echo "Paired: no" 144 + return 1 145 + fi 146 + } 147 + 148 + # Toggles device paired state 149 + toggle_paired() { 150 + if device_paired $1; then 151 + bluetoothctl remove $1 152 + device_menu "$device" 153 + else 154 + bluetoothctl pair $1 155 + device_menu "$device" 156 + fi 157 + } 158 + 159 + # Checks if a device is trusted 160 + device_trusted() { 161 + device_info=$(bluetoothctl info "$1") 162 + if echo "$device_info" | grep -q "Trusted: yes"; then 163 + echo "Trusted: yes" 164 + return 0 165 + else 166 + echo "Trusted: no" 167 + return 1 168 + fi 169 + } 170 + 171 + # Toggles device connection 172 + toggle_trust() { 173 + if device_trusted $1; then 174 + bluetoothctl untrust $1 175 + device_menu "$device" 176 + else 177 + bluetoothctl trust $1 178 + device_menu "$device" 179 + fi 180 + } 181 + 182 + # Prints a short string with the current bluetooth status 183 + # Useful for status bars like polybar, etc. 184 + print_status() { 185 + if power_on; then 186 + printf '' 187 + 188 + paired_devices_cmd="devices Paired" 189 + # Check if an outdated version of bluetoothctl is used to preserve backwards compatibility 190 + if (( $(echo "$(bluetoothctl version | cut -d ' ' -f 2) < 5.65" | bc -l) )); then 191 + paired_devices_cmd="paired-devices" 192 + fi 193 + 194 + mapfile -t paired_devices < <(bluetoothctl $paired_devices_cmd | grep Device | cut -d ' ' -f 2) 195 + counter=0 196 + 197 + for device in "${paired_devices[@]}"; do 198 + if device_connected $device; then 199 + device_alias=$(bluetoothctl info $device | grep "Alias" | cut -d ' ' -f 2-) 200 + 201 + if [ $counter -gt 0 ]; then 202 + printf ", %s" "$device_alias" 203 + else 204 + printf " %s" "$device_alias" 205 + fi 206 + 207 + ((counter++)) 208 + fi 209 + done 210 + printf "\n" 211 + else 212 + echo "" 213 + fi 214 + } 215 + 216 + # A submenu for a specific device that allows connecting, pairing, and trusting 217 + device_menu() { 218 + device=$1 219 + 220 + # Get device name and mac address 221 + device_name=$(echo $device | cut -d ' ' -f 3-) 222 + mac=$(echo $device | cut -d ' ' -f 2) 223 + 224 + # Build options 225 + if device_connected $mac; then 226 + connected="Connected: yes" 227 + else 228 + connected="Connected: no" 229 + fi 230 + paired=$(device_paired $mac) 231 + trusted=$(device_trusted $mac) 232 + options="$connected\n$paired\n$trusted\n$divider\n$goback\nExit" 233 + 234 + # Open rofi menu, read chosen option 235 + chosen="$(echo -e "$options" | $rofi_command "$device_name")" 236 + 237 + # Match chosen option to command 238 + case $chosen in 239 + "" | $divider) 240 + echo "No option chosen." 241 + ;; 242 + $connected) 243 + toggle_connection $mac 244 + ;; 245 + $paired) 246 + toggle_paired $mac 247 + ;; 248 + $trusted) 249 + toggle_trust $mac 250 + ;; 251 + $goback) 252 + show_menu 253 + ;; 254 + esac 255 + } 256 + 257 + # Opens a rofi menu with current bluetooth status and options to connect 258 + show_menu() { 259 + # Get menu options 260 + if power_on; then 261 + power="Power: on" 262 + 263 + # Human-readable names of devices, one per line 264 + # If scan is off, will only list paired devices 265 + devices=$(bluetoothctl devices | grep Device | cut -d ' ' -f 3-) 266 + 267 + # Get controller flags 268 + scan=$(scan_on) 269 + pairable=$(pairable_on) 270 + discoverable=$(discoverable_on) 271 + 272 + # Options passed to rofi 273 + options="$devices\n$divider\n$power\n$scan\n$pairable\n$discoverable\nExit" 274 + else 275 + power="Power: off" 276 + options="$power\nExit" 277 + fi 278 + 279 + # Open rofi menu, read chosen option 280 + chosen="$(echo -e "$options" | $rofi_command "Bluetooth")" 281 + 282 + # Match chosen option to command 283 + case $chosen in 284 + "" | $divider) 285 + echo "No option chosen." 286 + ;; 287 + $power) 288 + toggle_power 289 + ;; 290 + $scan) 291 + toggle_scan 292 + ;; 293 + $discoverable) 294 + toggle_discoverable 295 + ;; 296 + $pairable) 297 + toggle_pairable 298 + ;; 299 + *) 300 + device=$(bluetoothctl devices | grep "$chosen") 301 + # Open a submenu if a device is selected 302 + if [[ $device ]]; then device_menu "$device"; fi 303 + ;; 304 + esac 305 + } 306 + 307 + # Rofi command to pipe into, can add any options here 308 + rofi_command="rofi -theme theme/passmenu.rasi -dmenu -no-fixed-num-lines -yoffset -100 -i -p" 309 + 310 + case "$1" in 311 + --status) 312 + print_status 313 + ;; 314 + *) 315 + show_menu 316 + ;; 317 + esac
+115
home/profiles/desktop/bin/wifimenu
··· 1 + #!/usr/bin/env bash 2 + 3 + # rofi config without entry so to make select from available options only 4 + rofiprompt=theme/passmenu.rasi 5 + # normal rofi menu 6 + rofidmenu=theme/passmenu.rasi 7 + # rofi config for password 8 + rofipass=theme/passmenu.rasi 9 + 10 + # Power Status 11 + flag=$(cat /sys/class/net/wl*/flags) 12 + 13 + if [ "$flag" = "0x1003" ]; then 14 + power="On" 15 + else 16 + power="Off" 17 + fi 18 + 19 + # Connection Status 20 + state=$(cat /sys/class/net/wl*/operstate) 21 + 22 + if [ "$state" = "up" ]; then 23 + status=$(nmcli | grep "^wlp" | sed 's/\ connected\ to/Connected to/' | cut -d ':' -f2) 24 + else 25 + status="Disconnected" 26 + fi 27 + 28 + # ┌─┐┌─┐┬ ┬┌─┐┬─┐ 29 + # ├─┘│ ││││├┤ ├┬┘ 30 + # ┴ └─┘└┴┘└─┘┴└─ 31 + 32 + powertoggle=$( [ "$flag" = "0x1003" ] && echo "Power Off" || echo "Power On" ) 33 + 34 + powerswitch() { 35 + if [ "$powertoggle" = "Power Off" ]; then 36 + nmcli radio wifi off 37 + elif [ "$powertoggle" = "Power On" ]; then 38 + nmcli radio wifi on 39 + fi 40 + } 41 + 42 + # ┌─┐┌─┐┌┐┌┌┐┌┌─┐┌─┐┌┬┐ 43 + # │ │ │││││││├┤ │ │ 44 + # └─┘└─┘┘└┘┘└┘└─┘└─┘ ┴ 45 + 46 + connections() { 47 + list=$(nmcli --fields "SECURITY,SSID" device wifi list | tail -n +2 | sed "s/ */ /g" | sed -E "s/WPA*.?//g" | sed "s/^--//g" | sed "s/ //g") 48 + networks=$(printf "$list" | rofi -theme $rofiprompt -dmenu -i -hover-select -p "Select Wifi Network 49 + $status") 50 + wifi=$( echo "$networks" | sed "s/ //g" | sed "s/ //g" | xargs) 51 + [ -z "$networks" ] && exit 52 + nopass="No Password" 53 + pass=$(printf "$nopass\nCancel" | rofi -theme $rofipass -dmenu -i -hover-select -password -p "Wifi Password") 54 + 55 + if [ "$pass" = "" ]; then 56 + exit 57 + elif [ "$pass" = "$nopass" ]; then 58 + nmcli dev wifi con "$wifi" && printf "exit" | rofi -theme $rofiprompt -dmenu -only-match -i -p "Successfully Connected to $wifi" && exit 59 + elif [ "$pass" = "Cancel" ]; then 60 + exit 61 + else 62 + nmcli dev wifi con "$wifi" password "$pass" && printf "exit" | rofi -theme $rofiprompt -dmenu -i -only-match -p "Successfully Connected to $wifi" && exit 63 + fi 64 + 65 + printf "exit" | rofi -theme $rofiprompt -dmenu -i -p -only-match "Failed to Connect $wifi" && exit 66 + } 67 + 68 + 69 + # ┌┬┐┌─┐┌┐┌┬ ┬┌─┐┬ 70 + # │││├─┤││││ │├─┤│ 71 + # ┴ ┴┴ ┴┘└┘└─┘┴ ┴┴─┘ 72 + 73 + manual() { 74 + 75 + wifi=$(rofi -theme $rofidmenu -dmenu -i -p "Enter Wifi Name") 76 + 77 + [ -z "$wifi" ] && exit 78 + nopass="Run Without Password" 79 + pass=$(printf "$nopass\nCancel" | rofi -theme $rofipass -dmenu -i -password -p "Wifi Password") 80 + 81 + if [ "$pass" = "" ]; then 82 + exit 83 + elif [ "$pass" = "$nopass" ]; then 84 + nmcli dev wifi con "$wifi" && printf "exit" | rofi -theme $rofiprompt -dmenu -i -only-match -p "Successfully Connected to $wifi" && exit 85 + elif [ "$pass" = "Cancel" ]; then 86 + exit 87 + else 88 + nmcli dev wifi con "$wifi" password "$pass" && printf "exit" | rofi -theme $rofiprompt -dmenu -i -only-match -p "Successfully Connected to $wifi" && exit 89 + fi 90 + 91 + printf "exit" | rofi -theme $rofiprompt -dmenu -only-match -i -p "Failed to Connect $wifi" && exit 92 + } 93 + 94 + # ┌─┐┌─┐┌┬┐┬┌─┐┌┐┌┌─┐ 95 + # │ │├─┘ │ ││ ││││└─┐ 96 + # └─┘┴ ┴ ┴└─┘┘└┘└─┘ 97 + 98 + options="$powertoggle\nConnections\nConnect Manually" 99 + 100 + rofiwifi=$(printf "$options" | rofi -theme $rofiprompt -dmenu -i -hover-select -p "Wifi 101 + Powered: $power 102 + Status: $status") 103 + 104 + case $rofiwifi in 105 + $powertoggle) 106 + powerswitch 107 + ;; 108 + Connections) 109 + notify-send "Scanning" 110 + connections 111 + ;; 112 + "Connect Manually") 113 + manual 114 + esac 2>/dev/null 115 +
+2
home/profiles/desktop/default.nix
··· 108 108 ''; 109 109 # TODO hardcoded 110 110 ".local/bin/passmenu".source = ./bin/passmenu; 111 + ".local/bin/bluetoothmenu".source = ./bin/bluetoothmenu; 112 + ".local/bin/wifimenu".source = ./bin/wifimenu; 111 113 ".local/bin/powermenu".source = ./bin/powermenu; 112 114 ".local/bin/screenshot".source = ./bin/screenshot; 113 115 ".local/bin/mpv-ify".source = ./bin/mpv-ify;
+6
home/profiles/desktop/sxhkdrc
··· 36 36 super + o 37 37 screenshot 38 38 39 + super + w 40 + wifimenu 41 + 42 + super + b 43 + bluetoothmenu 44 + 39 45 # super + Escape 40 46 # pkill -USR1 -x sxhkd 41 47
-7
hosts/curve/configuration.nix
··· 30 30 31 31 time.timeZone = "Australia/Brisbane"; 32 32 33 - networking.useDHCP = false; 34 - networking.interfaces.enp0s31f6.useDHCP = true; 35 - networking.interfaces.wlp3s0.useDHCP = true; 36 - networking.wireless.enable = true; 37 - networking.wireless.interfaces = [ "wlp3s0" ]; 38 - networking.wireless.userControlled.enable = true; 39 - 40 33 # Select internationalisation properties. 41 34 i18n.defaultLocale = "en_US.UTF-8"; 42 35 # console = {
+1 -1
hosts/curve/hardware-configuration.nix
··· 41 41 # (the default) this is the recommended approach. When using systemd-networkd it's 42 42 # still possible to use this option, but it's recommended to use it in conjunction 43 43 # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. 44 - networking.useDHCP = lib.mkDefault true; 44 + # networking.useDHCP = lib.mkDefault true; 45 45 # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; 46 46 # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; 47 47
-1
hosts/profiles/gitea/default.nix
··· 30 30 }; 31 31 32 32 environment.systemPackages = [ pkgs.pandoc ]; 33 - 34 33 services.postgresql = { 35 34 enable = true; # Ensure postgresql is enabled 36 35 authentication = ''
+1 -1
hosts/profiles/matrix/default.nix
··· 6 6 # ./mautrix-discord.nix 7 7 # ./mautrix-whatsapp.nix 8 8 # ./mautrix-slack.nix 9 - # ./mautrix-signall.nix 9 + # ./mautrix-signal.nix 10 10 ./mjolnir.nix 11 11 ./heisenbridge.nix 12 12 ./compress-state-service.nix
+45 -36
hosts/profiles/wifi/default.nix
··· 3 3 { 4 4 networking.dhcpcd.wait = "background"; 5 5 networking.dhcpcd.extraConfig = "noarp"; 6 - networking.wireless.userControlled.enable = true; 7 - networking.wireless.networks = { 8 - "Chester 11403" = { 9 - pskRaw = "43fcb0bea43633899a9885865c53ea79d268b9bdfb8c3f4013718e43e6672e5e"; 10 - }; 11 - "HSBNEWiFi" = { 12 - pskRaw = "0820d84980eeb47630f13f04804fc9add684a8feebb64ba914cafc48f569d801"; 13 - }; 14 - "TP-LINK_1D79" = { 15 - pskRaw = "6d960910c33a59e94b151281cc3982863b4b112d8a4efd1b165e4f8e52e7dae8"; 16 - }; 17 - "nadir" = { 18 - pskRaw = "92e0c1f0b3a1bada333964f0ee4ac04e0d9ba941aa3f29216cc3782595a41e5f"; 19 - }; 20 - "WiFi-399631" = { 21 - pskRaw = "2e312c9721e470847f751d8b844d264dc5e2612361a579fc0bdebd2135b5a8ea"; 22 - }; 23 - "line" = { 24 - pskRaw = "ec36a5a116224c12e305c90b7f3c5a0b7417abfaacf15828748f6a1e1e316c03"; 25 - }; 26 - "MEHRA" = { 27 - pskRaw = "e1573bc9e30fd68ac8a805b7c5f9871322ffcdac909746831555905c2e156abb"; 28 - }; 29 - "Sandeep1" = { 30 - pskRaw = "035972401640bf4dc2d8651c0b9df515a69f6bc2bffa07cc936183128a6ccf0a"; 31 - }; 32 - "chadpad" = { 33 - pskRaw = "2594b3880a60817950bd60b2770c9793fd4cb784ed183f685a52502a9df2c7b1"; 34 - }; 35 - # "updog" = { 36 - # pskRaw = "be28d9e50e4d9a065f1afccad52675d0d4fabe85526c0245648671721db606b1"; 37 - # }; 38 - "Vodafone-07F38" = { 39 - pskRaw = "4ffd87de73ed31ef1aee1d0d178857490afbda3f0bb8453a0baaee7b2576f302"; 40 - }; 41 - }; 6 + networking.networkmanager.enable = true; 7 + 8 + # networking.useDHCP = false; 9 + # networking.interfaces.enp0s31f6.useDHCP = true; 10 + # networking.interfaces.wlp3s0.useDHCP = true; 11 + # networking.wireless.enable = true; 12 + # networking.wireless.interfaces = [ "wlp3s0" ]; 13 + # networking.wireless.userControlled.enable = true; 14 + 15 + # networking.wireless.userControlled.enable = true; 16 + # networking.wireless.networks = { 17 + # "Chester 11403" = { 18 + # pskRaw = "43fcb0bea43633899a9885865c53ea79d268b9bdfb8c3f4013718e43e6672e5e"; 19 + # }; 20 + # "HSBNEWiFi" = { 21 + # pskRaw = "0820d84980eeb47630f13f04804fc9add684a8feebb64ba914cafc48f569d801"; 22 + # }; 23 + # "TP-LINK_1D79" = { 24 + # pskRaw = "6d960910c33a59e94b151281cc3982863b4b112d8a4efd1b165e4f8e52e7dae8"; 25 + # }; 26 + # "nadir" = { 27 + # pskRaw = "92e0c1f0b3a1bada333964f0ee4ac04e0d9ba941aa3f29216cc3782595a41e5f"; 28 + # }; 29 + # "WiFi-399631" = { 30 + # pskRaw = "2e312c9721e470847f751d8b844d264dc5e2612361a579fc0bdebd2135b5a8ea"; 31 + # }; 32 + # "line" = { 33 + # pskRaw = "ec36a5a116224c12e305c90b7f3c5a0b7417abfaacf15828748f6a1e1e316c03"; 34 + # }; 35 + # "MEHRA" = { 36 + # pskRaw = "e1573bc9e30fd68ac8a805b7c5f9871322ffcdac909746831555905c2e156abb"; 37 + # }; 38 + # "Sandeep1" = { 39 + # pskRaw = "035972401640bf4dc2d8651c0b9df515a69f6bc2bffa07cc936183128a6ccf0a"; 40 + # }; 41 + # "chadpad" = { 42 + # pskRaw = "2594b3880a60817950bd60b2770c9793fd4cb784ed183f685a52502a9df2c7b1"; 43 + # }; 44 + # # "updog" = { 45 + # # pskRaw = "be28d9e50e4d9a065f1afccad52675d0d4fabe85526c0245648671721db606b1"; 46 + # # }; 47 + # "Vodafone-07F38" = { 48 + # pskRaw = "4ffd87de73ed31ef1aee1d0d178857490afbda3f0bb8453a0baaee7b2576f302"; 49 + # }; 50 + # }; 42 51 }
+1 -1
hosts/users/anish/default.nix
··· 6 6 hashedPassword = "$y$j9T$y3DPt/dWaPE.gRazQqw1w0$1RMH5sl/Nu8kW3ZMywYCPRniHD/jF5qRh0VKrdJ.bV2"; 7 7 shell = pkgs.zsh; 8 8 isNormalUser = true; 9 - extraGroups = [ "wheel" "audio" ]; 9 + extraGroups = [ "wheel" "audio" "networkmanager" ]; 10 10 openssh.authorizedKeys.keys = [ 11 11 # Curve 12 12 "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDM0Zvei46x/yZl/IeBCq6+IYQQ0avulzVyBysF9cPigZMCybWRV7IEU+E3k9t6JrbdbdGfJkcZIWmsWDdKS8W8mBnZpVoT0ffLynu8JQ/TKdGm4Qv6bgUeKNrGsNv0ZPs2CDaGSLj0oJfRF7Ko10tcLP0vW+yujrh+y6TH/vVzJioaV4TGvtCUpn+wEQah9ROwPQLUUofsSWdnRsDJ/gp37zXWs4l5wyjSKtP3O9RZUP7kBekbSqEgSXiTk0oUQSVqIWl9NDiP6onk/gSOjXsR/JPqsSN/XI/c/yj6gyY0f51Ru2D7iBxuMJIJcWV+rU6coIj+ULcQWLzt/7TI8jq5AOOzI/ll4zbL24Eo84Rz+TP9tvMMhDZ0VaMN22AJ8qQEjc5P09tWKsX7Jg39XelyV1jHXncE4yvIE9F4RSCHzWCeKeXakizQNuzSaxTxIExRFYHjNW5bR6+3MTGwVrEIXU+qML+0yFTR86MT+tdY5AreAJQLwbog79O1NupeXJE= anish@curve"