From 0b4e7f9185449bcdb9e9cc19b9b926ade9cd1ed3 Mon Sep 17 00:00:00 2001 From: amolinae06 Date: Sat, 7 Jun 2025 06:27:03 +0000 Subject: [PATCH] Man, am I the greatest --- .config/hellwal/templates/colors-river | 22 -------- .config/kanshi/config | 13 ++++- .config/lf/lfrc | 56 +++---------------- .config/mako/config | 7 +++ .config/zsh/.zshrc | 32 +++++++++++ .local/bin/abman | 77 ++++++++++++++++++++++++++ .local/bin/art | 6 +- .local/bin/aws | 2 +- .local/bin/bluetooth | 71 ------------------------ .local/bin/bwroot | 25 +++++---- .local/bin/emojimenu | 2 +- .local/bin/rec | 7 +++ .local/bin/sysutils | 6 +- 13 files changed, 163 insertions(+), 163 deletions(-) delete mode 100644 .config/hellwal/templates/colors-river create mode 100755 .local/bin/abman delete mode 100755 .local/bin/bluetooth create mode 100755 .local/bin/rec diff --git a/.config/hellwal/templates/colors-river b/.config/hellwal/templates/colors-river deleted file mode 100644 index 74be423..0000000 --- a/.config/hellwal/templates/colors-river +++ /dev/null @@ -1,22 +0,0 @@ -wallpaper="%%wallpaper%%" -background="%%background.hex%%" -foreground="%%foreground.hex%%" -curstor="%%cursor.hex%%" -border="%%border.hex%%" - -color0="%%color0.hex%%" -color1="%%color1.hex%%" -color2="%%color2.hex%%" -color3="%%color3.hex%%" -color4="%%color4.hex%%" -color5="%%color5.hex%%" -color6="%%color6.hex%%" -color7="%%color7.hex%%" -color8="%%color8.hex%%" -color9="%%color9.hex%%" -color10="%%color10.hex%%" -color11="%%color11.hex%%" -color12="%%color12.hex%%" -color13="%%color13.hex%%" -color14="%%color14.hex%%" -color15="%%color15.hex%%" diff --git a/.config/kanshi/config b/.config/kanshi/config index 8974c31..ef7ea23 100644 --- a/.config/kanshi/config +++ b/.config/kanshi/config @@ -1,8 +1,15 @@ profile { - output eDP-1 disable - output "LG Electronics MP59G 0x000672C5" mode 1920x1080 position 0,0 scale 1.0 + output "eDP-1" { + disable + } + output "LG Electronics MP59G 0x000672C5" { + mode 1920x1080 + position 0,0 + } } profile { - output eDP-1 enable scale 1.0 + output "eDP-1" { + enable + } } diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 3c039c9..64b6b3f 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -11,30 +11,13 @@ set cleaner ctpvclear # show hidden files set hidden true -# interpreter for shell commands set shell sh - -# set '-eu' options for shell commands -# These options are used to have safer shell commands. Option '-e' is used to -# exit on error and option '-u' is used to give error for unset variables. -# Option '-f' disables pathname expansion which can be useful when $f, $fs, and -# $fx variables contain names with '*' or '?' characters. However, this option -# is used selectively within individual commands as it can be limiting at -# times. set shellopts '-eu' - -# set internal field separator (IFS) to "\n" for shell commands -# This is useful to automatically split file names in $fs and $fx properly -# since default file separator used in these variables (i.e. 'filesep' option) -# is newline. You need to consider the values of these options and create your -# commands accordingly. set ifs "\n" -# leave some space at the top and the bottom of the screen set scrolloff 10 - -# Use the `dim` attribute instead of underline for the cursor in the preview pane set cursorpreviewfmt "\033[7;2m" +set drawbox # use enter for shell commands map shell @@ -68,14 +51,6 @@ map a :push %mkdir cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1 map r push :rename -# make sure trash folder exists -# %mkdir -p ~/.trash - -# move current file or selected files to trash folder -# (also see 'man mv' for backup/overwrite options) -# cmd trash %set -f; mv $fx ~/.trash - -# define a custom 'delete' command cmd delete ${{ set -f printf "$fx\n" @@ -84,8 +59,6 @@ cmd delete ${{ [ "$ans" = "y" ] && rm -rf $fx }} -# use '' key for either 'trash' or 'delete' command -# map trash map delete # extract the current file with the right command @@ -97,28 +70,17 @@ cmd extract ${{ *.tar.gz|*.tgz) tar xzvf $f;; *.tar.xz|*.txz) tar xJvf $f;; *.zip) unzip $f;; - *.rar) unrar x $f;; - *.7z) 7z x $f;; + #*.rar) unrar x $f;; + #*.7z) 7z x $f;; esac }} -# compress current file or selected files with tar and gunzip -cmd tar ${{ - set -f - mkdir $1 - cp -r $fx $1 - tar czf $1.tar.gz $1 - rm -rf $1 +map E extract + +cmd mkexec ${{ + chmod u+x $fx + printf "$fx is now executable" }} -# compress current file or selected files with zip -cmd zip ${{ - set -f - mkdir $1 - cp -r $fx $1 - zip -r $1.zip $1 - rm -rf $1 -}} +map V mkexec -cmd setbg "$1" -map b $setbg $f diff --git a/.config/mako/config b/.config/mako/config index 1e5b627..f734576 100644 --- a/.config/mako/config +++ b/.config/mako/config @@ -11,3 +11,10 @@ max-icon-size=64 default-timeout=5000 ignore-timeout=1 font=Inconsolata 11 + + +[app-name=spotify_player] +border-color=#1ed760 +background-color=#191414 +text-color=#ffffff +default-timeout=2048 diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 6eaa92a..5c07f39 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -70,12 +70,44 @@ zle -N zle-line-init echo -ne '\e[5 q' # Use beam shape cursor on startup. preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. +# Use lf to switch directories and bind it to ctrl-o +lfcd () { + tmp="$(mktemp -uq)" + trap 'rm -f $tmp >/dev/null 2>&1 && trap - HUP INT QUIT TERM PWR EXIT' HUP INT QUIT TERM PWR EXIT + lf -last-dir-path="$tmp" "$@" + if [ -f "$tmp" ]; then + dir="$(cat "$tmp")" + [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" + fi +} +bindkey -s '^o' '^ulfcd\n' + +bindkey -s '^a' '^ubc -lq\n' + +bindkey -s '^f' '^ucd "$(dirname "$(fzf)")"\n' + +bindkey '^[[P' delete-char + +# Edit line in vim with ctrl-e: +autoload edit-command-line; zle -N edit-command-line +bindkey '^e' edit-command-line +bindkey -M vicmd '^[[P' vi-delete-char +bindkey -M vicmd '^e' edit-command-line +bindkey -M visual '^[[P' vi-delete + # Aliases alias sudo='doas' alias neofetch='fastfetch' alias ls='ls -lah' alias vim='nvim' alias wal='hellwal -q' +alias patch='bwroot patch' +alias tcc='bwroot tcc' +alias g++='bwroot g++' +alias gcc='bwroot gcc' +alias git='bwroot git' +alias clang='bwroot clang' +alias make='bwroot make' # Commands fastfetch diff --git a/.local/bin/abman b/.local/bin/abman new file mode 100755 index 0000000..7c33960 --- /dev/null +++ b/.local/bin/abman @@ -0,0 +1,77 @@ +#!/bin/sh -x + +scandevices() { + # https://github.com/bluez/bluez/issues/826 + notify-send "abman" "Scanning for devices" + if [ "$(bluetoothctl show | grep "Powered: no")" ]; then + bluetoothctl power on + fi + devices="$(bluetoothctl --timeout 5 scan on | \ + awk '/Device/ {if (NF > 3) {for (i=4; i<=NF; i++) printf $i " "; print ""} else print $3}')" + if [ -z "$devices" ]; then + notify-send "abman" "Error: No devices were found" + exit 1 + fi + + selection="$(printf "%s\n" "$devices" | fuzzel -d -p "Available devices: ")" + if [ -n "$selection" ]; then + mac=$(bluetoothctl devices | grep "$selection" | awk '{print $2}') + bluetoothctl connect "$mac" & notify-send "abman" "Connecting to $selection" + fi +} + +pc_device(){ + devices="$(bluetoothctl devices | awk '{$1=$2=""; print substr($0,3)}')" + if [ -z "$devices" ]; then + notify-send "abman" "No previously connected devices" + exit 0; + fi + + selection="$(printf "%s\n" "$devices" | fuzzel -d -p "Device list: ")" + if [ -n "$selection" ]; then + if [ "$(bluetoothctl show | grep "Powered: no")" ]; then + bluetoothctl power on + fi + mac=$(bluetoothctl devices | grep "$selection" | awk '{print $2}') + bluetoothctl connect "$mac" & notify-send "abman" "Reconnecting to $selection" + fi +} + +toggledisc() { + if [ "$(bluetoothctl show | grep "Discoverable: yes")" ]; then + bluetoothctl discoverable off + notify-send "abman" "Discoverable off" + else + bluetoothctl discoverable on + notify-send "abman" "Set device as discoverable for 3 minutes" + fi +} + +togglepair() { + if [ "$(bluetoothctl show | grep "Pairable: yes")" ]; then + bluetoothctl pairable off + notify-send "abman" "Pairable off" + else + bluetoothctl pairable on + notify-send "abman" "Device is now pairable" + fi +} + +switchstate() { + if [ "$(bluetoothctl show | grep "Powered: yes")" ]; then + bluetoothctl power off + notify-send "abman" "Bluetooth is disabled" + elif [ "$(bluetoothctl show | grep "Powered: no")" ]; then + bluetoothctl power on + notify-send "abman" "Bluetooth is enabled" + fi +} + +case $(printf "%s\n" "󰂯 Connect Device" "󰦢 Reconnect device" "󰂱 Toggle discoverable" "󰂰 Toggle Pairable" "󰂳 Change State" | fuzzel -d -l 5) in + "󰂯 Connect Device") scandevices ;; + "󰦢 Reconnect device") pc_device ;; + "󰂱 Toggle discoverable") toggledisc ;; + "󰂰 Toggle Pairable") togglepair ;; + "󰂳 Change State") switchstate ;; + *) exit ;; +esac diff --git a/.local/bin/art b/.local/bin/art index 1beee50..0fb0d1e 100755 --- a/.local/bin/art +++ b/.local/bin/art @@ -1,9 +1,5 @@ #!/bin/sh -# -# Show icon in slstatus: -# Video [ REC 󰑊 ] -# Audio [ REC 󰍬 ] -# + # amolinae's recording tool screencast(){ case $(printf "%s\n" "󰍬 Mic ON" "󰍭 Mic OFF" | fuzzel -d -l 3) in diff --git a/.local/bin/aws b/.local/bin/aws index 52c94aa..d1717bf 100755 --- a/.local/bin/aws +++ b/.local/bin/aws @@ -9,6 +9,6 @@ img="$HOME/Pictures/$(date +"%d_%m_%y-%H_%M_%S").png" case "$1" in -f) grim "$img" && wl-copy -t image/png < "$img" && notify ;; - -r) grim -g "$(slurp)" "$img" && wl-copy -t image/png < "$img" && notify ;; + -r) grim -g "$(slurp &2; exit 1; ;; esac diff --git a/.local/bin/bluetooth b/.local/bin/bluetooth deleted file mode 100755 index 6964d46..0000000 --- a/.local/bin/bluetooth +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh -x -# Created by λmolinae - -checkstate() { - if [ "$(bluetoothctl show | grep "Powered: yes")" ]; then - echo "󰂯 Bluetooth ON" - else - echo "󰂲 Bluetooth OFF" - fi -} - -switchstate() { - case "$(checkstate | fuzzel -d)" in - "󰂯 ON") - bluetoothctl power off - notify-send "Bluetooth" "Bluetooth is disabled" - ;; - "󰂲 OFF") - bluetoothctl power on - notify-send "Bluetooth" "Bluetooth is enabled" - ;; - *) exit ;; - esac -} - -scandevices() { - # https://github.com/bluez/bluez/issues/826 - notify-send "Bluetooth" "Scanning for devices" - bluetoothctl --timeout 5 scan on - devices=$(bluetoothctl devices | awk '{$1=$2=""; print substr($0,3)}') - if [ -z "$devices" ]; then - notify-send "Bluetooth" "Error: No devices were found" - exit 1 - fi - - # TODO: Remove previously connected devices. - selection="$(printf "%s\n" "$devices" | fuzzel -d -p "Available devices: ")" - if [ -n "$selection" ]; then - mac=$(bluetoothctl devices | grep "$selection" | awk '{print $2}') - bluetoothctl connect "$mac" - notify-send "Bluetooth" "Connecting to $selection" - fi -} - -toggledisc() { - if [ "$(bluetoothctl show | grep "Discoverable: yes")" ]; then - bluetoothctl discoverable off - notify-send "Bluetooth" "Discoverable off" - else - bluetoothctl discoverable on - notify-send "Bluetooth" "Set device as discoverable for 3 minutes" - fi -} - -togglepair() { - if [ "$(bluetoothctl show | grep "Pairable: yes")" ]; then - bluetoothctl pairable off - notify-send "Bluetooth" "Pairable off" - else - bluetoothctl pairable on - notify-send "Bluetooth" "Device is now pairable" - fi -} - -case $(printf "%s\n" "󰂯 Connect Device" "󰂱 Toggle discoverable" "󰂰 Toggle Pairable" "󰂳 Change State" | fuzzel -d) in - "󰂯 Connect Device") scandevices ;; - "󰂱 Toggle discoverable") toggledisc ;; - "󰂰 Toggle Pairable") togglepair ;; - "󰂳 Change State") switchstate ;; - *) exit ;; -esac diff --git a/.local/bin/bwroot b/.local/bin/bwroot index 4de6c47..1d69920 100755 --- a/.local/bin/bwroot +++ b/.local/bin/bwroot @@ -1,17 +1,18 @@ #!/bin/sh -ROOT=""$HOME"/Documents/Miscellaneous/alpchroot" +ROOT="${HOME:-/home/amolinae}/Documents/Miscellaneous/alpchroot" -case "$1" in - "") echo "usage: bwroot ARGUMENT" >&2; exit 1; ;; +case "$1" in *) bwrap \ - --bind "$ROOT" / \ - --bind /proc /proc \ - --dev-bind /dev /dev \ - --bind "$PWD" "$PWD" \ - --bind "$HOME" "$HOME" \ - --unshare-all \ - --share-net \ - "$@" ;; -esac \ No newline at end of file + --bind "$ROOT" / \ + --bind /proc /proc \ + --bind /sys /sys \ + --dev-bind /dev /dev \ + --bind "$PWD" "$PWD" \ + --bind "$HOME" "$HOME" \ + --unshare-all \ + --share-net \ + "$@" ;; + "") echo "usage: bwroot ARGUMENT" >&2; exit 1; ;; +esac diff --git a/.local/bin/emojimenu b/.local/bin/emojimenu index 3f96a1c..9030d1a 100755 --- a/.local/bin/emojimenu +++ b/.local/bin/emojimenu @@ -1,7 +1,7 @@ #!/bin/sh # Get user selection via fuzzel from emoji file. -chosen="$(cut -d ';' -f1 ~/.local/share/misc/chars/* | fuzzel -d -l 16 -w 32 | sed "s/ .*//")" +chosen="$(cut -d ';' -f1 ~/.local/share/misc/chars/* | fuzzel -d | sed "s/ .*//")" # Exit if none chosen. [ -z "$chosen" ] && exit diff --git a/.local/bin/rec b/.local/bin/rec new file mode 100755 index 0000000..0ee9859 --- /dev/null +++ b/.local/bin/rec @@ -0,0 +1,7 @@ +#!/bin/sh + +if [[ ! -z "$(pgrep wf-recorder)" ]]; then + printf " [ REC 󰑊 ] \n" +else + printf " \n" +fi diff --git a/.local/bin/sysutils b/.local/bin/sysutils index 5f573df..8d23a41 100755 --- a/.local/bin/sysutils +++ b/.local/bin/sysutils @@ -5,7 +5,11 @@ case $(printf "%s\n" " Lock session" "󰍃 Log out" "󱂬 Kill process" " swaylock ;; "󰍃 Log out") - kill "$(pidof dwl)" + if pidof dwl > /dev/null; then + kill "$(pidof dwl)" + elif pidof river > /dev/null; then + kill "$(pidof river)" + fi ;; "󱂬 Kill process") ps -o pid,comm,user | \