From b04320a36b1509ef7483e42052844dbf6bbf82d3 Mon Sep 17 00:00:00 2001 From: REALERvolker1 <73304952+REALERvolker1@users.noreply.github.com> Date: Wed, 21 Sep 2022 16:04:32 -0400 Subject: [PATCH 1/2] Scusage now appends to file in --- bin/scusage | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/scusage b/bin/scusage index 71cc9a8..3b26053 100644 --- a/bin/scusage +++ b/bin/scusage @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import os import i3ipc import tabulate @@ -26,6 +27,7 @@ def bar(amount, max): return "="*int((amount*width)/max) def print_result(counts): + outpath = f"{os.getenv('XDG_CONFIG_HOME')}/scusage.txt" data = [] print("") total = sum(counts.values()) @@ -34,7 +36,12 @@ def print_result(counts): if not max: max = v data.append([k, f"{v} ({v/total*100:.0f}%)", bar(v, max)]) - print(tabulate.tabulate(data, headers=["shortcut", "count", ""])) + + result = tabulate.tabulate(data, headers=["shortcut", "count", ""]) + outfile = open(outpath, "a") + outfile.write(f"\n{result}\n") + outfile.close() + print(f"{result}\r\nFile saved to {outpath}\r\n") if __name__ == "__main__": run() From 6b1fe8e0685d373d6a28d08b23524fe763583b33 Mon Sep 17 00:00:00 2001 From: volker1 <73304952+REALERvolker1@users.noreply.github.com> Date: Wed, 21 Sep 2022 16:11:16 -0400 Subject: [PATCH 2/2] Update README.md to include saved file location --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b5d160f..0811be7 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ Mod4+s: mark swapee; focus right; swap container with mark swapee; unmark swapee Mod4+8: workspace "8: " 1 (3%) ==== Mod4+9: workspace "9: " 1 (3%) ==== Mod4+0: workspace "10: " 1 (3%) ==== +File saved to /home/tux/.config/scusage.txt ``` The idea is that this tool helps you identify which shortcuts you use most often,