1
1
mirror of https://github.com/nboughton/dotfiles synced 2024-11-26 04:28:43 +01:00

minor overhaul

This commit is contained in:
Nick Boughton 2020-12-14 10:48:41 +00:00
parent 6b68edd15a
commit 5f306f6d56
10 changed files with 149 additions and 152 deletions

@ -15,5 +15,5 @@ background-color=#4c566add
text-color=#d8dee9 text-color=#d8dee9
border-color=#434c5e border-color=#434c5e
default-timeout=30000 default-timeout=10000
ignore-timeout=1 ignore-timeout=1

@ -20,7 +20,9 @@ set $term alacritty
set $menu wofi -c ~/.config/wofi/config -s ~/.config/wofi/style.css -I set $menu wofi -c ~/.config/wofi/config -s ~/.config/wofi/style.css -I
### Output configuration ### Output configuration
output * bg /home/nick/Pictures/Wallpapers/tu6cqny3ffu31.jpg fill #output * bg /home/nick/Pictures/Wallpapers/tu6cqny3ffu31.jpg fill
#output * bg /home/nick/Pictures/Wallpapers/cf863cb7189443c5782ae6b0519d863f.jpg fill
output * bg /home/nick/Pictures/Wallpapers/wl0fdl62lik41.jpg fill
### Gnome settings ### Gnome settings
set $gnome-schema org.gnome.desktop.interface set $gnome-schema org.gnome.desktop.interface

@ -1,4 +1,4 @@
image=/home/nick/Pictures/oluit9ej7iu51.png image=/home/nick/Pictures/Wallpapers/wl0fdl62lik41.jpg
font=Roboto font=Roboto
indicator-radius=100 indicator-radius=100
indicator-thickness=20 indicator-thickness=20

@ -8,27 +8,26 @@
"margin-left": 5, "margin-left": 5,
"modules-left": [ "modules-left": [
"sway/workspaces", "sway/workspaces",
"idle_inhibitor", "sway/mode"
"sway/mode",
], ],
"modules-center": [ "modules-center": [
"clock"
],
"modules-right": [
"cpu", "cpu",
"custom/separator", "custom/separator",
"memory", "memory",
"custom/swap", "custom/swap",
"custom/separator", "custom/separator",
"clock",
"custom/separator",
"disk#1", "disk#1",
"disk#2", "disk#2",
"custom/separator", "custom/separator",
"battery"
],
"modules-right": [
"idle_inhibitor",
"backlight", "backlight",
"custom/separator",
"battery",
"custom/separator",
"pulseaudio", "pulseaudio",
"custom/pacman", "custom/updates",
"custom/auroch", "custom/auroch",
"tray" "tray"
], ],
@ -125,13 +124,13 @@
"format": " {percentage_used:2}%", "format": " {percentage_used:2}%",
"path": "/home" "path": "/home"
}, },
"custom/pacman": { "custom/updates": {
"format": " {}", "format": " {}",
"return-type": "json", "return-type": "json",
"interval": 5, "interval": 5,
"exec": "cat ~/tmp/updates.json", "exec": "cat ~/tmp/updates.json",
"exec-if": "exit 0", "exec-if": "exit 0",
"on-click": "alacritty --class aptus-upgrade -e ~/.config/waybar/modules/updates/update-system.sh; systemctl --user start updates.service", "on-click": "alacritty --class aptus-upgrade -e ~/.config/waybar/modules/updates/updates.sh; systemctl --user start updates.service",
"tooltip": true "tooltip": true
}, },
"custom/auroch": { "custom/auroch": {

@ -25,6 +25,119 @@ const (
var outfile = fmt.Sprintf("%s/tmp/auroch.json", os.Getenv("HOME")) var outfile = fmt.Sprintf("%s/tmp/auroch.json", os.Getenv("HOME"))
var packages = []*pkg{
{
AurName: "vue-cli",
UpstreamName: "@vue/cli",
UpstreamType: npm,
},
{
AurName: "vue-cli-service-global",
UpstreamName: "@vue/cli-service-global",
UpstreamType: npm,
},
{
AurName: "quasar-cli",
UpstreamName: "@quasar/cli",
UpstreamType: npm,
},
{
AurName: "quasar-icongenie",
UpstreamName: "@quasar/icongenie",
UpstreamType: npm,
},
{
AurName: "swnt",
UpstreamName: "nboughton/swnt",
UpstreamType: ghub,
},
{
AurName: "myzt",
UpstreamName: "nboughton/myzt",
UpstreamType: ghub,
},
{
AurName: "plymouth-theme-arch-charge-gdm",
UpstreamName: "nboughton/plymouth-theme-arch-charge-gdm",
UpstreamType: ghub,
},
{
AurName: "devd",
UpstreamName: "cortesi/devd",
UpstreamType: ghub,
},
}
func main() {
var (
out []string
class string
err error
)
class = "no-updates"
for _, p := range packages {
if err = p.getAurVer(); err != nil {
class = errClass
break
}
if p.UpstreamType == npm {
if err = p.getNpmVer(); err != nil {
class = errClass
break
}
} else if p.UpstreamType == ghub {
if err = p.getGithubVer(); err != nil {
class = errClass
break
}
}
log.Printf("%s %s -> %s\n", p.AurName, p.AurVer, p.UpstreamVer)
if p.AurVer != p.UpstreamVer {
out = append(out, fmt.Sprintf("%s %s -> %s", p.AurName, p.AurVer, p.UpstreamVer))
}
}
n := len(out)
txt := fmt.Sprintf("%d", n)
if class == errClass {
txt = "!"
}
if n > 0 {
class = "updates"
}
m := gobar.Module{
Name: "AUROCH",
Summary: "Outdated AUR Packages",
JSON: gobar.JSONOutput{
Text: txt,
Alt: txt,
Class: class,
Tooltip: strings.Join(out, "\n"),
Percentage: n,
},
}
if n > 0 {
log.Println("Sending DBUS Notification")
m.Notify(m.JSON.Tooltip, 10000)
}
log.Println("Writing JSON data")
f, err := os.Create(outfile)
if err != nil {
log.Fatalf("could not open %s for writing", outfile)
}
defer f.Close()
m.JSON.Write(f)
}
// Define relevant package data // Define relevant package data
type pkg struct { type pkg struct {
AurName string `json:"aur_name,omitempty"` // Name on the AUR (i.e vue-cli) AurName string `json:"aur_name,omitempty"` // Name on the AUR (i.e vue-cli)
@ -98,116 +211,3 @@ func (p *pkg) getGithubVer() error {
return nil return nil
} }
func main() {
packages := []*pkg{
{
AurName: "vue-cli",
UpstreamName: "@vue/cli",
UpstreamType: npm,
},
{
AurName: "vue-cli-service-global",
UpstreamName: "@vue/cli-service-global",
UpstreamType: npm,
},
{
AurName: "quasar-cli",
UpstreamName: "@quasar/cli",
UpstreamType: npm,
},
{
AurName: "quasar-icongenie",
UpstreamName: "@quasar/icongenie",
UpstreamType: npm,
},
{
AurName: "swnt",
UpstreamName: "nboughton/swnt",
UpstreamType: ghub,
},
{
AurName: "myzt",
UpstreamName: "nboughton/myzt",
UpstreamType: ghub,
},
{
AurName: "plymouth-theme-arch-charge-gdm",
UpstreamName: "nboughton/plymouth-theme-arch-charge-gdm",
UpstreamType: ghub,
},
{
AurName: "devd",
UpstreamName: "cortesi/devd",
UpstreamType: ghub,
},
}
var (
out []string
class string
err error
)
class = "no-updates"
for _, p := range packages {
if err = p.getAurVer(); err != nil {
class = errClass
break
}
if p.UpstreamType == npm {
if err = p.getNpmVer(); err != nil {
class = errClass
break
}
} else if p.UpstreamType == ghub {
if err = p.getGithubVer(); err != nil {
class = errClass
break
}
}
log.Printf("%s %s -> %s\n", p.AurName, p.AurVer, p.UpstreamVer)
if p.AurVer != p.UpstreamVer {
out = append(out, fmt.Sprintf("%s %s -> %s", p.AurName, p.AurVer, p.UpstreamVer))
}
}
n := len(out)
txt := fmt.Sprintf("%d", n)
if class == errClass {
txt = "!"
}
if n > 0 {
class = "updates"
}
m := gobar.Module{
Name: "AUROCH",
Summary: "Outdated AUR Packages",
JSON: gobar.JSONOutput{
Text: txt,
Alt: txt,
Class: class,
Tooltip: strings.Join(out, "\n"),
Percentage: n,
},
}
if n > 0 {
log.Println("Sending DBUS Notification")
m.Notify(m.JSON.Tooltip, 10000)
}
log.Println("Writing JSON data")
f, err := os.Create(outfile)
if err != nil {
log.Fatalf("could not open %s for writing", outfile)
}
defer f.Close()
m.JSON.Write(f)
}

@ -3,7 +3,7 @@ Description=Check for new upstream AUR versions of NPM packages
[Timer] [Timer]
OnStartupSec=5min OnStartupSec=5min
OnUnitActiveSec=1h OnUnitActiveSec=2h
[Install] [Install]
WantedBy=timers.target WantedBy=timers.target

@ -10,7 +10,7 @@ import (
"github.com/nboughton/dotfiles/waybar/modules/gobar" "github.com/nboughton/dotfiles/waybar/modules/gobar"
) )
var outfile = fmt.Sprintf("%s/tmp/updates.json", os.Getenv(("HOME"))) var outfile = fmt.Sprintf("%s/tmp/updates.json", os.Getenv("HOME"))
func main() { func main() {
m := gobar.Module{ m := gobar.Module{

@ -4,4 +4,4 @@ Description=Check for Pacman and AUR/git package updates
[Service] [Service]
Type=oneshot Type=oneshot
WorkingDirectory=%h/.config/waybar/modules/updates WorkingDirectory=%h/.config/waybar/modules/updates
ExecStart=go run %h/.config/waybar/modules/updates/update-check.go ExecStart=go run %h/.config/waybar/modules/updates/updates.go

@ -5,11 +5,11 @@
window#waybar { window#waybar {
color: #d8dee9; color: #d8dee9;
background: rgba(76, 86, 106, 0.75); background: linear-gradient(90deg, rgba(180, 142, 173, 0.5) 0%, rgba(94,129,172, 0.5) 50%, rgba(163, 190, 140, 0.5) 100%);
border-radius: 7px; border-radius: 7px;
} }
#custom-pacman { #custom-updates {
font-family: "Symbols Nerd Font"; font-family: "Symbols Nerd Font";
} }
@ -26,7 +26,7 @@ window#waybar {
#battery, #battery,
#backlight, #backlight,
#disk, #disk,
#custom-pacman, #custom-updates,
#custom-auroch, #custom-auroch,
#custom-swap, #custom-swap,
#custom-spotify, #custom-spotify,
@ -59,24 +59,18 @@ window#waybar {
border-bottom-left-radius: 7px; border-bottom-left-radius: 7px;
} }
#workspaces button.focused { #workspaces button.focused {
background: rgba(94,129,172, 0.7); background: rgba(180, 142, 173, 0.5);
} }
#idle_inhibitor { #idle_inhibitor {
margin: 0px; margin: 0px;
} }
#idle_inhibitor.activated {
background: rgba(163, 190, 140, 0.6);
}
#idle_inhibitor.deactivated {
background: rgba(208, 135, 112, 0.6);
}
#mode { #mode {
background: rgba(191, 97, 106, 0.7); background: rgba(191, 97, 106, 0.5);
} }
/* TOP BAR (right) */ /* TOP BAR (right/center) */
#disk.1, #disk.1,
#memory { #memory {
padding-right: 3px; padding-right: 3px;
@ -86,27 +80,30 @@ window#waybar {
padding-left: 3px; padding-left: 3px;
} }
#custom-pacman.no-updates, /*
#custom-updates.no-updates,
#custom-auroch.no-updates { #custom-auroch.no-updates {
background: rgba(163, 190, 140, 0.7); background: rgba(163, 190, 140, 0.7);
} }
#custom-pacman.updates, */
#custom-updates.updates,
#custom-auroch.updates { #custom-auroch.updates {
background: rgba(180, 142, 173, 0.7); background: rgba(180, 142, 173, 0.5);
} }
#custom-pacman.error { #custom-updates.error,
background: rgba(191, 97, 106, 0.7); #custom-auroch.error {
background: rgba(191, 97, 106, 0.5);
} }
#tray { #tray {
background: rgba(94,129,172, 0.7);
border-top-right-radius: 7px; border-top-right-radius: 7px;
border-bottom-right-radius: 7px; border-bottom-right-radius: 7px;
} }
/* BOTTOM BAR (left to right)*/ /* BOTTOM BAR (left to right)*/
#custom-weather { #custom-weather {
background: rgba(94,129,172, 0.7); padding-top: 5px;
padding-bottom: 5px;
border-top-left-radius: 7px; border-top-left-radius: 7px;
border-bottom-left-radius: 7px; border-bottom-left-radius: 7px;
} }
@ -122,11 +119,10 @@ window#waybar {
text-shadow: 1px 1px 1px #2e3440; text-shadow: 1px 1px 1px #2e3440;
} }
#taskbar button.active { #taskbar button.active {
background: rgba(180, 142, 173, 0.7); background: rgba(180, 142, 173, 0.5);
} }
#custom-spotify { #custom-spotify {
background: rgba(94,129,172, 0.7);
border-top-right-radius: 7px; border-top-right-radius: 7px;
border-bottom-right-radius: 7px; border-bottom-right-radius: 7px;
} }