Merge branch 'main' of gitea:ezri/dotfiles

This commit is contained in:
Ezri 2025-02-04 17:01:18 -07:00
commit 7e09c1d742
Signed by: ezri
GPG Key ID: 058A78E5680C6F24
51 changed files with 3873 additions and 379 deletions

View File

@ -1,4 +1,3 @@
working_directory = "/home/ezri"
[bell]
animation = "EaseOutSine"

View File

@ -1,92 +0,0 @@
colors:
# Default colors
primary:
# background: '0x1b191b'
# foreground: '0x9a7c9d'
background: '0x1e1e1e'
foreground: '0x9a7c9d'
# Normal colors
normal:
black: '0x2d272f'
red: '0xcf6a4c'
green: '0x8f9d6a'
yellow: '0xf9ee98'
blue: '0x7587a6'
magenta: '0x9b859d'
cyan: '0xafc4db'
white: '0xa7a7a7'
# Bright colors
bright:
black: '0x3f3242'
red: '0xcf6a4c'
green: '0x8f9d6a'
yellow: '0xf9ee98'
blue: '0x7587a6'
magenta: '0x9b859d'
cyan: '0xafc4db'
white: '0xffffff'
# normal:
# black: '0x453f45'
# red: '0xd27377'
# green: '0x7e9d7c'
# yellow: '0xd2c377'
# blue: '0x7587a6'
# magenta: '0xae96b0'
# cyan: '0xb0c4c2'
# white: '0xd6cad7'
# bright:
# black: '0x453f45'
# red: '0xd27377'
# green: '0x7e9d7c'
# yellow: '0xd2c377'
# blue: '0x7587a6'
# magenta: '0xae96b0'
# cyan: '0xb0c4c2'
# white: '0xd6cad7'
cursor:
style:
blinking: Always
shape: underline
font:
size: 9
normal:
family: JetBrainsMono Nerd Font
style: Regular
bold:
family: JetBrainsMono Nerd Font
style: Bold
italic:
family: JetBrainsMono Nerd Font
style: Italic
bold_italic:
family: JetBrainsMono Nerd Font
style: Semibold Italic
window:
title: Terminal
dynamic_title: true
opacity: 0.98
dynamic_padding: true
bell:
animation: EaseOutSine
duration: 200
color: '0x9a7c9d'
working_directory: /home/ezri
draw_bold_text_with_bright_colors: false
debug:
render_timer: false
highlight_damage: false

View File

@ -0,0 +1,16 @@
{
"BACKGROUND_COLOR": "#202225",
"IS_MAXIMIZED": true,
"IS_MINIMIZED": false,
"MINIMIZE_TO_TRAY": false,
"OPEN_ON_STARTUP": false,
"WINDOW_BOUNDS": {
"x": 0,
"y": 0,
"width": 1688,
"height": 1022
},
"DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING": true,
"SKIP_HOST_UPDATE": true,
"chromiumSwitches": {}
}

View File

@ -21,6 +21,7 @@
&.side {
margin: 10px;
margin-top: 20px;
margin-right: 0px;
}
@ -28,6 +29,10 @@
background-color: $bg0;
padding: 10px;
}
&.outline {
border: 1px solid $bg1;
}
}
.nebula {

View File

@ -0,0 +1,107 @@
;; -*-lisp-*- Include modules
(include "./modules/workspaces.yuck")
(include "./modules/clock.yuck")
(include "./modules/system.yuck")
(include "./modules/network.yuck")
(include "./modules/volume.yuck")
(include "./modules/aggietime.yuck")
(include "./modules/timer.yuck")
(include "./modules/mpris.yuck")
(defvar power--state "normal")
(include "./windows.yuck")
(defwindow leftbar
:monitor 1
:geometry (geometry :width "100%"
:height "36px"
:anchor "top center")
:exclusive true
:focusable false
:stacking "fg"
(centerbox :orientation "h"
:class "bar root"
(tycho-leftbar--left)
(tycho-leftbar--center)
(tycho-leftbar--right)))
(defwindow centerbar
:monitor 0
:geometry (geometry :width "100%"
:height "26px"
:anchor "top center")
:exclusive true
:focusable false
:stacking "fg"
(centerbox :orientation "h"
:class "bar root"
(tycho-centerbar--left)
(tycho-centerbar--center)
(tycho-centerbar--right)))
(defwindow rightbar
:monitor 2
:geometry (geometry :width "100%"
:height "36px"
:anchor "top center")
:exclusive true
:focusable false
:stacking "fg"
(centerbox :orientation "h"
:class "bar root"
(tycho-rightbar--left)
(tycho-rightbar--center)
(tycho-rightbar--right)))
(defwindow sidebar
:monitor 1
:geometry (geometry :width "200px"
:height "100%"
:anchor "left center")
:exclusive true
:focusable false
:stacking "fg"
(tycho-sidebar))
(defwindow network-status
:monitor 0
:geometry (geometry :width "200px"
:height "0px"
:x "300px"
:y "0px"
:anchor "top right")
:exclusive false
:focusable false
:stacking "overlay"
(box :orientation "v"
:class "bar root bg outline"
:visible {network--show-details}
(network-detail)))
(defwindow builtinbar
:monitor 0
:geometry (geometry :width "100%"
:height "36px"
:anchor "top center")
:exclusive true
:focusable false
:stacking "fg"
(centerbox :orientation "h" :class "bar root ${power--state == 'critical' ? 'reservepower' : ''}"
(rocinante-builtinbar--left)
(rocinante-builtinbar--center)
(rocinante-builtinbar--right)))
(defwindow polkit
:geometry (geometry
:anchor "center")
:focusable true
:exclusive false
:stacking "overlay"
(box :orientation "v"
:class "bar root bg outline"
"testing"))

View File

@ -11,7 +11,7 @@
(include "./windows.yuck")
(defwindow leftbar
:monitor 1
:monitor 2
:geometry (geometry :width "100%"
:height "36px"
:anchor "top center")
@ -25,7 +25,7 @@
(normandy-leftbar--right)))
(defwindow rightbar
:monitor 0
:monitor 1
:geometry (geometry :width "100%"
:height "26px"
:anchor "top center")
@ -38,8 +38,22 @@
"" ;;(normandy-rightbar--center)
(normandy-rightbar--right)))
(defwindow centerbar
:monitor 0
:geometry (geometry :width "100%"
:height "26px"
:anchor "top center")
:exclusive true
:focusable false
:stacking "fg"
(centerbox :orientation "h"
:class "bar root"
(normandy-centerbar--left)
(normandy-centerbar--center)
(normandy-centerbar--right)))
(defwindow sidebar
:monitor 1
:monitor 2
:geometry (geometry :width "210px"
:height "1044px"
:anchor "left bottom")
@ -48,3 +62,13 @@
:stacking "fg"
(normandy-sidebar))
(defwindow sidebar2
:monitor 1
:geometry (geometry :width "210px"
:height "1044px"
:anchor "right bottom")
:exclusive true
:focusable false
:stacking "fg"
(normandy-sidebar))

View File

@ -12,7 +12,7 @@
(defwindow leftbar
:monitor 1
:geometry (geometry :width "1440px"
:geometry (geometry :width "100%"
:height "36px"
:anchor "top center")
:exclusive true
@ -52,19 +52,30 @@
(tycho-rightbar--center)
(tycho-rightbar--right)))
(defwindow sidebar
:monitor 1
:geometry (geometry :width "200px"
:height "100%"
:anchor "left center")
:exclusive true
:focusable false
:stacking "fg"
(tycho-sidebar))
(defwindow network-status
:monitor 2
:monitor 0
:geometry (geometry :width "200px"
:height "0px"
:x "407px"
:x "300px"
:y "0px"
:anchor "top right")
:exclusive false
:focusable false
:stacking "overlay"
(box :orientation "v"
:class "bar root bg"
:class "bar root bg outline"
:visible {network--show-details}
(network-detail)))

View File

@ -0,0 +1,347 @@
;; -*-lisp-*-
(deflisten network--data
`~/.config/eww/scripts/network.py`)
(defvar network--show-details false)
(defwidget network--interface
[device]
(box :orientation "v"
:halign "center"
:space-evenly false
:spacing 0
(label :class "offline"
:visible {!device.online}
:text "offline")
(label :visible {device.online}
:class "special"
:text "${device.addresses[0].address}/${device.addresses[0].prefixlen}")))
(defwidget network-big--online
[]
(box :orientation "h"
:halign "start"
:valign "center"
:space-evenly false
:spacing 10
(label :class "medium green nebula"
:visible {network--data.online}
:text "online")
(label :class "medium offline nebula"
:visible {network--data.offline}
:text "offline")
(label :class "medium highlight nebula"
:visible {network--data.configuring}
:text "configuring")))
(defwidget network-big--lan
[device]
(label :visible {network--data
[device]
.online}
:class ""
:text "${network--data.interfaces[device].addresses[0].address}/${network--data.interfaces[device].addresses[0].prefixlen}"))
(defwidget network--wlan
[device]
(box :orientation "h"
:halign "start"
:space-evenly false
:spacing 0
(label :class "offline"
:visible {network--data
["network"]
[device]
["offline"]
}
:text "offline")
(label :visible {network--data
["network"]
[device]
["connecting"]
}
:class "highlight"
:text "connecting...")
(label :visible {network--data
["network"]
[device]
["online"]
}
:class "special"
:text "${network--data['wifi']['ssid']}")))
(defwidget network--lan
[device]
(box :orientation "h"
:halign "start"
:space-evenly false
:spacing 0
(label :class "offline"
:visible {!device.online}
:text "offline")
(label :visible {device.online}
:class {network--data.last_update.unix < clock--data.unix - 30 ? "highlight" : "special"}
:text "${device.addresses[0].address}/${device.addresses[0].prefixlen}")))
(defwidget network--secure
[]
(box :orientation "h"
:halign "start"
:space-evenly false
:spacing 0
(label :class "highlight"
:text "- insecure"
:visible {!
network--data.secure })
(label :class "green"
:text "- secured via ${network--data.secure_msg}"
:visible {network--data.secure})))
(defwidget vpn-network
[]
(box :orientation "v"
:halign "start"
:space-evenly false
:spacing 0
:visible {network--data
!=
''}
(label :class "highlight"
:text "offline"
:visible {!
network--data.interfaces.ezrinet.online })
(label :class "green"
:text "connected"
:visible {network--data.interfaces.ezrinet.online})
"personal network"))
(defwidget network
[]
(button :onclick "eww update network--show-details=${!network--show-details}"
(box :orientation "v"
:halign "start"
:space-evenly false
:spacing 0
:visible {network--data != ''}
(box :orientation "h"
:halign "center"
:space-evenly false
:spacing 10
(network--lan :device {network--data.default_interface}))
"communications")))
(defwidget network--public-ip
[]
(centerbox :orientation "h"
:halign "start"
:width 200
(box :halign "start"
"public ip:")
""
(box :halign "end"
:spacing 0
:space-evenly false
(label :class "highlight"
:text "offline"
:visible {!network--data.online})
(label :class "highlight"
:text "no response"
:visible {network--data.online && !network--data.have_public_ip})
(label :class "special"
:text {network--data.public_ip.ip}
:visible {network--data.online && network--data.have_public_ip}))))
(defwidget network--default-route
[]
(centerbox :orientation "h"
:halign "start"
:width 200
(box :halign "start"
"route on:")
""
(box :halign "end"
:spacing 0
:space-evenly false
(label :class "highlight"
:text "offline"
:visible {!network--data.online})
(label :class "highlight"
:text "no route"
:visible {network--data.online && !network--data.have_default_route})
(label :class "special"
:text {network--data.default_route}
:visible {network--data.online && network--data.have_default_route}))))
(defwidget network--gateway
[]
(centerbox :orientation "h"
:halign "start"
:width 200
(box :halign "start"
"gateway:")
""
(box :halign "end"
:spacing 0
:space-evenly false
(label :class "highlight"
:text "no response"
:visible {!network--data.have_gateway})
(label :class "special"
:text {network--data.gateway}
:visible {network--data.have_gateway}))))
(defwidget network--status-summary
[]
(centerbox :orientation "h"
:halign "start"
:width 200
(box :halign "start"
"status:")
""
(box :halign "end"
:spacing 0
:space-evenly false
(label :class "highlight"
:text "offline"
:visible {!network--data.online})
(label :class "special"
:text "online"
:visible {network--data.online && !network--data.secure})
(label :class "green"
:text {network--data.secure_msg == "usu" ? "vpn online" : "secure"}
:visible {network--data.online && network--data.secure}))))
(defwidget network-detail
[]
(box :orientation "v"
:halign "start"
:space-evenly false
:spacing 0
(network--status-summary)
(network--public-ip)
(network--default-route)
(network--gateway)
(centerbox :orientation "h"
:halign "start"
:width 200
(box :halign "start"
"last update:")
""
(box :halign "end"
:spacing 0
:space-evenly false
(label :class {network--data.last_update.unix < clock--data.unix - 30 ? "highlight" : "special"}
:text "${network--data.last_update.month}-${network--data.last_update.day} ${network--data.last_update.hour}:${network--data.last_update.minute}:${network--data.last_update.second}")))
))
(defwidget network-sidebar-details []
(box :orientation "v"
:halign "start"
:class "module"
:space-evenly false
:spacing 5
:width 200
(box :orientation "h"
:halign "center"
:class "nebula"
:spacing 10
:space-evenly false
(label :class "medium special"
:text "Comms"))
(box :orientation "h"
:halign "center"
:class "nebula"
:spacing 10
:space-evenly false
(label :class "nebula green"
:text "Online"
:visible {network--data.online})
(label :class "nebula highlight"
:text "Offline"
:visible {!network--data.online}))
(centerbox :orientation "h"
:halign "start"
:spacing 10
:width 200
:space-evenly false
(box :halign "start"
:class "nebula"
"Route On:")
""
(box :halign "end"
(label :text "No Route"
:class "highlight"
:visible {network--data.online && !network--data.have_default_route})
(label :text "${network--data.default_route}"
:class "special"
:visible {network--data.online && network--data.have_default_route})))
(centerbox :orientation "h"
:halign "start"
:spacing 10
:width 200
:space-evenly false
(box :halign "start"
:valign "start"
:class "nebula"
"Address:")
""
(box :halign "end"
:orientation "v"
(label :text "${network--data.default_interface.addresses[0].address}"
:class "special")
(label :text "/${network--data.default_interface.addresses[0].prefixlen}"
:halign "end"
:class "special")))
(centerbox :orientation "h"
:halign "start"
:spacing 10
:width 200
:space-evenly false
(box :halign "start"
:class "nebula"
"Public IP:")
""
(box :halign "end"
(label :text "Offline"
:class "highlight"
:visible {!network--data.have_public_ip})
(label :text {network--data.public_ip.ip}
:class "special"
:visible {network--data.have_public_ip})))
(centerbox :orientation "h"
:halign "start"
:spacing 10
:width 200
:space-evenly false
(box :halign "start"
:class "nebula"
"Gateway:")
""
(box :halign "end"
(label :text "Error"
:class "highlight nebula"
:visible {!network--data.have_gateway})
(label :text {network--data.gateway}
:class "special"
:visible {network--data.have_gateway})))
(centerbox :orientation "h"
:halign "start"
:class "nebula"
:spacing 10
:width 200
:space-evenly false
(box :halign "start"
"VPN:")
""
(box :halign "end"
(label :text "Offline"
:class "highlight"
:visible {!network--data.interfaces.ezrinet.online})
(label :text "Online"
:class "green"
:visible {network--data.interfaces.ezrinet.online})))
))

View File

@ -234,3 +234,114 @@
(label :class {network--data.last_update.unix < clock--data.unix - 30 ? "highlight" : "special"}
:text "${network--data.last_update.month}-${network--data.last_update.day} ${network--data.last_update.hour}:${network--data.last_update.minute}:${network--data.last_update.second}")))
))
(defwidget network-sidebar-details []
(box :orientation "v"
:halign "start"
:class "module"
:space-evenly false
:spacing 5
:width 200
(box :orientation "h"
:halign "center"
:class "nebula"
:spacing 10
:space-evenly false
(label :class "medium special"
:text "Comms"))
(box :orientation "h"
:halign "center"
:class "nebula"
:spacing 10
:space-evenly false
(label :class "nebula green"
:text "Online"
:visible {network--data.online})
(label :class "nebula highlight"
:text "Offline"
:visible {!network--data.online}))
(centerbox :orientation "h"
:halign "start"
:spacing 10
:width 200
:space-evenly false
(box :halign "start"
:class "nebula"
"Route On:")
""
(box :halign "end"
(label :text "No Route"
:class "highlight"
:visible {network--data.online && !network--data.have_default_route})
(label :text "${network--data.default_route}"
:class "special"
:visible {network--data.online && network--data.have_default_route})))
(centerbox :orientation "h"
:halign "start"
:spacing 10
:width 200
:space-evenly false
(box :halign "start"
:valign "start"
:class "nebula"
"Address:")
""
(box :halign "end"
:orientation "v"
(label :text "${network--data.default_interface.addresses[0].address}"
:class "special")
(label :text "/${network--data.default_interface.addresses[0].prefixlen}"
:halign "end"
:class "special")))
(centerbox :orientation "h"
:halign "start"
:spacing 10
:width 200
:space-evenly false
(box :halign "start"
:class "nebula"
"Public IP:")
""
(box :halign "end"
(label :text "Offline"
:class "highlight"
:visible {!network--data.have_public_ip})
(label :text {network--data.public_ip.ip}
:class "special"
:visible {network--data.have_public_ip})))
(centerbox :orientation "h"
:halign "start"
:spacing 10
:width 200
:space-evenly false
(box :halign "start"
:class "nebula"
"Gateway:")
""
(box :halign "end"
(label :text "Error"
:class "highlight nebula"
:visible {!network--data.have_gateway})
(label :text {network--data.gateway}
:class "special"
:visible {network--data.have_gateway})))
(centerbox :orientation "h"
:halign "start"
:class "nebula"
:spacing 10
:width 200
:space-evenly false
(box :halign "start"
"VPN:")
""
(box :halign "end"
(label :text "Offline"
:class "highlight"
:visible {!network--data.interfaces.ezrinet.online})
(label :text "Online"
:class "green"
:visible {network--data.interfaces.ezrinet.online})))
))

View File

@ -1,6 +1,6 @@
;; -*-lisp-*-
(deflisten sway--data :initial '{"mode": "default"}'
`~/.config/eww/scripts/sway.py`)
`sway_listen`)
(defvar hypr--data '{}')

View File

@ -13,6 +13,10 @@ except:
sys.exit(1)
from gi.repository import Playerctl, GLib
from gi.events import GLibEventLoopPolicy
import asyncio
asyncio.set_event_loop_policy(GLibEventLoopPolicy())
title_maxlen = 40
title_end_at = ["(", "-"]
@ -56,8 +60,8 @@ class StatusDisplay:
def show(self):
self._init_player()
main = GLib.MainLoop()
main.run()
loop = asyncio.get_event_loop()
loop.run_forever()
def _get_status(self, playing=None):
if self._player:

View File

@ -0,0 +1,306 @@
#!/usr/bin/env python3
import trparse
from subprocess import run, PIPE, DEVNULL
import json
import sys
import os
import re
from time import sleep, time as now
from ipaddress import (
IPv4Address as IPAddress,
IPv4Network as IPNetwork,
IPv4Interface as IPInterface,
AddressValueError,
)
from netifaces import interfaces, ifaddresses, AF_INET, AF_LINK, gateways
import dbus
from datetime import datetime
# These are networks that are considered secure. All traffic being routed
# through one of these networks is being encrypted and routed through an
# anonymizing service.
SECURE_FIRSTHOP_NETWORKS = {
"home": IPNetwork("10.242.0.0/16"), # Personal network
"mullvad": IPNetwork("10.64.0.1/32"), # Mullvad VPN
"usu": IPNetwork("129.123.8.126/32"), # USU VPN
}
# Interfaces that we should check
DEFAULT_INTERFACES_TO_WATCH = ["lan", "ezrinet"]
# Interfaces that we should use when determining if we are online
DEFAULT_INTERFACES_TO_COUNT = ["lan"]
# Overrides for IP addresses to ping to determine if an interface is
# online This is useful for interfaces that don't have or report a
# gateway, but we still want to check if they're online, such as the
# ezrinet interface.
INTERFACE_PING_OVERRIDES = {"ezrinet": IPAddress("10.242.3.1")}
INTERFACES_TO_WATCH = os.environ.get(
"NETWORK_INTERFACES_TO_WATCH", ",".join(DEFAULT_INTERFACES_TO_WATCH)
).split(",")
INTERFACES_TO_COUNT = os.environ.get(
"NETWORK_INTERFACES_TO_COUNT", ",".join(DEFAULT_INTERFACES_TO_COUNT)
).split(",")
for key, value in os.environ.items():
if key[: len("NETWORK_PING_OVERRIDE_")] == "NETWORK_PING_OVERRIDE_":
INTERFACE_PING_OVERRIDES[key[len("NETWORK_PING_OVERRIDE_") :]] = IPAddress(
value
)
class Interface:
name: str
mac: str
addresses: list[IPInterface]
gateway: IPAddress | None
@property
def online(self):
# If we have no addresses, we're not online
if len(self.addresses) == 0:
return False
# If we have an override, ping that
if self.name in INTERFACE_PING_OVERRIDES:
return ping(INTERFACE_PING_OVERRIDES[self.name])
# If we have no gateway, this interface is likely not intended
# to route beyond the local network, so we'll assume it's
# online, at least for whatever it's used for.
if self.gateway is None:
return True
return ping(self.gateway)
def asdict(self):
return {
"name": self.name,
"mac": self.mac,
"addresses": [
{
"address": str(addr.ip),
"netmask": str(addr.netmask),
"network": str(addr.network),
"prefixlen": addr._prefixlen,
}
for addr in self.addresses
],
"online": self.online,
}
def get_first_hop() -> IPAddress | None:
"""Get the first network hop."""
# Use ping to get the first hop
cmd = ["/usr/bin/ping", "-c1", "-W0.3", "-t1", "1.1.1.1"]
result = run(cmd, stdout=PIPE, stderr=PIPE)
try:
ip = IPAddress(result.stdout.decode("utf-8").split("\n")[1].split()[1])
except (IndexError, AddressValueError):
# If we can't parse the output, return None
return None
return ip
def validate_first_hop_is_secure(first_hop: IPAddress):
"""Check if the first hop is in a secure network."""
for name, network in SECURE_FIRSTHOP_NETWORKS.items():
if first_hop in network:
return name
def get_gateways():
"""Get gateways on each interface."""
gw = gateways().get(AF_INET, [])
result = {}
for iface in INTERFACES_TO_WATCH:
for gateway in gw:
if gateway[1] == iface:
result[iface] = gateway[0]
return result
def interface_status(interface: str, gw):
"""Get the status of an interface."""
try:
addrs = ifaddresses(interface)
except:
addrs = {}
result = Interface()
result.name = interface
result.gateway = gw.get(interface, None)
if AF_LINK in addrs:
result.mac = addrs[AF_LINK][0]["addr"]
else:
result.mac = None
if AF_INET in addrs:
result.addresses = [
IPInterface(f'{addr["addr"]}/{addr["netmask"]}')
for addr in addrs.get(AF_INET, [])
]
else:
result.addresses = []
return result
def ping(host: IPAddress) -> bool:
cmd = ["/usr/bin/ping", "-c1", "-w1", str(host)]
result = run(cmd, stdout=DEVNULL, stderr=DEVNULL)
return result.returncode == 0
def get_public_ip():
"""Get the public IP address."""
cmd = ["/usr/bin/curl", "-s", "https://ipinfo.io"]
result = run(cmd, stdout=PIPE, stderr=PIPE)
try:
data = json.loads(result.stdout.decode("utf-8"))
except (IndexError, ValueError):
return None
try:
# If the IP address is invalid, don't return anything
IPAddress(data["ip"])
except (AddressValueError, KeyError):
if data.get("status", None) == 429:
# We're rate limited, so return something indicating that
return {"rate_limited": True}
return None
return data
def get_default_route():
"""Get the default route."""
cmd = ["/usr/bin/ip", "route", "show", "default"]
result = run(cmd, stdout=PIPE, stderr=PIPE)
try:
# Get first line (might have multiple gateway routes)
line = result.stdout.decode("utf-8").split("\n")[0]
# Get the gateway link (following "dev")
link = re.search(r"dev\s+(\S+)", line).group(1)
# We already know the gateway IP based on our firsthop check earlier, and that's more reliable since it will respect any routing rules
except (IndexError, AttributeError):
return None
return link
def format_time(time: datetime) -> dict[str, str | int]:
"""Format a datetime object for display."""
return {
"hour": f"{time.hour:02}",
"minute": f"{time.minute:02}",
"second": f"{time.second:02}",
"year": f"{time.year:04}",
"month": f"{time.month:02}",
"day": f"{time.day:02}",
"unix": int(time.timestamp()),
}
# system_bus = dbus.SystemBus()
# networkd = system_bus.get_object(
# "org.freedesktop.network1", "/org/freedesktop/network1"
# )
# manager = dbus.Interface(networkd, "org.freedesktop.network1.Manager")
# def get_dbus_interfaces():
# for iface in INTERFACES_TO_WATCH:
# dbus_object = system_bus.get_object(
# "org.freedesktop.network1", manager.GetLinkByName(iface)
# )
# dbus_interface = dbus.Interface(dbus_object, "org.freedesktop.network1.Link")
# yield dbus_interface
runtime_dir = os.environ.get("XDG_RUNTIME_DIR", "/tmp")
def load_last_data(var_name: str):
try:
if os.path.exists(f"{runtime_dir}/{var_name}.json"):
with open(f"{runtime_dir}/{var_name}.json", "r") as f:
return json.load(f), os.path.getmtime(f"{runtime_dir}/{var_name}.json")
except:
pass
return None, None
def store_last_data(var_name: str, data):
with open(f"{runtime_dir}/{var_name}.json", "w") as f:
json.dump(data, f)
last_default_route = load_last_data("default_route")[0]
last_ip_data, last_request = load_last_data("ip_data")
try:
last_first_hop = IPAddress(load_last_data("first_hop")[0])
except:
last_first_hop = None
while True:
try:
online = ping("1.1.1.1")
except:
online = False
hop = get_first_hop()
gw = get_gateways()
default_route = get_default_route()
# public IP shouldn't change often, so only check every 2 hours or
# if the default route or first hop changes
if (
default_route != last_default_route
or last_ip_data is None
or last_request is None
or now() - last_request > (2 * 60 * 60)
or (hop != last_first_hop and hop is not None)
):
print("refreshing public IP", file=sys.stderr, flush=True)
public_ip_data = get_public_ip()
if public_ip_data is None:
print("failed to get public IP", file=sys.stderr, flush=True)
elif public_ip_data.get("rate_limited", False):
last_ip_data = public_ip_data
public_ip_data = None
else:
last_ip_data = public_ip_data
# Write the public IP data to a file
store_last_data("ip_data", public_ip_data)
last_default_route = default_route
store_last_data("default_route", default_route)
last_request = now()
last_first_hop = hop
store_last_data("first_hop", str(hop))
else:
public_ip_data = last_ip_data
if hop is not None:
secure_msg = validate_first_hop_is_secure(hop)
secure = secure_msg is not None
else:
# If we can't reach the router, assume insecure
secure = False
iface_data = [interface_status(iface, gw) for iface in INTERFACES_TO_WATCH]
iface_dict = {iface.name: iface.asdict() for iface in iface_data}
default_route_iface_data = interface_status(default_route, gw)
print(
json.dumps(
{
"online": online,
"secure": secure,
"interfaces": iface_dict,
"public_ip": public_ip_data or {},
"have_public_ip": public_ip_data is not None and "ip" in public_ip_data,
"default_route": default_route,
"default_interface": default_route_iface_data.asdict(),
"have_default_route": default_route is not None,
"gateway": str(hop),
"have_gateway": hop is not None,
"last_update": format_time(datetime.now()),
}
),
flush=True,
)
sleep(5)

View File

@ -48,7 +48,9 @@ class Workspace:
self.alerted = False
@classmethod
def parse_file(cls: type, filename: str) -> Tuple[WorkspaceTree, WorkspaceList]:
def parse_file(
cls: type, filename: str
) -> Tuple[WorkspaceTree, WorkspaceList, str]:
result = {}
initial: dict = None
@ -75,7 +77,9 @@ class Workspace:
for context, groups in initial["contexts"].items()
}
return result, workspaces
default_context = initial.get("default_context", "personal")
return result, workspaces, default_context
@staticmethod
def full_dictify(tree: WorkspaceTree):
@ -99,7 +103,7 @@ class Workspace:
}
workspace_tree, workspace_list = Workspace.parse_file(
workspace_tree, workspace_list, default_context = Workspace.parse_file(
f"{os.environ['HOME']}/.config/sway/workspaces.json"
)
@ -107,7 +111,7 @@ data = {
"ws": {},
"mode": "default",
"current": {},
"context": "work" if gethostname() == "tycho.vpn.ezri.dev" else "personal",
"context": default_context,
"visible": {},
}

View File

@ -2,6 +2,9 @@
;; Top-Level Module Definitions ;;
;;;; ;;;;
;;; ;;;
;; PolKit Auth Window ;;
;;; ;;;
;;; ;;;
;; Bars for Rocinante ;;
@ -84,6 +87,31 @@
(sway-workspace :group "left")
(sway-workspaces :group "left")))
(defwidget normandy-centerbar--left []
(box :orientation "h"
:halign "start"
:space-evenly false
:spacing 20
:class "leftbox"
(sway-workspaces :group "center")
(sway-workspace :group "center")))
(defwidget normandy-centerbar--center []
(box :orientation "h"
:halign "end"
:space-evenly false
:spacing 20
:class "centerbox"
(system-name)))
(defwidget normandy-centerbar--right []
(box :orientation "h"
:halign "end"
:space-evenly false
:spacing 20
:class "rightbox"
(mpris2)))
(defwidget normandy-rightbar--left []
(box :orientation "h"
:halign "start"
@ -116,13 +144,23 @@
;; Bars for Tycho Station ;;
;;; ;;;
(defwidget tycho-sidebar []
(box :orientation "v"
:valign "start"
:space-evenly false
:spacing 20
:class "root side"
(sideclock)
(network-sidebar-details)
(system-gauges)))
(defwidget tycho-leftbar--left []
(box :orientation "h"
:halign "start"
:space-evenly false
:spacing 20
:class "leftbox"
(clock)
(system-name)
))
(defwidget tycho-leftbar--center []
@ -131,7 +169,7 @@
:space-evenly false
:spacing 20
:class "centerbox"
(system-name)
))
(defwidget tycho-leftbar--right []
@ -168,8 +206,8 @@
:spacing 20
:class "rightbox"
(vpn-network)
(network)
(mpris2)
(network)
(system-memory)
(system-cpu-avg)
(clock)))

157
.config/hypr/hyprland.conf Normal file
View File

@ -0,0 +1,157 @@
#
# Please note not all available settings / options are set here.
# For a full list, see the wiki (basic and advanced configuring)
#
monitor=,preferred,auto,1
input {
kb_file=/home/ezri/.config/hypr/keymap.xkb
kb_layout=
kb_options=compose:caps
follow_mouse=1
touchpad {
natural_scroll=no
}
sensitivity=0 # -1.0 - 1.0, 0 means no modification.
}
general {
main_mod=SUPER
gaps_in=5
gaps_out=20
border_size=2
col.active_border=0xff815986
col.inactive_border=0xff2d272f
apply_sens_to_raw=0 # whether to apply the sensitivity to raw input (e.g. used by games where you aim using your mouse)
damage_tracking=full # leave it on full unless you hate your GPU and want to make it suffer
layout=dwindle
}
decoration {
rounding=5
blur=0
blur_size=4 # minimum 1
blur_passes=1 # minimum 1
blur_new_optimizations=1
}
animations {
bezier=overshoot,0.05,0.2,0,1.1
bezier=overshoot2,0.05,0.3,0,1.3
enabled=1
animation=windows,1,3,overshoot2
animation=windowsIn,1,3,overshoot2
animation=border,1,3,overshoot
animation=fade,1,3,overshoot
animation=workspaces,1,3,overshoot
}
gestures {
workspace_swipe=yes
}
# example window rules
# for windows named/classed as abc and xyz
#windowrule=move 69 420,abc
#windowrule=size 420 69,abc
#windowrule=tile,xyz
#windowrule=float,abc
#windowrule=pseudo,abc
#windowrule=monitor 0,xyz
# some nice mouse binds
bindm=SUPER,mouse:272,movewindow
bindm=SUPER,mouse:273,resizewindow
# My binds
bind=SUPER,RETURN,exec,hypr-sensible-launcher
bind=SUPERSHIFT,RETURN,exec,alacritty
bind=SUPERSHIFT,Q,killactive,
bind=SUPERSHIFT,E,exit,
bind=SUPERALT,F,togglefloating,
bind=SUPER,D,exec,wofi --show drun
bind=SUPER,B,movefocus,l
bind=SUPER,F,movefocus,r
bind=SUPER,P,movefocus,u
bind=SUPER,N,movefocus,d
bind=SUPERSHIFT,B,movewindow,l
bind=SUPERSHIFT,F,movewindow,r
bind=SUPERSHIFT,P,movewindow,u
bind=SUPERSHIFT,N,movewindow,d
bind=SUPER,Tab,changegroupactive,f
bind=SUPERSHIFT,Tab,changegroupactive,b
bind=SUPER,T,togglegroup,
bind=SUPER,1,workspace,1
bind=SUPER,2,workspace,2
bind=SUPER,3,workspace,3
bind=SUPER,4,workspace,4
bind=SUPER,5,workspace,5
bind=SUPER,6,workspace,6
bind=SUPER,7,workspace,7
bind=SUPER,8,workspace,8
bind=SUPER,9,workspace,9
bind=SUPER,0,workspace,10
bind=SUPERSHIFT,1,movetoworkspace,1
bind=SUPERSHIFT,2,movetoworkspace,2
bind=SUPERSHIFT,3,movetoworkspace,3
bind=SUPERSHIFT,4,movetoworkspace,4
bind=SUPERSHIFT,5,movetoworkspace,5
bind=SUPERSHIFT,6,movetoworkspace,6
bind=SUPERSHIFT,7,movetoworkspace,7
bind=SUPERSHIFT,8,movetoworkspace,8
bind=SUPERSHIFT,9,movetoworkspace,9
bind=SUPERSHIFT,0,movetoworkspace,10
# Audio key bindings
bind=,XF86AudioPlay,exec,playerctl play-pause
bind=,XF86AudioNext,exec,playerctl next
bind=,XF86AudioPrev,exec,playerctl previous
# Volume key bindings
bind=,XF86AudioRaiseVolume,exec,pactl set-sink-volume @DEFAULT_SINK@ +1%
bind=,XF86AudioLowerVolume,exec,pactl set-sink-volume @DEFAULT_SINK@ -1%
bind=,XF86AudioMute,exec,pactl set-sink-mute @DEFAULT_SINK@ toggle
# Brightness key bindings
bind=,XF86MonBrightnessUp,exec,light -A 5
bind=,XF86MonBrightnessDown,exec,light -U 5
# Lock screen
bind=SUPER,L,exec,loginctl lock-session
# Notification dismissal
bind=SUPERCTRL,SPACE,exec,dunstctl close
# Start daemons
exec-once=systemctl --user import-environment DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP
exec-once=dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP
exec=systemctl --user start hypr-session.target
# Start status bar
exec=eww open hypr-mainbar
wsbind=1,eDP-1
wsbind=2,eDP-1
wsbind=3,eDP-1
wsbind=4,eDP-1
wsbind=5,eDP-1
wsbind=6,eDP-1
wsbind=7,eDP-1
wsbind=8,eDP-1
wsbind=9,eDP-1
wsbind=10,eDP-1

1564
.config/hypr/keymap.xkb Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,131 @@
{
"default_context": "personal",
"contexts": {
"personal": {
"left": [
{
"index": 10,
"name": "config",
"exec": "pavucontrol",
"program_name": "pavucontrol"
},
{
"index": 9,
"name": "email",
"exec": "alacritty",
"program_name": "console"
},
{
"index": 8,
"name": "discord",
"exec": "discord",
"program_name": "discord"
},
{
"index": 7,
"name": "music",
"exec": "feishin",
"program_name": "feishin"
},
{
"index": 6,
"name": "documents",
"exec": "alacritty",
"program_name": "console"
},
{
"index": 5,
"name": "VM management",
"exec": "virt-manager",
"program_name": "virt-manager"
},
{
"index": 4,
"name": "project",
"exec": "env MOZ_ENABLE_WAYLAND=0 firefox --new-window",
"program_name": "firefox"
},
{
"index": 3,
"name": "internet",
"exec": "env MOZ_ENABLE_WAYLAND=0 firefox --new-window",
"program_name": "firefox"
},
{
"index": 2,
"name": "code",
"exec": "alacritty",
"program_name": "console"
},
{
"index": 1,
"name": "terminal",
"exec": "alacritty",
"program_name": "console"
}
],
"right": [
{
"index": 11,
"name": "terminal",
"exec": "alacritty",
"program_name": "console"
},
{
"index": 12,
"name": "code",
"exec": "alacritty",
"program_name": "console"
},
{
"index": 13,
"name": "internet",
"exec": "env MOZ_ENABLE_WAYLAND=0 firefox --new-window",
"program_name": "firefox"
},
{
"index": 14,
"name": "steam",
"exec": "steam",
"program_name": "steam"
},
{
"index": 15,
"name": "minecraft",
"exec": "prismlauncher",
"program_name": "prismlauncher"
},
{
"index": 16,
"name": "images",
"exec": "gimp",
"program_name": "gimp"
},
{
"index": 17,
"name": "video",
"exec": "jellyfinmediaplayer",
"program_name": "jellyfinmediaplayer"
},
{
"index": 18,
"name": "slack",
"exec": "slack",
"program_name": "slack"
},
{
"index": 19,
"name": "zoom",
"exec": "zoom",
"program_name": "zoom"
},
{
"index": 20,
"name": "config",
"exec": "pavucontrol",
"program_name": "pavucontrol"
}
]
}
}
}

View File

@ -0,0 +1,76 @@
{
"default_context": "personal",
"display_ordering": ["builtin"],
"display_layout": {
"builtin": "eDP-1"
},
"contexts": {
"personal": {
"builtin": [
{
"index": 1,
"name": "terminal",
"exec": "console",
"program_name": "console"
},
{
"index": 2,
"name": "code",
"exec": "emacsclient",
"args": ["-nc"],
"program_name": "emacsclient"
},
{
"index": 3,
"name": "internet",
"exec": "firefox",
"args": ["--new-window"],
"program_name": "firefox"
},
{
"index": 4,
"name": "project",
"exec": "firefox",
"args": ["--new-window"],
"program_name": "firefox"
},
{
"index": 5,
"name": "servers",
"exec": "virt-manager",
"program_name": "virt-manager"
},
{
"index": 6,
"name": "steam",
"exec": "steam",
"program_name": "steam"
},
{
"index": 7,
"name": "media",
"exec": "jellyfinmediaplayer",
"program_name": "jellyfinmediaplayer"
},
{
"index": 8,
"name": "real-time comms",
"exec": "discord",
"program_name": "discord"
},
{
"index": 9,
"name": "messages",
"exec": "thunderbird",
"program_name": "thunderbird"
},
{
"index": 10,
"name": "config",
"exec": "pavucontrol",
"program_name": "pavucontrol"
}
]
}
}
}

View File

@ -0,0 +1,161 @@
{
"default_context": "work",
"display_ordering": ["left", "center", "right"],
"display_layout": {
"left": "DP-5",
"right": "DP-7",
"center": "DP-4"
},
"contexts": {
"work": {
"left": [
{
"index": 5,
"name": "discord",
"exec": "discord",
"program_name": "discord"
},
{
"index": 4,
"name": "project",
"exec": "firefox",
"args": ["--new-window"],
"program_name": "firefox"
},
{
"index": 3,
"name": "documentation",
"exec": "firefox",
"args": ["--new-window"],
"environ": {},
"program_name": "firefox"
},
{
"index": 2,
"name": "code",
"exec": "emacsclient",
"args": ["-nc"],
"program_name": "emacsclient"
},
{
"index": 1,
"name": "console",
"exec": "console",
"program_name": "console"
}
],
"center": [
{
"index": 6,
"name": "console",
"exec": "console",
"program_name": "console"
},
{
"index": 7,
"name": "code",
"exec": "emacsclient",
"args": ["-nc"],
"program_name": "emacsclient"
},
{
"index": 8,
"name": "internet",
"exec": "firefox",
"args": ["--new-window"],
"program_name": "firefox"
},
{
"index": 9,
"name": "project",
"exec": "firefox-developer-edition",
"args": ["-start-debugger-server", "--new-window"],
"program_name": "firefox-developer-edition"
},
{
"index": 10,
"name": "server management",
"exec": "virt-manager",
"program_name": "virt-manager",
"systemd": false
},
{
"index": 11,
"name": "password management",
"exec": "bitwarden-desktop",
"program_name": "bitwarden"
},
{
"index": 12,
"name": "video",
"exec": "jellyfinmediaplayer",
"program_name": "jellyfinmediaplayer"
},
{
"index": 13,
"name": "edex-ui",
"exec": "edex-ui",
"program_name": "edex-ui"
},
{
"index": 14,
"name": "mail",
"exec": "thunderbird",
"program_name": "thunderbird",
"environ": {
"MOZ_ENABLE_WAYLAND": "1"
}
},
{
"index": 15,
"name": "config",
"exec": "console",
"program_name": "console"
}
],
"right": [
{
"index": 16,
"name": "console",
"exec": "console",
"program_name": "console"
},
{
"index": 17,
"name": "code",
"exec": "emacsclient",
"args": ["-nc"],
"program_name": "emacsclient"
},
{
"index": 18,
"name": "music",
"exec": "feishin",
"program_name": "feishin"
},
{
"index": 19,
"name": "project",
"exec": "firefox",
"args": ["--new-window"],
"program_name": "firefox"
},
{
"index": 20,
"name": "slack",
"exec": "slack",
"program_name": "slack",
"args": [
"--enable-features=UseOzonePlatform",
"--ozone-platform=wayland",
"--enable-gpu-rasterization"
],
"memory_profile": {
"high": "800M",
"max": "1.2G"
}
}
]
}
}
}

View File

@ -30,8 +30,8 @@ set $colorwallpaper '#1e1e1e'
output * bg '#1e1e1e' solid_color
## Include Device-Specific Configs
include display-arrangement.conf
include workspace-arrangement.conf
#include display-arrangement.conf
#include workspace-arrangement.conf
### ###
# Window Management Keybinds #
@ -61,6 +61,34 @@ mode "resize" {
}
}
## Workspace Switching Keybinds
bindsym {
$mod+1 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager FocusWorkspace y 1
$mod+2 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager FocusWorkspace y 2
$mod+3 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager FocusWorkspace y 3
$mod+4 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager FocusWorkspace y 4
$mod+5 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager FocusWorkspace y 5
$mod+6 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager FocusWorkspace y 6
$mod+7 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager FocusWorkspace y 7
$mod+8 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager FocusWorkspace y 8
$mod+9 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager FocusWorkspace y 9
$mod+0 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager FocusWorkspace y 10
}
## Window Reassignment Keybinds
bindsym {
$mod+Shift+1 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager MoveContainer y 1
$mod+Shift+2 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager MoveContainer y 2
$mod+Shift+3 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager MoveContainer y 3
$mod+Shift+4 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager MoveContainer y 4
$mod+Shift+5 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager MoveContainer y 5
$mod+Shift+6 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager MoveContainer y 6
$mod+Shift+7 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager MoveContainer y 7
$mod+Shift+8 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager MoveContainer y 8
$mod+Shift+9 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager MoveContainer y 9
$mod+Shift+0 exec busctl --user call dev.ezri.sway /ContextManager dev.ezri.sway.ContextManager MoveContainer y 10
}
bindsym $mod+r mode "resize"
## Moving Windows
@ -91,6 +119,18 @@ bindsym {
$mod+f focus right
$mod+p focus up
$mod+n focus down
# Arrow key output bindings
$mod+Control+Left focus output left
$mod+Control+Right focus output right
$mod+Control+Up focus output up
$mod+Control+Down focus output down
# Emacs output bindings
$mod+Control+b focus output left
$mod+Control+f focus output right
$mod+Control+p focus output up
$mod+Control+n focus output down
}
## Containers
@ -153,6 +193,15 @@ for_window [app_id="Alacritty"] {
client.unfocused $colorbackground $colorwallpaper $colorprimary $colorbackground $colorbackground
}
## Floating windows should have titles
for_window [floating] border normal 1
## Thunderbird New.* windows should float
for_window [app_id="thunderbird" title="(New|Write)"] floating enable
## Bitwarden extension windows should float by default
for_window [app_id="firefox" title="Extension: \(Bitwarden Password Manager\)"] floating enable
### ###
# Application Keybinds #
### ###
@ -174,6 +223,10 @@ bindsym --locked {
XF86AudioPlay exec playerctl play-pause
XF86AudioNext exec playerctl next
XF86AudioPrev exec playerctl previous
XF86AudioRaiseVolume exec pactl set-sink-volume @DEFUALT_SINK@ +5%
XF86AudioLowerVolume exec pactl set-sink-volume @DEFUALT_SINK@ -5%
XF86AudioMute exec pactl set-sink-mute @DEFUALT_SINK@ toggle
}
## Screen Locking

View File

@ -0,0 +1,9 @@
### -*-conf-space-*- ###
# Gathering Storm Display Config #
### ###
set $display eDP-1
output $display scale 1 pos 0 1080
output $display color_profile icc /usr/share/color/icc/colord/BOE_CQ_______NE160QDM_NZ6.icm

View File

@ -3,9 +3,11 @@
### ###
set $leftdisplay 'HDMI-A-1'
set $centerdisplay 'DP-1'
set $rightdisplay 'DP-2'
output {
$leftdisplay pos 0 0 mode --custom 1920x1080@75Hz
$rightdisplay pos 1920 0 mode --custom 1920x1080@75Hz
$leftdisplay pos 0 220 mode --custom 1920x1080@75Hz
$centerdisplay pos 1920 0 mode 2560x1440@165Hz
$rightdisplay pos 4480 230 mode --custom 1920x1080@75Hz
}

View File

@ -7,10 +7,10 @@ set $centerdisplay "Hewlett Packard HP S340c CN490508SQ"
set $rightdisplay "HP Inc. HP Z27n G2 6CM0151FD4"
output {
$leftdisplay pos 0 0 mode 2560x1440@60Hz transform 270
$leftdisplay bg ~/Images/Sidepaper.png center
$centerdisplay pos 1440 450 mode 3440x1440 transform 0
$leftdisplay pos 0 450 mode 2560x1440@60Hz
$leftdisplay bg ~/Images/Wallpaper.png center
$centerdisplay pos 2560 450 mode 3440x1440 transform 0
$centerdisplay bg ~/Images/Wallpaper.png center
$rightdisplay pos 4880 0 mode 2560x1440@60Hz transform 90
$rightdisplay pos 6000 0 mode 2560x1440@60Hz transform 90
$rightdisplay bg ~/Images/Sidepaper.png center
}

View File

@ -0,0 +1,11 @@
#### -*-conf-space-*- ####
## Sidebar Gaps Config ##
#### ####
workspace {
# 1 gaps left 260
# 2 gaps left 260
# 3 gaps left 260
# 4 gaps left 260
# 5 gaps left 260
}

View File

@ -2,7 +2,7 @@
timeout 10 'pgrep swaylock &> /dev/null && swaymsg "output * power off"' resume 'pgrep swaylock &> /dev/null && swaymsg "output * power on" && gpg-connect-agent UPDATESTARTUPTTY /bye'
timeout 15 'pgrep swaylock &> /dev/null && pkill -u 1000 -SIGSTOP electron' resume 'pgrep swaylock &> /dev/null && pkill -u 1000 -SIGCONT electron'
timeout 150 'loginctl lock-session && swaymsg "output * power off"'
timeout 300 'loginctl lock-session && swaymsg "output * power off"'
lock ~/.local/bin/screenlock
before-sleep 'loginctl lock-session'
unlock 'pkill -SIGUSR1 swaylock'

View File

@ -20,30 +20,3 @@ workspace {
10 output $display
}
## Workspace Switching Keybinds
bindsym {
$mod+1 exec swaymsg workspace 1
$mod+2 exec swaymsg workspace 2
$mod+3 exec swaymsg workspace 3
$mod+4 exec swaymsg workspace 4
$mod+5 exec swaymsg workspace 5
$mod+6 exec swaymsg workspace 6
$mod+7 exec swaymsg workspace 7
$mod+8 exec swaymsg workspace 8
$mod+9 exec swaymsg workspace 9
$mod+0 exec swaymsg workspace 10
}
## Window Reassignment Keybinds
bindsym {
$mod+Shift+1 exec swaymsg move container to workspace 1
$mod+Shift+2 exec swaymsg move container to workspace 2
$mod+Shift+3 exec swaymsg move container to workspace 3
$mod+Shift+4 exec swaymsg move container to workspace 4
$mod+Shift+5 exec swaymsg move container to workspace 5
$mod+Shift+6 exec swaymsg move container to workspace 6
$mod+Shift+7 exec swaymsg move container to workspace 7
$mod+Shift+8 exec swaymsg move container to workspace 8
$mod+Shift+9 exec swaymsg move container to workspace 9
$mod+Shift+0 exec swaymsg move container to workspace 10
}

View File

@ -36,31 +36,3 @@ workspace {
19 output $rightdisplay
20 output $rightdisplay
}
## Workspace Switching Keybinds
bindsym {
$mod+1 exec swaymsg workspace $(sway-find-workspace 1 )
$mod+2 exec swaymsg workspace $(sway-find-workspace 2 )
$mod+3 exec swaymsg workspace $(sway-find-workspace 3 )
$mod+4 exec swaymsg workspace $(sway-find-workspace 4 )
$mod+5 exec swaymsg workspace $(sway-find-workspace 5 )
$mod+6 exec swaymsg workspace $(sway-find-workspace 6 )
$mod+7 exec swaymsg workspace $(sway-find-workspace 7 )
$mod+8 exec swaymsg workspace $(sway-find-workspace 8 )
$mod+9 exec swaymsg workspace $(sway-find-workspace 9 )
$mod+0 exec swaymsg workspace $(sway-find-workspace 10)
}
## Window Reassignment Keybinds
bindsym {
$mod+Shift+1 exec swaymsg move container to workspace $(sway-find-workspace 1 )
$mod+Shift+2 exec swaymsg move container to workspace $(sway-find-workspace 2 )
$mod+Shift+3 exec swaymsg move container to workspace $(sway-find-workspace 3 )
$mod+Shift+4 exec swaymsg move container to workspace $(sway-find-workspace 4 )
$mod+Shift+5 exec swaymsg move container to workspace $(sway-find-workspace 5 )
$mod+Shift+6 exec swaymsg move container to workspace $(sway-find-workspace 6 )
$mod+Shift+7 exec swaymsg move container to workspace $(sway-find-workspace 7 )
$mod+Shift+8 exec swaymsg move container to workspace $(sway-find-workspace 8 )
$mod+Shift+9 exec swaymsg move container to workspace $(sway-find-workspace 9 )
$mod+Shift+0 exec swaymsg move container to workspace $(sway-find-workspace 10)
}

View File

@ -0,0 +1,75 @@
### -*-conf-space-*- ###
# Dual-Monitor Workspace Settings #
### ###
# This file defines the workspaces and creates the keybinds to switch
# between them and move containers around between them. This version
# is for dual-monitor systems. The host-specific display-arrangement.conf
# file should declare the $leftdisplay and $rightdisplay variables used
# here.
workspace {
# Left monitor workspaces
1 output $leftdisplay
2 output $leftdisplay
3 output $leftdisplay
4 output $leftdisplay
5 output $leftdisplay
6 output $leftdisplay
7 output $leftdisplay
8 output $leftdisplay
9 output $leftdisplay
10 output $leftdisplay
# Center monitor workspaces
11 output $centerdisplay
12 output $centerdisplay
13 output $centerdisplay
14 output $centerdisplay
15 output $centerdisplay
16 output $centerdisplay
17 output $centerdisplay
18 output $centerdisplay
19 output $centerdisplay
20 output $centerdisplay
# Right monitor workspaces
21 output $rightdisplay
22 output $rightdisplay
23 output $rightdisplay
24 output $rightdisplay
25 output $rightdisplay
26 output $rightdisplay
27 output $rightdisplay
28 output $rightdisplay
29 output $rightdisplay
30 output $rightdisplay
}
## Workspace Switching Keybinds
bindsym {
$mod+1 exec swaymsg workspace $(sway-find-workspace 1 )
$mod+2 exec swaymsg workspace $(sway-find-workspace 2 )
$mod+3 exec swaymsg workspace $(sway-find-workspace 3 )
$mod+4 exec swaymsg workspace $(sway-find-workspace 4 )
$mod+5 exec swaymsg workspace $(sway-find-workspace 5 )
$mod+6 exec swaymsg workspace $(sway-find-workspace 6 )
$mod+7 exec swaymsg workspace $(sway-find-workspace 7 )
$mod+8 exec swaymsg workspace $(sway-find-workspace 8 )
$mod+9 exec swaymsg workspace $(sway-find-workspace 9 )
$mod+0 exec swaymsg workspace $(sway-find-workspace 10)
}
## Window Reassignment Keybinds
bindsym {
$mod+Shift+1 exec swaymsg move container to workspace $(sway-find-workspace 1 )
$mod+Shift+2 exec swaymsg move container to workspace $(sway-find-workspace 2 )
$mod+Shift+3 exec swaymsg move container to workspace $(sway-find-workspace 3 )
$mod+Shift+4 exec swaymsg move container to workspace $(sway-find-workspace 4 )
$mod+Shift+5 exec swaymsg move container to workspace $(sway-find-workspace 5 )
$mod+Shift+6 exec swaymsg move container to workspace $(sway-find-workspace 6 )
$mod+Shift+7 exec swaymsg move container to workspace $(sway-find-workspace 7 )
$mod+Shift+8 exec swaymsg move container to workspace $(sway-find-workspace 8 )
$mod+Shift+9 exec swaymsg move container to workspace $(sway-find-workspace 9 )
$mod+Shift+0 exec swaymsg move container to workspace $(sway-find-workspace 10)
}

View File

@ -0,0 +1,288 @@
{
"default_context": "personal-portable",
"workspaces": [
{
"index": 1,
"name": "console",
"exec": "console",
"program_name": "console"
},
{
"index": 2,
"name": "code",
"exec": "emacsclient",
"args": ["-nc"],
"program_name": "emacsclient"
},
{
"index": 3,
"name": "documentation",
"exec": "firefox",
"args": ["--new-window"],
"environ": {},
"program_name": "firefox"
},
{
"index": 4,
"name": "project",
"exec": "firefox",
"args": ["--new-window"],
"program_name": "firefox"
},
{
"index": 5,
"name": "discord",
"exec": "discord",
"program_name": "discord"
},
{
"index": 6,
"name": "console",
"exec": "console",
"program_name": "console"
},
{
"index": 7,
"name": "code",
"exec": "emacsclient",
"args": ["-nc"],
"program_name": "emacsclient"
},
{
"index": 8,
"name": "internet",
"exec": "firefox",
"args": ["--new-window"],
"program_name": "firefox"
},
{
"index": 9,
"name": "project",
"exec": "firefox-developer-edition",
"args": ["-start-debugger-server", "--new-window"],
"program_name": "firefox-developer-edition"
},
{
"index": 10,
"name": "server management",
"exec": "virt-manager",
"program_name": "virt-manager",
"systemd": false
},
{
"index": 11,
"name": "password management",
"exec": "bitwarden-desktop",
"program_name": "bitwarden"
},
{
"index": 12,
"name": "video",
"exec": "jellyfinmediaplayer",
"program_name": "jellyfinmediaplayer"
},
{
"index": 13,
"name": "comms",
"exec": "zoom",
"program_name": "zoom"
},
{
"index": 14,
"name": "mail",
"exec": "thunderbird",
"program_name": "thunderbird",
"environ": {
"MOZ_ENABLE_WAYLAND": "1"
}
},
{
"index": 15,
"name": "config",
"exec": "console",
"program_name": "console"
},
{
"index": 16,
"name": "console",
"exec": "console",
"program_name": "console"
},
{
"index": 17,
"name": "code",
"exec": "emacsclient",
"args": ["-nc"],
"program_name": "emacsclient"
},
{
"index": 18,
"name": "music",
"exec": "feishin",
"program_name": "feishin"
},
{
"index": 19,
"name": "internet",
"exec": "firefox",
"args": ["--new-window"],
"program_name": "firefox"
},
{
"index": 20,
"name": "slack",
"exec": "slack",
"program_name": "slack",
"args": [
"--enable-features=UseOzonePlatform",
"--ozone-platform=wayland",
"--enable-gpu-rasterization"
]
},
{
"index": 21,
"name": "ferrets",
"exec": "firefox",
"args": ["--new-window", "https://www.twitch.tv/ferretsoftware"],
"program_name": "firefox"
},
{
"index": 22,
"name": "encrypted comms",
"exec": "signal-desktop",
"program_name": "signal"
},
{
"index": 23,
"name": "steam",
"exec": "steam",
"program_name": "steam"
}
],
"contexts": {
"docked": {
"primary": "center",
"outputs": [
{
"names": ["eDP-1"],
"group": "builtin",
"position": [0, 600],
"eww_windows": ["builtinbar"],
"mode": "2560x1600@165Hz scale 1.5 color_profile icc /usr/share/color/icc/colord/BOE_CQ_______NE160QDM_NZ6.icm"
},
{
"make": "Acer Technologies",
"model": "XV271U M3",
"serial": "1322131231233",
"group": "left",
"position": [1707, 0],
"mode": "2560x1440@120Hz",
"eww_windows": ["leftbar", "sidebar"]
},
{
"make": "Dell Inc.",
"model": "DELL U3818DW",
"serial": "97F8P9350W0L",
"group": "center",
"position": [4267, 0],
"mode": "3840x1600",
"eww_windows": ["centerbar"]
},
{
"make": "Acer Technologies",
"model": "XV271U M3",
"serial": "1431038964205",
"group": "right",
"position": [8107, 0],
"mode": "2560x1440@120Hz",
"eww_windows": ["rightbar"]
}
],
"groups": {
"builtin": {
"workspaces": [21, 22],
"reverse": false
},
"left": {
"workspaces": [6, 2, 3, 4, 5],
"reverse": true
},
"center": {
"workspaces": [1, 7, 8, 9, 10, 11, 12, 13, 14, 15],
"reverse": false
},
"right": {
"workspaces": [16, 17, 19, 18, 20, 13],
"reverse": false
}
}
},
"work-portable": {
"primary": "builtin",
"outputs": [
{
"names": ["eDP-1"],
"group": "builtin",
"position": [0, 0],
"eww_windows": ["builtinbar"],
"mode": "2560x1600@165Hz scale 1.25 color_profile icc /usr/share/color/icc/colord/BOE_CQ_______NE160QDM_NZ6.icm"
}
],
"groups": {
"builtin": {
"workspaces": [1, 7, 8, 9, 10, 13, 18, 20, 14, 15],
"reverse": false
}
}
},
"personal-portable": {
"primary": "builtin",
"outputs": [
{
"names": ["eDP-1"],
"group": "builtin",
"position": [0, 0],
"eww_windows": ["builtinbar"],
"mode": "2560x1600@165Hz scale 1.25 color_profile icc /usr/share/color/icc/colord/BOE_CQ_______NE160QDM_NZ6.icm"
}
],
"groups": {
"builtin": {
"workspaces": [1, 7, 8, 9, 23, 22, 18, 5, 14, 15],
"reverse": false
}
}
},
"spawnpoint": {
"primary": "external",
"outputs": [
{
"names": ["eDP-1"],
"group": "builtin",
"position": [2560, 0],
"eww_windows": ["builtinbar"],
"mode": "2560x1600@165Hz scale 1.5 color_profile icc /usr/share/color/icc/colord/BOE_CQ_______NE160QDM_NZ6.icm"
},
{
"make": "LG Electronics",
"model": "LG UltraFine",
"serial": "111NTRL2Y030",
"group": "external",
"position": [0, 0],
"eww_windows": ["centerbar"],
"mode": "3840x2160@60Hz scale 1.5"
}
],
"groups": {
"builtin": {
"workspaces": [6, 2, 3, 18, 5],
"reverse": false
},
"external": {
"workspaces": [1, 7, 8, 9, 23, 22, 19, 20, 14, 15],
"reverse": false
}
}
}
}
}

View File

@ -1,26 +1,18 @@
{
"default_context": "work",
"display_ordering": ["left", "center", "right"],
"display_layout": {
"left": "DP-5",
"right": "DP-7",
"center": "DP-4"
},
"contexts": {
"work": {
"left": [
"workspaces": [
{
"index": 5,
"name": "discord",
"exec": "discord",
"program_name": "discord"
"index": 1,
"name": "console",
"exec": "console",
"program_name": "console"
},
{
"index": 4,
"name": "project",
"exec": "firefox",
"args": ["--new-window"],
"program_name": "firefox"
"index": 2,
"name": "code",
"exec": "emacsclient",
"args": ["-nc"],
"program_name": "emacsclient"
},
{
"index": 3,
@ -31,20 +23,18 @@
"program_name": "firefox"
},
{
"index": 2,
"name": "code",
"exec": "emacsclient",
"args": ["-nc"],
"program_name": "emacsclient"
"index": 4,
"name": "project",
"exec": "firefox",
"args": ["--new-window"],
"program_name": "firefox"
},
{
"index": 1,
"name": "console",
"exec": "console",
"program_name": "console"
}
],
"center": [
"index": 5,
"name": "discord",
"exec": "discord",
"program_name": "discord"
},
{
"index": 6,
"name": "console",
@ -101,16 +91,17 @@
"index": 14,
"name": "mail",
"exec": "thunderbird",
"program_name": "thunderbird"
"program_name": "thunderbird",
"environ": {
"MOZ_ENABLE_WAYLAND": "1"
}
},
{
"index": 15,
"name": "config",
"exec": "console",
"program_name": "console"
}
],
"right": [
},
{
"index": 16,
"name": "console",
@ -127,8 +118,8 @@
{
"index": 18,
"name": "music",
"exec": "spotify",
"program_name": "spotify"
"exec": "feishin",
"program_name": "feishin"
},
{
"index": 19,
@ -152,7 +143,54 @@
"max": "1.2G"
}
}
]
],
"contexts": {
"work": {
"primary": "center",
"outputs": [
{
"make": "HP Inc.",
"model": "HP Z27n G2",
"serial": "6CM0151FHY",
"group": "left",
"position": [0, 450],
"mode": "2560x1440@75Hz",
"eww_windows": ["sidebar", "leftbar"]
},
{
"make": "Hewlett Packard",
"model": "HP S340c",
"serial": "CN490508SQ",
"group": "center",
"position": [2560, 450],
"mode": "3440x1440",
"eww_windows": ["centerbar"]
},
{
"make": "HP Inc.",
"model": "HP Z27n G2",
"serial": "6CM0151FD4",
"group": "right",
"position": [6000, 0],
"mode": "2560x1440@75Hz",
"transform": 90,
"eww_windows": ["rightbar"]
}
],
"groups": {
"left": {
"workspaces": [1, 2, 3, 4, 5],
"reverse": true
},
"center": {
"workspaces": [6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
"reverse": false
},
"right": {
"workspaces": [16, 17, 18, 19, 20],
"reverse": false
}
}
}
}
}

View File

@ -13,8 +13,8 @@ Restart=on-failure
Slice=session.slice
MemoryAccounting=yes
# Tide eats memory like crazy, so lets put it on a diet.
MemoryHigh=3G
MemoryMax=5G
MemoryHigh=8G
MemoryMax=10G
[Install]
WantedBy=graphical-session.target

View File

@ -1,4 +0,0 @@
# -*-conf-unix-*-
[Service]
ExecStartPost=eww open-many leftbar rightbar sidebar

View File

@ -1,4 +0,0 @@
# -*-conf-unix-*-
[Service]
ExecStartPost=eww open-many leftbar centerbar rightbar network-status

View File

@ -3,7 +3,7 @@ Description=KDE Connect Daemon
[Service]
Type=simple
ExecStart=/usr/lib/kdeconnectd
ExecStart=/usr/bin/kdeconnectd
[Install]
WantedBy=default.target
WantedBy=sway-session.target

View File

@ -4,7 +4,7 @@ BindTo=sway-session.target
[Service]
Type=simple
ExecStart=/usr/bin/lxpolkit
ExecStart=/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
[Install]
WantedBy=sway-session.target

View File

@ -0,0 +1,14 @@
[Unit]
Description = Sway workspace context manager for dynamic-monitor setups
PartOf=sway-session.target
[Service]
Type=dbus
BusName=dev.ezri.sway
ExecStart=/usr/bin/sway_context_manager
Slice=session.slice
Restart=on-abnormal
RestartSec=5s
[Install]
WantedBy=sway-session.target

View File

@ -1 +1,2 @@
.config/ssh/1*.conf
.config/ssh/3*.conf

View File

@ -7,7 +7,10 @@ alias userctl="\systemctl --user"
alias ujournalctl="\journalctl --user"
alias reconf="source $HOME/.zshrc"
alias reconf="exec $SHELL"
# Use safeexec to ensure we are using system binaries (required for some AUR packages)
alias paru="safeexec paru"
alias cp="cp -i --reflink=auto"
alias mv="mv -i"
@ -27,8 +30,10 @@ alias sudo='sudo '
alias sign='gpg --sign-with ezri@ezri.dev --detach-sign'
alias verify='gpg --verify'
alias bw-personal='BITWARDENCLI_APPDATA_DIR=~/.config/bw-cli-personal bw'
function didifuckingstutter {
echo $fg[blue]Apologies, right away.$fg[default]
echo $fg[blue]Apologies, milady. Right away.$fg[default]
# Run the last command as root
last_cmd=$(fc -ln -1)
# if last command was emacs, use TRAMP rather than running as root
@ -37,7 +42,7 @@ function didifuckingstutter {
echo "> $fg[white]$cmd$fg[default]"
$=cmd
else
cmd="sudo $(fc -ln -1)"
cmd="sudo zsh -c '$(fc -ln -1)'"
echo "> $fg[white]$cmd$fg[default]"
sudo -p "$fg[red]I'll need your authorization:$fg[default] " $last_cmd
fi

View File

@ -11,7 +11,7 @@ PATH_wincmake=/opt/msvcmake/bin:/opt/msvc/bin/x64
cdpath=(~ ~/src)
export PATH=.:$PATH_asdf:$PATH_node:$PATH_pyenv:$PATH_java:$PATH_user:$PATH_system
export PATH=.:$PATH_node:$PATH_pyenv:$PATH_java:$PATH_user:$PATH_system
# Function to run a command with only the "safe" system PATH element
function safeexec {

View File

@ -2,10 +2,7 @@
setopt auto_cd
# Use directory stack
setopt auto_pushd
# Always resolve symlinks when changing directory
setopt chase_links
# Ignore duplicate commands and commands starting with space
setopt hist_ignore_dups
setopt hist_ignore_space

View File

@ -63,7 +63,7 @@ eval $(awk '{print "PERSONAL_" $0}' ${HOME}/.personal-info 2>/dev/null)
if [[ -z ${MACHINE_CHASSIS} ]]; then MACHINE_CHASSIS=$(hostnamectl chassis 2>/dev/null); fi
if [[ -z ${MACHINE_CHASSIS} ]]; then MACHINE_CHASSIS="desktop"; fi
if [[ ${MACHINE_CHASSIS} != "container" ]]; then
if [[ ${MACHINE_CHASSIS} != "container" ]] && [[ ${OS_ID} == "arch" ]]; then
# Only check if a reboot is necessary if we're not in a container
precmd_functions+=(precmd_kernel_info)
fi
@ -100,7 +100,7 @@ case $OS_ID in
show_os_icon=0
;;
esac
prompt="▶"
prompt_char="%(?..%F{red}%f)"
host="%F{cyan}[ %F{green}${hostname}%(!.%F{red} as root.) %F{cyan}]%f"
localhost="%F{cyan}[ %F{magenta}%B${hostname}%(!.%F{red} as root.)%b %F{cyan}]%f"
serial_host="%F{cyan}[ %F{magenta}${hostname}%(!.%F{red} as root.) %F{cyan}] %F{red}%y%f"
@ -108,17 +108,21 @@ container_host="%F{cyan}[ %F{blue}%B${hostname}%(!.%F{red} as root.)%b %F{cyan}]
returncode="%(?..%F{red}  %?%f)"
prompt_line1='$kernel_info_msg_0_'
prompt_line3=$prompt
prompt_line3=" $prompt_char"
# Create conditional prompt line 2
if [[ -v SSH_CLIENT ]]; then
prompt_line2='${host}$pyenv_info_msg_0_ ${pwd}'
history_line="${host}"
elif [[ ${TTY} =~ "tty" ]]; then
prompt_line2='${serial_host}$pyenv_info_msg_0_ ${pwd}'
elif [[ ${MACHINE_CHASSIS} == "container" ]]; then
history_line="${serial_host}"
elif [[ ${MACHINE_CHASSIS} == "container" ]] || [[ ${MACHINE_CHASSIS} == "vm" ]]; then
prompt_line2='${container_host}$pyenv_info_msg_0_ ${pwd}'
history_line="${container_host}"
else
prompt_line2='${localhost}$pyenv_info_msg_0_ ${pwd}'
history_line="${localhost}"
fi
# Inject icon if available, with ANSI color code stored in $OS_ANSI_COLOR
@ -126,15 +130,36 @@ if [[ ${show_os_icon} -eq 1 ]]; then
prompt_line2=$'%{\x1b[${OS_ANSI_COLOR}m${os_icon}\x1b[0m%}'" ${prompt_line2}"
fi
if [[ ${TERM} == "dumb" ]]; then
set-prompt() {
if [[ ${TERM} == "dumb" ]]; then
# Dumb terminal needs a dumb prompt, otherwise things like
# emacs TRAMP break
PROMPT='[%~] $ '
else
PROMPT2='> '
else
PROMPT="${prompt_line1}
${prompt_line2}
${prompt_line3} "
fi
PROMPT2=" %F{yellow}%_ %f "
fi
}
set-prompt
rewrite-prompt-and-accept() {
if [[ ${TERM} == "dumb" ]]; then
return
fi
PROMPT='${history_line} %F{yellow}%T%f ${pwd}$pyenv_info_msg_0_ %F{green}${prompt_char}%f '
# Clear any suggestions; we've committed to this command
zle autosuggest-clear
zle reset-prompt
set-prompt
zle accept-line
}
zle -N rewrite-prompt-and-accept
bindkey '^M' rewrite-prompt-and-accept
RPROMPT='$vcs_info_msg_0_$returncode'

View File

@ -1 +0,0 @@
prompt.zsh##distro.Arch

View File

@ -75,3 +75,62 @@ function lsssh() {
echo "$user@$host"
done
}
function bwunlock() {
# Unlock Bitwarden vault and export session key
local bwfd
local bwpasswd
local secretstore
local bwcmd
local skipkeyring
# Use default Bitwarden account
secretstore="bw"
bwcmd="bw"
skipkeyring=0
while [[ $# -gt 0 ]]; do
case $1 in
--personal)
# Use personal Bitwarden account
secretstore="bw-personal"
bwcmd="env BITWARDENCLI_APPDATA_DIR=$HOME/.config/bw-cli-personal bw"
;;
--debug)
# Enable debug output
set -x
;;
--ask)
# Prompt for Bitwarden password
skipkeyring=1
;;
*)
echo "Unknown option: $1" >&2
;;
esac
shift
done
# Attempt to read Bitwarden password from keyring
if ! (( skipkeyring )); then
bwpasswd=$(secret-tool lookup service $secretstore 2>/dev/null)
fi
if [[ -z "${bwpasswd}" ]]; then
# If password is not found in keyring, prompt for it
read -s -p "Enter Bitwarden password: " bwpasswd
echo
# Store Bitwarden password in keyring
if ! (( skipkeyring )); then
secret-tool store --label="Bitwarden" service $secretstore
fi
fi
# Unlock Bitwarden vault and export session key
export BW_SESSION=$(eval $bwcmd unlock --raw "'$bwpasswd'" 2>/dev/tty)
if [[ -z "${BW_SESSION}" ]]; then
echo "Failed to unlock Bitwarden vault" >&2
return 1
else
echo "Bitwarden vault unlocked"
fi
}

View File

@ -1,2 +0,0 @@
# source $HOME/.local/lib/asdf/asdf.sh
# source $HOME/.local/lib/asdf/completions/asdf.bash

View File

@ -513,26 +513,31 @@ Indent using tabs, render with tab-width of 2.
:config
(setq company-idle-delay 0.3))
#+END_SRC
** LSP Mode
** LSP
#+BEGIN_SRC emacs-lisp
(use-package lsp-mode
(use-package eglot
:ensure t
:init
;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
(setq lsp-keymap-prefix "C-c l")
:hook ((python-mode . lsp) ;; pip install python-lsp-server pyls-black pyls-isort pyls-mypy
(elixir-mode . lsp)
(rust-mode . lsp)
(java-mode . lsp)
(php-mode . lsp)
(typescript-mode . lsp) ;; npm install -g typescript typescript-language-server
(lsp-mode . lsp-enable-which-key-integration))
:config (lsp-register-custom-settings
'(("pyls.plugins.pyls_mypy.enabled" t t)
("pyls.plugins.pyls_mypy.live_mode" nil t)
("pyls.plugins.pyls_black.enabled" t t)
("pyls.plugins.pyls_isort.enabled" t t)))
:commands lsp)
:defer t
:bind (:map eglot-mode-map
("C-c C-e" . eglot-rename)
("C-." . eglot-code-actions))
:hook ((python-mode . eglot-ensure)
(python-mode . flyspell-prog-mode)
(python-mode . superword-mode)
(python-mode . hs-minor-mode))
:config
(setq-default eglot-workspace-configuration
'((:pylsp . (:configurationSources ["flake8"]
:plugins (
:mccabe (:enabled :json-false)
:pyflakes (:enabled :json-false)
:flake8 (:enabled :json-false
:maxLineLength 88)
:ruff (:enabled t :lineLength 88)
:pydocstyle (:enabled t :convention "numpy")
:yapf (:enabled :json-false)
:autopep8 (:enabled :json-false)
:black (:enabled t :line_length 88 :cache_config t)))))))
#+END_SRC
** Languages
@ -570,11 +575,11 @@ After installing the ~rust-analyzer~ program, the following can be used:
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode))
(add-hook 'tsx-ts-mode-hook #'lsp)
(add-hook 'tsx-ts-mode-hook #'setup-tide-mode)
;; (add-hook 'tsx-ts-mode-hook #'eglot)
;; (add-hook 'tsx-ts-mode-hook #'setup-tide-mode)
(add-hook 'typescript-ts-mode-hook #'lsp)
(add-hook 'typescript-ts-mode-hook #'setup-tide-mode)
;; (add-hook 'typescript-ts-mode-hook #'eglot)
;; (add-hook 'typescript-ts-mode-hook #'setup-tide-mode)
#+END_SRC
**** TIDE
#+BEGIN_SRC emacs-lisp
@ -659,7 +664,7 @@ After installing the ~rust-analyzer~ program, the following can be used:
#+RESULTS:
** Format All The Buffers
* Format All The Buffers
#+BEGIN_SRC emacs-lisp
(use-package format-all
:ensure t)

View File

@ -4,11 +4,10 @@ exec </dev/null
exec > >(systemd-cat -t i3-sensible-launcher -p info)
exec 2> >(systemd-cat -t i3-sensible-launcher -p err)
pyenv shell system
export PATH=$HOME/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
current_workspace=$(swaymsg -t get_workspaces | jq '.[] | select(.focused==true).name' -r)
ws_data=$(jq <$HOME/.config/sway/workspaces.json ".contexts | [.[] | values[]] | flatten(1) | .[] | select(.index==${current_workspace})" -c)
ws_data=$(sway_get_focused_workspace)
current_workspace=$(echo $ws_data | jq -r '.index')
program=$(echo $ws_data | jq -r '.exec')
program_name=$(echo $ws_data | jq -r '.program_name')

View File

@ -10,10 +10,16 @@ done
echo "Output sets: $output_sets" >&2
if [[ -f $XDG_RUNTIME_DIR/wm_context ]]; then
wm_context=$(<$XDG_RUNTIME_DIR/wm_context)
else
wm_context=$(jq <~/.config/sway/workspaces.json '.default_context' -r)
fi
workspace_counts=()
total_workspaces=0
for output in {1..${#output_sets[@]}}; do
workspace_counts+=$(jq <~/.config/sway/workspaces.json ".contexts[.default_context] | [values[]][$((output - 1))] | length" -r)
workspace_counts+=$(jq <~/.config/sway/workspaces.json ".contexts.${wm_context} | [values[]][$((output - 1))] | length" -r)
((total_workspaces += workspace_counts[output]))
done

View File

@ -1,15 +1,18 @@
#!/usr/bin/env zsh
exec </dev/null
exec > >(systemd-cat -t gpclient -p info) 2>&1
# Toggles the GlobalProtect VPN connection on and off
# Get the current state of the VPN connection
if pgrep gpclient &>/dev/null; then
# VPN is connected, so disconnect
echo "Disconnecting from VPN..."
pkexec gpclient disconnect
pkexec env TZ=Etc/UTC gpclient disconnect
else
# VPN is disconnected, so connect
echo "Connecting to VPN..."
# pkexec doesn't pass the DISPLAY and XAUTHORITY environment variables, so we need to pass them manually
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY gpclient connect gp.usu.edu
TZ=Etc/UTC sudo /usr/sbin/gpclient --fix-openssl connect gp.usu.edu
fi

Binary file not shown.

1
.zshrc
View File

@ -12,3 +12,4 @@ fi
setopt INC_APPEND_HISTORY_TIME