Made bar usable

lightmode
E. Almqvist 2 years ago
parent cc6d22b14e
commit 8a7ff7e7a1
  1. 2524
      eww/.config/eww/debug
  2. 107
      eww/.config/eww/eww.scss
  3. 178
      eww/.config/eww/eww.yuck
  4. 44
      eww/.config/eww/scripts/battery
  5. 20
      eww/.config/eww/scripts/check-all-updates.sh
  6. 20
      eww/.config/eww/scripts/cmus.sh
  7. 50
      eww/.config/eww/scripts/get_spotify_status.sh
  8. 2
      eww/.config/eww/scripts/getram
  9. 2
      eww/.config/eww/scripts/getvol
  10. 194
      eww/.config/eww/scripts/pavolume.sh
  11. 12
      eww/.config/eww/scripts/scroll_spotify_status.sh
  12. 20
      eww/.config/eww/scripts/updates.sh
  13. 13
      eww/.config/eww/scripts/wifi
  14. 2
      xmonad/.xmonad/xmonad.hs

File diff suppressed because it is too large Load Diff

@ -1,7 +1,7 @@
// Font stuff // Font stuff
$font-size: 16px; $font-size: 16px;
$icon-size: 18px; $icon-size: 18px;
$logo-size: 28px; $logo-size: 22px;
// Basic colors // Basic colors
$black: #121212; $black: #121212;
@ -21,12 +21,14 @@ $fg-alt-color: #635c4b;
$fg-sel-color: $blue; $fg-sel-color: $blue;
$border-color: #484848; $border-color: #484848;
$fg-accent: $blue;
// Misc // Misc
$anim-transition: 250ms; $anim-transition: 150ms;
* { * {
all: unset; //Unsets everything so you can style everything from scratch all: unset; //Unsets everything so you can style everything from scratch
font-family: "Hack Mono", "Font Awesome"; font-family: "Fira Code";
// color: $fg-color; // color: $fg-color;
} }
@ -39,6 +41,7 @@ $anim-transition: 250ms;
background-color: $bg-color; background-color: $bg-color;
color: $fg-color; color: $fg-color;
border-right: solid 1px $border-color; border-right: solid 1px $border-color;
padding: .3rem;
} }
// Styles on classes (see eww.yuck for more information) // Styles on classes (see eww.yuck for more information)
@ -48,48 +51,120 @@ button {
} }
// Workspaces // Workspaces
.ws-active { font-weight: bold; } .ws-active {
font-weight: bold;
color: $blue;
}
.ws-inactive { opacity: 0.2; } .ws-inactive { opacity: 0.2; }
.workspaces { .workspaces {
// background-color: $black; // background-color: $bg-alt-color;
// border-radius: $font-size; // transition-property: all;
// border: 1px solid $border-color; // transition-duration: 1s;
} }
button.ws { button.ws {
// color: $fg-color;
font-size: $font-size; font-size: $font-size;
margin: 4px; margin: 4px;
} }
button.ws:hover { button.ws:hover {
color: $yellow; color: $fg-accent;
opacity: 1.0; opacity: 0.8;
}
// Generic stuff
scale trough {
all: unset;
background-color: $bg-alt-color;
border-radius: 5px;
min-height: 60px;
min-width: 4px;
margin: .3rem 0 .3rem 0;
}
// Menu
.powermenu {
transition: color $anim-transition;
// border-right: solid 1px $border-color;
}
.quit, .lock, .reboot, .poweroff {
padding: .5rem .2rem .3rem 0rem;
}
// Colors for the buttons
.lock:hover { color: $white; }
.quit:hover { color: $green; }
.reboot:hover { color: $yellow; }
.poweroff:hover { color: $red; }
.pm-active {
// background-color: $bg-alt-color;
// border-radius: 5px;
}
.pm-inner {
padding: .2rem 0;
} }
// Control // Control
.control { .control {
margin-bottom: $logo-size; margin-bottom: $logo-size;
padding: .5rem;
margin: 0 .5rem 0 .5rem;
font-family: Material Icons;
font-size: 1.6em;
border-radius: 5px;
} }
.icon { .icon {
opacity: 0.8; opacity: 0.4;
margin: 0 .2rem;
font-size: $icon-size; font-size: $icon-size;
font-family: Material Icons;
} }
.icon:hover { .icon:hover {
opacity: 1.0; opacity: 1.0;
color: red; // color: red;
}
// Volume stuff
.volbar trough highlight {
background-color: $fg-accent;
border-radius: 5px;
}
// Time
.time {
font-size: 11px;
// border-radius: 5px;
border-top: solid 2px $border-color;
color: $fg-alt-color;
padding: .7rem 0;
padding-bottom: .5rem;
margin: .5rem 0 .5rem 0;
} }
// Logo button // Logo button
.logo { .logo {
margin-top: 6px; margin-top: 6px;
font-size: $logo-size; font-size: $logo-size;
// opacity: 0.8; opacity: 0.8;
} }
.logo:hover { .logo-seperator {
color: red; border-bottom: 2px solid $border-color;
}
// .logo:hover {
// // color: $red;
// }
// Color overrides
.red {
color: $red;
opacity: 0.8;
} }

@ -1,37 +1,159 @@
(defwidget bar [screen] (defwidget bar [screen]
(centerbox :orientation "v" (box :orientation "v"
(box :class "segment-start" :valign "start" :space-evenly false :orientation "v" :vexpand "false"
(logo) :hexpand "false"
) (box :class "segment-start"
(box :class "segment-mid" :valign "center" :orientation "v" :valign "start"
(workspaces :wsp workspaces-data :ori "v") :space-evenly false
) :orientation "v"
(box :class "segment-end" :valign "end" :orientation "v" :space-evenly false
(control) ;; (logo)
) (power)
) )
(box :class "segment-mid"
:valign "center"
:orientation "v"
:space-evenly false
(workspaces :wsp workspaces-data)
)
(box :class "segment-end"
:valign "end"
:orientation "v"
:space-evenly false
(control)
)
)
) )
;; Logo ;; Logo widget
(defwidget logo [] (defwidget logo []
(button :class "logo" (button :class "logo"
"Λ" "Λ"
)) ))
;; Powermenu Widgets ;;
(defwidget power []
(eventbox ;;:onhover "${EWW_CMD} update power=true"
:onhoverlost "${EWW_CMD} update power=false"
(box :orientation "v"
:space-evenly "false"
:vexpand "false"
:class "powermenu ${power ? 'pm-active' : ''}"
;; Open menu button
(button :class "icon logo ${power ? 'logo-seperator' : ''}"
:tooltip "Open menu"
:onclick "${EWW_CMD} update power=true" "Λ")
(revealer :transition "slidedown"
:reveal power
:duration "450ms"
(box :orientation "v"
:class "pm-inner"
:space-evenly true
:halign "middle"
:spacing 6
;; Lock screen
(button :class "icon lock"
:tooltip "Lock screen"
:onclick "betterlockscreen -l" "")
;; Quit WM (goto login manager)
(button :class "icon quit"
:tooltip "Logout"
:onclick "killall xmonad-x86_64-linux" "")
;; Reboot
(button :class "icon reboot"
:tooltip "Reboot"
:onclick "reboot" "")
;; Poweroff
(button :class "icon poweroff"
:tooltip "Poweroff"
:onclick "poweroff now" "")
))
;; Poweroff
)))
(defvar power false)
;; Control widget (container)
(defwidget control [] (defwidget control []
(box :class "control" :spacing 16 :orientation "v" (box :class "control" :spacing 12 :space-evenly false :orientation "v"
(button :class "icon volume" :valign "start" ;; (wifi)
"" ;; (bat)
) (volume)
(button :class "icon music" :valign "start" (time)
""
)
(button :class "icon date" :valign "start"
""
)
) )
) )
;; Clock Widget
(defwidget time []
(box :orientation "v"
:class "time"
:valign "end"
(button :onclick "scripts/popup calendar"
:class "hour" hour)
(button :onclick "scripts/popup calendar"
:class "min" min)
(button :onclick "scripts/popup calendar"
:class "sec" sec)
))
(defpoll hour :interval "1s" "date '+%H'")
(defpoll min :interval "1s" "date '+%M'")
(defpoll sec :interval "1s" "date '+%S'")
;; Volume widget
(defwidget volume []
(eventbox :onhover "${EWW_CMD} update volume=true"
:onhoverlost "${EWW_CMD} update volume=false"
(box :orientation "v"
:space-evenly "false"
:spacing "2"
(revealer :transition "slideup"
:reveal volume
:duration "450ms"
(scale :class "volbar"
:value current-volume
:orientation "v"
:flipped true
:tooltip "Volume: ${current-volume}%"
:max 101
:min 0
:onchange "amixer -D pulse sset Master {}%"
)
)
(button :onclick "amixer -D pulse set Master 1+ toggle"
:class "icon volume + ${muted-volume != 'on' ? 'red' : ''}"
{muted-volume != "on" ? "ﱝ" : "墳"}
)
)))
(defvar volume false)
(defpoll current-volume :interval "1ms" "amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'")
(defpoll muted-volume :interval "1ms" "amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $4 }' | tr -d '%'")
;; Battery Widgets ;;
(defwidget bat []
(box :orientation "v"
:space-evenly "false"
(label :class "icon bat"
:halign "middle"
:text battery
:tooltip "Battery: ${battery-cappacity}%")))
(defpoll battery :interval "1s" "scripts/battery icon")
(defpoll battery-cappacity :interval "1s" "scripts/battery percent")
;; Wifi Widgets ;;
(defwidget wifi []
(box :orientation "v"
:halign "middle"
:tooltip "SSID: ${wifi-name}"
(button :class "icon wifi-icon" wifi-icon
)))
(defpoll wifi-icon :interval "1s" "scripts/wifi icon")
(defpoll wifi-name :interval "1s" "scripts/wifi name")
;; Workspaces container ;; Workspaces container
(defwidget workspaces [wsp] (defwidget workspaces [wsp]
(box :space-evenly true :spacing 4 :orientation "v" :class "workspaces" (box :space-evenly true :spacing 4 :orientation "v" :class "workspaces"
@ -60,22 +182,18 @@
:value {value == "" ? "0" : value} :value {value == "" ? "0" : value}
:onchange onchange))) :onchange onchange)))
(defwidget time []
(box
"${time}"))
(defpoll time :interval "500ms"
"date '+%H%M.%S %Y-%m-%d'")
;; WINDOWS ;; WINDOWS
(defwindow bar-1 (defwindow bar-1
:monitor 0 :monitor 0
:windowtype "dock" :windowtype "dock"
:geometry (geometry :x "0%" :geometry (geometry :x "0%"
:y "0%" :y "0%"
:width "38px" :width "42px"
:height "100%" :height "100%"
:anchor "left center") :anchor "left center")
:reserve (struts :side "left" :distance "38px") :reserve (struts :side "left" :distance "42px")
:hexpand "false"
:vexpand "false"
(bar :screen 1)) (bar :screen 1))
(defwindow bar-2 (defwindow bar-2
@ -87,6 +205,8 @@
:height "100%" :height "100%"
:anchor "left center") :anchor "left center")
:reserve (struts :side "left" :distance "42px") :reserve (struts :side "left" :distance "42px")
:hexpand "false"
:vexpand "false"
(bar :screen 2)) (bar :screen 2))
(defwindow time-thing (defwindow time-thing

@ -0,0 +1,44 @@
#!/bin/sh
bat=/sys/class/power_supply/BAT0/
per="$(cat "$bat/capacity")"
icon() {
[ $(cat "$bat/status") = Charging ] && echo "" && exit
if [ "$per" -gt "90" ]; then
icon=""
elif [ "$per" -gt "80" ]; then
icon=""
elif [ "$per" -gt "70" ]; then
icon=""
elif [ "$per" -gt "60" ]; then
icon=""
elif [ "$per" -gt "50" ]; then
icon=""
elif [ "$per" -gt "40" ]; then
icon=""
elif [ "$per" -gt "30" ]; then
icon=""
elif [ "$per" -gt "20" ]; then
icon=""
elif [ "$per" -gt "10" ]; then
icon=""
notify-send -u critical "Battery Low" "Connect Charger"
elif [ "$per" -gt "0" ]; then
icon=""
notify-send -u critical "Battery Low" "Connect Charger"
else
echo && exit
fi
echo "$icon"
}
percent() {
echo $per
}
[ "$1" = "icon" ] && icon && exit
[ "$1" = "percent" ] && percent && exit
exit

@ -1,20 +0,0 @@
#!/bin/sh
#source https://github.com/x70b1/polybar-scripts
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
updates_arch=0
fi
# if ! updates_aur=$(cower -u 2> /dev/null | wc -l); then
if ! updates_aur=$(trizen -Su --aur --quiet | wc -l); then
updates_aur=0
fi
updates=$(("$updates_arch" + "$updates_aur"))
if [ "$updates" -gt 0 ]; then
echo " $updates"
else
echo "0"
fi

@ -1,20 +0,0 @@
#!/bin/bash
prepend_zero () {
seq -f "%02g" $1 $1
}
artist=$(echo -n $(cmus-remote -C status | grep "tag artist" | cut -c 12-))
if [[ $artist = *[!\ ]* ]]; then
song=$(echo -n $(cmus-remote -C status | grep title | cut -c 11-))
position=$(cmus-remote -C status | grep position | cut -c 10-)
minutes1=$(prepend_zero $(($position / 60)))
seconds1=$(prepend_zero $(($position % 60)))
duration=$(cmus-remote -C status | grep duration | cut -c 10-)
minutes2=$(prepend_zero $(($duration / 60)))
seconds2=$(prepend_zero $(($duration % 60)))
echo -n "$artist - $song [$minutes1:$seconds1/$minutes2:$seconds2]"
else
echo
fi

@ -1,50 +0,0 @@
#!/bin/bash
# The name of polybar bar which houses the main spotify module and the control modules.
PARENT_BAR="now-playing"
PARENT_BAR_PID=$(pgrep -a "polybar" | grep "$PARENT_BAR" | cut -d" " -f1)
# Set the source audio player here.
# Players supporting the MPRIS spec are supported.
# Examples: spotify, vlc, chrome, mpv and others.
# Use `playerctld` to always detect the latest player.
# See more here: https://github.com/altdesktop/playerctl/#selecting-players-to-control
PLAYER="spotify"
# Format of the information displayed
# Eg. {{ artist }} - {{ album }} - {{ title }}
# See more attributes here: https://github.com/altdesktop/playerctl/#printing-properties-and-metadata
FORMAT="{{ title }} - {{ artist }}"
# Sends $2 as message to all polybar PIDs that are part of $1
update_hooks() {
while IFS= read -r id
do
polybar-msg -p "$id" hook spotify-play-pause $2 1>/dev/null 2>&1
done < <(echo "$1")
}
PLAYERCTL_STATUS=$(playerctl --player=$PLAYER status 2>/dev/null)
EXIT_CODE=$?
if [ $EXIT_CODE -eq 0 ]; then
STATUS=$PLAYERCTL_STATUS
else
STATUS="No player is running"
fi
if [ "$1" == "--status" ]; then
echo "$STATUS"
else
if [ "$STATUS" = "Stopped" ]; then
echo "No music is playing"
elif [ "$STATUS" = "Paused" ]; then
update_hooks "$PARENT_BAR_PID" 2
playerctl --player=$PLAYER metadata --format "$FORMAT"
elif [ "$STATUS" = "No player is running" ]; then
echo "$STATUS"
else
update_hooks "$PARENT_BAR_PID" 1
playerctl --player=$PLAYER metadata --format "$FORMAT"
fi
fi

@ -1,2 +0,0 @@
#!/bin/sh
printf "%.0f\n" $(free -m | grep Mem | awk '{print ($3/$2)*100}')

@ -1,2 +0,0 @@
#!/bin/sh
amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%' | head -1

@ -1,194 +0,0 @@
#!/usr/bin/env bash
# finds the active sink for pulse audio and increments the volume. useful when you have multiple audio outputs and have a key bound to vol-up and down
osd='no'
inc='2'
capvol='no'
maxvol='100'
autosync='yes'
# Muted status
# yes: muted
# no : not muted
curStatus="no"
active_sink=""
limit=$((100 - inc))
maxlimit=$((maxvol - inc))
reloadSink() {
active_sink=$(pacmd list-sinks | awk '/* index:/{print $3}')
}
function volUp {
getCurVol
if [ "$capvol" = 'yes' ]
then
if [ "$curVol" -le 100 ] && [ "$curVol" -ge "$limit" ]
then
pactl set-sink-volume "$active_sink" -- 100%
elif [ "$curVol" -lt "$limit" ]
then
pactl set-sink-volume "$active_sink" -- "+$inc%"
fi
elif [ "$curVol" -le "$maxvol" ] && [ "$curVol" -ge "$maxlimit" ]
then
pactl set-sink-volume "$active_sink" "$maxvol%"
elif [ "$curVol" -lt "$maxlimit" ]
then
pactl set-sink-volume "$active_sink" "+$inc%"
fi
getCurVol
if [ ${osd} = 'yes' ]
then
qdbus org.kde.kded /modules/kosd showVolume "$curVol" 0
fi
if [ ${autosync} = 'yes' ]
then
volSync
fi
}
function volDown {
pactl set-sink-volume "$active_sink" "-$inc%"
getCurVol
if [ ${osd} = 'yes' ]
then
qdbus org.kde.kded /modules/kosd showVolume "$curVol" 0
fi
if [ ${autosync} = 'yes' ]
then
volSync
fi
}
function getSinkInputs {
input_array=$(pacmd list-sink-inputs | grep -B 4 "sink: $1 " | awk '/index:/{print $2}')
}
function volSync {
getSinkInputs "$active_sink"
getCurVol
for each in $input_array
do
pactl set-sink-input-volume "$each" "$curVol%"
done
}
function getCurVol {
curVol=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | grep 'volume:' | grep -E -v 'base volume:' | awk -F : '{print $3}' | grep -o -P '.{0,3}%'| sed s/.$// | tr -d ' ')
}
function volMute {
case "$1" in
mute)
pactl set-sink-mute "$active_sink" 1
curVol=0
status=1
;;
unmute)
pactl set-sink-mute "$active_sink" 0
getCurVol
status=0
;;
esac
if [ ${osd} = 'yes' ]
then
qdbus org.kde.kded /modules/kosd showVolume ${curVol} ${status}
fi
}
function volMuteStatus {
curStatus=$(pacmd list-sinks | grep -A 15 "index: $active_sink$" | awk '/muted/{ print $2}')
}
# Prints output for bar
# Listens for events for fast update speed
function listen {
firstrun=0
pactl subscribe 2>/dev/null | {
while true; do
{
# If this is the first time just continue
# and print the current state
# Otherwise wait for events
# This is to prevent the module being empty until
# an event occurs
if [ $firstrun -eq 0 ]
then
firstrun=1
else
read -r event || break
if ! echo "$event" | grep -e "on card" -e "on sink"
then
# Avoid double events
continue
fi
fi
} &>/dev/null
output
done
}
}
function output() {
reloadSink
getCurVol
volMuteStatus
if [ "${curStatus}" = 'yes' ]
then
echo " ---%"
else
echo " $curVol%"
fi
} #}}}
reloadSink
case "$1" in
--up)
volUp
;;
--down)
volDown
;;
--togmute)
volMuteStatus
if [ "$curStatus" = 'yes' ]
then
volMute unmute
else
volMute mute
fi
;;
--mute)
volMute mute
;;
--unmute)
volMute unmute
;;
--sync)
volSync
;;
--listen)
# Listen for changes and immediately create new output for the bar
# This is faster than having the script on an interval
listen
;;
*)
# By default print output for bar
output
;;
esac

@ -1,12 +0,0 @@
#!/bin/bash
# see man zscroll for documentation of the following parameters
zscroll -l 30 \
--delay 0.1 \
--scroll-padding " " \
--match-command "$HOME/.config/polybar/scripts/get_spotify_status.sh --status" \
--match-text "Playing" "--scroll 1" \
--match-text "Paused" "--scroll 0" \
--update-check true "$HOME/.config/polybar/scripts/get_spotify_status.sh" &
wait

@ -1,20 +0,0 @@
#!/bin/sh
#source https://github.com/x70b1/polybar-scripts
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
updates_arch=0
fi
# if ! updates_aur=$(cower -u 2> /dev/null | wc -l); then
if ! updates_aur=$(yay -Su --aur --quiet | wc -l); then
updates_aur=0
fi
updates=$(("$updates_arch" + "$updates_aur"))
if [ "$updates" -gt 0 ]; then
echo " $updates"
else
echo "0"
fi

@ -0,0 +1,13 @@
#!/bin/sh
symbol() {
[ $(cat /sys/class/net/w*/operstate) = down ] && echo && exit
echo
}
name() {
nmcli | grep "^wlp" | sed 's/\ connected\ to\ /Connected to /g' | cut -d ':' -f2
}
[ "$1" = "icon" ] && symbol && exit
[ "$1" = "name" ] && name && exit

@ -81,7 +81,7 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) =
-- launch rofi shell -- launch rofi shell
, ((modm, xK_p), spawn "rofi -show run") , ((modm, xK_p), spawn "rofi -show run")
-- pause cmus -- pause cmus
, ((modm, xK_u), spawn "cmus-remote --pause") , ((modm, xK_u), spawn "playerctl play-pause")
-- spawn firefox -- spawn firefox
, ((modm, xK_b), spawn "firefox") , ((modm, xK_b), spawn "firefox")
-- screenshot -- screenshot

Loading…
Cancel
Save