refresh dotfiles

This commit is contained in:
Fabio Lenherr 2022-09-19 15:06:41 +02:00
parent f2684e3cc3
commit a54e94bbb0
No known key found for this signature in database
GPG key ID: 868FFD689D878939
26 changed files with 506 additions and 552 deletions

View file

@ -484,3 +484,150 @@ color: #bfc9db;
margin : 0px 0px 0px 0px;
}
//cockpit stuff
.cockpit_class {
all: unset;
}
.cockpit_clock {
padding: 0px 30px 0px 30px;
}
.cockpit_box {
background-color: #06060b;
border-radius: 10px;
margin: 5px;
padding: 0px 5px 0px 5px;
opacity: 0.85;
}
.cockpit_button_shutdown {
color: red;
font-size: 40px;
margin: 0px 5px -30px 5px;
}
.cockpit_button_sleep {
color: blue;
font-size: 40px;
margin: 0px 5px -30px 5px;
}
.cockpit_button_restart {
color: green;
font-size: 40px;
margin: 0px 5px -30px 5px;
}
.song_info {
margin: -50px 0px 0px 0px;
font-size: 20px;
color: grey;
}
.album_cover {
margin: -60px 10px 20px 10px;
padding: 0px;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
border-radius: 10px;
}
.cockpit_button_settings {
color: #D35D6E;
font-size: 35px;
margin: -30px 5px 0px 5px;
}
.weather-icon {
font-size: 80px;
margin: 10px 0px 35px 25px;
font-family: Iosevka;
}
.weather-stat {
font-size: 30px;
font-weight: bold;
color: #D35D6E;
margin: -20px 0px 10px 0px;
}
.temperature {
color: grey;
font-size: 48px;
font-weight: 900;
margin: 0px 0px 0px 20px;
}
.weather-quote {
margin: 30px -5px 0px 20px;
font-size: 20px;
}
.weather-quote-head, .weather-quote-tail {
color: grey;
font-size: 18px;
margin: 10px 0px 10px 10px;
}
.cockpit_clock_left {
font-size: 50px;
font-weight: bold;
color: #D35D6E;
margin: 5px -20px -30px 0px;
}
.cockpit_clock_right {
font-size: 50px;
font-weight: bold;
color: #D35D6E;
margin: 5px 0px -30px -20px;
}
.cockpit_date {
font-size: 50px;
font-weight: bold;
color: #D35D6E;
margin: -30px -20px 0px -20px;
}
.cockpit_clock_sep {
font-size: 40px;
font-weight: bold;
color: #D35D6E;
margin: 0px -20px -30px -20px;
}
.cockpit_docs {
color: red;
font-size: 30px;
margin: 10px 0px -10px 0px;
}
.cockpit_pics {
color: green;
font-size: 30px;
margin: 0px 0px 0px 0px;
padding: 0px;
}
.cockpit_gits {
color: blue;
font-size: 30px;
margin: -20px 0px 10px 0px;
}
.cockpit_sep_bottom {
color: #38384d;
font-size: 18;
margin : -10px 0px 0px 0px;
padding: 0px;
}
.cockpit_sep_top {
color: #38384d;
font-size: 18;
margin : 0px 0px -10px 0px;
padding: 0px;
}

View file

@ -9,9 +9,9 @@
(defpoll brightness_percent :interval "5s" "brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}' | tr -d '%'")
;; battery definitions ;;
(defpoll battery_status :interval "1m" "./scripts/battery stat")
(defpoll battery-capacity :interval "1m" "scripts/battery percent")
(defpoll battery :interval "1m" "scripts/battery icon")
(defpoll battery_status :interval "5s" "./scripts/battery stat")
(defpoll battery-capacity :interval "5s" "scripts/battery percent")
(defpoll battery :interval "5s" "scripts/battery icon")
;; memory definitions ;;
(defpoll memory :interval "15s" "scripts/memory")
@ -25,11 +25,8 @@
(defpoll WLAN_ICON :interval "1m" "~/.config/eww/scripts/wifi --ICON")
;; music definitions ;;
;;(defpoll song :interval "2s" "~/.config/eww/scripts/music_info --song")
;;(defpoll song_artist :interval "2s" "~/.config/eww/scripts/music_info --artist")
;;(defpoll current_status :interval "1s" "~/.config/eww/scripts/music_info --time")
;;(defpoll song_status :interval "2s" "~/.config/eww/scripts/music_info --status")
;;(defpoll cover_art :interval "2s" "~/.config/eww/scripts/music_info --cover")
(defpoll Song_info :interval "2s" "scripts/music_control")
(defpoll Thumbnail :interval "2s" "scripts/music_control2")
;; current window ;;
;;(defpoll currentWindow :interval "100ms" "hyprctl activewindow | grep class | awk -F ':' '{ print $2 }'")
@ -38,6 +35,14 @@
(defpoll calendar_day :interval "20h" "date '+%d'")
(defpoll calendar_year :interval "20h" "date '+%Y'")
;; Weather vars
(defpoll weather-interval :interval "20m" "scripts/weather")
(defpoll weather-icon :interval "20m" "cat ~/.cache/weather/weather-icon")
(defpoll temperature :interval "20m" "cat ~/.cache/weather/weather-degree")
(defpoll weather-hex :interval "20m" "cat ~/.cache/weather/weather-hex")
(defpoll weather-stat :interval "20m" "cat ~/.cache/weather/weather-stat")
(defpoll weather-stat-side :interval "20m" "~/.config/eww/scripts/weather-trimmer")
(defpoll weather-quote :interval "20m" "~/.config/eww/scripts/getwethquote")
;; simple variables ;;
(defvar eww "$HOME/.local/bin/eww -c $HOME/.config/eww")
@ -327,6 +332,56 @@
:show_truncated false
:wrap false))))))
;; cockpit widget ;;
(defwidget cockpit []
(box :orientation "h"
(box :class "cockpit_class"
:orientation "h"
(box :orientation "v"
(box :class "cockpit_box" :orientation "v"
(box
(button :class "cockpit_button_shutdown" :onclick "hyprctl dispatch exec 'shutdown now'" "")
(button :class "cockpit_button_restart" :onclick "hyprctl dispatch exec reboot" "")
(button :class "cockpit_button_sleep" :onclick "hyprctl dispatch exec 'playerctl -a pause & swaylock -c 000000 & systemctl suspend'" ""))
(label :text "" :class "audio_sep" :halign "center")
(box
(button :class "cockpit_button_settings" :onclick "hyprctl dispatch exec 'pavucontrol'" "")
(button :class "cockpit_button_settings" :onclick "scripts/change-audio bluetooth" "")))
(box :class "cockpit_box" :orientation "v"
(button :class "cockpit_docs" :onclick "hyprctl dispatch exec nautilus $HOME/Documents" "Documents ")
(label :text "" :class "cockpit_sep_top" :halign "center")
(button :class "cockpit_pics" :onclick "hyprctl dispatch exec nautilus $HOME/Pictures" "Pictures ")
(label :text "" :class "cockpit_sep_bottom" :halign "center")
(button :class "cockpit_gits" :onclick "hyprctl dispatch exec 'alacritty --working-directory $HOME/gits'" "gits ")))
(box :orientation "v"
(box :class "cockpit_box" :orientation "v"
(box :class "cockpit_clock"
(label :text clock_time :class "cockpit_clock_left" )
(label :text "" :class "cockpit_clock_sep" )
(label :text clock_minute :class "cockpit_clock_right"))
(label :text "" :class "audio_sep" :halign "center")
(box :class "cockpit_clock"
(label :text clock_date :class "cockpit_date")
))
(box :class "cockpit_box" (weather)))
(box :width 300 :height 200 :class "cockpit_box" :orientation "v"
(box :class "song_info"
(label :wrap true :text "${Song_info}"))
(box :class "album_cover" :style 'background-image: url("${Thumbnail}")')
)))
)
;; weather ;;
(defwidget weather []
(box :orientation "v" :space-evenly "false"
(box :orientation "h" :space-evenly "false"
(box :class "weather-icon" :style "color: ${weather-hex}" {weather-icon})
(box :class "temperature" "${temperature}"))
(box :orientation "v" :space-evenly "false"
(box :class "weather-stat" {weather-stat}))
(box :class "weather-quote-head"
(label :wrap true :text {weather-quote}))))
;; left side but displayed right? ;;
(defwidget left []
(box :orientation "h"
@ -423,7 +478,19 @@
:width "99%"
:height "20px"
:anchor "top center")
:stacking "fg"
:stacking "bg"
:wm-ignore false
:exclusive true
(bar_1))
;; draw the bar ;;
(defwindow cockpit_window
:monitor 0
:geometry (geometry
:width "600px"
:height "500px"
:anchor "center")
:stacking "overlay"
:wm-ignore false
:exclusive true
(cockpit))

31
eww/scripts/audio_devices Executable file
View file

@ -0,0 +1,31 @@
#!/bin/bash
CLIENTS=$(pactl list sink-inputs | grep "application.process.binary" | awk -F '= ' ' { print $2 } ' | tr -d '"')
readarray -t lines <<<"$CLIENTS"
printf "%s\n" "${lines[@]}"
echo ${lines[2]}
#echo "(box :class \"works\" :orientation \"h\" :spacing 5 :space-evenly \"false\" (button :onclick \"hyprctl dispatch workspace 1\" :class \"$un$o1$f1\" \"$ic_1\") (button :onclick \"hyprctl dispatch workspace 2\" :class \"$un$o2$f2\" \"$ic_2\") (button :onclick \"hyprctl dispatch workspace 3\" :class \"$un$o3$f3\" \"$ic_3\") (button :onclick \"hyprctl dispatch workspace 4\" :class \"$un$o4$f4\" \"$ic_4\") (button :onclick \"hyprctl dispatch workspace 5\" :class \"$un$o5$f5\" \"$ic_5\") (button :onclick \"hyprctl dispatch workspace 6\" :class \"$un$o6$f6\" \"$ic_6\") (button :onclick \"hyprctl dispatch workspace 7\" :class \"$un$o7$f7\" \"$ic_7\") (button :onclick \"hyprctl dispatch workspace 8\" :class \"$un$o8$f8\" \"$ic_8\"))"
# (eventbox :onhover "scripts/pop hoverCreate"
# :onhoverlost "scripts/pop hoverGet audio_ctl"
# (box :class "audio-box" :orientation "v" :space-evenly "false" :vexpand "false" :hexpand "false"
# (box :halign "center" :space-evenly "false" :hexpand "false" :vexpand "false"
# (box :class "speaker_icon" :orientation "v")
# (box :orientation "v" :halign "center" :vexpand "false" :hexpand "false"
# (label :class "speaker_text" :text "speaker" :valign "center" :halign "left" )
# (box :class "speaker_bar" :halign "center" :vexpand "false" :hexpand "false"
# (scale :value volume_percent
# :space-evenly "false"
# :orientation "h"
# :onchange "pactl set-sink-volume @DEFAULT_SINK@ {}%"
# :tooltip "volume on ${volume_percent}%"
# :max 100
# :min 0))))
# (label :text "" :class "audio_sep" :halign "center")
# ))))

8
eww/scripts/cockpit_toggle Executable file
View file

@ -0,0 +1,8 @@
#! /bin/bash
ISOPEN=$(eww windows | grep "*cockpit")
if [ "$ISOPEN" = "" ]; then
eww open cockpit_window
else
eww close cockpit_window
fi

5
eww/scripts/firefox_control.sh Executable file
View file

@ -0,0 +1,5 @@
#! /bin/bash
NUM=$(pactl list clients short | grep "firefox" | awk -F 'PipeWire' ' { print $1 } ' | tr -d ' \t\n')
CLIENT=$(pactl list sink-inputs short | grep "$NUM" | awk -F ' ' ' { print $1 }' | tr -d ' \t\n')
pactl set-sink-input-volume "$CLIENT" "$1"

2
eww/scripts/getwethquote Executable file
View file

@ -0,0 +1,2 @@
#!/bin/bash
echo -e $(cat $HOME/.cache/weather/weather-quote) | head -n1

2
eww/scripts/getwethquote2 Executable file
View file

@ -0,0 +1,2 @@
#!/bin/bash
echo -e $(cat $HOME/.cache/weather/weather-quote) | tail -n1

2
eww/scripts/music_control Executable file
View file

@ -0,0 +1,2 @@
#!/bin/bash
echo $(playerctl metadata -p ncspot,%any --format "{{ artist }}\n{{ album }}\n{{ title }}")

3
eww/scripts/music_control2 Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
echo $(playerctl -p ncspot,%any metadata mpris:artUrl)

5
eww/scripts/ncspot_control.sh Executable file
View file

@ -0,0 +1,5 @@
#! /bin/bash
NUM=$(pactl list clients short | grep "ncspot" | awk -F 'PipeWire' ' { print $1 } ' | tr -d ' \t\n')
CLIENT=$(pactl list sink-inputs short | grep "$NUM" | awk -F ' ' ' { print $1 }' | tr -d ' \t\n')
pactl set-sink-input-volume "$CLIENT" "$1"

10
eww/scripts/spotifyd Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
#if [ "$PLAYER_EVENT" = "start" ] || [ "$PLAYER_EVENT" = "change" ];
#then
trackName=$(playerctl -p spotifyd,%any metadata title)
artistAndAlbumName=$(playerctl -p spotifyd,%any metadata --format "{{ artist }} ({{ album }})")
Thumbnail_url=$(playerctl -p spotifyd,%any metadata mpris:artUrl)
Thumbnail=$(curl "$Thumbnail_url")
notify-send -u low "$trackName" "$artistAndAlbumName " -i "$Thumbnail"
#fi

10
eww/scripts/spotifyd.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
if [ "$PLAYER_EVENT" = "start" ] || [ "$PLAYER_EVENT" = "change" ];
then
song=$(playerctl metadata -p spotifyd --format "{{ title }}\n{{ artist }}\n{{ album }}")
if [ ! -f "/home/dashie/.cache/icons/$song" ]; then
thumb=$(playerctl metadata -p spotifyd --format '{{lc(mpris:artUrl)}}')
convert "$thumb" -flatten -thumbnail 256x256 /home/dashie/.cache/icons/"$song"
fi
dunstify -I /home/dashie/.cache/icons/"$song" -t 3000 "Spotify" "$song"
fi

12
eww/scripts/toggle-mute Executable file
View file

@ -0,0 +1,12 @@
#! /bin/bash
SINK=$(pactl info | grep "Default Sink"| awk -F 'Default Sink: ' ' { print $2 } ')
pactl set-sink-mute $SINK toggle
MUTE=$(pactl list sinks | grep -A 6 "$SINK" | grep "Mute: yes" | tr -d '\t')
if [ "$MUTE" = "Mute: yes" ]; then
dunstify -a "toggleMute" -r 2 -u low "Muted"
else
dunstify -a "toggleMute" -r 2 -u low "Unmuted"
fi

125
eww/scripts/weather Executable file
View file

@ -0,0 +1,125 @@
#!/bin/bash
tmp_weather="$HOME/.cache/weather"
tmp_weather_stat=$tmp_weather/weather-stat
tmp_weather_degree=$tmp_weather/weather-degree
tmp_weather_quote=$tmp_weather/weather-quote
tmp_weather_hex=$tmp_weather/weather-hex
tmp_weather_icon=$tmp_weather/weather-icon
if [ ! -d $tmp_weather ]; then
mkdir -p $tmp_weather
fi
# Put in your api and stuff link here
# If you dunno, head to openweathermap.org, and make and account
#(completely free I swear, and then get your API Key and your City ID)
# I wish I was smart enough to do it like Elena, but this is the top I could do lol
KEY="{your key}"
ID="{your city id}"
UNIT="{metric}" #Options are 'metric' and 'imperial'
weather=$(curl -sf "http://api.openweathermap.org/data/2.5/weather?APPID="$KEY"&id="$ID"&units="$UNIT"")
echo $weather
if [ ! -z "$weather" ]; then
weather_temp=$(echo "$weather" | jq ".main.temp" | cut -d "." -f 1)
weather_icon_code=$(echo "$weather" | jq -r ".weather[].icon" | head -1)
weather_description=$(echo "$weather" | jq -r ".weather[].description" | head -1 | sed -e "s/\b\(.\)/\u\1/g")
#Big long if statement of doom
if [ "$weather_icon_code" == "50d" ]; then
weather_icon=" "
weather_quote="Forecast says it's misty \nMake sure you don't get lost on your way..."
weather_hex="#84afdb" #a7b8b2
elif [ "$weather_icon_code" == "50n" ]; then
weather_icon=" "
weather_quote="Forecast says it's a misty night \nDon't go anywhere tonight or you might get lost..."
weather_hex="#84afdb"
elif [ "$weather_icon_code" == "01d" ]; then
weather_icon=" "
weather_quote="It's a sunny day, gonna be fun! \nDon't go wandering all by yourself though..."
weather_hex="#ffd86b"
elif [ "$weather_icon_code" == "01n" ]; then
weather_icon=" "
weather_quote="It's a clear night \nYou might want to take a evening stroll to relax..."
weather_hex="#fcdcf6"
elif [ "$weather_icon_code" == "02d" ]; then
weather_icon=" "
weather_quote="It's cloudy, sort of gloomy \nYou'd better get a book to read..."
weather_hex="#adadff"
elif [ "$weather_icon_code" == "02n" ]; then
weather_icon=" "
weather_quote="It's a cloudy night \nHow about some hot chocolate and a warm bed?"
weather_hex="#adadff"
elif [ "$weather_icon_code" == "03d" ]; then
weather_icon=" "
weather_quote="It's cloudy, sort of gloomy \nYou'd better get a book to read..."
weather_hex="#adadff"
elif [ "$weather_icon_code" == "03n" ]; then
weather_icon=" "
weather_quote="It's a cloudy night \nHow about some hot chocolate and a warm bed?"
weather_hex="#adadff"
elif [ "$weather_icon_code" == "04d" ]; then
weather_icon=" "
weather_quote="It's cloudy, sort of gloomy \nYou'd better get a book to read..."
weather_hex="#adadff"
elif [ "$weather_icon_code" == "04n" ]; then
weather_icon=" "
weather_quote="It's a cloudy night \nHow about some hot chocolate and a warm bed?"
weather_hex="#adadff"
elif [ "$weather_icon_code" == "09d" ]; then
weather_icon=" "
weather_quote="It's rainy, it's a great day! \nGet some ramen and watch as the rain falls..."
weather_hex="#6b95ff"
elif [ "$weather_icon_code" == "09n" ]; then
weather_icon=" "
weather_quote=" It's gonna rain tonight it seems \nMake sure your clothes aren't still outside..."
weather_hex="#6b95ff"
elif [ "$weather_icon_code" == "10d" ]; then
weather_icon=" "
weather_quote="It's rainy, it's a great day! \nGet some ramen and watch as the rain falls..."
weather_hex="#6b95ff"
elif [ "$weather_icon_code" == "10n" ]; then
weather_icon=" "
weather_quote=" It's gonna rain tonight it seems \nMake sure your clothes aren't still outside..."
weather_hex="#6b95ff"
elif [ "$weather_icon_code" == "11d" ]; then
weather_icon=""
weather_quote="There's storm for forecast today \nMake sure you don't get blown away..."
weather_hex="#ffeb57"
elif [ "$weather_icon_code" == "11n" ]; then
weather_icon=""
weather_quote="There's gonna be storms tonight \nMake sure you're warm in bed and the windows are shut..."
weather_hex="#ffeb57"
elif [ "$weather_icon_code" == "13d" ]; then
weather_icon=" "
weather_quote="It's gonna snow today \nYou'd better wear thick clothes and make a snowman as well!"
weather_hex="#e3e6fc"
elif [ "$weather_icon_code" == "13n" ]; then
weather_icon=" "
weather_quote="It's gonna snow tonight \nMake sure you get up early tomorrow to see the sights..."
weather_hex="#e3e6fc"
elif [ "$weather_icon_code" == "40d" ]; then
weather_icon=" "
weather_quote="Forecast says it's misty \nMake sure you don't get lost on your way..."
weather_hex="#84afdb"
elif [ "$weather_icon_code" == "40n" ]; then
weather_icon=" "
weather_quote="Forecast says it's a misty night \nDon't go anywhere tonight or you might get lost..."
weather_hex="#84afdb"
else
weather_icon=" "
weather_quote="Sort of odd, I don't know what to forecast \nMake sure you have a good time!"
weather_hex="#adadff"
fi
echo "$weather_icon" > $tmp_weather_icon
echo "$weather_description" > $tmp_weather_stat
echo "$weather_temp""°C" > $tmp_weather_degree
echo "$weather_quote" > $tmp_weather_quote
echo "$weather_hex" > $tmp_weather_hex
else
echo "Weather Unavailable" > $tmp_weather_stat
echo " " > $tmp_weather_icon
echo "Ah well, no weather huh? \nEven if there's no weather, it's gonna be a great day!" > $tmp_weather_quote
echo "-" > $tmp_weather_degree
echo "#adadff" > $tmp_weather_hex
fi

9
eww/scripts/weather-trimmer Executable file
View file

@ -0,0 +1,9 @@
#!/bin/bash
weather=$(cat $HOME/.cache/weather/weather-stat)
weather_count=$(cat $HOME/.cache/weather/weather-stat | wc -c)
if [ "$weather_count" -lt 10 ]; then
echo $weather;
else
echo $(cat $HOME/.cache/weather/weather-stat | cut -c1-6)...
fi