summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormyortv <myortv@proton.me>2026-01-17 10:41:57 +0300
committermyortv <myortv@proton.me>2026-01-17 10:41:57 +0300
commit8346102a59b5017625a914dd53f82c83a17ce719 (patch)
treed58b61a013f032cec7ab88ac55c6e4e24da511b8
parent95fc1dd5b960bb6e29b24fa3ea102c5b9a438129 (diff)
added real default layout, updated run.shHEADmaster
-rwxr-xr-xrun.sh14
-rwxr-xr-xscript.sh2
-rwxr-xr-xsetup.sh3
-rw-r--r--summoner.py89
-rw-r--r--todo.md1
5 files changed, 77 insertions, 32 deletions
diff --git a/run.sh b/run.sh
new file mode 100755
index 0000000..6e432b6
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+
+VENV_PATH="$SCRIPT_DIR/venv"
+
+
+source "$VENV_PATH/bin/activate"
+
+python "$SCRIPT_DIR/summoner.py"
+
+
+deactivate
diff --git a/script.sh b/script.sh
deleted file mode 100755
index a62037d..0000000
--- a/script.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-source venv/bin/activate
-python watcher.py
diff --git a/setup.sh b/setup.sh
new file mode 100755
index 0000000..9aed2da
--- /dev/null
+++ b/setup.sh
@@ -0,0 +1,3 @@
+python -m venv venv
+source ./venv/bin/activate
+pip install -r ./req.txt
diff --git a/summoner.py b/summoner.py
index 6a8e889..b996c00 100644
--- a/summoner.py
+++ b/summoner.py
@@ -52,48 +52,70 @@ class Layout:
# actually interactable, because it is usually expected behaviour
LAYOUTS = {
- 'show_partial_overlay': Layout(
+ 'exec --no-startup-id echo "show_system_monitor"': Layout(
windows=[
Window(
- run=["alacritty", "-T", "cmatrix2", "-e", "cmatrix"],
- geometry={"x": 350, "y": 150, "w": 250, "h": 500},
- window_name="cmatrix2",
+ run=["/home/myo/sources/system_monitor/run.sh"],
+ geometry={"x": 50, "y": 50, "w": 400, "h": 1000},
+ window_name="SystemMonitor",
),
Window(
- run=["alacritty", "-T", "cmatrix3", "-e", "cmatrix"],
- geometry={"x": 900, "y": 300, "w": 250, "h": 500},
- window_name="cmatrix3",
+ run=["alacritty", "-T", "w_todo", "-e", "todo_output.sh", "/home/myo/Desk/todo_/todo.md", "22"],
+ geometry={"x": 500, "y": 50, "w": 900, "h": 350},
+ window_name="w_todo",
),
],
close_layout_on=[
- 'exec --no-startup-id echo "show_partial_overlay"',
+ 'exec --no-startup-id echo "show_system_monitor"',
]
),
- 'exec --no-startup-id echo "show_overlay_1"': Layout(
+ 'exec --no-startup-id echo "show_newsboat"': Layout(
windows=[
Window(
- run=["alacritty", "-T", "cmatrix", "-e", "cmatrix"],
- geometry={"x": 50, "y": 50, "w": 250, "h": 500},
- window_name="cmatrix",
+ run=["/home/myo/sources/system_monitor/run.sh"],
+ geometry={"x": 50, "y": 50, "w": 400, "h": 1000},
+ window_name="SystemMonitor",
),
- # Window(
- # run=["alacritty", "-T", "bigtime", "-e", "bigtime"],
- # geometry={"x": 350, "y": 50, "w": 1800, "h": 250},
- # window_name="bigtime",
- # steal_focus=True,
- # ),
Window(
- run=None,
- geometry={"x": 350, "y": 50, "w": 1800, "h": 250},
- window_name="special",
- skip_spawn=True,
- restore_to_initial_state=True,
- workspace="21"
+ run=["alacritty", "-T", "w_todo_short", "-e", "todo_output.sh", "/home/myo/Desk/todo_/todo.md", "3"],
+ geometry={"x": 500, "y": 50, "w": 1100, "h": 100},
+ window_name="w_todo_short",
+ ),
+ Window(
+ run=["alacritty", "-T", "w_newsboat", "-e", "newsboat"],
+ geometry={"x": 500, "y": 175, "w": 1100, "h": 350},
+ window_name="w_newsboat",
+ ),
+ Window(
+ run=["alacritty", "-T", "w_termusic", "-e", "termusic"],
+ geometry={"x": 500, "y": 550, "w": 1100, "h": 500},
+ window_name="w_termusic",
+ steal_focus=True,
+ ),
+ ],
+ close_layout_on=[
+ 'exec --no-startup-id echo "show_newsboat"',
+ # 'exec --no-startup-id echo "show_system_monitor"',
+ ]
+ ),
+ 'exec --no-startup-id echo "show_todo"': Layout(
+ windows=[
+ Window(
+ run=["/home/myo/sources/system_monitor/run.sh"],
+ geometry={"x": 50, "y": 50, "w": 400, "h": 1000},
+ window_name="SystemMonitor",
+ ),
+
+ Window(
+ run=["alacritty", "-T", "w_todo_edit", "-e", "helix", "/home/myo/Desk/todo_/todo.md"],
+ geometry={"x": 500, "y": 50, "w": 1300, "h": 1000},
+ window_name="w_todo_edit",
+ steal_focus=True,
),
],
close_layout_on=[
- 'exec --no-startup-id echo "show_partial_overlay"',
- 'exec --no-startup-id echo "show_overlay_1"',
+ 'exec --no-startup-id echo "show_todo"',
+ # 'exec --no-startup-id echo "show_system_monitor"',
]
),
}
@@ -353,8 +375,9 @@ def workspace_empty(ws: i3ipc.Con):
def spawn(targets: List[Window]):
tree = i3.get_tree()
for win in filter(lambda target: not find_window_container(tree, target), targets):
- res = subprocess.Popen(win.run)
- logging.debug(f"window spawned: {res}")
+ if win.run:
+ res = subprocess.Popen(win.run)
+ logging.debug(f"window spawned: {res}")
def find_window_container(tree: i3ipc.Con, win: Window) -> i3ipc.Con | None:
@@ -385,8 +408,9 @@ def get_spawn_targets(
) -> List[Window]:
"""returns filtered out unique spawn targets"""
all_windows = reduce(
- lambda a, b: a.windows + b.windows,
+ lambda a, b: a + b.windows,
layouts,
+ list(),
)
return list(set(all_windows))
@@ -539,6 +563,13 @@ def get_cli_args():
"spawn, position, float, hide, and restore predefined windows. "
"Layouts appear on empty workspaces or when triggered, and disappear "
"when focus or workspace state changes."
+ "\n"
+ "Edit `LAYOUTS` variable inside of this script, to modify layouts.\n"
+ "To make keybindings accessable, add bindsym strings like this:\n"
+ 'bindsym --release $mod+Ctrl+y exec --no-startup-id echo "show_system_monitor"\n'
+ 'Then, use `exec --no-startup-id echo "show_system_monitor"\n` as key in `LAYOUTS` variable\n'
+ "Value should be valid Layout value.\n\n"
+ "You can find more in README.md"
)
)
diff --git a/todo.md b/todo.md
index 2e23fa9..c06d8cb 100644
--- a/todo.md
+++ b/todo.md
@@ -1,2 +1 @@
- [ ] refactoring (code is very shit, it's 7:22, i want to go to sleep, i had work to do instead of this...)
-- [ ] documentation