905116cb8c03d1aea671c3a8285fc4179c1370f3

Author
TheEdgeOfRage <git@theedgeofrage.com>
Committer
TheEdgeOfRage <git@theedgeofrage.com>
Date

Message

Update autoname script

Diff

 1diff --git a/dot_config/sway/autoname-workspaces.py b/dot_config/sway/autoname-workspaces.py
 2index 03615a2c6b749bac11dd8501696c4ffb8ad4af68..5b36f81b18dd58843962655eec6ce0f091e72ce8 100644
 3--- a/dot_config/sway/autoname-workspaces.py
 4+++ b/dot_config/sway/autoname-workspaces.py
 5@@ -58,6 +58,7 @@ WINDOW_ICONS: dict[str, str] = {
 6     'feh': nf.icons['md_image'],
 7     'firefox': nf.icons['fa_firefox'],
 8     'firefoxdeveloperedition': nf.icons['fa_firefox'],
 9+    'gamescope': nf.icons['md_steam'],
10     'ghb': nf.icons['md_video'],
11     'gimp': nf.icons['fa_paint_brush'],
12     'gimp-2.10': nf.icons['fa_paint_brush'],
13@@ -83,6 +84,7 @@ WINDOW_ICONS: dict[str, str] = {
14     'obs': nf.icons['md_video'],
15     'openlens': nf.icons['md_kubernetes'],
16     'org.gnome.nautilus': nf.icons['fa_folder'],
17+    'oversteer': nf.icons['md_gamepad_variant'],
18     'pavucontrol': nf.icons['fa_volume_up'],
19     'picard': nf.icons['fa_music'],
20     'qbittorrent': nf.icons['fa_download'],
21@@ -95,6 +97,9 @@ WINDOW_ICONS: dict[str, str] = {
22     'steam': nf.icons['md_steam'],
23     'steam_app_671860': nf.icons['md_pistol'],  # battlebit
24     'steam_app_1336490': nf.icons['fae_storm'],  # against the storm
25+    'steam_app_599140': nf.icons['md_coffin'],  # graveyard keeper
26+    'steam_app_284160': nf.icons['md_car'],  # beamng.drive
27+    'steam_app_1250410': nf.icons['md_airplane'],  # microsoft flight simulator
28     'surviving mars': nf.icons['fa_rocket'],
29     'telegram-desktop': nf.icons['fa_telegram'],
30     'terraria.bin.x86_64': nf.icons['fa_tree'],
31@@ -107,6 +112,7 @@ WINDOW_ICONS: dict[str, str] = {
32     'zenity': nf.icons['fa_window_maximize'],
33 }
34 
35+
36 # This icon is used for any application not in the list above
37 DEFAULT_ICON = '*'
38 
39@@ -186,6 +192,7 @@ def rename_workspaces(i3) -> None:
40         icons = [
41             icon_for_window(w) for w in workspace.leaves()
42         ]
43+        icons += [icon_for_window(w) for w in workspace.floating_nodes]
44         if num is None:
45             new_name = str(workspace.num)
46         else:
47@@ -198,6 +205,9 @@ def rename_workspaces(i3) -> None:
48 # called on exit to indicate that this script is no longer running.
49 def undo_window_renaming(i3) -> None:
50     for workspace in i3.get_tree().workspaces():
51+        if workspace.num == -1:
52+            continue
53+
54         num = parse_workspace_number(workspace.name)
55         icons = None
56         if num is None:
57@@ -219,6 +229,7 @@ def get_signal_handler(i3) -> Callable[[int, FrameType | None], Any]:
58 
59 def main():
60     i3 = Connection()
61+    i3.get_tree()
62 
63     # exit gracefully when ctrl+c is pressed
64     for sig in [signal.SIGINT, signal.SIGTERM]: