scripts: show-wifi-password & trackball.sh

This commit is contained in:
Joseph Ferano 2025-06-24 18:41:27 +07:00
parent a84025dce4
commit 21d00a7cf2
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,20 @@
#!/bin/bash
curr_network=$(nmcli device wifi | rg "^\*" | awk '{print $3}')
if [ -z "$curr_network" ]; then
echo "Looks like we're not connected to any network"
exit 1
fi
path_to_net_conns="/etc/NetworkManager/system-connections"
fullpath="${path_to_net_conns}/${curr_network}.nmconnection"
if [ ! -f "$fullpath" ]; then
echo "Could not find this wifi's Network Manager entry"
exit 1
fi
password=$(sudo cat $fullpath | rg "^psk" | cut -d "=" -f 2)
echo Name: \ \ \ $curr_network
echo Password: $password

13
.local/scripts/trackball.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
# Set mouse buttons for elecom
# 3 = 9 (forward)
# 8 = 3 (right click)
# 9 = 2 (middle click)
# 10 = 8 (back)
dev_id=$(xinput | rg "slave\s+pointer" | rg ELECOM | rg -o "id=(\d+)" -r '$1')
if [ -n "$dev_id" ]; then
xinput set-button-map $dev_id 1 2 9 4 5 6 7 2 3 8
echo "Button mapping applied" >> /tmp/trackball.log
else
echo "No device found" >> /tmp/trackball.log
fi