Refactor codebase to use nix modules

This commit is contained in:
Julia Lange 2024-04-14 05:40:02 -07:00
parent a4735423b4
commit ffada2703c
114 changed files with 1018 additions and 744 deletions

View file

@ -0,0 +1,27 @@
#!/usr/bin/env xonsh
import shelve
# Usage:
# ./changeprimary.xsh workspace
# changes to that workspace
# if workspace is "etc" then changes to etcN where N is a number
workspace=$ARG1
monitor=$HYPR_MON_PRIMARY
current_workspace = "home"
with shelve.open($HYPR_WORK_DB) as db:
current_workspace = db.get("primary")
if workspace == "etc":
if current_workspace.startswith("etc"):
current = current_workspace[3:] % db.get("primary_extras")
current_workspace = "etc" + str(current)
else:
current_workspace = "etc0"
else:
current_workspace = workspace
db["primary"] = current_workspace
hyprctl dispatch moveworkspacetomonitor name:@(current_workspace) $HYPR_MON_PRIMARY >> /dev/null
hyprctl dispatch workspace name:@(current_workspace) >> /dev/null

View file

@ -0,0 +1,27 @@
#!/usr/bin/env xonsh
import shelve
import copy
# Usage:
# ./changesecondary.xsh
# cycles through the secondary workspaces
current_secondary = "chat"
with shelve.open($HYPR_WORK_DB) as db:
workspaces = db.get("secondaries").copy()
current_primary = db.get("primary")
current_secondary = db.get("secondary")
#extras = db.get("secondary_extras")
if current_primary in workspaces:
workspaces.remove(current_primary)
current_secondary = workspaces[
(workspaces.index(current_secondary)+1) % len(workspaces)
]
db["secondary"] = current_secondary
# Change primary to bind
hyprctl dispatch moveworkspacetomonitor name:@(current_secondary) $HYPR_MON_SECONDARY
hyprctl dispatch workspace name:@(current_secondary)

View file

@ -0,0 +1,13 @@
#!/usr/bin/env xonsh
import shelve
# Usage:
# ./initdb.xsh
# initialize a db for use hypr workspace scripts
with shelve.open($HYPR_WORK_DB) as db:
db["primary"] = "home"
db["secondary"] = "chat"
db["secondaries"] = ["chat", "web", "med"]
db["secondary_extras"] = 1
db["primary_extras"] = 1