diff --git a/.local/bin/block_battery b/.local/bin/block_battery index 9303e4e..22c429d 100755 --- a/.local/bin/block_battery +++ b/.local/bin/block_battery @@ -1,18 +1,22 @@ #!/bin/sh -battery=$(cat /sys/class/power_supply/BAT0/capacity) +battery=/sys/class/power_supply/BAT0 +capacity=$(cat $battery/capacity) +bstatus=$(cat $battery/status) -if [ $battery -gt 80 ]; then +if [ "$bstatus" = "Charging" ]; then + symbol=󰂄 +elif [ $capacity -gt 80 ]; then symbol= -elif [ $battery -gt 60 ]; then +elif [ $capacity -gt 60 ]; then symbol= -elif [ $battery -gt 40 ]; then +elif [ $capacity -gt 40 ]; then symbol= -elif [ $battery -gt 20 ]; then +elif [ $capacity -gt 20 ]; then symbol= else symbol= fi -echo "${symbol} ${battery}%" +echo "${symbol} ${capacity}%" diff --git a/.local/bin/hyprdwm b/.local/bin/hyprdwm index 9e01001..b0073b9 100755 --- a/.local/bin/hyprdwm +++ b/.local/bin/hyprdwm @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh # This is a script aimed at replicating the functionality of DWM where # there are 9 workspaces per monitor. diff --git a/.local/bin/hyprgaps b/.local/bin/hyprgaps index 66af956..c4caef4 100755 --- a/.local/bin/hyprgaps +++ b/.local/bin/hyprgaps @@ -1,12 +1,46 @@ -#!/usr/bin/env sh +#!/bin/sh increase=0 -if [ "$1" != "-i" ] && [ "$1" != "-d" ] || [ -z "$2" ]; then - echo "Wrong number of arguments" - exit 1 -else - [ "$1" = "-i" ] && increase=1 -fi + +# Reading from config +config="$HOME/.config/hypr/hyprland.conf" +def_gaps_out="$(grep "^\s*gaps_out" $config | awk '{print $3}')" +[ -z "$def_gaps_out" ] && def_gaps_out=12 +def_gaps_in="$(grep "^\s*gaps_in" $config | awk '{print $3}')" +[ -z "$def_gaps_in" ] && def_gaps_in=12 +def_rounding="$(grep "^\s*rounding" $config | awk '{print $3}')" +[ -z "$def_rounding" ] && def_rounding=10 + +case $1 in + -i) + increase=1 + ;; + -d) + increase=0 + ;; + -r) + hyprctl keyword general:gaps_out $def_gaps_out + hyprctl keyword general:gaps_in $def_gaps_in + hyprctl keyword decoration:rounding $def_rounding + exit 0 + ;; + -t) + gaps_out="$(hyprctl getoption general:gaps_out | grep "int" | awk '{print $2}')" + if [ $gaps_out = 0 ]; then + hyprctl keyword general:gaps_out $def_gaps_out + hyprctl keyword general:gaps_in $def_gaps_in + hyprctl keyword decoration:rounding $def_rounding + else + hyprctl keyword general:gaps_out 0 + hyprctl keyword general:gaps_in 0 + hyprctl keyword decoration:rounding 0 + fi + exit 0 + ;; + *) + exit 1 + ;; +esac amount="$2" curr_out="$(hyprctl -j getoption general:gaps_out | jq '.int')" @@ -19,11 +53,20 @@ fi new_in="$(($new_out / 2))" -if [ $new_out -lt 0 ] || [ $new_in -lt 0 ]; then +if [ $new_out -le 0 ] || [ $new_in -le 0 ]; then new_out=0 new_in=0 fi +# Handing smooth rounding transition +notify-send "$max_rounding" +if [ $new_in -gt $def_rounding ]; then + new_rounding=$def_rounding +else + new_rounding=$new_in +fi +hyprctl keyword decoration:rounding "$new_rounding" + hyprctl keyword general:gaps_out "$new_out" hyprctl keyword general:gaps_in "$new_in" diff --git a/.local/bin/menu-accent b/.local/bin/menu-accent index 16a1d8e..ff26f90 100755 --- a/.local/bin/menu-accent +++ b/.local/bin/menu-accent @@ -7,7 +7,7 @@ yellow blue purple cyan -white" | rofi -no-fixed-num-lines -dmenu -p "Choose an accent color:") +white" | fuzzel --dmenu -l 8 -p "Choose an accent color:") [ -z "$accent" ] && exit 0 echo "$accent" > ~/.config/colors/accent source ~/.config/zsh/.zshrc diff --git a/.local/bin/menu-layout b/.local/bin/menu-layout index 7309b87..f376cdf 100755 --- a/.local/bin/menu-layout +++ b/.local/bin/menu-layout @@ -1,5 +1,5 @@ -#!/usr/bin/env sh +#!/bin/sh -layout=`autorandr | rofi -dmenu -i -p "Select layout:" | awk '{print $1}'` +layout=`autorandr | fuzzel --dmenu -i -p "Select layout:" | awk '{print $1}'` autorandr $layout diff --git a/.local/bin/menu-man b/.local/bin/menu-man index c719630..50d476c 100755 --- a/.local/bin/menu-man +++ b/.local/bin/menu-man @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh -sel="$(man -k . | rofi -dmenu -i -p "Man page:")" -[ "$sel" = "" ] && exite # Exit on no selection +sel="$(man -k . | fuzzel --dmenu -i -p "Man page:")" +[ "$sel" = "" ] && exit # Exit on no selection # Selection comes in the form of: # $program ($num) - $desc diff --git a/.local/bin/menu-wpio b/.local/bin/menu-wpio index 10538e7..e26a7c8 100755 --- a/.local/bin/menu-wpio +++ b/.local/bin/menu-wpio @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh # Simple rofi script for changing default audio sink audio_info="$(wpctl status \ @@ -27,7 +27,8 @@ devices="$(echo "$devices_and_numbers" \ | awk -F'[' '{print $1}' \ | cut -c 2-)" -chosen="$(echo "$devices" | rofi -no-fixed-num-lines -dmenu -p "Select audio $1:" -i)" +lines="$(echo "$devices" | wc -l)" +chosen="$(echo "$devices" | fuzzel -l $lines --dmenu -p "Select audio $1:" -i)" if [ -z "$chosen" ]; then # Exited without selecting exit