├── .gitignore ├── 2bspwm ├── README.md ├── bunnyfetch ├── cl ├── colorer_dmenu ├── fetch ├── getxres ├── info ├── launcher ├── lock ├── playerctl_controls ├── playerctl_status ├── polybar-autohide ├── powermenu ├── prompt ├── screen ├── toggle_bar └── umount-menu /.gitignore: -------------------------------------------------------------------------------- 1 | random_album 2 | revise 3 | -------------------------------------------------------------------------------- /2bspwm: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # neeasade 3 | # makes dual borders 4 | # depends on wmutils/opt 5 | 6 | # polyfill a script in my dots. 7 | bspwindows() { 8 | case "${1:-active}" in 9 | active) 10 | bspc query -N -n .local.descendant_of.window.leaf.!fullscreen 11 | ;; 12 | inactive) 13 | bspc query -N -n .local.!descendant_of.window.leaf.!fullscreen 14 | ;; 15 | esac 16 | } 17 | 18 | border_width_current=$(bspc config border_width) 19 | 20 | # half if even, 1px to outer if odd 21 | border_width_in_normal=$(( border_width_current )) 22 | # border_width_out_normal=$(( border_width_current*5 )) 23 | border_width_out_normal=20 24 | border_width_in_focused=$border_width_in_normal 25 | border_width_out_focused=$border_width_out_normal 26 | 27 | background_color=$(getxres background | sed 's/#//g') 28 | border_color_in_normal=$(getxres color8 | sed 's/#//g') 29 | border_color_out_normal=$background_color 30 | border_color_in_focused=$(getxres color1 | sed 's/#//g') 31 | border_color_out_focused=$background_color 32 | 33 | type theme >/dev/null 2>&1 && eval "$(theme get)" 34 | 35 | _chwb2() { 36 | colorType=$1 37 | shift 38 | _getVal() { 39 | eval echo \$${1}_${colorType} 40 | } 41 | 42 | [ "$width_normal" = "$width_focused" ] || \ 43 | echo "$@" | sed 's/ /\n/g' | xargs -I{} bspc config -n {} border_width $(_getVal width) 44 | 45 | chwb2 -I $(_getVal border_color_in) -O $(_getVal border_color_out) -i $(_getVal border_width_in) -o $(_getVal border_width_out) $@ 2>/dev/null 46 | } 47 | 48 | width_normal=$((border_width_in_normal+border_width_out_normal)) 49 | width_focused=$((border_width_in_focused+border_width_out_focused)) 50 | bspc config border_width "$width_normal" 51 | 52 | _chwb2 focused $(bspwindows) 53 | _chwb2 normal $(bspwindows inactive) 54 | 55 | bspc subscribe node_state node_geometry node_focus | while read msg; do 56 | _chwb2 focused $(bspwindows) 57 | _chwb2 normal $(bspwindows inactive) 58 | done 59 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Where all of my scripts lie. 2 | 3 | It might be better to go to [dotfiles](https://github.com/kiddae/dotfiles) to get a better overview. 4 | -------------------------------------------------------------------------------- /bunnyfetch: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Tiny colored fetch script 3 | # Requires Typicons Font to display the icons 4 | # elenapan @ github 5 | 6 | f=3 b=4 7 | for j in f b; do 8 | for i in {0..7}; do 9 | printf -v $j$i %b "\e[${!j}${i}m" 10 | done 11 | done 12 | d=$'\e[1m' 13 | t=$'\e[0m' 14 | v=$'\e[7m' 15 | 16 | # Items 17 | sep= 18 | s=$d$f0$sep$t 19 | 20 | w= 21 | wifiname="$(iwgetid | cut -d \" -f2)" 22 | 23 | h= 24 | wmname="$(xprop -id $(xprop -root -notype | awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}') -notype -f _NET_WM_NAME 8t | grep "WM_NAME" | cut -f2 -d \")" 25 | 26 | k= 27 | kernel="$(uname -r | cut -d '-' -f1)" 28 | 29 | r= 30 | resolution="$(xwininfo -root | grep geometry | awk '{print $2}' | cut -d + -f1)" 31 | 32 | sh= 33 | shell=$(basename $SHELL) 34 | 35 | # (\ /) 36 | # ( · ·) 37 | # c(")(") 38 | 39 | # (\ /) 40 | # ( . .) 41 | # c(")(") 42 | 43 | tput clear 44 | cat << EOF 45 | 46 | $d$f1$h $t$wmname 47 | (\ /) $f3$k $t$kernel 48 | ( $d. .$t) $f2$sh $t$shell 49 | c($f1"$t)($f1"$t) $f5$r $t$resolution 50 | $f4$w $t$wifiname 51 | 52 | EOF 53 | -------------------------------------------------------------------------------- /cl: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Nice and clean colorscheme script 4 | 5 | f=3 b=4 6 | for j in f b; do 7 | for i in {0..7}; do 8 | printf -v $j$i %b "\e[${!j}${i}m" 9 | done 10 | done 11 | d=$'\e[1m' 12 | t=$'\e[0m' 13 | v=$'\e[7m' 14 | 15 | cat << EOF 16 | 17 | $f1███$d██$t $f2███$d██$t $f3███$d██$t $f4███$d██$t $f5███$d██$t $f6███$d██$t 18 | $f1███$d██$t $f2███$d██$t $f3███$d██$t $f4███$d██$t $f5███$d██$t $f6███$d██$t 19 | $ft███$d$f7██$t $ft███$d$f7██$t $ft███$d$f7██$t $ft███$d$f7██$t $ft███$d$f7██$t $ft███$d$f7██$t 20 | 21 | EOF 22 | -------------------------------------------------------------------------------- /colorer_dmenu: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | colorer $(ls -1 ~/.config/colorer/colorschemes/ | prompt 'Colorer:') 3 | -------------------------------------------------------------------------------- /fetch: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | pkgs=$(paru -Qq | wc -l &) 3 | distro=$(cat /etc/os-release | head -n1 | cut -d\" -f2 &) 4 | kernel=$(uname -r &) 5 | 6 | ramtotal=$(free -h | grep Mem | awk '{ print $2 }' &) 7 | ramused=$(free -h | grep Mem | awk '{ print $3 }' &) 8 | 9 | uptime=$(uptime -p | cut -d" " -f2- &) 10 | model=$(cat /sys/devices/virtual/dmi/id/product_name &) 11 | 12 | duhometotal=$(df -h /home | tail -n1 | awk '{ print $2 }') 13 | duhomeused=$(df -h /home | tail -n1 | awk '{ print $3 }') 14 | duhomepercent=$(df -h /home | tail -n1 | awk '{ print $5 }') 15 | duroottotal=$(df -h / | tail -n1 | awk '{ print $2 }') 16 | durootused=$(df -h / | tail -n1 | awk '{ print $3 }') 17 | durootpercent=$(df -h / | tail -n1 | awk '{ print $5 }') 18 | 19 | foreground=7 20 | 21 | echo -e "" 22 | echo -e " \033[4$foreground;30m \033[0m" 23 | echo -e " \033[4$foreground;30m distro \033[0m \033[3${foreground}m$distro\033[0m" 24 | echo -e " \033[4$foreground;30m kernel \033[0m \033[3${foreground}m$kernel\033[0m" 25 | echo -e " \033[4$foreground;30m uptime \033[0m \033[3${foreground}m$uptime\033[0m" 26 | echo -e " \033[4$foreground;30m packgs \033[0m \033[3${foreground}m$pkgs\033[0m" 27 | echo -e " \033[4$foreground;30m home \033[0m \033[3${foreground}m$duhomeused / $duhometotal ($duhomepercent)\033[0m" 28 | echo -e " \033[4$foreground;30m root \033[0m \033[3${foreground}m$durootused / $duroottotal ($durootpercent)\033[0m" 29 | echo -e " \033[4$foreground;30m memory \033[0m \033[3${foreground}m$ramused / $ramtotal\033[0m" 30 | echo -e " \033[4$foreground;30m \033[0m" 31 | echo -e "" 32 | -------------------------------------------------------------------------------- /getxres: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | xrdb -query | grep $1 | head -n1 | cut -d':' -f2 | sed 's/ //g' 3 | -------------------------------------------------------------------------------- /info: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | date=$(date +'%d %b') 3 | time=$(date +'%H:%M') 4 | layout=$(getlayout) 5 | title=$(playerctl metadata title) 6 | artist=$(playerctl metadata artist) 7 | status=$(playerctl metadata --format '{{lc(status)}}') 8 | volume=$(pamixer --get-volume) 9 | art=$(playerctl metadata mpris:artUrl) 10 | if [ -z "$art" ]; then 11 | art="/home/me/Pictures/Profile pics/profile4.jpg" 12 | fi 13 | echo $art 14 | 15 | notify-send "Hey!" "Today is ${date}, it is ${time}.\nYou are using the ${layout} layout.\n${title} by ${artist} is ${status} (${volume}%)." -t 2500 -i "${art}" 16 | -------------------------------------------------------------------------------- /launcher: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # theme=~/.cache/colorer/rofi.rasi 3 | # theme=~/.config/rofi/san.rasi 4 | # rofi -show run -theme $theme 5 | prompt 'Launcher' --run 6 | -------------------------------------------------------------------------------- /lock: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # i3lock -c `getxres background` -k --insidevercolor=`getxres background` --insidewrongcolor=`getxres background` --ringvercolor=`getxres color4` --ringwrongcolor=`getxres color1` --ringcolor=`getxres background` --line-uses-inside --keyhlcolor=`getxres color3` --bshlcolor=`getxres color1` --wrongcolor=`getxres foreground` --verifcolor=`getxres foreground` --insidecolor=`getxres background` --separatorcolor=`getxres color8` --datecolor=`getxres color8` --time-font=scientifica --date-font=scientifica --verif-font=scientifica --wrong-font=scientifica --timesize=42 --datesize=21 --verifsize=10 --wrongsize=10 --datecolor=`getxres color8` --timecolor=`getxres color1` --ring-width 1 --radius 130 --datepos="tx:ty+30" --timestr="%H:%M" --timepos="ix:iy" --datestr="%A %d, %B" 3 | # betterlockscreen -l 4 | XDG_SEAT_PATH="/org/freedesktop/DisplayManager/Seat0" dm-tool lock 5 | -------------------------------------------------------------------------------- /playerctl_controls: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | play_icon=$2 3 | pause_icon=$3 4 | prev_icon=$4 5 | next_icon=$5 6 | [[ $(playerctl status -p $1 2>/dev/null) = "Playing" ]] && color=$(polybar --dump=foreground base 2>/dev/null) || color=$(polybar --dump=line-color base 2>/dev/null) 7 | player=$1 8 | [[ $(playerctl status -p $1 2>/dev/null) = "Playing" ]] && status=$pause_icon || status=$play_icon 9 | string=$(echo %{A1:playerctl previous -p $1:}$prev_icon%{A}%{A1:playerctl play-pause -p $1:} $status%{A}%{A1:playerctl next -p $1:} $next_icon%{A}%{-o}) 10 | 11 | echo $string 12 | -------------------------------------------------------------------------------- /playerctl_status: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import sys 3 | import subprocess 4 | 5 | 6 | def get(str): 7 | try: 8 | return subprocess.check_output(str, shell=True).decode('utf-8').replace('\n', '') 9 | except: 10 | return "" 11 | 12 | 13 | def getpol(key, bar): 14 | str = "polybar --dump={} {} 2>/dev/null".format(key, bar) 15 | return get(str) 16 | 17 | 18 | def getctl(format): 19 | global player 20 | str = "playerctl metadata --format {{{{{}}}}} -p {} 2>/dev/null".format( 21 | format, player) 22 | return get(str) 23 | 24 | 25 | player = sys.argv[1] 26 | play_icon = sys.argv[2] 27 | pause_icon = sys.argv[3] 28 | prev_icon = sys.argv[4] 29 | next_icon = sys.argv[5] 30 | logo_icon = sys.argv[6] 31 | strlen = int(sys.argv[7]) 32 | 33 | if getctl('status') == "Playing": 34 | color = getpol('foreground', 'base') 35 | else: 36 | color = getpol('line-color', 'base') 37 | 38 | artist = getctl('artist') 39 | title = getctl('title') 40 | total_length = len(artist) + len(title) + 2 41 | 42 | if total_length > strlen: 43 | difference = total_length-strlen 44 | title = title[:-difference] + '…' 45 | total_length = len(artist) + len(title) + 1 46 | if total_length > strlen: 47 | difference = total_length-strlen 48 | artist = artist[:-difference] 49 | 50 | if getctl('status') == "Playing": 51 | status = pause_icon 52 | else: 53 | status = play_icon 54 | 55 | # Formatting the string 56 | strlogo = "%{F" + color + "}" + logo_icon 57 | strartist = "%{T2}" + artist + ":%{T-}" 58 | strtitle = title 59 | strprev = "%{F-}%{A1:playerctl previous -p " + \ 60 | player + ":}" + prev_icon + "%{A}" 61 | strplaypause = "%{A1:playerctl play-pause -p " + \ 62 | player + ":}" + status + "%{A}" 63 | strnext = "%{A1:playerctl next -p " + player + ":}" + next_icon + "%{A}" 64 | 65 | print(strlogo, strartist, strtitle, strprev, strplaypause, strnext) 66 | -------------------------------------------------------------------------------- /polybar-autohide: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import time 3 | import subprocess 4 | import re 5 | import logging 6 | import signal 7 | import sys 8 | 9 | DELAY = 10 10 | SCREEN_HEIGHT = subprocess.check_output( 11 | "xdpyinfo | awk '/dimensions/{print $2}' | cut -d'x' -f2", shell=True) 12 | PERCENT_LIMIT = 15 13 | BAR_HEIGHT = int(subprocess.check_output( 14 | 'polybar --dump=height base 2>/dev/null', shell=True)) + int(subprocess.check_output('polybar --dump=offset-y base 2>/dev/null', shell=True)) * 1 + int(subprocess.check_output('polybar --dump=border-size base 2>/dev/null', shell=True)) * 2 15 | print(BAR_HEIGHT) 16 | if subprocess.check_output('polybar --dump=bottom base 2>/dev/null', shell=True) == b'true\n': 17 | BAR_POS = 'bottom' 18 | else: 19 | BAR_POS = 'top' 20 | SHOW_CMD = 'xdo show -N Polybar && bspc config {}_padding {}'.format( 21 | BAR_POS, BAR_HEIGHT + int(subprocess.check_output('bspc config left_padding', shell=True))) 22 | HIDE_CMD = 'xdo hide -N Polybar && bspc config bottom_padding $(bspc config left_padding) && bspc config top_padding $(bspc config right_padding)' 23 | 24 | logging.basicConfig(level=logging.INFO) 25 | 26 | 27 | def get_y_position(): 28 | xdotool_output = subprocess.check_output( 29 | 'xdotool getmouselocation --shell', 30 | shell=True).decode('utf-8') 31 | return int(re.search(r'Y=(\d{1,})', xdotool_output).groups()[0]) + 1 32 | 33 | 34 | def cleanup(*args): 35 | subprocess.call(SHOW_CMD, shell=True) 36 | sys.exit(0) 37 | 38 | 39 | signal.signal(signal.SIGINT, cleanup) 40 | signal.signal(signal.SIGTERM, cleanup) 41 | 42 | 43 | subprocess.call(HIDE_CMD, shell=True) 44 | hidden = True 45 | while True: 46 | y = get_y_position() 47 | if hidden: 48 | if BAR_POS == 'bottom': 49 | on_edge = y > (1080 - 10) 50 | else: 51 | on_edge = y < 10 52 | else: 53 | if BAR_POS == 'bottom': 54 | on_edge = y > (1080 - BAR_HEIGHT) 55 | else: 56 | on_edge = y < BAR_HEIGHT 57 | logging.info("Got height %d. On edge: %s", y, str(on_edge)) 58 | if on_edge and hidden: 59 | subprocess.call(SHOW_CMD, shell=True) 60 | hidden = False 61 | if (not on_edge) and (not hidden): 62 | subprocess.call(HIDE_CMD, shell=True) 63 | hidden = True 64 | time.sleep(DELAY) 65 | -------------------------------------------------------------------------------- /powermenu: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | choices="Poweroff\nQuit\nReboot\nLock\nSuspend" 3 | # chosen=$(echo -e $choices | rofi -dmenu -i -p "Power Menu" -theme ~/.cache/colorer/rofi.rasi) 4 | fg=$(xrdb -query | grep foreground | cut -d':' -f2 | sed 's/ //g') 5 | bg=$(xrdb -query | grep background | cut -d':' -f2 | sed 's/ //g') 6 | chosen=$(echo -e $choices | prompt "Powermenu") 7 | echo "$chosen" 8 | 9 | case "$chosen" in 10 | Lock) lock ;; 11 | Suspend) systemctl suspend ;; 12 | Quit) bspc quit ;; 13 | Poweroff) poweroff ;; 14 | Reboot) reboot ;; 15 | esac 16 | -------------------------------------------------------------------------------- /prompt: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Use as dmenu (by piping values separated by \n to it) 4 | # $1 is the text shown in the prompt (defaults as 'dmenu') 5 | # if $2 is '--run', runs dmenu_run instead 6 | 7 | fg=$(colorer -g color7) 8 | bg=$(colorer -g bg) 9 | [[ $1 == '' ]] && prompt='dmenu' || prompt=$1 10 | args="-fn mono-11 -h 40 -nb ${bg} -nf ${fg} -sb ${fg} -sf ${bg} -p ${prompt} -i -b" 11 | [[ $2 == '--run' ]] && dmenu_run $args || dmenu $args 12 | # [[ $2 == '--run' ]] && rofi -show run -theme ~/.config/colorer/out/rofi.rasi || rofi -dmenu -p "$1" -theme ~/.config/colorer/out/rofi.rasi -i 13 | -------------------------------------------------------------------------------- /screen: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # file=/tmp/$(date +%s).png 4 | # default_dir=~/Pictures/Screenshots 5 | # 6 | # sleep 0.6 7 | # maim -u $1 $file 8 | # 9 | # # dir=$(find ~ -type d 2>/dev/null | rofi -dmenu -i -p "Choose a directory" -theme ~/.cache/colorer/rofi.rasi) 10 | # fg=$(xrdb -query | grep foreground | cut -d':' -f2 | sed 's/ //g') 11 | # bg=$(xrdb -query | grep background | cut -d':' -f2 | sed 's/ //g') 12 | # #dir=$(find ~ -type d 2>/dev/null | prompt "Where?") 13 | # dir=$default_dir 14 | # 15 | # if [[ -n $dir ]]; then 16 | # mv $file $dir 17 | # else 18 | # mv $file $default_dir 19 | # fi 20 | 21 | file=~/Pictures/Screenshots/$(date +%s).png 22 | maim -u $1 $file 23 | 24 | xclip -selection clipboard -target image/png -i $file 25 | 26 | notify-send "Took a screenshot" "saved to ${file} and copied to clipboard." -i $file 27 | -------------------------------------------------------------------------------- /toggle_bar: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | xdo show -N Polybar; pkill -f polybar-autohide || polybar-autohide &>/dev/null 3 | -------------------------------------------------------------------------------- /umount-menu: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | udiskie-umount $(udiskie-info -a | prompt "Choose...") 3 | 4 | --------------------------------------------------------------------------------