This commit is contained in:
coast 2025-07-31 01:51:10 +03:30
parent b2cc8b4367
commit c3e187aec8
15 changed files with 143 additions and 19 deletions

View file

@ -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 */

Binary file not shown.

Binary file not shown.

41
local/bin/bat-symbol Executable file
View file

@ -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()

View file

@ -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()

29
local/bin/grubfk Executable file
View file

@ -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

7
local/bin/sb-swap Executable file
View file

@ -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}"

22
local/bin/screencast Executable file
View file

@ -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

View file

@ -89,4 +89,5 @@ def main():
capture_selection(file)
if __name__ == "__main__":
main()
main()

13
local/bin/swallow Executable file
View file

@ -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 "$@"

0
local/bin/usbmount Normal file → Executable file
View file

0
local/bin/usbumount Normal file → Executable file
View file

View file

@ -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'"},
};

Binary file not shown.

Binary file not shown.