From 3f209809e6a2180121ce276e4e52594ce1810e18 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Mon, 8 Jan 2024 06:26:02 -0500 Subject: Encrypt fonts --- .Xresources | 48 +++++++++++++++++++++++++++ .local/bin/backlightctl | 83 ++++++++++++++++++++++++++++++++++++++++++++++ .local/share/yadm/archive | Bin 0 -> 14160568 bytes 3 files changed, 131 insertions(+) create mode 100644 .Xresources create mode 100755 .local/bin/backlightctl create mode 100644 .local/share/yadm/archive diff --git a/.Xresources b/.Xresources new file mode 100644 index 0000000..c14fc72 --- /dev/null +++ b/.Xresources @@ -0,0 +1,48 @@ +! __ __ +! \ \/ /_ __ ___ ___ ___ _ _ _ __ ___ ___ ___ +! \ /| '__/ _ \/ __|/ _ \| | | | '__/ __/ _ \/ __| +! / \| | | __/\__ \ (_) | |_| | | | (_| __/\__ \ +! /_/\_\_| \___||___/\___/ \__,_|_| \___\___||___/ +! +! + +! X Resources: Generated with Hodler (http://github.com/matttproud/hodler) +!black +*color0: #111a1f +*color8: #868b8d +!red +*color1: #8d7856 +*color9: #810002 +!green +*color2: #798362 +*color10: #037500 +!yellow +*color3: #9b9257 +*color11: #ebcb88 +!blue +*color4: #63768a +*color12: #63768a +!magenta +*color5: #b7416e +*color13: #738c9c +!cyan +*color6: #6998b3 +*color14: #66aabb +!white +*color7: #c0c7ca +*color15: #c0c7ca +!other +*background: #222d32 +*foreground: #acb3b5 +*cursorColor: #ebcb88 +! See "highlightColorMode" and "hm" options in XTerm manual page. +*highlightTextColor: #2e333c +*highlightColor: #161f2a +! No support for cursor text coloring; would be #1e232b. +! No support for bold coloring; would be #626a73. + +!other +*.alpha: 0.80 + +Sxiv.background: #111A1F +Sxiv.foreground: #9B9257 diff --git a/.local/bin/backlightctl b/.local/bin/backlightctl new file mode 100755 index 0000000..d3f6280 --- /dev/null +++ b/.local/bin/backlightctl @@ -0,0 +1,83 @@ +#!/bin/sh + +# Get the correct sub-directory for your backlight device +root_path="/sys/class/backlight/" +device="$(find "$root_path" | tail -n 1)" + +max="$(cat "$device/max_brightness")" + +# What percentage to increase/decrease by when no argument is given +default_step=10 +# What percentage to set to when no argument is given +default_set=50 + +to_percent() { + printf "%d" "$((100 * $1 / $max))" +} + +to_value() { + printf "%d" "$((max * $1 / 100))" +} + +get_status() { + cat "$device/brightness" +} + +get_percent() { + to_percent "$(get_status)" +} + +# Add $1 to current brightness. Adjust if out of bounds (0-$max) +# $1 is converted to a value between 0-$max within this function +get_total() { + value="$(to_value "$1")" + printf "%d" "$(($(get_status) + value))" +} + +helpmsg="Usage: backlightctl -[FLAG] [PERCENTAGE] + -i, --increase: Increase brightness by n (default 10%) + -d, --decrease: Decrease brightness by n (default 10%) + -s, --set: Set brightness to specific value (default 50%) + -g --get: Get current brightness + -q, --quiet: Don't send any notification (for use in dwmblocks) + -h, --help: Print this help message +" + +case "$1" in + +-i | --increase) + [ -z "$2" ] && step="$default_step" || step="$2" + get_total "$step" >"$device/brightness" + ;; + +-d | --decrease) + [ -z "$2" ] && step="$default_step" || step="$2" + get_total "-$step" >"$device/brightness" + ;; + +-s | --set) + [ -z "$2" ] && set="$default_set" || set="$2" + to_value "$set" >"$device/brightness" + ;; + +-g | --get) + printf "󰃠 %s\n" "$(get_status)%" + ;; + +-h | --help) + printf "%s" "$helpmsg" + ;; +*) + printf "\033[31mInvalid option: $1\033[0m\n%s" "$helpmsg" && exit 1 + ;; +esac + +# Send notification +case "$@" in +*-q* | *--quiet*) + exit 0 + ;; +*) + notify-send.sh -t 1000 --replace-file /tmp/bl-notif -a "󰃠 Brightness:" "$(get_percent)%" + ;; +esac diff --git a/.local/share/yadm/archive b/.local/share/yadm/archive new file mode 100644 index 0000000..6ac24c8 Binary files /dev/null and b/.local/share/yadm/archive differ -- cgit v1.2.3