diff --git a/dmenu/config.h b/dmenu/config.h index 31dbeca..6353d8f 100644 --- a/dmenu/config.h +++ b/dmenu/config.h @@ -1,7 +1,7 @@ /* See LICENSE file for copyright and license details. */ /* Default settings; can be overriden by command line. */ -static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ +static int topbar = 0; /* -b option; if 0, dmenu appears at bottom */ /* -fn option overrides fonts[0]; default X11 font or font set */ static const int user_bh = 0; /* add an defined amount of pixels to the bar height */ diff --git a/dmenu/dmenu b/dmenu/dmenu index df152b0..3caefec 100755 Binary files a/dmenu/dmenu and b/dmenu/dmenu differ diff --git a/dmenu/dmenu.o b/dmenu/dmenu.o index 28cfe19..97aec27 100644 Binary files a/dmenu/dmenu.o and b/dmenu/dmenu.o differ diff --git a/local/bin/bat-symbol b/local/bin/bat-symbol new file mode 100755 index 0000000..1ae28f8 --- /dev/null +++ b/local/bin/bat-symbol @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +def read_file(path): + try: + with open(path, "r") as f: + return f.read().strip() + except: + return None + +def get_battery_info(): + capacity = read_file("/sys/class/power_supply/BAT1/capacity") + status = read_file("/sys/class/power_supply/BAT1/status") + ac_online = read_file("/sys/class/power_supply/ACAD/online") + + try: + percent = int(capacity) + except (TypeError, ValueError): + percent = None + + charging = (status == "Charging") or (ac_online == "1") + return charging, percent + +def print_symbol(): + charging, percent = get_battery_info() + + if percent is None: + print("[?]") + return + + if charging and percent >= 90: + print("[++]") + elif charging and percent < 30: + print("[-+]") + elif charging: + print("[+]") + elif not charging and percent < 30: + print("[--]") + else: + print("[-]") + +if __name__ == "__main__": + print_symbol() diff --git a/local/bin/brwmenu b/local/bin/brwmenu index 3c11864..858f51b 100755 --- a/local/bin/brwmenu +++ b/local/bin/brwmenu @@ -3,14 +3,14 @@ import subprocess import sys import shutil import urllib.parse +import os -DMENU_OPTS = ["-i", "-fn", "DepartureMono:size=10", "-nb", "#151515", "-nf", "#bbbbbb", "-sb", "#2a1f4d", "-sf", "#eeeeee"] -BROWSER = "mullvad-browser-bin" +DMENU_OPTS = ["-i", "-fn", "monospace:size=12", "-nb", "#151515", "-nf", "#bbbbbb", "-sb", "#005577", "-sf", "#eeeeee"] +BROWSER = "qutebrowser" NOTIFIER = "notify-send" CHOICES = [ - "Startpage", "URL", "Incognito URL", "YouTube", "Github", "Codeberg", - "coasteen.github.io", "IPLeak", "Safebooru", "Wikipedia" + "Paulgo", "URL", "Incognito URL", "YouTube", "Codeberg", "Tildegit", "IPLeak", "Safebooru", "Wikipedia" ] def notify(title, message): @@ -18,9 +18,7 @@ def notify(title, message): def run_dmenu(prompt, options=None): cmd = ["dmenu", *DMENU_OPTS, "-p", prompt] - stdin = None - if options: - stdin = "\n".join(options) + stdin = "\n".join(options) if options else None proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True) out, _ = proc.communicate(stdin) return out.strip() @@ -32,27 +30,40 @@ def get_input(prompt, prefix=""): sys.exit(1) return prefix + urllib.parse.quote_plus(text) -def open_url(url): +def is_browser_running(): try: - subprocess.Popen([BROWSER, url]) + proc = subprocess.Popen(["pgrep", "-f", BROWSER], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) + proc.communicate() + return proc.returncode == 0 except: - notify("Error", f"Failed to open browser: {url}") + return False + +def open_url(url): + try: + if is_browser_running(): + subprocess.Popen([BROWSER, ":open", "-t", url]) + else: + subprocess.Popen([BROWSER, url]) + except Exception as e: + notify("Error", f"Failed to open browser: {url}\n{e}") sys.exit(1) +def search_with_paulgio(query): + return f"https://paulgo.io/search?q={urllib.parse.quote_plus(query)}" + def main(): choice = run_dmenu("Where to?", CHOICES) if not choice: notify("Error", "No selection made") sys.exit(1) - - if choice == "Github": - open_url(get_input("Username & repo:", "https://github.com/")) elif choice == "Codeberg": open_url(get_input("Username & repo:", "https://codeberg.org/")) + elif choice == "Tildegit": + open_url(get_input("Username & repo:", "https://tildegit.org/")) elif choice == "IPLeak": open_url("https://ipleak.net") - elif choice == "Startpage": - open_url("https://www.startpage.com/do/search?q=" + get_input("Search Startpage:")) + elif choice == "Paulgo": + open_url(search_with_paulgio(get_input("Search Paulgo:"))) elif choice == "Wikipedia": open_url("https://en.wikipedia.org/wiki/Special:Search?search=" + get_input("Search Wikipedia:")) elif choice == "URL": @@ -75,8 +86,6 @@ def main(): open_url("https://youtube.com/results?search_query=" + get_input("Search YouTube:")) elif choice == "Safebooru": open_url("https://safebooru.org/index.php?page=post&s=list&tags=" + get_input("Search Safebooru:")) - elif choice == "coasteen.github.io": - open_url("https://coasteen.github.io/www/") else: notify("Error", f"Invalid selection: {choice}") sys.exit(1) @@ -87,3 +96,4 @@ if __name__ == "__main__": print(f"Error: Required command '{cmd}' not found", file=sys.stderr) sys.exit(1) main() + diff --git a/local/bin/grubfk b/local/bin/grubfk new file mode 100755 index 0000000..06a87f5 --- /dev/null +++ b/local/bin/grubfk @@ -0,0 +1,29 @@ +#!/bin/zsh + +grub_screen() { + clear + echo -e "\n\n\t GNU GRUB 2.06" + echo -e "\n" + echo -e "\t Minimal BASH-like line editing is supported. For the first word, TAB" + echo -e "\t lists possible command completions. Anywhere else TAB lists possible" + echo -e "\t device or file completions." + echo -e "\n" +} + +grub_screen + +# Fake GRUB prompt +while true; do + echo -ne " grub> " + read -r command + case $command in + exit|quit) + clear + break + ;; + *) + echo -e "\t Unknown command. Press a key to continue..." + read -r dummy + ;; + esac +done diff --git a/local/bin/sb-swap b/local/bin/sb-swap new file mode 100755 index 0000000..096e308 --- /dev/null +++ b/local/bin/sb-swap @@ -0,0 +1,7 @@ +#!/bin/sh + +swap_used_kib=$(awk '/SwapTotal/ {total=$2} /SwapFree/ {free=$2} END {print total - free}' /proc/meminfo) + +swap_used_mib=$((swap_used_kib / 1024)) + +echo "${swap_used_mib}" diff --git a/local/bin/screencast b/local/bin/screencast new file mode 100755 index 0000000..9ea3683 --- /dev/null +++ b/local/bin/screencast @@ -0,0 +1,22 @@ +#!/bin/sh +set -e + +printf "Title: " +read TITLE +printf "Sound device (ex: default, 1, 2): " +read SNDDEV + +TITLE="$(echo $TITLE | sed 's/ /_/g')" +DIRNAME="$TITLE-$(date '+%s')" +mkdir -p "$HOME/videos/screencasts/$DIRNAME" + +ffmpeg -loglevel fatal -video_size 1600x900 -framerate 30 -f x11grab -i :0.0 -c:v libx264 -preset veryfast "$HOME/videos/screencasts/$DIRNAME/video.mkv" & printf "Video recording started.\n" +aucat -f snd/$SNDDEV -o "$HOME/videos/screencasts/$DIRNAME/audio.wav" > /dev/null & printf "Audio recording started.\n\n" + +printf "Press enter to stop recording" +read lol +kill $(pgrep ffmpeg) +kill $(pgrep aucat) + +cd "$HOME/videos/screencasts/$DIRNAME" +ffmpeg -loglevel fatal -i video.mkv -i audio.wav -c copy final.mkv diff --git a/local/bin/screenie b/local/bin/screenie index 38ddb21..ed09d4d 100755 --- a/local/bin/screenie +++ b/local/bin/screenie @@ -89,4 +89,5 @@ def main(): capture_selection(file) if __name__ == "__main__": - main() \ No newline at end of file + main() + diff --git a/local/bin/swallow b/local/bin/swallow new file mode 100755 index 0000000..38756f9 --- /dev/null +++ b/local/bin/swallow @@ -0,0 +1,13 @@ +#!/bin/sh +COMMAND="$*" +BINARY="$(printf "$COMMAND" | sed 's/ .*//')" +ARGS="$(printf "$COMMAND" | sed "s/$BINARY //")" + +main() { + WINID=$(xdo id) + xdo hide $WINID + $BINARY "$ARGS" || $BINARY $ARGS + xdo show $WINID +} + +[ "$1" = "" ] && printf "Error: You must provide at least one argument.\nExample usage: swallow mpv ~/videos/AmericanPsycho.mkv\n" || main "$@" diff --git a/local/bin/usbmount b/local/bin/usbmount old mode 100644 new mode 100755 diff --git a/local/bin/usbumount b/local/bin/usbumount old mode 100644 new mode 100755 diff --git a/slstatus/config.h b/slstatus/config.h index 6d43325..b83a027 100644 --- a/slstatus/config.h +++ b/slstatus/config.h @@ -69,6 +69,7 @@ static const struct arg args[] = { {run_command, "[vol %s%] ", "pamixer --get-volume"}, {temp, "[tmp %s°C] ", "/sys/class/thermal/thermal_zone3/temp"}, {run_command, "[mem %s]", "sb-memory"}, + {run_command, " [swp %s]", "sb-swap"}, {run_command, " [bat %s] ", "sb-battery"}, {run_command, "[%s]", "date '+%I:%M %P'"}, }; diff --git a/slstatus/slstatus b/slstatus/slstatus index 3bdaabe..ad65dd3 100755 Binary files a/slstatus/slstatus and b/slstatus/slstatus differ diff --git a/slstatus/slstatus.o b/slstatus/slstatus.o index fb80c81..452beb0 100644 Binary files a/slstatus/slstatus.o and b/slstatus/slstatus.o differ