diff --git a/eww/eww.scss b/eww/eww.scss deleted file mode 120000 index 20327e3..0000000 --- a/eww/eww.scss +++ /dev/null @@ -1 +0,0 @@ -/home/shaked/.config/eww/eww.scss \ No newline at end of file diff --git a/eww/eww.scss b/eww/eww.scss new file mode 100644 index 0000000..310cc1f --- /dev/null +++ b/eww/eww.scss @@ -0,0 +1,14 @@ +*{ + all: unset; //Unsets everything so you can style everything from scratch +} +.window-button { + background-color: rgb(44, 44, 44); +} + +.window-button:hover { + background-color: rgb(27, 27, 27); +} + +.window-button:active { + background-color: rgb(17, 17, 17); +} \ No newline at end of file diff --git a/eww/eww.yuck b/eww/eww.yuck deleted file mode 120000 index c1af50b..0000000 --- a/eww/eww.yuck +++ /dev/null @@ -1 +0,0 @@ -/home/shaked/.config/eww/eww.yuck \ No newline at end of file diff --git a/eww/eww.yuck b/eww/eww.yuck new file mode 100644 index 0000000..7a7b9c2 --- /dev/null +++ b/eww/eww.yuck @@ -0,0 +1,23 @@ +(defpoll windows :interval "1s" + :initial "initial-value" ; optional, defaults to poll at startup + :run-while time-visible ; optional, defaults to 'true' + `scripts/windows.sh`) + +(defwidget windows_widget [] + (box + (literal :content windows) + ) +) + +(defwindow example + :monitor 0 + :geometry (geometry + :x "0%" + :y "0%" + :width "50%" + :height "30%" + :anchor "center center") + :stacking "fg" + :windowtype "dock" + (windows_widget) +) \ No newline at end of file diff --git a/eww/scripts b/eww/scripts deleted file mode 120000 index dda377f..0000000 --- a/eww/scripts +++ /dev/null @@ -1 +0,0 @@ -/home/shaked/.config/eww/scripts \ No newline at end of file diff --git a/eww/scripts/move_to_window.sh b/eww/scripts/move_to_window.sh new file mode 100755 index 0000000..682666f --- /dev/null +++ b/eww/scripts/move_to_window.sh @@ -0,0 +1,3 @@ +window_id=$(hyprctl clients | rg 'Window ([A-Fa-f0-9]+)' | grep -F "$*" | sed -E 's/Window (.*) \->.*/\1/g') +hyprctl dispatch focuswindow address:0x$window_id > /dev/null +eww close example \ No newline at end of file diff --git a/eww/scripts/windows.sh b/eww/scripts/windows.sh new file mode 100755 index 0000000..fa87357 --- /dev/null +++ b/eww/scripts/windows.sh @@ -0,0 +1,41 @@ +#! /bin/bash +trun() { + window=$1 + OLD_IFS="$IFS" + IFS=$' ' + for word in $window; do + if [[ $count == $word_per_line ]]; then + str="$str$word\n" + count=0 + else + str="$str$word " + count=$(($count + 1)) + fi + done + IFS=$OLD_IFS + echo $str +} + +img() { + window=$1 + windows_images_dir=$HOME/.config/hyprmsn/windows + echo "$windows_images_dir/$(ls $windows_images_dir | grep -F $window)" +} + +word_per_line=3 +echo "(box" +OLD_IFS="$IFS" +IFS=$'\n' +windows=$(hyprctl clients | rg 'Window ([A-Fa-f0-9]+)' | sed -E 's/.*\-> (.*):/\1/g') +for window in $windows; do + window_str=$(trun $window) + window_img=$(img $window) + eww="(box :orientation \"v\" :class \"window-box\" (image :path \"$window_img\" :image-width 192 :image-height 108) (button :onclick \"scripts/move_to_window.sh \'$window\'\" :class \"window-button\" (box :orientation \"v\" " + for string in $(echo -e $window_str); do + eww="$eww $(echo -e "(label :text \"$string\")")" + done + eww="$eww)))" + echo $eww +done +IFS=$OLD_IFS +echo ")" \ No newline at end of file