Switch to a predefined eww config
This commit is contained in:
parent
92f52c0c42
commit
6703367fdf
9 changed files with 436 additions and 0 deletions
8
modules/wm/hyprland/config/eww/README.md
Normal file
8
modules/wm/hyprland/config/eww/README.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# Eww config file structure
|
||||
```bash
|
||||
eww.yuck -> calls eww_windows
|
||||
eww_windows.yuck -> calls widgets, defines all windows
|
||||
eww_widgets.yuck -> calls eww_variables, defines all widgets
|
||||
eww_variables.yuck -> defines all variabes
|
||||
scripts/ -> contains all scripts used by variables/buttons/others
|
||||
```
|
||||
28
modules/wm/hyprland/config/eww/eww_variables.yuck
Normal file
28
modules/wm/hyprland/config/eww/eww_variables.yuck
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
;;;; QUOTE
|
||||
|
||||
(defpoll quote_text :interval "3600s" `./scripts/quote.sh`)
|
||||
|
||||
;;;; FETCH AND DATE
|
||||
|
||||
(defpoll host
|
||||
:initial-value ""
|
||||
:interval "1h"
|
||||
|
||||
`echo $(whoami)@$(hostname)`
|
||||
)
|
||||
|
||||
(defpoll TODAY :interval "1s" `date +%m/%d/%y`)
|
||||
(defpoll distro :interval "12h" "awk '/^ID=/' /etc/*-release | awk -F'=' '{ print tolower($2) }'")
|
||||
(defpoll de :interval "12h" "echo $XDG_CURRENT_DESKTOP")
|
||||
(defpoll shell :interval "5m" "echo $SHELL | awk -F'/' '{print $NF}'")
|
||||
(defpoll uptime :interval "30s" "./scripts/uptime.sh")
|
||||
(defpoll packages :interval "5m" "pacman -Q | wc -l")
|
||||
|
||||
;;;; NOTES, MUSIC, NETWORKING
|
||||
|
||||
(defpoll NOTES :interval "1s" "cat -s ~/Documents/notes.txt")
|
||||
(defpoll music_current :interval "1s" "mpc current")
|
||||
(defpoll ssid :interval "1s" "iwgetid -r || echo 'Disconnected'")
|
||||
|
||||
;;;; App list LISTEN VAR
|
||||
(defpoll search_listen :interval "5m" "scripts/search_items.txt")
|
||||
145
modules/wm/hyprland/config/eww/eww_widgets.yuck
Normal file
145
modules/wm/hyprland/config/eww/eww_widgets.yuck
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
; -> WIDGETS FOR EWW <- ;
|
||||
|
||||
;;;; Imports
|
||||
(include "/home/horseman/.config/eww/eww_variables.yuck")
|
||||
|
||||
;;;; Metric (cpu, ram, etc bars) constructor widget
|
||||
(defwidget metric [label value onchange]
|
||||
(box :orientation "h" :class "metric" :space-evenly false
|
||||
(box :class "label" label)
|
||||
(scale :min 0 :max 101 :active {onchange != ""} :value value :onchange onchange)))
|
||||
|
||||
;;;; Background Black Holder Widget
|
||||
|
||||
(defwidget bg []
|
||||
(box :class "bg-box" :orientation "v" :space-evenly false))
|
||||
|
||||
|
||||
;;;; Favorite App Locations
|
||||
|
||||
(defwidget favorites[]
|
||||
(box :class "favs" :orientation "v" :space-evenly false :halign "center" :valign "center"
|
||||
(button :onclick "pcmanfm ~ &" "")
|
||||
(button :onclick "pcmanfm ~/.config/ &" "漣")
|
||||
(button :onclick "pcmanfm ~/Downloads &" "")
|
||||
(button :onclick "pcmanfm ~/Pictures &" "")))
|
||||
|
||||
;;;; Big Calendar Widget
|
||||
|
||||
(defwidget cal []
|
||||
(calendar :halign "center" :valign "center" :class "cal" :month 10 :year 2021))
|
||||
|
||||
;;;; Small date in mm/dd/yy format
|
||||
|
||||
(defwidget smalldate []
|
||||
(label :class "small-date" :valign "center" :halign "center" :text TODAY))
|
||||
|
||||
;;;; User information fetch widget
|
||||
|
||||
(defwidget uinfo []
|
||||
(box :class "uinfo" :orientation "v" :space-evenly false :halign "center" :valign "center"
|
||||
(label :style "color: #5e81ac;" :text {host} :halign "center" :valign "center" :wrap "false" :limit-width 25)
|
||||
(label :style "color: #efefef;" :text "⎯⎯⎯⎯⎯⎯⎯⎯" :halign "center" :valign "center" :wrap "false" :limit-width 25)
|
||||
|
||||
;; Tags for values
|
||||
(box :orientation "h" :space-evenly "false" :spacing 10
|
||||
(box :orientation "v" :class "fetch" :spacing 2
|
||||
(label :style "font-family: 'archcraft'; color: #b48ead;" :halign "end" :text "")
|
||||
(label :style "color: #ebcb8b;" :halign "end" :text "缾")
|
||||
(label :style "color: #80a0c0;" :halign "end" :text "")
|
||||
(label :style "color: #b48ead;" :halign "end" :text ""))
|
||||
|
||||
;; Fetch Values
|
||||
(box :orientation "v" :class "fetch"
|
||||
(label :style "color: #b48ead;" :halign "start" :text ": ${distro}")
|
||||
(label :style "color: #ebcb8b;" :halign "start" :text ": Hyprland")
|
||||
(label :style "color: #80a0c0;" :halign "start" :text ": ${shell}")
|
||||
(label :style "color: #b48ead;" :halign "start" :text ": ${uptime}")
|
||||
))))
|
||||
|
||||
;;;; System Information Widget
|
||||
|
||||
(defwidget sys[]
|
||||
(box :class "cpu" :orientation "v" :space-evenly false :halign "center" :valign "center"
|
||||
(metric :label "" :value {EWW_CPU.avg} :onchange "")
|
||||
(metric :label "" :value {EWW_RAM.used_mem_perc} :onchange "")
|
||||
(metric :label "龍" :value {(EWW_NET.wlan0.NET_UP)/100} :onchange "")
|
||||
(metric :label "" :value {(EWW_DISK["/"].free / EWW_DISK["/"].total) * 100} :onchange "")))
|
||||
|
||||
;;;; Random Quote Widget
|
||||
|
||||
(defwidget quote[]
|
||||
(box :class "quote" :orientation "v" :space-evenly false :halign "center" :valign "center"
|
||||
(label :class "quote-text" :text "${quote_text}" :wrap true)))
|
||||
|
||||
;;;; QuickSettings widget
|
||||
|
||||
(defwidget quicksettings []
|
||||
(box :orientation "h" :space-evenly true :class "quicksettings" :spacing "10" :halign "center" :valign "center"
|
||||
(button :style "color: #5e81ac;" :onclick "mpv --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0 &" (image :path "/home/horsema" :width 32 :height 32))
|
||||
(button :style "color: #81a1c1; padding-left: 3px;" :onclick "pavucontrol &" (image :path "images/audio-headphones.svg" :width 32 :height 32))
|
||||
(button :style "color: #b48ead;" :onclick "sh ~/.config/eww/scripts/airplane_mode.sh &" (image :path "images/network-card.svg" :width 32 :height 32))))
|
||||
|
||||
;;;; AppBar widget
|
||||
(defwidget appbar []
|
||||
(box :orientation "h" :space-evenly true :class "appbar" :spacing "5" :halign "center" :valign "center"
|
||||
(button :style "color: #5e81ac;" :onclick "krita&" (image :path "images/krita.svg" :width 32 :height 32))
|
||||
(button :style "color: #81a1c1;" :onclick "firefox&" (image :path "images/firefox.svg" :width 32 :height 32))
|
||||
(button :style "color: #b48ead;" :onclick "vscodium&" (image :path "images/vscode.svg" :width 32 :height 32))
|
||||
(button :style "color: #bf616a;" :onclick "gimp&" (image :path "images/gimp.svg" :width 32 :height 32))))
|
||||
|
||||
;;;; TODO Notes Displaying widget
|
||||
|
||||
(defwidget notes []
|
||||
(box :spacing 5 :class "notes" :orientation "v" :space-evenly false :halign "center" :valign "center"
|
||||
(label :style "color: #5e81ac;" :text NOTES :halign "center" :valign "center" :wrap true :limit-width 150 :vexpand false :hexpand false)
|
||||
(box :orientation "h"
|
||||
(button :onclick "echo '' > ~/Documents/notes.txt" "[ Empty ]")
|
||||
(button :onclick "pcmanfm ~/Documents/notes.txt" "[ Edit TODO ]"))))
|
||||
|
||||
;;;; Rofi style search
|
||||
(defwidget searchapps []
|
||||
(eventbox :onhoverlost "eww close searchapps"
|
||||
(box :orientation "v" :space-evenly false :class "search-win" :halign "top" :valign "top"
|
||||
(box :orientation "h" :space-evenly false :class "searchapps-bar" :halign "top" :valign "top"
|
||||
(label :class "search-label" :text "")
|
||||
(input :class "search-bar" :onchange "~/.config/eww/scripts/search.sh {}"))
|
||||
(literal :halign "center" :valign "center" :class "app-container" :content search_listen))))
|
||||
|
||||
;;;; Rofi style powermenu
|
||||
(defwidget bigpowermenu []
|
||||
(box :orientation "h" :space-evenly false :class "bigpowermenu" :halign "center" :valign "center" :spacing 20
|
||||
(button :style "color: #d8dee9;" :class "shutdown" :onrightclick "systemctl poweroff" "")
|
||||
(button :style "color: #e5e9f0;" :class "reboot" :onrightclick "systemctl reboot" "")
|
||||
(button :style "color: #eceff4;" :class "lock" :onrightclick "bsplock" "")
|
||||
(button :style "color: #e8e8e8;" :class "suspend" :onrightclick "mpc -q pause & amixer set Master mute & systemctl suspend" "")
|
||||
(button :style "color: #ffffff;" :class "logout" :onrightclick "bspc quit" "")))
|
||||
|
||||
;;;; Music Player
|
||||
(defwidget musicplayer []
|
||||
|
||||
(box :orientation "v" :space-evenly false :class "musicplayer" :halign "center" :valign "center" :hexpand true :vexpand true
|
||||
(label :class "label-control" :text "${music_current}" :halign "center" :limit-width 50 :show-truncated true :hexpand true :vexpand true)
|
||||
(box :orientation "h" :space-evenly false :class "controls" :halign "center" :valign "center" :spacing 20
|
||||
(button :style "color: #d8dee9;" :onclick "mpc -q toggle && notify-send -u low -t 1800 ${music_current}" "懶")
|
||||
(button :style "color: #e5e9f0;" :onclick "mpc -q stop" "")
|
||||
(button :style "color: #eceff4;" :onclick "mpc -q next && notify-send -u low -t 1800 ${music_current}" "")
|
||||
(button :style "color: #e8e8e8;" :onclick "mpc -q prev && notify0send -u low -t 1800 ${music_current}" ""))))
|
||||
|
||||
(defwidget network []
|
||||
|
||||
(box :orientation "v" :space-evenly false :class "network" :halign "center" :valign "center" :hexpand true :vexpand true
|
||||
(label :class "label-control" :text "${ssid}" :halign "center" :limit-width 50 :show-truncated true :hexpand true :vexpand true)
|
||||
(box :orientation "h" :space-evenly false :class "controls" :halign "center" :valign "center" :spacing 20
|
||||
(button :style "color: #d8dee9;" :onclick "sh ~/.config/eww/scripts/airplane_mode.sh" "")
|
||||
(button :style "color: #e5e9f0;" :onclick "alacritty --class 'alacritty-float,alacritty-float' -e bmon &" "")
|
||||
(button :style "color: #eceff4;" :onclick "alacritty --class 'alacritty-float,alacritty-float' -e nmtui &" "")
|
||||
(button :style "color: #e8e8e8;" :onclick "nm-connection-editor &" ""))))
|
||||
|
||||
(defwidget screenshot []
|
||||
|
||||
(box :orientation "v" :space-evenly false :class "network" :halign "center" :valign "center" :hexpand true :vexpand true
|
||||
(label :class "label-control" :text " Screenshot" :halign "center" :limit-width 50 :show-truncated true :hexpand true :vexpand true)
|
||||
(box :orientation "h" :space-evenly false :class "controls" :halign "center" :valign "center" :spacing 20
|
||||
(button :style "color: #d8dee9;" :onclick "eww close screenshot && ~/.config/eww/scripts/screenshot 'SCREEN'" "")
|
||||
(button :style "color: #e5e9f0;" :onclick "eww close screenshot && ~/.config/eww/scripts/screenshot 'SELECT'" ""))))
|
||||
191
modules/wm/hyprland/config/eww/eww_windows.yuck
Normal file
191
modules/wm/hyprland/config/eww/eww_windows.yuck
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
; -> WINDOWS FOR EWW WIDGETS <- ;
|
||||
|
||||
;;;; IMPORTS
|
||||
(include "/home/horseman/.config/eww/eww_widgets.yuck")
|
||||
|
||||
;;;; Fetch widget window
|
||||
|
||||
(defwindow fetch
|
||||
:wm-ignore: true
|
||||
:monitor 0
|
||||
:windowtype "dock"
|
||||
:geometry (geometry :x "20px"
|
||||
:y "65px"
|
||||
:width "170px"
|
||||
:height "200px"
|
||||
:anchor "top left")
|
||||
(uinfo))
|
||||
|
||||
;;;; System information window
|
||||
|
||||
(defwindow sys
|
||||
:class "cpu-win"
|
||||
:wm-ignore true
|
||||
:monitor 0
|
||||
:windowtype "dock"
|
||||
:geometry (geometry :x "200px"
|
||||
:y "275px"
|
||||
:width "170px"
|
||||
:height "48px"
|
||||
:anchor "top left")
|
||||
(sys))
|
||||
|
||||
;;;; Random Quotes
|
||||
|
||||
(defwindow quote
|
||||
:wm-ignore true
|
||||
:monitor 0
|
||||
:windowtype "dock"
|
||||
:geometry (geometry :x "200px"
|
||||
:y "65px"
|
||||
:width "170px"
|
||||
:height "200px"
|
||||
:anchor "top left")
|
||||
(quote))
|
||||
|
||||
;;;; Quicksettings window
|
||||
|
||||
(defwindow quicksettings
|
||||
:wm-ignore true
|
||||
:monitor 0
|
||||
:windowtype "dock"
|
||||
:geometry (geometry :x "20px"
|
||||
:y "275px"
|
||||
:width "170px"
|
||||
:height "50px"
|
||||
:anchor "top left")
|
||||
(quicksettings))
|
||||
|
||||
;;;; Favorite applications
|
||||
|
||||
(defwindow appbar
|
||||
:wm-ignore true
|
||||
:monitor 0
|
||||
:windowtype "dock"
|
||||
:geometry (geometry :x "20"
|
||||
:y "335px"
|
||||
:width "170px"
|
||||
:height "70px"
|
||||
:anchor "top left")
|
||||
(appbar))
|
||||
|
||||
;;;; Big Calendar Window
|
||||
|
||||
(defwindow calendar
|
||||
:wm-ignore: true
|
||||
:monitor 0
|
||||
:windowtype "dock"
|
||||
:geometry (geometry :x "20px"
|
||||
:y "415px"
|
||||
:width "240px"
|
||||
:height "160px"
|
||||
:anchor "top left")
|
||||
(cal))
|
||||
|
||||
;;;; Favorite Locations Window
|
||||
|
||||
(defwindow favorites
|
||||
:wm-ignore: true
|
||||
:monitor 0
|
||||
:windowtype "dock"
|
||||
:geometry (geometry :x "270px"
|
||||
:y "415px"
|
||||
:width "100px"
|
||||
:height "160px"
|
||||
:anchor "top left")
|
||||
(favorites))
|
||||
|
||||
;;;; Small date Window
|
||||
|
||||
(defwindow smalldate
|
||||
:wm-ignore: true
|
||||
:monitor 0
|
||||
:windowtype "dock"
|
||||
:geometry (geometry :x "270px"
|
||||
:y "580px"
|
||||
:width "100px"
|
||||
:height "39px"
|
||||
:anchor "top left")
|
||||
(smalldate))
|
||||
|
||||
;;;; Background Container Window
|
||||
(defwindow bg
|
||||
:class "bg"
|
||||
:wm-ignore true
|
||||
:monitor 0
|
||||
:windowtype "dock"
|
||||
:geometry (geometry :x "5px"
|
||||
:y "40px"
|
||||
:width "380px"
|
||||
:height "800px"
|
||||
:anchor "top left")
|
||||
(bg))
|
||||
|
||||
;;;; TODO Notes window
|
||||
(defwindow notes
|
||||
:wm-ignore: true
|
||||
:monitor 0
|
||||
:windowtype "dock"
|
||||
:geometry (geometry :x "20px"
|
||||
:y "630px"
|
||||
:width "350px"
|
||||
:height "100px"
|
||||
:anchor "top left")
|
||||
(notes))
|
||||
|
||||
;;;; Searching Windows
|
||||
|
||||
(defwindow searchapps
|
||||
:wm-ignore: true
|
||||
:monitor 0
|
||||
:windowtype "normal"
|
||||
:geometry (geometry :x "40%"
|
||||
:y "30%"
|
||||
:width "20%"
|
||||
:height "50%"
|
||||
:anchor "top left")
|
||||
(searchapps))
|
||||
|
||||
(defwindow bigpowermenu
|
||||
:wm-ignore true
|
||||
:monitor 0
|
||||
:windowtype "dock"
|
||||
:geometry (geometry :x "0px"
|
||||
:y "0%"
|
||||
:width "20%"
|
||||
:height "10%"
|
||||
:anchor "center center")
|
||||
(bigpowermenu))
|
||||
|
||||
(defwindow musicplayer
|
||||
:wm-ignore true
|
||||
:monitor 0
|
||||
:windowtype "dock"
|
||||
:geometry (geometry :x "0px"
|
||||
:y "0%"
|
||||
:width "20%"
|
||||
:height "10%"
|
||||
:anchor "center center")
|
||||
(musicplayer))
|
||||
|
||||
(defwindow network
|
||||
:wm-ignore true
|
||||
:monitor 0
|
||||
:windowtype "dock"
|
||||
:geometry (geometry :x "0px"
|
||||
:y "0%"
|
||||
:width "20%"
|
||||
:height "10%"
|
||||
:anchor "center center")
|
||||
(network))
|
||||
|
||||
(defwindow screenshot
|
||||
:wm-ignore true
|
||||
:monitor 0
|
||||
:windowtype "dock"
|
||||
:geometry (geometry :x "0px"
|
||||
:y "0%"
|
||||
:width "20%"
|
||||
:height "10%"
|
||||
:anchor "center center")
|
||||
(screenshot))
|
||||
7
modules/wm/hyprland/config/eww/scripts/airplane_mode.sh
Normal file
7
modules/wm/hyprland/config/eww/scripts/airplane_mode.sh
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
status=$(nmcli n)
|
||||
if [[ "$status" == "enabled" ]]; then
|
||||
nmcli n off
|
||||
else
|
||||
nmcli n on
|
||||
fi
|
||||
3
modules/wm/hyprland/config/eww/scripts/quote.sh
Executable file
3
modules/wm/hyprland/config/eww/scripts/quote.sh
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "\"The futility of lighting birthday candles to immediately blow them out is one reason why I find children's birthday parties unpractical.\""
|
||||
41
modules/wm/hyprland/config/eww/scripts/screenshot
Normal file
41
modules/wm/hyprland/config/eww/scripts/screenshot
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
time=`date +%Y-%m-%d-%I-%M-%S`
|
||||
geometry=`xrandr | head -n1 | cut -d',' -f2 | tr -d '[:blank:],current'`
|
||||
dir="`xdg-user-dir PICTURES`/Screenshots"
|
||||
file="Screenshot_${time}_${geometry}.png"
|
||||
|
||||
# notify
|
||||
notify_user () {
|
||||
if [[ -e "$dir/$file" ]]; then
|
||||
dunstify -u low --replace=699 -i /usr/share/archcraft/icons/dunst/picture.png "Saved in $dir"
|
||||
else
|
||||
dunstify -u low --replace=699 -i /usr/share/archcraft/icons/dunst/picture.png "Screenshot Deleted."
|
||||
fi
|
||||
}
|
||||
|
||||
# take shots
|
||||
shotnow () {
|
||||
cd ${dir} && sleep 0.5 && maim -u -f png "$file" && viewnior ${dir}/"$file"
|
||||
notify_user
|
||||
}
|
||||
|
||||
shotarea () {
|
||||
cd ${dir} && maim -u -f png -s -b 2 -c 0.35,0.55,0.85,0.25 -l "$file" && viewnior ${dir}/"$file"
|
||||
notify_user
|
||||
}
|
||||
|
||||
if [[ ! -d "$dir" ]]; then
|
||||
mkdir -p "$dir"
|
||||
fi
|
||||
|
||||
chosen="$1"
|
||||
case $chosen in
|
||||
"SCREEN")
|
||||
shotnow
|
||||
;;
|
||||
"SELECT")
|
||||
shotarea
|
||||
;;
|
||||
esac
|
||||
|
||||
8
modules/wm/hyprland/config/eww/scripts/search.sh
Normal file
8
modules/wm/hyprland/config/eww/scripts/search.sh
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
list=$(ls /usr/bin/ | grep -m 10 -i "$1")
|
||||
buf=""
|
||||
for l in $list ; do
|
||||
buf="$buf (button :class \"item\" :onclick \"$l &\" \"$l\")"
|
||||
done
|
||||
echo "(box :orientation \"v\" :spacing 5 :class \"apps\" :halign \"center\" :valign \"center\" $buf)" > ~/.config/eww/scripts/search_items.txt
|
||||
|
||||
5
modules/wm/hyprland/config/eww/scripts/uptime.sh
Executable file
5
modules/wm/hyprland/config/eww/scripts/uptime.sh
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
uptime=$(($(date +%s) - $(date +%s -d "$(last reboot | head -n 1 | sed -e 's/reboot system boot ...... //; s/still running//')")));
|
||||
|
||||
echo $((uptime / 3600 % 60))h $((uptime / 60 % 60))m
|
||||
Loading…
Add table
Add a link
Reference in a new issue