Skip to content

Commit

Permalink
waybar vert conf w/ broken window mod + minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
prasanthrangan committed Feb 25, 2024
1 parent 082a402 commit ad9911f
Show file tree
Hide file tree
Showing 37 changed files with 265 additions and 154 deletions.
31 changes: 0 additions & 31 deletions Configs/.config/hypr/scripts/spotifyvolumecontrol.sh

This file was deleted.

8 changes: 4 additions & 4 deletions Configs/.config/hypr/scripts/swwwallpaper.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env sh


# lock instance

lockFile="/tmp/hyrpdots$(id -u)swwwallpaper.lock"
Expand Down Expand Up @@ -112,7 +113,7 @@ fi

# evaluate options

while getopts "nps" option ; do
while getopts "nps:" option ; do
case $option in
n ) # set next wallpaper
xtrans="grow"
Expand All @@ -121,9 +122,8 @@ while getopts "nps" option ; do
xtrans="outer"
Wall_Change p ;;
s ) # set input wallpaper
shift $((OPTIND -1))
if [ -f "$1" ] ; then
Wall_Update "$1"
if [ -f "$OPTARG" ] ; then
Wall_Update "$OPTARG"
fi ;;
* ) # invalid option
echo "n : set next wall"
Expand Down
60 changes: 35 additions & 25 deletions Configs/.config/hypr/scripts/themeswitch.sh
Original file line number Diff line number Diff line change
@@ -1,45 +1,46 @@
#!/usr/bin/env sh


# set variables
ScrDir=`dirname "$(realpath "$0")"`
source "${ScrDir}/globalcontrol.sh"
readarray -t theme_ctl < <( cut -d '|' -f 2 $ThemeCtl )


# define functions
Theme_Change()
{
local x_switch=$1
local curTheme=$(awk -F '|' '$1 == 1 {print $2}' $ThemeCtl)
for (( i=0 ; i<${#theme_ctl[@]} ; i++ ))
do
if [ "${theme_ctl[i]}" == "${curTheme}" ] ; then
if [ $x_switch == 'n' ] ; then
nextIndex=$(( (i + 1) % ${#theme_ctl[@]} ))
elif [ $x_switch == 'p' ] ; then
nextIndex=$(( i - 1 ))
fi
ThemeSet="${theme_ctl[nextIndex]}"
break
fi
done
}


# evaluate options
while getopts "npst" option ; do
while getopts "nps:t" option ; do
case $option in

n ) # set next theme
ThemeSet=`head -1 "$ThemeCtl" | cut -d '|' -f 2` #default value
flg=0
while read line
do
if [ $flg -eq 1 ] ; then
ThemeSet=`echo $line | cut -d '|' -f 2`
break
elif [ `echo $line | cut -d '|' -f 1` -eq 1 ] ; then
flg=1
fi
done < "$ThemeCtl"
Theme_Change n
export xtrans="grow" ;;

p ) # set previous theme
ThemeSet=`tail -1 "$ThemeCtl" | cut -d '|' -f 2` #default value
flg=0
while read line
do
if [ $flg -eq 1 ] ; then
ThemeSet=`echo $line | cut -d '|' -f 2`
break
elif [ `echo $line | cut -d '|' -f 1` -eq 1 ] ; then
flg=1
fi
done < <( tac "$ThemeCtl" )
Theme_Change p
export xtrans="outer" ;;

s ) # set selected theme
shift $((OPTIND -1))
ThemeSet=$1 ;;
ThemeSet="$OPTARG" ;;

t ) # display tooltip
echo ""
Expand Down Expand Up @@ -95,6 +96,15 @@ if [ ! -z "$(grep '^1|' "$ThemeCtl" | awk -F '|' '{print $3}')" ] ; then
fi


# kitty
ln -fs $ConfDir/kitty/themes/${ThemeSet}.conf $ConfDir/kitty/themes/theme.conf
killall -SIGUSR1 kitty


# rofi
cp $ConfDir/rofi/themes/${ThemeSet}.rasi $ConfDir/rofi/themes/theme.rasi


# kvantum QT
kvantummanager --set "${ThemeSet}"

Expand Down
94 changes: 57 additions & 37 deletions Configs/.config/hypr/scripts/volumecontrol.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,72 +6,92 @@ source $ScrDir/globalcontrol.sh

# define functions

function print_error
print_error ()
{
cat << "EOF"
./volumecontrol.sh -[device] <action>
./volumecontrol.sh -[device] <actions>
...valid device are...
i -- [i]nput decive
o -- [o]utput device
i -- input decive
o -- output device
p -- player application
...valid actions are...
i -- <i>ncrease volume [+5]
d -- <d>ecrease volume [-5]
m -- <m>ute [x]
i -- increase volume [+5]
d -- decrease volume [-5]
m -- mute [x]
EOF
exit 1
}

function notify_vol
notify_vol ()
{
vol=`pamixer $srce --get-volume | cat`
angle="$(( (($vol+2)/5) * 5 ))"
ico="${icodir}/vol-${angle}.svg"
bar=$(seq -s "." $(($vol / 15)) | sed 's/[0-9]//g')
dunstify "t2" -a "$vol$bar" "$nsink" -i $ico -r 91190 -t 800
dunstify "t2" -a "${vol}${bar}" "${nsink}" -i $ico -r 91190 -t 800
}

function notify_mute
notify_mute ()
{
mute=`pamixer $srce --get-mute | cat`
if [ "$mute" == "true" ] ; then
dunstify "t2" -a "muted" "$nsink" -i ${icodir}/muted-${dvce}.svg -r 91190 -t 800
mute=$(pamixer "${srce}" --get-mute | cat)
[ "${srce}" == "--default-source" ] && dvce="mic" || dvce="speaker"
if [ "${mute}" == "true" ] ; then
dunstify "t2" -a "muted" "${nsink}" -i ${icodir}/muted-${dvce}.svg -r 91190 -t 800
else
dunstify "t2" -a "unmuted" "$nsink" -i ${icodir}/unmuted-${dvce}.svg -r 91190 -t 800
dunstify "t2" -a "unmuted" "${nsink}" -i ${icodir}/unmuted-${dvce}.svg -r 91190 -t 800
fi
}

action_pamixer ()
{
pamixer "${srce}" -"${1}" "${step}"
vol=$(pamixer "${srce}" --get-volume | cat)
}

action_playerctl ()
{
[ "${1}" == "i" ] && pvl="+" || pvl="-"
playerctl --player="${srce}" volume 0.0"${step}""${pvl}"
vol=$(playerctl --player="${srce}" volume | awk '{ printf "%.0f\n", $0 * 100 }')
}


# set device source
# eval device option

while getopts io SetSrc
while getopts iop: DeviceOpt
do
case $SetSrc in
i) nsink=$(pamixer --list-sources | grep "_input." | head -1 | awk -F '" "' '{print $NF}' | sed 's/"//')
srce="--default-source"
dvce="mic" ;;
case "${DeviceOpt}" in
i) nsink=$(pamixer --list-sources | grep "_input." | tail -1 | awk -F '" "' '{print $NF}' | sed 's/"//')
[ -z "${nsink}" ] && echo "ERROR: Input device not found..." && exit 0
ctrl="pamixer"
srce="--default-source" ;;
o) nsink=$(pamixer --get-default-sink | grep "_output." | awk -F '" "' '{print $NF}' | sed 's/"//')
srce=""
dvce="speaker" ;;
[ -z "${nsink}" ] && echo "ERROR: Output device not found..." && exit 0
ctrl="pamixer"
srce="" ;;
p) nsink=$(playerctl --list-all | grep -w "${OPTARG}")
[ -z "${nsink}" ] && echo "ERROR: Player ${OPTARG} not active..." && exit 0
ctrl="playerctl"
srce="${nsink}" ;;
*) print_error ;;
esac
done

if [ $OPTIND -eq 1 ] ; then
print_error
fi


# set device action
# set default variables

icodir="${XDG_CONFIG_HOME:-$HOME/.config}/dunst/icons/vol"
shift $((OPTIND -1))
step="${2:-5}"
icodir="~/.config/dunst/icons/vol"

case $1 in
i) pamixer $srce -i ${step}
notify_vol ;;
d) pamixer $srce -d ${step}
notify_vol ;;
m) pamixer $srce -t
notify_mute ;;


# execute action

case "${1}" in
i) action_${ctrl} i ;;
d) action_${ctrl} d ;;
m) "${ctrl}" "${srce}" -t && notify_mute && exit 0 ;;
*) print_error ;;
esac

notify_vol

14 changes: 6 additions & 8 deletions Configs/.config/hypr/scripts/wbarconfgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ fi
export set_sysname=`hostnamectl hostname`
export w_position=`grep '^1|' $conf_ctl | cut -d '|' -f 3`

case ${w_position} in
left) export hv_pos="width" ; export r_deg=90 ;;
right) export hv_pos="width" ; export r_deg=270 ;;
*) export hv_pos="height" ; export r_deg=0 ;;
esac

export w_height=`grep '^1|' $conf_ctl | cut -d '|' -f 2`
if [ -z $w_height ] ; then
y_monres=`cat /sys/class/drm/*/modes | head -1 | cut -d 'x' -f 2`
Expand Down Expand Up @@ -102,14 +108,6 @@ gen_mod right 6
echo -e "\n\n// sourced from modules based on config.ctl //\n" >> $conf_file
echo "$write_mod" | sed 's/","/\n/g ; s/ /\n/g' | awk -F '/' '{print $NF}' | awk -F '#' '{print $1}' | awk '!x[$0]++' | while read mod_cpy
do

# case ${w_position}-$(grep -E '"modules-left":|"modules-center":|"modules-right":' $conf_file | grep "$mod_cpy" | tail -1 | cut -d '"' -f 2 | cut -d '-' -f 2) in
# top-left) export mod_pos=1;;
# top-right) export mod_pos=2;;
# bottom-right) export mod_pos=3;;
# bottom-left) export mod_pos=4;;
# esac

if [ -f $modules_dir/$mod_cpy.jsonc ] ; then
envsubst < $modules_dir/$mod_cpy.jsonc >> $conf_file
fi
Expand Down
60 changes: 59 additions & 1 deletion Configs/.config/hypr/scripts/wbarstylegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ScrDir=`dirname "$(realpath "$0")"`
source $ScrDir/globalcontrol.sh
waybar_dir="${XDG_CONFIG_HOME:-$HOME/.config}/waybar"
modules_dir="$waybar_dir/modules"
conf_ctl="$waybar_dir/config.ctl"
in_file="$waybar_dir/modules/style.css"
out_file="$waybar_dir/style.css"
src_file="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/themes/theme.conf"
Expand All @@ -22,7 +23,7 @@ fi

# calculate height from control file or monitor res

b_height=`grep '^1|' $waybar_dir/config.ctl | cut -d '|' -f 2`
b_height=`grep '^1|' $conf_ctl | cut -d '|' -f 2`

if [ -z $b_height ] || [ "$b_height" == "0" ]; then
y_monres=`cat /sys/class/drm/*/modes | head -1 | cut -d 'x' -f 2`
Expand Down Expand Up @@ -53,6 +54,63 @@ if [ $s_fontpx -lt 10 ] ; then
fi


# adjust values for vert/horz

export w_position=`grep '^1|' $conf_ctl | cut -d '|' -f 3`
case ${w_position} in
top|bottom)
export x1g_margin=${g_margin}
export x2g_margin=0
export x3g_margin=${g_margin}
export x4g_margin=0
export x1rb_radius=0
export x2rb_radius=${b_radius}
export x3rb_radius=${b_radius}
export x4rb_radius=0
export x1lb_radius=${b_radius}
export x2lb_radius=0
export x3lb_radius=0
export x4lb_radius=${b_radius}
export x1rc_radius=0
export x2rc_radius=${c_radius}
export x3rc_radius=${c_radius}
export x4rc_radius=0
export x1lc_radius=${c_radius}
export x2lc_radius=0
export x3lc_radius=0
export x4lc_radius=${c_radius}
export x1="top"
export x2="bottom"
export x3="left"
export x4="right" ;;
left|right)
export x1g_margin=0
export x2g_margin=${g_margin}
export x3g_margin=0
export x4g_margin=${g_margin}
export x1rb_radius=0
export x2rb_radius=0
export x3rb_radius=${b_radius}
export x4rb_radius=${b_radius}
export x1lb_radius=${b_radius}
export x2lb_radius=${b_radius}
export x3lb_radius=0
export x4lb_radius=0
export x1rc_radius=0
export x2rc_radius=${c_radius}
export x3rc_radius=${c_radius}
export x4rc_radius=0
export x1lc_radius=${c_radius}
export x2lc_radius=0
export x3lc_radius=0
export x4lc_radius=${c_radius}
export x1="left"
export x2="right"
export x3="top"
export x4="bottom" ;;
esac


# list modules and generate theme style

export modules_ls=$(grep -m 1 '".*.": {' --exclude="$modules_dir/footer.jsonc" $modules_dir/*.jsonc | cut -d '"' -f 2 | awk -F '/' '{ if($1=="custom") print "#custom-"$NF"," ; else print "#"$NF","}')
Expand Down
Loading

0 comments on commit ad9911f

Please sign in to comment.