Updates #2
BIN
eww/images/icons/apps/discord.png
Normal file
After Width: | Height: | Size: 8.3 KiB |
BIN
eww/images/icons/apps/files.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
eww/images/icons/apps/firefox.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
eww/images/icons/apps/notes.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
eww/images/icons/apps/reddit.png
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
eww/images/icons/apps/telegram.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
eww/images/icons/apps/terminal.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
eww/images/icons/battery/battery-1.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
eww/images/icons/battery/battery-2.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
eww/images/icons/battery/battery-3.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
eww/images/icons/battery/charge.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
eww/images/icons/battery/full.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
eww/images/icons/battery/low.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
2
eww/images/icons/dashboard.svg
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" id="Outline" viewBox="0 0 24 24" fill="#161616" width="512" height="512"><path d="M7,0H4A4,4,0,0,0,0,4V7a4,4,0,0,0,4,4H7a4,4,0,0,0,4-4V4A4,4,0,0,0,7,0ZM9,7A2,2,0,0,1,7,9H4A2,2,0,0,1,2,7V4A2,2,0,0,1,4,2H7A2,2,0,0,1,9,4Z"/><path d="M20,0H17a4,4,0,0,0-4,4V7a4,4,0,0,0,4,4h3a4,4,0,0,0,4-4V4A4,4,0,0,0,20,0Zm2,7a2,2,0,0,1-2,2H17a2,2,0,0,1-2-2V4a2,2,0,0,1,2-2h3a2,2,0,0,1,2,2Z"/><path d="M7,13H4a4,4,0,0,0-4,4v3a4,4,0,0,0,4,4H7a4,4,0,0,0,4-4V17A4,4,0,0,0,7,13Zm2,7a2,2,0,0,1-2,2H4a2,2,0,0,1-2-2V17a2,2,0,0,1,2-2H7a2,2,0,0,1,2,2Z"/><path d="M20,13H17a4,4,0,0,0-4,4v3a4,4,0,0,0,4,4h3a4,4,0,0,0,4-4V17A4,4,0,0,0,20,13Zm2,7a2,2,0,0,1-2,2H17a2,2,0,0,1-2-2V17a2,2,0,0,1,2-2h3a2,2,0,0,1,2,2Z"/></svg>
|
After Width: | Height: | Size: 767 B |
BIN
eww/images/icons/gmail.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
eww/images/icons/music/next-button.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
eww/images/icons/music/pause-button.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
eww/images/icons/music/play-button.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
eww/images/icons/music/previous-button.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
eww/images/icons/quotes.png
Normal file
After Width: | Height: | Size: 8.8 KiB |
22
eww/images/icons/search.svg
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generator: Adobe Illustrator 25.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 513.749 513.749" style="enable-background:new 0 0 513.749 513.749;" xml:space="preserve" fill="#161616" width="512" height="512">
|
||||
<g>
|
||||
<path d="M504.352,459.061l-99.435-99.477c74.402-99.427,54.115-240.344-45.312-314.746S119.261-9.277,44.859,90.15 S-9.256,330.494,90.171,404.896c79.868,59.766,189.565,59.766,269.434,0l99.477,99.477c12.501,12.501,32.769,12.501,45.269,0 c12.501-12.501,12.501-32.769,0-45.269L504.352,459.061z M225.717,385.696c-88.366,0-160-71.634-160-160s71.634-160,160-160 s160,71.634,160,160C385.623,314.022,314.044,385.602,225.717,385.696z"/>
|
||||
</g>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</svg>
|
After Width: | Height: | Size: 865 B |
BIN
eww/images/icons/system/no-wifi.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
eww/images/icons/system/poweroff.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
eww/images/icons/system/shutdown.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
eww/images/icons/system/sys-exit.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
eww/images/icons/system/sys-lock.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
eww/images/icons/system/sys-reboot.png
Normal file
After Width: | Height: | Size: 7.8 KiB |
BIN
eww/images/icons/system/sys-sleep.png
Normal file
After Width: | Height: | Size: 7.0 KiB |
BIN
eww/images/icons/system/wifi.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
eww/images/icons/volume/mute.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
eww/images/icons/volume/volume.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
eww/images/music.png
Normal file
After Width: | Height: | Size: 111 KiB |
BIN
eww/images/profile.jpg
Normal file
After Width: | Height: | Size: 214 KiB |
80
eww/ml4w-dashboard/eww.scss
Normal file
@ -0,0 +1,80 @@
|
||||
/** Global *******************************************/
|
||||
*{
|
||||
all: unset;
|
||||
font-family: feather;
|
||||
font-family: "JetBrains Mono";
|
||||
color: #151515;
|
||||
}
|
||||
|
||||
|
||||
/** Boxes ***********************************/
|
||||
.winbox {
|
||||
background-color: #F5EEE6;
|
||||
border: 1px solid #161616;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
/** Resources ***********************************/
|
||||
.res_box {
|
||||
background-color: #F0E9E1;
|
||||
border: 1px solid #E6DFD7;
|
||||
border-radius: 12px;
|
||||
padding: 14px 18px 14px 18px;
|
||||
}
|
||||
|
||||
.res_circle {
|
||||
background-color: #E1DCD2;
|
||||
border: 0px solid #161616;
|
||||
border-radius: 100%;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.res_circle_small {
|
||||
background-color: #F5EEE6;
|
||||
border: 0px solid #161616;
|
||||
border-radius: 100%;
|
||||
padding: 40px;
|
||||
}
|
||||
|
||||
.res_text {
|
||||
background-color: #E6E1D7;
|
||||
border: 1px solid #161616;
|
||||
border-radius: 16px;
|
||||
font-size : 14px;
|
||||
padding: 0px 8px 0px 8px;
|
||||
margin: 0px 0px 0px 0px;
|
||||
font-weight : bold;
|
||||
}
|
||||
|
||||
.res_cpu {
|
||||
color: #FD6B85;
|
||||
}
|
||||
|
||||
.res_mem {
|
||||
color: #B1A6EE;
|
||||
}
|
||||
|
||||
.res_disk {
|
||||
color: #67D4F1;
|
||||
}
|
||||
|
||||
/** Power Buttons ***********************************/
|
||||
.powericons {
|
||||
background-repeat: no-repeat;
|
||||
background-size: 48px;
|
||||
min-height: 48px;
|
||||
min-width: 48px;
|
||||
}
|
||||
|
||||
/** Quotes ***********************************/
|
||||
.quote_box {
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
.quote_text {
|
||||
font-size : 14px;
|
||||
font-style: italic;
|
||||
font-weight : bold;
|
||||
}
|
||||
|
||||
/** EOF *************************************************/
|
145
eww/ml4w-dashboard/eww.yuck
Normal file
@ -0,0 +1,145 @@
|
||||
;; **
|
||||
;; ** Widgets config for EWW
|
||||
;; ** Created by : @adi1090x
|
||||
;; **
|
||||
|
||||
;; ** Variables ***********************************************************************
|
||||
|
||||
;; System vars
|
||||
(defpoll HOST :interval "5s" `hostname`)
|
||||
(defpoll CPU_USAGE :interval "1s" `../scripts/sys_info --cpu`)
|
||||
(defpoll MEM_USAGE :interval "1s" `../scripts/sys_info --mem`)
|
||||
(defpoll DISK_USAGE :interval "1s" `../scripts/sys_info --disk`)
|
||||
(defpoll BLIGHT :interval "1s" `../scripts/sys_info --blight`)
|
||||
(defpoll BATTERY :interval "5s" `../scripts/sys_info --bat`)
|
||||
(defpoll QUOTE :interval "5m" `../scripts/quotes`)
|
||||
|
||||
;; ** Widgets *************************************************************************
|
||||
|
||||
;; resources
|
||||
(defwidget resources []
|
||||
(box :class "winbox"
|
||||
(centerbox :orientation "h"
|
||||
(box :class "res_box" :orientation "v" :valign "center" :halign "center" :spacing 15 :space-evenly "false"
|
||||
(box :class "res_circle" :orientation "v" :valign "center" :halign "center"
|
||||
(circular-progress :class "res_cpu" :value CPU_USAGE :thickness 15
|
||||
(label :class "res_circle_small" :text "CPU")))
|
||||
(label :class "res_text" :valign "end" :halign "center" :text "${CPU_USAGE}%"))
|
||||
(box :class "res_box" :orientation "v" :valign "center" :halign "center" :spacing 15 :space-evenly "false"
|
||||
(box :class "res_circle" :orientation "v" :valign "center" :halign "center"
|
||||
(circular-progress :class "res_mem" :value MEM_USAGE :thickness 15
|
||||
(label :class "res_circle_small" :text "MEMORY")))
|
||||
(label :class "res_text" :valign "end" :halign "center" :text "${MEM_USAGE}%"))
|
||||
(box :class "res_box" :orientation "v" :valign "center" :halign "center" :spacing 15 :space-evenly "false"
|
||||
(box :class "res_circle" :orientation "v" :valign "center" :halign "center"
|
||||
(circular-progress :class "res_disk" :value DISK_USAGE :thickness 15
|
||||
(label :class "res_circle_small" :text "DISK")))
|
||||
(label :class "res_text" :valign "end" :halign "center" :text "${DISK_USAGE}%")))))
|
||||
|
||||
;; powermenus
|
||||
(defwidget logout []
|
||||
(box :class "winbox"
|
||||
(button :style "background-image: url('../images/icons/system/sys-exit.png');" :class "powericons" :valign "center" :halign "center" :onclick "../scripts/system --logout")))
|
||||
(defwidget suspend []
|
||||
(box :class "winbox"
|
||||
(button :style "background-image: url('../images/icons/system/sys-sleep.png');" :class "powericons" :valign "center" :halign "center" :onclick "../scripts/system --suspend")))
|
||||
(defwidget lock []
|
||||
(box :class "winbox"
|
||||
(button :style "background-image: url('../images/icons/system/sys-lock.png');" :class "powericons" :valign "center" :halign "center" :onclick "../scripts/system --suspend")))
|
||||
(defwidget reboot []
|
||||
(box :class "winbox"
|
||||
(button :style "background-image: url('../images/icons/system/sys-reboot.png');" :class "powericons" :valign "center" :halign "center" :onclick "../scripts/system --reboot")))
|
||||
(defwidget shutdown []
|
||||
(box :class "winbox"
|
||||
(button :style "background-image: url('../images/icons/system/poweroff.png');" :class "powericons" :valign "center" :halign "center" :onclick "../scripts/system --shutdown")))
|
||||
|
||||
;; quotes
|
||||
(defwidget quotes []
|
||||
(box :class "winbox"
|
||||
(box :class "quote_box" :orientation "h" :valign "center" :halign "center" :spacing 10 :space-evenly "false"
|
||||
(box :class "powericons" :style "background-image: url('../images/icons/quotes.png');")
|
||||
(box :class "powericons" :style "background-image: url('../images/icons/quotes.png');")
|
||||
(box :class "powericons" :style "background-image: url('../images/icons/quotes.png');")
|
||||
(label :class "quote_text" :valign "center" :halign "center" :text QUOTE :wrap true :limit-width 90 ))))
|
||||
|
||||
;; ** Windows *************************************************************************
|
||||
|
||||
;; resources
|
||||
(defwindow resources
|
||||
:monitor 0
|
||||
:geometry (geometry :x "15px"
|
||||
:y "15px"
|
||||
:width "480px"
|
||||
:height "200px"
|
||||
:anchor "top right")
|
||||
:stacking "fg"
|
||||
:wm-ignore false
|
||||
(resources))
|
||||
|
||||
;; powermenu
|
||||
(defwindow logout
|
||||
:monitor 0
|
||||
:geometry (geometry :x "1420px"
|
||||
:y "320px"
|
||||
:width "80px"
|
||||
:height "80px"
|
||||
:anchor "top left")
|
||||
:stacking "fg"
|
||||
:wm-ignore false
|
||||
(logout))
|
||||
|
||||
(defwindow suspend
|
||||
:monitor 0
|
||||
:geometry (geometry :x "1520px"
|
||||
:y "320px"
|
||||
:width "80px"
|
||||
:height "80px"
|
||||
:anchor "top left")
|
||||
:stacking "fg"
|
||||
:wm-ignore false
|
||||
(suspend))
|
||||
|
||||
(defwindow lock
|
||||
:monitor 0
|
||||
:geometry (geometry :x "1620px"
|
||||
:y "320px"
|
||||
:width "80px"
|
||||
:height "80px"
|
||||
:anchor "top left")
|
||||
:stacking "fg"
|
||||
:wm-ignore false
|
||||
(lock))
|
||||
|
||||
(defwindow reboot
|
||||
:monitor 0
|
||||
:geometry (geometry :x "1720px"
|
||||
:y "320px"
|
||||
:width "80px"
|
||||
:height "80px"
|
||||
:anchor "top left")
|
||||
:stacking "fg"
|
||||
:wm-ignore false
|
||||
(reboot))
|
||||
|
||||
(defwindow shutdown
|
||||
:monitor 0
|
||||
:geometry (geometry :x "1820px"
|
||||
:y "320px"
|
||||
:width "80px"
|
||||
:height "80px"
|
||||
:anchor "top left")
|
||||
:stacking "fg"
|
||||
:wm-ignore false
|
||||
(shutdown))
|
||||
|
||||
;; quotes
|
||||
(defwindow quotes
|
||||
:monitor 0
|
||||
:geometry (geometry :x "1420px"
|
||||
:y "420px"
|
||||
:width "480px"
|
||||
:height "100px"
|
||||
:anchor "top left")
|
||||
:stacking "fg"
|
||||
:wm-ignore false
|
||||
(quotes))
|
33
eww/ml4w-dashboard/launch.sh
Executable file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
## Files and CMD
|
||||
FILE="$HOME/.cache/eww_launch.sidebar"
|
||||
CFG="$HOME/dotfiles/eww/ml4w-dashboard"
|
||||
EWW=`which eww`
|
||||
|
||||
## Run eww daemon if not running already
|
||||
if [[ ! `pidof eww` ]]; then
|
||||
${EWW} daemon
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
## Open widgets
|
||||
run_eww() {
|
||||
${EWW} --config "$CFG" open-many \
|
||||
resources \
|
||||
logout \
|
||||
suspend \
|
||||
lock \
|
||||
reboot \
|
||||
shutdown \
|
||||
quotes
|
||||
}
|
||||
|
||||
## Launch or close widgets accordingly
|
||||
if [[ ! -f "$FILE" ]]; then
|
||||
touch "$FILE"
|
||||
run_eww
|
||||
else
|
||||
${EWW} --config "$CFG" close resources logout suspend lock reboot shutdown quotes
|
||||
rm "$FILE"
|
||||
fi
|
29
eww/scripts/battery
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
## Get battery info
|
||||
BATTERY="$(acpi | awk -F ' ' 'END {print $4}' | tr -d \%,)"
|
||||
CHARGE="$(acpi | awk -F ' ' 'END {print $3}' | tr -d \,)"
|
||||
|
||||
main() {
|
||||
if [[ ($CHARGE = *"Charging"*) && ($BATTERY -lt "100") ]]; then
|
||||
echo "images/icons/battery/charge.png"
|
||||
elif [[ $CHARGE = *"Full"* ]]; then
|
||||
echo "images/icons/battery/full.png"
|
||||
else
|
||||
if [[ ($BATTERY -lt 100) && (($BATTERY -gt 65) || ($BATTERY -eq 65)) ]]; then
|
||||
echo "images/icons/battery/battery-3.png"
|
||||
elif [[ ($BATTERY -lt 65) && (($BATTERY -gt 35) || ($BATTERY -eq 35)) ]]; then
|
||||
echo "images/icons/battery/battery-2.png"
|
||||
elif [[ ($BATTERY -lt 35) && (($BATTERY -gt 10) || ($BATTERY -eq 10)) ]]; then
|
||||
echo "images/icons/battery/battery-1.png"
|
||||
elif [[ ($BATTERY -lt 10) && (($BATTERY -gt 0) || ($BATTERY -eq 0)) ]]; then
|
||||
echo "images/icons/battery/low.png"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ $1 == '--icon' ]]; then
|
||||
main
|
||||
elif [[ $1 == '--perc' ]]; then
|
||||
echo "${BATTERY}%"
|
||||
fi
|
27
eww/scripts/check-network
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
count=0
|
||||
|
||||
ID="$(ip link | awk '/state UP/ {print $2}')"
|
||||
SSID="$(iwgetid -r)"
|
||||
|
||||
net_stat () {
|
||||
if (ping -c 1 archlinux.org || ping -c 1 google.com || ping -c 1 bitbucket.org || ping -c 1 github.com || ping -c 1 sourceforge.net) &>/dev/null; then
|
||||
if [[ $ID == e* ]]; then
|
||||
echo "Online"
|
||||
echo "images/icons/system/wifi.png"
|
||||
else
|
||||
echo "$SSID"
|
||||
echo "images/icons/system/wifi.png"
|
||||
fi
|
||||
else
|
||||
echo "Offline"
|
||||
echo "images/icons/system/no-wifi.png"
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ $1 == '--stat' ]]; then
|
||||
net_stat | head -n1
|
||||
elif [[ $1 == '--icon' ]]; then
|
||||
net_stat | tail -n1
|
||||
fi
|
7
eww/scripts/mails
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/python
|
||||
|
||||
import imaplib
|
||||
obj = imaplib.IMAP4_SSL('imap.gmail.com',993)
|
||||
obj.login('username@gmail.com','PASSWORD') # write your email and password
|
||||
obj.select()
|
||||
print(len(obj.search(None, 'UnSeen')[1][0].split()))
|
97
eww/scripts/music_info
Executable file
@ -0,0 +1,97 @@
|
||||
#!/bin/bash
|
||||
|
||||
## Get data
|
||||
STATUS="$(mpc status)"
|
||||
COVER="/tmp/.music_cover.jpg"
|
||||
MUSIC_DIR="$HOME/Music"
|
||||
|
||||
## Get status
|
||||
get_status() {
|
||||
if [[ $STATUS == *"[playing]"* ]]; then
|
||||
echo "images/icons/music/pause-button.png"
|
||||
else
|
||||
echo "images/icons/music/play-button.png"
|
||||
fi
|
||||
}
|
||||
|
||||
## Get song
|
||||
get_song() {
|
||||
song=`mpc -f %title% current`
|
||||
if [[ -z "$song" ]]; then
|
||||
echo "Offline"
|
||||
else
|
||||
echo "$song"
|
||||
fi
|
||||
}
|
||||
|
||||
## Get artist
|
||||
get_artist() {
|
||||
artist=`mpc -f %artist% current`
|
||||
if [[ -z "$artist" ]]; then
|
||||
echo "Offline"
|
||||
else
|
||||
echo "$artist"
|
||||
fi
|
||||
}
|
||||
|
||||
## Get time
|
||||
get_time() {
|
||||
time=`mpc status | grep "%)" | awk '{print $4}' | tr -d '(%)'`
|
||||
if [[ -z "$time" ]]; then
|
||||
echo "0"
|
||||
else
|
||||
echo "$time"
|
||||
fi
|
||||
}
|
||||
get_ctime() {
|
||||
ctime=`mpc status | grep "#" | awk '{print $3}' | sed 's|/.*||g'`
|
||||
if [[ -z "$ctime" ]]; then
|
||||
echo "0:00"
|
||||
else
|
||||
echo "$ctime"
|
||||
fi
|
||||
}
|
||||
get_ttime() {
|
||||
ttime=`mpc -f %time% current`
|
||||
if [[ -z "$ttime" ]]; then
|
||||
echo "0:00"
|
||||
else
|
||||
echo "$ttime"
|
||||
fi
|
||||
}
|
||||
|
||||
## Get cover
|
||||
get_cover() {
|
||||
ffmpeg -i "${MUSIC_DIR}/$(mpc current -f %file%)" "${COVER}" -y &> /dev/null
|
||||
STATUS=$?
|
||||
|
||||
# Check if the file has a embbeded album art
|
||||
if [ "$STATUS" -eq 0 ];then
|
||||
echo "$COVER"
|
||||
else
|
||||
echo "images/music.png"
|
||||
fi
|
||||
}
|
||||
|
||||
## Execute accordingly
|
||||
if [[ "$1" == "--song" ]]; then
|
||||
get_song
|
||||
elif [[ "$1" == "--artist" ]]; then
|
||||
get_artist
|
||||
elif [[ "$1" == "--status" ]]; then
|
||||
get_status
|
||||
elif [[ "$1" == "--time" ]]; then
|
||||
get_time
|
||||
elif [[ "$1" == "--ctime" ]]; then
|
||||
get_ctime
|
||||
elif [[ "$1" == "--ttime" ]]; then
|
||||
get_ttime
|
||||
elif [[ "$1" == "--cover" ]]; then
|
||||
get_cover
|
||||
elif [[ "$1" == "--toggle" ]]; then
|
||||
mpc -q toggle
|
||||
elif [[ "$1" == "--next" ]]; then
|
||||
{ mpc -q next; get_cover; }
|
||||
elif [[ "$1" == "--prev" ]]; then
|
||||
{ mpc -q prev; get_cover; }
|
||||
fi
|
4
eww/scripts/quotes
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
quote="`fortune -n 90 -s | head -n 1`"
|
||||
echo "$quote"
|
85
eww/scripts/sys_info
Executable file
@ -0,0 +1,85 @@
|
||||
#!/bin/bash
|
||||
|
||||
## Files and Data
|
||||
PREV_TOTAL=0
|
||||
PREV_IDLE=0
|
||||
cpuFile="/tmp/.cpu_usage"
|
||||
|
||||
## Get CPU usage
|
||||
get_cpu() {
|
||||
if [[ -f "${cpuFile}" ]]; then
|
||||
fileCont=$(cat "${cpuFile}")
|
||||
PREV_TOTAL=$(echo "${fileCont}" | head -n 1)
|
||||
PREV_IDLE=$(echo "${fileCont}" | tail -n 1)
|
||||
fi
|
||||
|
||||
CPU=(`cat /proc/stat | grep '^cpu '`) # Get the total CPU statistics.
|
||||
unset CPU[0] # Discard the "cpu" prefix.
|
||||
IDLE=${CPU[4]} # Get the idle CPU time.
|
||||
|
||||
# Calculate the total CPU time.
|
||||
TOTAL=0
|
||||
|
||||
for VALUE in "${CPU[@]:0:4}"; do
|
||||
let "TOTAL=$TOTAL+$VALUE"
|
||||
done
|
||||
|
||||
if [[ "${PREV_TOTAL}" != "" ]] && [[ "${PREV_IDLE}" != "" ]]; then
|
||||
# Calculate the CPU usage since we last checked.
|
||||
let "DIFF_IDLE=$IDLE-$PREV_IDLE"
|
||||
let "DIFF_TOTAL=$TOTAL-$PREV_TOTAL"
|
||||
let "DIFF_USAGE=(1000*($DIFF_TOTAL-$DIFF_IDLE)/$DIFF_TOTAL+5)/10"
|
||||
echo "${DIFF_USAGE}"
|
||||
else
|
||||
echo "?"
|
||||
fi
|
||||
|
||||
# Remember the total and idle CPU times for the next check.
|
||||
echo "${TOTAL}" > "${cpuFile}"
|
||||
echo "${IDLE}" >> "${cpuFile}"
|
||||
}
|
||||
|
||||
## Get Used memory
|
||||
get_mem() {
|
||||
printf "%.0f\n" $(free -m | grep Mem | awk '{print ($3/$2)*100}')
|
||||
}
|
||||
|
||||
## Get Brightness
|
||||
get_blight() {
|
||||
CARD=`ls /sys/class/backlight | head -n 1`
|
||||
|
||||
if [[ "$CARD" == *"intel_"* ]]; then
|
||||
BNESS=`xbacklight -get`
|
||||
LIGHT=${BNESS%.*}
|
||||
else
|
||||
BNESS=`blight -d $CARD get brightness`
|
||||
PERC="$(($BNESS*100/255))"
|
||||
LIGHT=${PERC%.*}
|
||||
fi
|
||||
|
||||
echo "$LIGHT"
|
||||
}
|
||||
|
||||
## Get Battery
|
||||
get_battery() {
|
||||
BAT=`ls /sys/class/power_supply | grep BAT | head -n 1`
|
||||
cat /sys/class/power_supply/${BAT}/capacity
|
||||
}
|
||||
|
||||
## Get Disk Usage
|
||||
get_disk() {
|
||||
df -h / | awk '{print $5}' | tail -n1 | sed 's/%//g'
|
||||
}
|
||||
|
||||
## Execute accordingly
|
||||
if [[ "$1" == "--cpu" ]]; then
|
||||
get_cpu
|
||||
elif [[ "$1" == "--mem" ]]; then
|
||||
get_mem
|
||||
elif [[ "$1" == "--blight" ]]; then
|
||||
get_blight
|
||||
elif [[ "$1" == "--bat" ]]; then
|
||||
get_battery
|
||||
elif [[ "$1" == "--disk" ]]; then
|
||||
get_disk
|
||||
fi
|
39
eww/scripts/system
Executable file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CFG="$HOME/.config/eww/arin/sidedar"
|
||||
EWW=`which eww`
|
||||
|
||||
close_eww() {
|
||||
${EWW} --config "$CFG" close resources logout suspend lock reboot shutdown quotes
|
||||
}
|
||||
|
||||
## Options #############################################
|
||||
if [[ $1 = "--lock" ]]; then
|
||||
close_eww
|
||||
betterlockscreen --lock
|
||||
|
||||
elif [[ $1 = "--logout" ]]; then
|
||||
close_eww
|
||||
#openbox --exit
|
||||
berryc quit
|
||||
|
||||
elif [[ $1 = "--suspend" ]]; then
|
||||
close_eww
|
||||
amixer set Master mute
|
||||
systemctl suspend
|
||||
|
||||
elif [[ $1 = "--reboot" ]]; then
|
||||
close_eww
|
||||
systemctl reboot
|
||||
|
||||
elif [[ $1 = "--shutdown" ]]; then
|
||||
close_eww
|
||||
systemctl poweroff
|
||||
|
||||
## Help Menu #############################################
|
||||
else
|
||||
echo "
|
||||
Available options:
|
||||
--lock --logout --suspend --reboot --shutdown
|
||||
"
|
||||
fi
|
70
eww/scripts/volume
Executable file
@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get Volume
|
||||
get_volume() {
|
||||
status=`amixer get Master | tail -n1 | grep -wo 'on'`
|
||||
|
||||
if [[ "$status" == "on" ]]; then
|
||||
volume=`amixer get Master | tail -n1 | awk -F ' ' '{print $5}' | tr -d '[]'`
|
||||
echo "$volume"
|
||||
else
|
||||
echo "Mute"
|
||||
fi
|
||||
}
|
||||
|
||||
# Get icons
|
||||
get_icon() {
|
||||
vol="$(get_volume)"
|
||||
current="${vol%%%}"
|
||||
status=`amixer get Master | tail -n1 | grep -wo 'on'`
|
||||
|
||||
if [[ "$status" == "on" ]]; then
|
||||
if [[ "$current" -eq "0" ]]; then
|
||||
echo "images/icons/volume/mute.png"
|
||||
elif [[ ("$current" -ge "0") && ("$current" -le "30") ]]; then
|
||||
echo "images/icons/volume/volume.png"
|
||||
elif [[ ("$current" -ge "30") && ("$current" -le "60") ]]; then
|
||||
echo "images/icons/volume/volume.png"
|
||||
elif [[ ("$current" -ge "60") && ("$current" -le "100") ]]; then
|
||||
echo "images/icons/volume/volume.png"
|
||||
fi
|
||||
else
|
||||
echo "images/icons/volume/mute.png"
|
||||
fi
|
||||
}
|
||||
|
||||
# Increase Volume
|
||||
inc_volume() {
|
||||
amixer -Mq set Master,0 5%+ unmute
|
||||
}
|
||||
|
||||
# Decrease Volume
|
||||
dec_volume() {
|
||||
amixer -Mq set Master,0 5%- unmute
|
||||
}
|
||||
|
||||
# Toggle Mute
|
||||
toggle_mute() {
|
||||
status=`amixer get Master | tail -n1 | grep -wo 'on'`
|
||||
|
||||
if [[ "$status" == "on" ]]; then
|
||||
amixer set Master toggle
|
||||
else
|
||||
amixer set Master toggle
|
||||
fi
|
||||
}
|
||||
|
||||
# Execute accordingly
|
||||
if [[ "$1" == "--get" ]]; then
|
||||
get_volume
|
||||
elif [[ "$1" == "--icon" ]]; then
|
||||
get_icon
|
||||
elif [[ "$1" == "--inc" ]]; then
|
||||
inc_volume
|
||||
elif [[ "$1" == "--dec" ]]; then
|
||||
dec_volume
|
||||
elif [[ "$1" == "--toggle" ]]; then
|
||||
toggle_mute
|
||||
else
|
||||
get_volume
|
||||
fi
|
147
eww/scripts/weather_info
Executable file
@ -0,0 +1,147 @@
|
||||
#!/bin/bash
|
||||
|
||||
## Collect data
|
||||
cache_dir="$HOME/.cache/eww/weather"
|
||||
cache_weather_stat=${cache_dir}/weather-stat
|
||||
cache_weather_degree=${cache_dir}/weather-degree
|
||||
cache_weather_quote=${cache_dir}/weather-quote
|
||||
cache_weather_hex=${cache_dir}/weather-hex
|
||||
cache_weather_icon=${cache_dir}/weather-icon
|
||||
|
||||
## Weather data
|
||||
KEY="YOUR_KEY"
|
||||
ID="CITY_ID"
|
||||
UNIT="metric" # Available options : 'metric' or 'imperial'
|
||||
|
||||
## Make cache dir
|
||||
if [[ ! -d "$cache_dir" ]]; then
|
||||
mkdir -p ${cache_dir}
|
||||
fi
|
||||
|
||||
## Get data
|
||||
get_weather_data() {
|
||||
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"
|
||||
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" > ${cache_weather_icon}
|
||||
echo "$weather_description" > ${cache_weather_stat}
|
||||
echo "$weather_temp""°C" > ${cache_weather_degree}
|
||||
echo -e "$weather_quote" > ${cache_weather_quote}
|
||||
echo "$weather_hex" > ${cache_weather_hex}
|
||||
else
|
||||
echo "Weather Unavailable" > ${cache_weather_stat}
|
||||
echo " " > ${cache_weather_icon}
|
||||
echo -e "Ah well, no weather huh? \nEven if there's no weather, it's gonna be a great day!" > ${cache_weather_quote}
|
||||
echo "-" > ${cache_weather_degree}
|
||||
echo "#adadff" > ${tcache_weather_hex}
|
||||
fi
|
||||
}
|
||||
|
||||
## Execute
|
||||
if [[ "$1" == "--getdata" ]]; then
|
||||
get_weather_data
|
||||
elif [[ "$1" == "--icon" ]]; then
|
||||
cat ${cache_weather_icon}
|
||||
elif [[ "$1" == "--temp" ]]; then
|
||||
cat ${cache_weather_degree}
|
||||
elif [[ "$1" == "--hex" ]]; then
|
||||
cat ${cache_weather_hex}
|
||||
elif [[ "$1" == "--stat" ]]; then
|
||||
cat ${cache_weather_stat}
|
||||
elif [[ "$1" == "--quote" ]]; then
|
||||
cat ${cache_weather_quote} | head -n1
|
||||
elif [[ "$1" == "--quote2" ]]; then
|
||||
cat ${cache_weather_quote} | tail -n1
|
||||
fi
|
||||
|
33
eww/scripts/widget_apps
Executable file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ "$1" == "--tr" ]]; then
|
||||
alacritty --working-directory ~ &
|
||||
|
||||
elif [[ "$1" == "--ff" ]]; then
|
||||
firefox &
|
||||
|
||||
elif [[ "$1" == "--fm" ]]; then
|
||||
thunar ~ &
|
||||
|
||||
elif [[ "$1" == "--ge" ]]; then
|
||||
geany &
|
||||
|
||||
elif [[ "$1" == "--dc" ]]; then
|
||||
discord &
|
||||
|
||||
elif [[ "$1" == "--tg" ]]; then
|
||||
telegram-desktop &
|
||||
|
||||
elif [[ "$1" == "--rd" ]]; then
|
||||
firefox --new-tab "https://reddit.com"
|
||||
|
||||
elif [[ "$1" == "--ml" ]]; then
|
||||
firefox --new-tab "https://mail.google.com"
|
||||
|
||||
elif [[ "$1" == "--pow" ]]; then
|
||||
xfce4-power-manager-settings &
|
||||
|
||||
elif [[ "$1" == "--nm" ]]; then
|
||||
networkmanager_dmenu
|
||||
|
||||
fi
|
9
eww/scripts/widget_search
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ "$1" == "--menu" ]]; then
|
||||
rofi -show drun
|
||||
|
||||
elif [[ "$1" == "--search" ]]; then
|
||||
firefox --new-tab "https://google.com"
|
||||
|
||||
fi
|