diff --git a/local/bin/usbmount b/local/bin/usbmount new file mode 100644 index 0000000..81ba1a5 --- /dev/null +++ b/local/bin/usbmount @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 + +import os +import subprocess +import sys + +RED = "\033[0;31m" +RESET = "\033[0m" + +def main(): + if os.geteuid() != 0: + print(f"{RED}[!] Superuser access is required{RESET}") + sys.exit(1) + + if not os.path.exists("/dev/sda"): + print(f"{RED}[!] USB not found!{RESET}") + sys.exit(1) + + print(f"{RED}[*] Decrypting /dev/sda1...{RESET}") + try: + subprocess.run(["cryptsetup", "open", "/dev/sda1", "sda1_crypt"], check=True) + subprocess.run(["mount", "/dev/mapper/sda1_crypt", "/mnt/usb", "--mkdir"], check=True) + print(f"{RED}[*] Decrypted and mounted to /mnt/usb!{RESET}") + except subprocess.CalledProcessError as e: + print(f"{RED}[!] Error: {e}{RESET}") + sys.exit(1) + +if __name__ == "__main__": + main() diff --git a/local/bin/usbumount b/local/bin/usbumount new file mode 100644 index 0000000..ffe68bc --- /dev/null +++ b/local/bin/usbumount @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 + +import os +import subprocess +import sys + +RED = "\033[0;31m" +RESET = "\033[0m" + +def run(cmd, fail_msg): + try: + subprocess.run(cmd, check=True) + except subprocess.CalledProcessError: + print(f"{RED}[!] {fail_msg}{RESET}") + sys.exit(1) + +def main(): + if os.geteuid() != 0: + print(f"{RED}[!] Superuser access is required{RESET}") + sys.exit(1) + + print(f"{RED}[*] Unmounting /mnt/usb...{RESET}") + run(["umount", "/mnt/usb"], "Failed to unmount /mnt/usb") + + print(f"{RED}[*] Closing encrypted device...{RESET}") + run(["cryptsetup", "close", "sda1_crypt"], "Failed to close mapper device") + + print(f"{RED}[*] Unmounted and closed successfully!{RESET}") + +if __name__ == "__main__": + main() diff --git a/suckless/dwm/config.h b/suckless/dwm/config.h index 95d512e..3878b2b 100644 --- a/suckless/dwm/config.h +++ b/suckless/dwm/config.h @@ -1,4 +1,3 @@ - /* See LICENSE file for copyright and license details. */ /* appearance */ diff --git a/suckless/slstatus/config.h b/suckless/slstatus/config.h index aa73ce0..8ae8a78 100644 --- a/suckless/slstatus/config.h +++ b/suckless/slstatus/config.h @@ -65,10 +65,10 @@ static const char unknown_str[] = "n/a"; */ static const struct arg args[] = { /* function format argument */ - {run_command, " [ %s%] ", "pamixer --get-volume"}, + {run_command, "[ %s%]", "amixer get Master | grep -o '[0-9]*%' | head -1"}, {ram_used, " [ %s] ", NULL}, - {battery_state, " [%s", "BAT1"}, + {battery_state, "[%s", "BAT1"}, {battery_perc, " %s%] ", "BAT1"}, - {run_command, " [󱑃 %s] ", "date +%I:%M-%p"}, + {run_command, "[󱑃 %s] ", "date +%I:%M-%p"}, }; diff --git a/suckless/slstatus/slstatus b/suckless/slstatus/slstatus index a5bf5c3..042803c 100755 Binary files a/suckless/slstatus/slstatus and b/suckless/slstatus/slstatus differ diff --git a/suckless/slstatus/slstatus.o b/suckless/slstatus/slstatus.o index 551855b..d457825 100644 Binary files a/suckless/slstatus/slstatus.o and b/suckless/slstatus/slstatus.o differ