Init
This commit is contained in:
117
.config/eww/eww.scss
Executable file
117
.config/eww/eww.scss
Executable file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
*
|
||||
* Catppuccin Frappe palette
|
||||
* Maintainer: rubyowo
|
||||
*
|
||||
*/
|
||||
|
||||
$base: #303446;
|
||||
$mantle: #292c3c;
|
||||
$crust: #232634;
|
||||
|
||||
$text: #c6d0f5;
|
||||
$subtext0: #a5adce;
|
||||
$subtext1: #b5bfe2;
|
||||
|
||||
$surface0: #414559;
|
||||
$surface1: #51576d;
|
||||
$surface2: #626880;
|
||||
|
||||
$overlay0: #737994;
|
||||
$overlay1: #838ba7;
|
||||
$overlay2: #949cbb;
|
||||
|
||||
$blue: #8caaee;
|
||||
$lavender: #babbf1;
|
||||
$sapphire: #85c1dc;
|
||||
$sky: #99d1db;
|
||||
$teal: #81c8be;
|
||||
$green: #a6d189;
|
||||
$yellow: #e5c890;
|
||||
$peach: #ef9f76;
|
||||
$maroon: #ea999c;
|
||||
$red: #e78284;
|
||||
$mauve: #ca9ee6;
|
||||
$pink: #f4b8e4;
|
||||
$flamingo: #eebebe;
|
||||
$rosewater: #f2d5cf;
|
||||
|
||||
/*
|
||||
* Author: Keule2
|
||||
* Created: 23.09.2023
|
||||
*/
|
||||
|
||||
/*****************/
|
||||
/* Defaults */
|
||||
/*****************/
|
||||
* {
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
font-family: "FiraCode Nerd Font Mono";
|
||||
font-weight: bold;
|
||||
font-size: 13px;
|
||||
color: $text;
|
||||
}
|
||||
|
||||
window {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
tooltip{
|
||||
background: $surface0;
|
||||
border: solid 2px $sapphire;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 2px;
|
||||
margin: 4px 2px;
|
||||
}
|
||||
|
||||
.widget {
|
||||
border: solid 2px $sapphire;
|
||||
background: $surface1;
|
||||
padding: 0px 5px;
|
||||
margin: 2px;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/*****************/
|
||||
/* Root */
|
||||
/*****************/
|
||||
.bar1, .bar2, .bar3{
|
||||
background-color: rgba(65, 69, 89, 0.8);
|
||||
border-top-left-radius: 0px;
|
||||
border-top-right-radius: 0px;
|
||||
}
|
||||
|
||||
.root {
|
||||
margin: 2px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
/*****************/
|
||||
/* Cutom widgets */
|
||||
/*****************/
|
||||
/* Player */
|
||||
.Playing {
|
||||
color: $sapphire;
|
||||
}
|
||||
|
||||
/* Session */
|
||||
.session {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
/* Workspaces */
|
||||
.workspace_entry {
|
||||
padding: 2px 5px;
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
.workspace_entry.current {
|
||||
background: $overlay0;
|
||||
}
|
||||
|
||||
.workspace_entry_p:hover .workspace_entry{
|
||||
background: $overlay2;
|
||||
}
|
||||
216
.config/eww/eww.yuck
Executable file
216
.config/eww/eww.yuck
Executable file
@@ -0,0 +1,216 @@
|
||||
;; TODO Update workspaces only when workspaces updated
|
||||
;; TODO Camera access, Microphone access,.... -> indicator-mic-cam
|
||||
(defwindow bar1
|
||||
:monitor 0
|
||||
:geometry (geometry :x "0%"
|
||||
:y "0px"
|
||||
:width "100%"
|
||||
:height "35px"
|
||||
:anchor "top center")
|
||||
:stacking "fg"
|
||||
:exclusive true
|
||||
:focusable false
|
||||
|
||||
(content)
|
||||
)
|
||||
|
||||
(defwindow bar2
|
||||
:monitor 1
|
||||
:geometry (geometry :x "0%"
|
||||
:y "0px"
|
||||
:width "100%"
|
||||
:height "35px"
|
||||
:anchor "top center")
|
||||
:stacking "fg"
|
||||
:exclusive true
|
||||
:focusable false
|
||||
|
||||
(content)
|
||||
)
|
||||
|
||||
(defwindow bar3
|
||||
:monitor 2
|
||||
:geometry (geometry :x "0%"
|
||||
:y "0px"
|
||||
:width "100%"
|
||||
:height "35px"
|
||||
:anchor "top center")
|
||||
:stacking "fg"
|
||||
:exclusive true
|
||||
:focusable false
|
||||
|
||||
(content)
|
||||
)
|
||||
|
||||
|
||||
(defwidget content []
|
||||
(centerbox :orientation "h" :class "root"
|
||||
(box :space-evenly false :halign "start"
|
||||
(workspaces)
|
||||
(window_w)
|
||||
)
|
||||
(time :halign "center")
|
||||
(box :space-evenly false :halign "end"
|
||||
(systray :class "widget systray")
|
||||
(player)
|
||||
(cpu)
|
||||
(memory)
|
||||
(network)
|
||||
(battery)
|
||||
(audio)
|
||||
(session)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;;PLAYER
|
||||
(deflisten MUSIC :initial "" "playerctl -a metadata --follow --format '{\"text\":\"{{artist}} - {{markup_escape(title)}}\", \"state\":\"{{status}}\"}' || true")
|
||||
(defwidget player []
|
||||
(box :class "widget"
|
||||
(eventbox
|
||||
:onclick "playerctl play-pause"
|
||||
:onmiddleclick "playerctl previous"
|
||||
:onrightclick "playerctl next"
|
||||
(label :tooltip "${MUSIC.text}" :class "${MUSIC.state}" :text " ")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;;CPU
|
||||
(defwidget cpu []
|
||||
(box :class "widget"
|
||||
(label :text "${round(EWW_CPU.avg, 0)}% ")
|
||||
)
|
||||
)
|
||||
|
||||
;;Memory
|
||||
(defwidget memory []
|
||||
(box :class "widget"
|
||||
(label :text "${round(EWW_RAM.used_mem / (1024*1024*1024), 1)} " :tooltip "${round(EWW_RAM.used_mem_perc, 0)}%")
|
||||
)
|
||||
)
|
||||
|
||||
;;Network
|
||||
(defpoll IS_WIRELESS :interval "10s" "~/.config/eww/scripts/net.sh iswlan")
|
||||
(defpoll NET_INT :interval "10s" "~/.config/eww/scripts/net.sh getint")
|
||||
(defpoll NET_NAME :interval "10s" "~/.config/eww/scripts/net.sh ssid")
|
||||
(defwidget network []
|
||||
(box :class "widget"
|
||||
(eventbox :onclick "nm-connection-editor & disown"
|
||||
(label :text "${round(EWW_NET[NET_INT].NET_UP / 1000, 1)}kB/s⇡ ${round(EWW_NET[NET_INT].NET_DOWN / 1000, 1)}kB/s⇣ ${IS_WIRELESS? "" : ""}" :tooltip "${NET_INT} ${IS_WIRELESS? ":${NET_NAME}" : ""}")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defpoll BAT_INFO :interval "1m" "~/.config/eww/scripts/battery.sh")
|
||||
(defwidget battery []
|
||||
(box :class "widget" :visible "${BAT_INFO.has_battery}"
|
||||
(label :text "${BAT_INFO.percentage}"
|
||||
:tooltip "${BAT_INFO.time_remaining}"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defwindow battery_warning
|
||||
:monitor 0
|
||||
:exclusive "false"
|
||||
:stacking "overlay"
|
||||
:geometry (geometry :anchor "center"
|
||||
:width "10%"
|
||||
:height "10%")
|
||||
(box :class "widget" :orientation "v"
|
||||
(label :text "${BAT_INFO.percentage}!"
|
||||
:tooltip "${BAT_INFO.time_remaining}"
|
||||
)
|
||||
(button :onclick "${EWW_CMD} close battery_warning"
|
||||
(label :text "")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;;Audio
|
||||
(defpoll DEF_SINK :interval "10s" "~/.config/eww/scripts/audio.sh getdefaultsink")
|
||||
(defpoll IS_MUTED_SOURCE :interval "10s" "~/.config/eww/scripts/audio.sh ismutedsource @DEFAULT_SOURCE@")
|
||||
(defpoll IS_MUTED_SINK :interval "10s" "~/.config/eww/scripts/audio.sh ismutedsink @DEFAULT_SINK@")
|
||||
(defpoll IS_BLUE :interval "10s" "~/.config/eww/scripts/audio.sh isblue @DEFAULT_SINK@")
|
||||
(defpoll VOLUME_SOURCE :interval "10s" "~/.config/eww/scripts/audio.sh getvol @DEFAULT_SOURCE@")
|
||||
(defpoll VOLUME_SINK :interval "10s" "~/.config/eww/scripts/audio.sh getvol @DEFAULT_SINK@")
|
||||
(defwidget audio []
|
||||
(box :class "widget"
|
||||
(eventbox
|
||||
:onclick "${EWW_CMD} open audio_popup"
|
||||
:onmiddleclick "~/.config/eww/scripts/audio.sh mutesink @DEFAULT_SINK@"
|
||||
:onrightclick "~/.config/eww/scripts/audio.sh mutesource @DEFAULT_SOURCE@"
|
||||
:onscroll "~/.config/eww/scripts/audio.sh vol {}"
|
||||
|
||||
(label :text "${IS_MUTED_SINK? " ": "${round(VOLUME_SINK * 100, 0)}%"}${IS_BLUE? "" : ""} ${IS_MUTED_SOURCE? "" : "${round(VOLUME_SOURCE * 100, 0)}%"}"
|
||||
:tooltip "${DEF_SINK}"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defwindow audio_popup
|
||||
:monitor 0
|
||||
:exclusive "false"
|
||||
:stacking "overlay"
|
||||
:geometry (geometry :anchor "top right")
|
||||
(audio_menu)
|
||||
)
|
||||
|
||||
(defpoll audio_device :interval "10s" "~/.config/eww/scripts/audio.sh getdevices")
|
||||
(defwidget audio_menu []
|
||||
(eventbox :onhoverlost "${EWW_CMD} close audio_popup"
|
||||
(box :class "widget" :orientation "v"
|
||||
(for dev in audio_device
|
||||
(button :onclick "pactl set-default-sink ${dev.id} & ${EWW_CMD} close audio_popup"
|
||||
(label :text "${dev.name == DEF_SINK? "" : ""} ${dev.name}")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;;Session
|
||||
(defwidget session []
|
||||
(box :class "widget"
|
||||
(eventbox :onclick "swaync-client -t -sw"
|
||||
(label :class "session" :text "")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; Time/Date
|
||||
(defpoll TIME :interval "5s" `date +\"%H:%M\"`)
|
||||
(defpoll DATE :interval "1m" `date +\"%d.%m.%Y\"`)
|
||||
|
||||
(defwidget time []
|
||||
(box :class "widget" :space-evenly false
|
||||
(eventbox :onclick "merkuro-calendar & disown"
|
||||
(label :text "${TIME} ${DATE} ")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; Active Window Title
|
||||
(deflisten window :initial "..." "sh ~/.config/eww/scripts/get_window_title.sh")
|
||||
(defwidget window_w []
|
||||
(box :class "widget" :visible {window != ""}
|
||||
(label :limit-width 85 :text "${window}")
|
||||
)
|
||||
)
|
||||
|
||||
;; Workspaces
|
||||
(deflisten workspaces :initial "[]" "bash ~/.config/eww/scripts/get_workspaces.sh")
|
||||
(deflisten current_workspace :initial "1" "bash ~/.config/eww/scripts/get_active_workspace.sh")
|
||||
(defwidget workspaces []
|
||||
(box :class "widget workspaces" :space-evenly false
|
||||
(for workspace in workspaces
|
||||
(eventbox :onclick "hyprctl dispatch workspace ${workspace.id}" :class "workspace_entry_p"
|
||||
(box :class "workspace_entry ${workspace.id == current_workspace ? "current" : ""} ${workspace.windows > 0 ? "occupied" : "empty"}"
|
||||
(label :class "test" :text "${workspace.id}")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
76
.config/eww/scripts/audio.sh
Executable file
76
.config/eww/scripts/audio.sh
Executable file
@@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
echo "Usage:
|
||||
$0 <action> <sink|source>
|
||||
actions: vol"
|
||||
}
|
||||
|
||||
if [ -z $1 ]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z $2 ] && [ "$1" != "getdevices" ] && [ "$1" != "getdefaultsink" ]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
vol() {
|
||||
if [ "$1" == "up" ]; then
|
||||
vol="5%+"
|
||||
else
|
||||
vol="5%-"
|
||||
fi
|
||||
|
||||
wpctl set-volume @DEFAULT_SINK@ $vol
|
||||
eww update VOLUME_SINK=$(getvol @DEFAULT_SINK@)
|
||||
}
|
||||
|
||||
getvol() {
|
||||
wpctl get-volume $1 | awk '{print $2}'
|
||||
}
|
||||
|
||||
ismutedsource() {
|
||||
pactl get-source-mute $1 | awk '{print ($2 == "no"? "false" : "true")}'
|
||||
}
|
||||
|
||||
ismutedsink() {
|
||||
pactl get-sink-mute $1 | awk '{print ($2 == "no"? "false" : "true")}'
|
||||
}
|
||||
|
||||
mutesink() {
|
||||
pactl set-sink-mute $1 toggle
|
||||
eww update IS_MUTED_SINK=$(ismutedsink $1)
|
||||
}
|
||||
|
||||
mutesource() {
|
||||
pactl set-source-mute $1 toggle
|
||||
eww update IS_MUTED_SOURCE=$(ismutedsource $1)
|
||||
}
|
||||
|
||||
isblue() {
|
||||
wpctl inspect $1 | grep api.bluez -q -m 1 && echo true || echo false
|
||||
}
|
||||
|
||||
if [ "$1" == "getdevices" ]; then
|
||||
pactl -f json list sinks | jq -Mc '[.[] | {id: .index, name: .description, mute: .mute, default: (.state == "RUNNING")}]'
|
||||
elif [ "$1" == "vol" ]; then
|
||||
vol $2
|
||||
elif [ "$1" == "getvol" ]; then
|
||||
getvol $2
|
||||
elif [ "$1" == "ismutedsource" ]; then
|
||||
ismutedsource $2
|
||||
elif [ "$1" == "ismutedsink" ]; then
|
||||
ismutedsink $2
|
||||
elif [ "$1" == "mutesink" ]; then
|
||||
mutesink $2
|
||||
elif [ "$1" == "mutesource" ]; then
|
||||
mutesource $2
|
||||
elif [ "$1" == "isblue" ]; then
|
||||
isblue $2
|
||||
elif [ "$1" == "getdefaultsink" ]; then
|
||||
wpctl inspect @DEFAULT_SINK@ | grep 'node.description' | awk -F ' = ' '{print $2}' | sed 's/\"//g'
|
||||
else
|
||||
usage
|
||||
fi
|
||||
28
.config/eww/scripts/battery.sh
Executable file
28
.config/eww/scripts/battery.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
bat=$(upower -e | grep BAT)
|
||||
|
||||
if [ -z $bat ]; then
|
||||
echo '{}' | jq -Mc ".has_battery = false"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
upower=$(upower -i $bat)
|
||||
|
||||
get_percentage() {
|
||||
echo "$1" | grep percentage | awk '{print $2}'
|
||||
}
|
||||
|
||||
get_time_remaining() {
|
||||
echo "$1" | grep "time to empty" | awk -F: '{print $2}'
|
||||
}
|
||||
|
||||
get_icon_name() {
|
||||
echo "$1" | grep icon-name | awk '{print $2}'
|
||||
}
|
||||
|
||||
is_charging() {
|
||||
echo "$1" | grep state | awk '{print $2}'
|
||||
}
|
||||
|
||||
echo '{}' | jq -Mc ".has_battery = true | .percentage = \"$(get_percentage "$upower")\" | .time_remaining= \"$(get_time_remaining "$upower")\" | .is_charging = \"$(is_charging "$upower")\" | .icon_name = \"$(get_icon_name "$upower")\" "
|
||||
21
.config/eww/scripts/change_active_workspace.sh
Executable file
21
.config/eww/scripts/change_active_workspace.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#! /bin/bash
|
||||
function clamp {
|
||||
min=$1
|
||||
max=$2
|
||||
val=$3
|
||||
python -c "print(max($min, min($val, $max)))"
|
||||
}
|
||||
|
||||
direction=$1
|
||||
current=$2
|
||||
if test "$direction" = "down"
|
||||
then
|
||||
target=$(clamp 1 10 $(($current+1)))
|
||||
echo "jumping to $target"
|
||||
hyprctl dispatch workspace $target
|
||||
elif test "$direction" = "up"
|
||||
then
|
||||
target=$(clamp 1 10 $(($current-1)))
|
||||
echo "jumping to $target"
|
||||
hyprctl dispatch workspace $target
|
||||
fi
|
||||
6
.config/eww/scripts/get_active_workspace.sh
Executable file
6
.config/eww/scripts/get_active_workspace.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
hyprctl monitors -j | jq '.[] | select(.focused) | .activeWorkspace.id'
|
||||
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - |
|
||||
stdbuf -o0 awk -F '>>|,' -e '/^workspace>>/ {print $2}' -e '/^focusedmon>>/ {print $3}'
|
||||
3
.config/eww/scripts/get_window_title.sh
Executable file
3
.config/eww/scripts/get_window_title.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
hyprctl activewindow -j | jq --raw-output .title
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 awk -F '>>|,' '/^activewindow>>/{print $3}'
|
||||
10
.config/eww/scripts/get_workspaces.sh
Executable file
10
.config/eww/scripts/get_workspaces.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
spaces (){
|
||||
hyprctl workspaces -j | jq -Mc '[.[] | {id: (.id | tostring), windows: (.windows | tostring)}] | sort_by(.id)'
|
||||
}
|
||||
|
||||
spaces
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do
|
||||
spaces
|
||||
done
|
||||
20
.config/eww/scripts/get_yt_media_art.sh
Executable file
20
.config/eww/scripts/get_yt_media_art.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
url=$(cat ~/.config/YouTube\ Music/config.json | jq --raw-output .url)
|
||||
if [ -z "$url" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
id="${url##*?v=}"
|
||||
id="${id%%&*}"
|
||||
|
||||
#https://img.youtube.com/vi/$id/[option].jpg
|
||||
#0
|
||||
#1
|
||||
#mqdefault
|
||||
#hqdefault
|
||||
#sddefault
|
||||
#maxresdefault
|
||||
url="https://img.youtube.com/vi/$id/sddefault.jpg"
|
||||
|
||||
curl -o ~/.config/eww/medi_art.jpg "$url"
|
||||
63
.config/eww/scripts/net.sh
Executable file
63
.config/eww/scripts/net.sh
Executable file
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 <func> [args]
|
||||
func: islowest[INT], iswlan, ssid"
|
||||
}
|
||||
|
||||
if [ -z $1 ]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
getlowest() {
|
||||
lines=$(ip route | grep default)
|
||||
|
||||
# Initialize variables to store the highest metric and interface
|
||||
lowest_metric=99999999999
|
||||
lowest_interface=""
|
||||
|
||||
# Loop through the lines and compare metrics
|
||||
while IFS= read -r line; do
|
||||
interface=$(echo "$line" | awk '{print $5}')
|
||||
metric=$(echo "$line" | awk '{for(i=1;i<=NF;i++) if($i=="metric") print $(i+1)}')
|
||||
|
||||
if [ "$metric" -lt "$lowest_metric" ]; then
|
||||
lowest_metric="$metric"
|
||||
lowest_interface="$interface"
|
||||
fi
|
||||
done <<< "$lines"
|
||||
|
||||
echo "$lowest_interface"
|
||||
}
|
||||
|
||||
islowest() {
|
||||
if [ "$(getlowest)" == "$1" ]; then
|
||||
echo "true"
|
||||
else
|
||||
echo "false"
|
||||
fi
|
||||
}
|
||||
|
||||
iswlan(){
|
||||
int=$(nmcli -t -f active,ssid,device dev wifi | grep -m 1 yes | awk -F ':' '{print $3}')
|
||||
|
||||
if ! [ -z $int ]; then
|
||||
islowest $int
|
||||
else
|
||||
echo "false"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$1" == "iswlan" ]; then
|
||||
iswlan
|
||||
elif [ "$1" == "islowest" ]; then
|
||||
islowest $2
|
||||
elif [ "$1" == "getint" ]; then
|
||||
getlowest
|
||||
elif [ "$1" == "ssid" ]; then
|
||||
nmcli -t -f active,ssid dev wifi | grep -m 1 yes | awk -F: '{print $2}'
|
||||
else
|
||||
usage
|
||||
fi
|
||||
Reference in New Issue
Block a user