Created
April 17, 2024 03:30
-
-
Save kRHYME7/bc97c3bf99d931d5af11df56a6e1f668 to your computer and use it in GitHub Desktop.
Test only
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
#// set variables | |
scrDir="$(dirname "$(realpath "$0")")" | |
source "${scrDir}/globalcontrol.sh" | |
rofiConf="${confDir}/rofi/selector.rasi" | |
#// scale for monitor | |
eval "$(hyprctl monitors -j |\ | |
jq -r '.[] | select(.focused==true) | | |
"export monId=\(.id) | |
export monScale=\(.scale) | |
export monWidth=\(.width / .scale) | |
export monHeight=\(.height / .scale ) | |
export monTrans=\(.transform) | |
export monRatio=\((.width / .height) | ceil) | |
export aspect_r=\(((.width / .scale) * 10 / (.height / .scale )) | floor) | |
export baseDime=\(if .transform % 2 == 1 then "height" else "width" end) | |
"')" | |
#// set rofi scaling | |
[[ "${rofiScale}" =~ ^[0-9]+$ ]] || rofiScale=12 | |
rofiScale=$(( rofiScale - monRatio )) | |
r_scale="configuration {font: \"JetBrainsMono Nerd Font ${rofiScale}\";}" | |
elem_border=$(( hypr_border * 5 )) | |
icon_border=$(( elem_border - 5 )) | |
#? Test for vert monitor | |
columns=$(( $monRatio + 2 )) | |
lines=1 | |
if [ "${baseDime}" = "height" ]; then | |
temp=$columns | |
columns=$lines | |
lines=$temp | |
fi | |
#// generate config | |
case "${themeSelect}" in | |
2) # adapt to style 2 | |
i_size=$(( aspect_r - 2 - monRatio )) | |
r_override="window{$baseDime:100%;} mainbox{background-color:#00000003;} listview{columns:${columns};lines:${lines};} element{border-radius:${elem_border}px;background-color:@main-bg;} element-icon{size:${i_size}em;border-radius:${icon_border}px 0px 0px ${icon_border}px;}" | |
thmbExtn="quad" ;; | |
*) # default to style 1 | |
i_size=$(( aspect_r + 2 )) | |
r_override="element{border-radius:${elem_border}px;padding:0.5em;} listview{columns:2;} element-icon{size:${i_size}em;border-radius:${icon_border}px;}" | |
thmbExtn="sqre" ;; | |
esac | |
#// launch rofi menu | |
get_themes | |
rofiSel=$(for i in ${!thmList[@]} ; do | |
echo -en "${thmList[i]}\x00icon\x1f${thmbDir}/$(set_hash "${thmWall[i]}").${thmbExtn}\n" | |
done | rofi -dmenu -theme-str "${r_scale}" -theme-str "${r_override}" -config "${rofiConf}" -select "${hydeTheme}") | |
#// apply theme | |
if [ ! -z "${rofiSel}" ] ; then | |
"${scrDir}/themeswitch.sh" -s "${rofiSel}" | |
notify-send -a "t1" -i "~/.config/dunst/icons/hyprdots.png" " ${rofiSel}" | |
fi | |
VRRR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment