Clean up sway

This commit is contained in:
natemaia 2022-01-06 18:58:27 -08:00
parent 09a0d7bec8
commit 70ad256365
5 changed files with 95 additions and 420 deletions

View File

@ -1,201 +0,0 @@
[
{
"name": "top",
"output": "",
"layer": "bottom",
"position": "top",
"width": "auto",
"height": 30,
"homogeneous": true,
"margin-top": 0,
"margin-bottom": 0,
"padding-horizontal": 0,
"padding-vertical": 0,
"spacing": 2,
"items-padding": 0,
"css-name": "panel-top",
"icons": "light",
"menu-start": "off",
"modules-left": [
"sway-workspaces"
],
"modules-center": [
"clock"
],
"modules-right": [
"executor-updates",
"executor-cpuav",
"executor-cpubar",
"executor-temp",
"executor-memory"
],
"controls": "right",
"controls-settings": {
"alignment": "right",
"components": [
"brightness",
"battery",
"volume",
"bluetooth",
"net"
],
"commands": {
"battery": "",
"net": "nm-connection-editor",
"bluetooth": "blueman-manager"
},
"custom-items": [
{
"name": "Wallpapers",
"icon": "azote",
"cmd": "azote"
},
{
"name": "Look & Feel",
"icon": "preferences-desktop-theme",
"cmd": "lxappearance"
},
{
"name": "Outputs",
"icon": "wdisplays",
"cmd": "wdisplays && sway-save-outputs"
},
{
"name": "Panel settings",
"icon": "nwg-panel",
"cmd": "nwg-panel-config"
}
],
"menu": {
"name": "Exit",
"icon": "system-shutdown-symbolic",
"items": [
{
"name": "Lock",
"cmd": "swaylock -f -c 000000"
},
{
"name": "Logout",
"cmd": "swaymsg exit"
},
{
"name": "Restart",
"cmd": "systemctl reboot"
},
{
"name": "Shutdown",
"cmd": "systemctl -i poweroff"
}
]
},
"show-values": false,
"interval": 1,
"icon-size": 18,
"hover-opens": false,
"leave-closes": true,
"css-name": "panel-top",
"net-interface": "wlan0",
"Exit": "Exittt",
"system-shutdown-symbolic": "system-shutdown",
"output-switcher": true,
"window-width": 320,
"window-margin": 0,
"root-css-name": "controls-overview"
},
"sway-workspaces": {
"show-layout": false,
"show-icon": true,
"name-length": 20,
"mark-autotiling": false,
"mark-content": true,
"numbers": [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8"
]
},
"clock": {
"format": "%H:%M:%S",
"interval": 1,
"on-right-click": "",
"tooltip-text": "",
"on-left-click": "gsimplecal",
"on-middle-click": "",
"on-scroll-up": "",
"on-scroll-down": "",
"css-name": "clock",
"root-css-name": "root-clock"
},
"executor-updates": {
"script": "baph -c",
"interval": 900,
"icon-size": 16,
"on-left-click": "foot bash -c 'baph -unN ; read -p \"Press Enter to finish\"'",
"tooltip-text": "AUR & Official Updates",
"on-middle-click": "",
"on-right-click": "",
"on-scroll-up": "",
"on-scroll-down": "",
"css-name": "",
"root-css-name": "",
"icon-placement": "left"
},
"executor-cpubar": {
"script": "gopsuinfo -c g",
"interval": 2,
"tooltip-text": "",
"on-left-click": "",
"on-middle-click": "",
"on-right-click": "",
"on-scroll-up": "",
"on-scroll-down": "",
"css-name": "",
"icon-size": 16,
"icon-placement": "left"
},
"executor-cpuav": {
"script": "gopsuinfo -i a",
"interval": 2,
"tooltip-text": "CPU average load",
"on-left-click": "foot htop",
"on-middle-click": "",
"on-right-click": "",
"on-scroll-up": "",
"on-scroll-down": "",
"css-name": "",
"icon-size": 16,
"icon-placement": "right"
},
"executor-temp": {
"script": "gopsuinfo -i t",
"interval": 5,
"tooltip-text": "",
"on-left-click": "",
"on-middle-click": "",
"on-right-click": "",
"on-scroll-up": "",
"on-scroll-down": "",
"css-name": "",
"icon-size": 16,
"icon-placement": "left"
},
"executor-memory": {
"script": "gopsuinfo -i m",
"interval": 5,
"tooltip-text": "",
"on-left-click": "",
"on-middle-click": "",
"on-right-click": "",
"on-scroll-up": "",
"on-scroll-down": "",
"css-name": "",
"icon-size": 16,
"icon-placement": "left"
}
}
]

View File

@ -1,201 +0,0 @@
[
{
"name": "top",
"output": "",
"layer": "bottom",
"position": "top",
"width": "auto",
"height": 30,
"homogeneous": true,
"margin-top": 0,
"margin-bottom": 0,
"padding-horizontal": 0,
"padding-vertical": 0,
"spacing": 2,
"items-padding": 0,
"css-name": "panel-top",
"icons": "light",
"menu-start": "off",
"modules-left": [
"sway-workspaces"
],
"modules-center": [
"clock"
],
"modules-right": [
"executor-updates",
"executor-cpuav",
"executor-cpubar",
"executor-temp",
"executor-memory"
],
"controls": "right",
"controls-settings": {
"alignment": "right",
"components": [
"brightness",
"battery",
"volume",
"bluetooth",
"net"
],
"commands": {
"battery": "",
"net": "nm-connection-editor",
"bluetooth": "blueman-manager"
},
"custom-items": [
{
"name": "Wallpapers",
"icon": "azote",
"cmd": "azote"
},
{
"name": "Look & Feel",
"icon": "preferences-desktop-theme",
"cmd": "lxappearance"
},
{
"name": "Outputs",
"icon": "wdisplays",
"cmd": "wdisplays && sway-save-outputs"
},
{
"name": "Panel settings",
"icon": "nwg-panel",
"cmd": "nwg-panel-config"
}
],
"menu": {
"name": "Exit",
"icon": "system-shutdown-symbolic",
"items": [
{
"name": "Lock",
"cmd": "swaylock -f -c 000000"
},
{
"name": "Logout",
"cmd": "swaymsg exit"
},
{
"name": "Restart",
"cmd": "systemctl reboot"
},
{
"name": "Shutdown",
"cmd": "systemctl -i poweroff"
}
]
},
"show-values": false,
"interval": 1,
"icon-size": 18,
"hover-opens": false,
"leave-closes": true,
"css-name": "panel-top",
"net-interface": "wlan0",
"Exit": "Exittt",
"system-shutdown-symbolic": "system-shutdown",
"output-switcher": true,
"window-width": 320,
"window-margin": 0,
"root-css-name": "controls-overview"
},
"sway-workspaces": {
"show-layout": false,
"show-icon": true,
"name-length": 20,
"mark-autotiling": false,
"mark-content": true,
"numbers": [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8"
]
},
"clock": {
"format": "%H:%M:%S",
"interval": 1,
"on-right-click": "",
"tooltip-text": "",
"on-left-click": "gsimplecal",
"on-middle-click": "",
"on-scroll-up": "",
"on-scroll-down": "",
"css-name": "clock",
"root-css-name": "root-clock"
},
"executor-updates": {
"script": "baph -c",
"interval": 900,
"icon-size": 16,
"on-left-click": "foot bash -c 'baph -unN ; read -p \"Press Enter to finish\"'",
"tooltip-text": "AUR & Official Updates",
"on-middle-click": "",
"on-right-click": "",
"on-scroll-up": "",
"on-scroll-down": "",
"css-name": "",
"root-css-name": "",
"icon-placement": "left"
},
"executor-cpubar": {
"script": "gopsuinfo -c g",
"interval": 2,
"tooltip-text": "",
"on-left-click": "",
"on-middle-click": "",
"on-right-click": "",
"on-scroll-up": "",
"on-scroll-down": "",
"css-name": "",
"icon-size": 16,
"icon-placement": "left"
},
"executor-cpuav": {
"script": "gopsuinfo -i a",
"interval": 2,
"tooltip-text": "CPU average load",
"on-left-click": "foot htop",
"on-middle-click": "",
"on-right-click": "",
"on-scroll-up": "",
"on-scroll-down": "",
"css-name": "",
"icon-size": 16,
"icon-placement": "right"
},
"executor-temp": {
"script": "gopsuinfo -i t",
"interval": 5,
"tooltip-text": "",
"on-left-click": "",
"on-middle-click": "",
"on-right-click": "",
"on-scroll-up": "",
"on-scroll-down": "",
"css-name": "",
"icon-size": 16,
"icon-placement": "left"
},
"executor-memory": {
"script": "gopsuinfo -i m",
"interval": 5,
"tooltip-text": "",
"on-left-click": "",
"on-middle-click": "",
"on-right-click": "",
"on-scroll-up": "",
"on-scroll-down": "",
"css-name": "",
"icon-size": 16,
"icon-placement": "left"
}
}
]

View File

@ -0,0 +1,89 @@
#!/usr/bin/python
import os
import time
import subprocess
import argparse
# You may either use the full icon(s) path here, like e.g.:
# "/home/piotr/.config/nwg-panel/icons_light/arch-linux.svg"
# or just give the icon name, like below.
# The icon must either exist in your icon theme, or you may place `icon_name.svg`
# custom files in '~/.config/nwg-panel/icons_light/' and '~/.config/nwg-panel/icons_dark/'.
def check(interval):
# Avoid checking on each panel restart: check if the time given as `interval` passed first.
# Make sure if the path below matches your temp directory.
file = "/tmp/archlabs-updates"
if os.path.isfile(file):
if int(time.time() - os.stat(file).st_mtime) > interval:
arch, aur = check_updates()
save_string("{},{}".format(arch, aur), file)
else:
try:
vals = load_string(file).split(",")
arch, aur = int(vals[0]), int(vals[1])
except:
arch, aur = 0, 0
else:
arch, aur = check_updates()
save_string("{},{}".format(arch, aur), file)
if arch > 0 and aur > 0:
print("software-update-available")
print("{}/{}".format(arch, aur))
elif arch > 0:
print("software-update-available")
print("{}".format(arch))
elif aur > 0:
print("software-update-available")
print("{}".format(aur))
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-i",
"--interval",
type=int,
default=900,
help="check Interval in seconds")
args = parser.parse_args()
check(args.interval)
def save_string(string, file):
try:
file = open(file, "wt")
file.write(string)
file.close()
except:
print("Error writing file '{}'".format(file))
def load_string(path):
try:
with open(path, 'r') as file:
data = file.read()
return data
except:
return ""
def check_updates():
arch, aur = 0, 0
try:
output = subprocess.check_output(["baph", "-c"]).decode("utf-8").split()
aur = int(output[0])
arch = int(output[1])
except Exception as e:
print(e)
return arch, aur
if __name__ == "__main__":
main()

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
baph -u &&
rm /tmp/archlabs-updates;
echo Press enter to exit...; read;
swaymsg reload

View File

@ -1,18 +0,0 @@
{
"keyboard-layout": "",
"autotiling-workspaces": "1 2 3 4 5 6 7 8",
"autotiling-on": true,
"night-lat": -1,
"night-long": -1,
"night-temp-low": 4500,
"night-temp-high": 6500,
"night-gamma": 1.0,
"night-on": true,
"terminal": "foot",
"file-manager": "thunar",
"editor": "mousepad",
"browser": "chromium --disable-gpu-memory-buffer-video-frames --enable-features=UseOzonePlatform --ozone-platform=wayland",
"panel-preset": "custom",
"panel-custom": "archlabs.json",
"show-on-startup": true
}