From bd629235bb283e3f4f4a4ce60faf721c1bf83fb8 Mon Sep 17 00:00:00 2001 From: Michael Kantor Date: Wed, 18 Dec 2024 00:26:14 -0500 Subject: Added hammer script. Added script to display the current clipboard contents as a QR code. Updated README. --- README.md | 2 ++ config.py | 38 +++++++++++++++++++------------------- hammer.sh | 2 ++ qrdisplay.sh | 2 ++ 4 files changed, 25 insertions(+), 19 deletions(-) create mode 100755 hammer.sh create mode 100755 qrdisplay.sh diff --git a/README.md b/README.md index cf8cd9c..ed9af74 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,8 @@ Default programs are located at the top of `config.py`. |MODKEY + Y|Go to 'hidden' group.| |MODKEY + SHIFT + Y|Send window to 'hidden' group.| |MODKEY + CONTROL + Y|Send window to 'hidden' group and follow.| +|MODKEY + Q|Display clipboard contents as a QR code.| +|MODKEY + CONTROL + E|Open the hammer editor.| ### Copyright --- diff --git a/config.py b/config.py index db4a870..ef74cd3 100644 --- a/config.py +++ b/config.py @@ -159,8 +159,8 @@ def move_floating(qtile, xMod, yMod): qtile.current_window.set_position_floating(x, y) - with open('/tmp/wins.dict', 'w') as f: - f.write(str(qtile.current_window.get_position())) + #with open('/tmp/wins.dict', 'w') as f: + # f.write(str(qtile.current_window.get_position())) def resize_floating(qtile, xMod, yMod): x = qtile.current_window.get_size()[0] + xMod @@ -212,6 +212,17 @@ def cycle_float(qtile, direc): # # with open('/tmp/qtile_debug.py', 'w') as f: # f.write(str(dic)) +#@hook.subscribe.changegroup +#def defloat_mpv_onchange(): +# global qtile + +# with open('/tmp/wins.dict', 'w') as f: +# f.write(str(dir(qtile.current_group))) + + #name = c.info()['name'] + + #if 'mpv' in name: + # c.disable_floating() @hook.subscribe.setgroup def move_pin(): @@ -274,8 +285,8 @@ def swallow(c): return 0 name = c.info()['name'] - with open('/tmp/wins.dict', 'w') as f: - f.write(name) + #with open('/tmp/wins.dict', 'w') as f: + # f.write(name) #with open('/tmp/test.fifo', 'r') as f: # f.write(name) @@ -294,20 +305,6 @@ def swallow(c): pid = str(pid) ppid = str(psutil.Process(psutil.Process(int(pid)).ppid()).ppid()) - try: - if ppid in term_pids and ppid != 0: - with open('/tmp/wins.dict', 'w') as f: - f.write('skipping')#name))#.window.get_net_wm_pid())) - - else: - ppid = str(psutil.Process(int(ppid)).ppid()) - with open('/tmp/wins.dict', 'w') as f: - f.write(str(ppid))#name))#.window.get_net_wm_pid())) - - except Exception as e: - pass - #with open('/tmp/wins.dict', 'w') as f: - # f.write(str(ppid))#name))#.window.get_net_wm_pid())) if name in terms: terminal_windows.append({pid:c}) @@ -393,7 +390,7 @@ keys = [ Key([mod, "control"], "bracketright", lazy.spawn(f"{mpc} volume +5")), - Key([mod, "control"], "e", lazy.spawn(f"{home}/hammer.sh")), + Key([mod, "control"], "e", lazy.spawn(f"{home}/.config/qtile/hammer.sh")), # Toggle between different layouts as defined below Key([mod], "Tab", lazy.next_layout()), @@ -443,6 +440,8 @@ keys = [ Key([mod, 'shift'], "n", lazy.function(unpin_win)), + #Key([mod], "q", lazy.spawn("xclip -o | qrencode -m 2 -s 25 -o /dev/stdout | display")), + Key([mod], "q", lazy.spawn(f"{home}/.config/qtile/qrdisplay.sh")), #KeyChord([mod], "x", [ # Key([], "h", lazy.function(move_floating, -8, 0)), # Key([], "j", lazy.function(move_floating, 0, 8)), @@ -735,6 +734,7 @@ floating_layout = layout.Floating(float_rules=[ Match(title='branchdialog'), Match(title='pinentry'), Match(title='xsnow'), + Match(title='ImageMagick: -'), #{'wmclass': 'confirm'}, #{'wmclass': 'dialog'}, #{'wmclass': 'main.py'}, diff --git a/hammer.sh b/hammer.sh new file mode 100755 index 0000000..bf63cbc --- /dev/null +++ b/hammer.sh @@ -0,0 +1,2 @@ +#!/bin/sh +WINEPREFIX=~/wine/.hammer wine ~/.local/share/Steam/steamapps/common/Team\ Fortress\ 2/bin/x64/hammerplusplus.exe diff --git a/qrdisplay.sh b/qrdisplay.sh new file mode 100755 index 0000000..adac3f9 --- /dev/null +++ b/qrdisplay.sh @@ -0,0 +1,2 @@ +#!/bin/bash +xclip -o | qrencode -m 2 -s 25 -o /dev/stdout | display -- cgit v1.2.1