diff options
-rw-r--r-- | README.md | 65 | ||||
-rw-r--r-- | autostart.sh_example | 25 | ||||
-rw-r--r-- | config.py | 47 | ||||
-rwxr-xr-x | cusmodules/colors.py | 9 | ||||
-rwxr-xr-x | cusmodules/cuswidgets/ticker_gecko.py | 2 | ||||
-rwxr-xr-x | cusmodules/wallpaper.py | 12 | ||||
-rwxr-xr-x | hammer.sh | 2 | ||||
-rwxr-xr-x | mic.sh | 1 | ||||
-rwxr-xr-x | qrdisplay.sh | 2 |
9 files changed, 103 insertions, 62 deletions
@@ -1,24 +1,37 @@ ## Mike's Custom Qtile Config -### Features +## Important! +--- +Qtile has changed to the `uv` package manager and done away with the old entry point. Use the guide [here](https://docs.qtile.org/en/latest/manual/install/index.html), installing with widget dependencies, and run `uv pip install requests` in the directory where you cloned the qtile repository. I start qtile using `startx` with `$HOME/git/qtile/.venv/bin/python $HOME/git/qtile/.venv/bin/qtile start` in my `~/.xinitrc`. + +## Features --- - Pywal Integration. - Window Swallowing. - Cryptocurrency Widget. -Automatic reloads from wallpaper.py and colors.py assumes that the `qtile` script is located in `$HOME/git/qtile/bin/`. I use the master branch of qtile from github. +Automatic reloads from wallpaper.py and colors.py assumes that the `qtile` script is located in `$HOME/git/qtile/.venv/bin/`. I use the master branch of qtile from GitHub. ### Dependencies --- +- Zsh. - [Mpd2](https://pypi.org/project/python-mpd2/). Host is ~/.mpd/socket. Port is 6600. - [Ario](https://ario-player.sourceforge.net/). - Imagemagick. - [Pywal.](https://github.com/dylanaraps/pywal) +- [OpenRazer.](https://openrazer.github.io) - [Xsnow.](https://www.ratrabbit.nl/ratrabbit/xsnow/) - Xautolock. Uses [slock](https://tools.suckless.org/slock/) with xres and message patches. I might put my fork up in the future. - [Dmenu.](https://github.com/LukeSmithxyz/dmenu) - [Flameshot.](https://flameshot.org/) +- [Dunst.](https://github.com/dunst-project/dunst) - Powerline Symbols. +- Nimbus Sans. +- Liberation Sans. + +### Usage +--- +Copy `autostart.sh_example` to `autostart.sh` in the same directory. Make any necessary changes. ### Defaults --- @@ -27,7 +40,7 @@ Default programs are located at the top of `config.py`. - Terminal Emulator: [Alacritty.](https://github.com/alacritty/alacritty) - Browser: [Librewolf.](https://librewolf.net/) -### Key Bindings +## Key Bindings --- |Binding|Action| |-|-| @@ -90,28 +103,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.| - -### Copyright ---- -Copyright (c) 2012-2015 Tycho Andersen, -Copyright (c) 2013 xarvh, -Copyright (c) 2013 horsik, -Copyright (c) 2013-2014 roger, -Copyright (c) 2013 Tao Sauvage, -Copyright (c) 2014 ramnes, -Copyright (c) 2014 Sean Vig, -Copyright (c) 2014 Adi Sieker. - -Modified by Michael Kantor - -Permission is hereby granted, free of charge, to any person obtaining a copy of this - software and associated documentation files (the “Software”), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to the following - conditions: -The above copyright notice and this permission notice shall be included in all copies - or substantial portions of the Software. +|MODKEY + Q|Display clipboard contents as a QR code.| +|MODKEY + CONTROL + E|Open the hammer++ editor.| ## Custom Modules @@ -162,3 +155,25 @@ Gets the price of a cryptocurrency from [CoinGecko](https://www.coingecko.com/). - DOGE More can be added to the "currencies" variable in the "match" function. + +## Copyright +--- +Copyright (c) 2012-2015 Tycho Andersen, +Copyright (c) 2013 xarvh, +Copyright (c) 2013 horsik, +Copyright (c) 2013-2014 roger, +Copyright (c) 2013 Tao Sauvage, +Copyright (c) 2014 ramnes, +Copyright (c) 2014 Sean Vig, +Copyright (c) 2014 Adi Sieker. + +Modified by Michael Kantor + +Permission is hereby granted, free of charge, to any person obtaining a copy of this + software and associated documentation files (the “Software”), to deal in the Software + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to the following + conditions: +The above copyright notice and this permission notice shall be included in all copies + or substantial portions of the Software. diff --git a/autostart.sh_example b/autostart.sh_example new file mode 100644 index 0000000..b33aa55 --- /dev/null +++ b/autostart.sh_example @@ -0,0 +1,25 @@ +#!/bin/zsh + +mpd + +amixer -q set Capture mute nocap + +xautolock -time 5 -locker 'slock -m "$(cowsay $(fortune))"' & + +picom & + +xclip & + +dunst & + +touch /tmp/crprices.json +$HOME/.config/qtile/cusmodules/cuswidgets/ticker_gecko.py BTC XMR DOGE & + +sleep 1 + +$HOME/git/qtile/.venv/bin/qtile shell -c "reload_config()" & + +if [ "$(date +%m)" -eq 12 ]; then + #xsnow -notrees & + $HOME/Downloads/xsnow-3.7.6/src/xsnow -notrees -nomenu -scale 40 -moon 0 +fi @@ -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 @@ -229,13 +229,6 @@ def move_pin(): #with open('/tmp/wins.dict', 'w') as f: # f.write(str(qtile.groups().get('swallow').get('windows'))) -@hook.subscribe.client_name_updated -def defloat_mpv(c): - name = c.info()['name'] - - if 'mpv' in name: - c.disable_floating() - @hook.subscribe.client_killed def un_swallow(c): global terms @@ -274,15 +267,12 @@ 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) - if 'mpv' in name: - c.disable_floating() - pid = c.window.get_net_wm_pid() if pid == None: @@ -294,20 +284,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}) @@ -373,7 +349,7 @@ keys = [ Key([], "XF86AudioPause", lazy.spawn(f"{mpc} pause")), Key([], "XF86AudioPrev", lazy.spawn(f"{mpc} prev")), Key([], "XF86AudioNext", lazy.spawn(f"{mpc} next")), - Key([mod], "m", lazy.spawn("amixer -q set Capture toggle"), lazy.spawn(f"{home}/.config/qtile/mic.sh")), + Key([mod], "m", lazy.spawn(f"{home}/.config/qtile/mic.sh")), Key([mod], "comma", lazy.spawn(f"{mpc} prev")), Key([mod, "shift"], "comma", lazy.spawn(f"{mpc} seek 0%")), @@ -393,7 +369,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 +419,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)), @@ -512,6 +490,7 @@ keys.append(Key([mod, "control"], '0', lazy.window.togroup('X'), lazy.group['X'] widget_defaults = { 'font': 'Nimbus Sans', + #'font': 'Liberation Sans', 'fontsize': 13, 'padding': 2, } @@ -543,10 +522,11 @@ screens = [ widget.GroupBox( margin_y = 6, - margin_x = 0, + margin_x = 5, padding_y = 5, - padding_x = 3, + padding_x = 1, borderwidth = 3, + spacing = 1, active = '#ffffff', inactive = inactive('color0'), rounded = False, @@ -554,6 +534,8 @@ screens = [ highlight_color = [color.get('color0').strip('#'), highlight('color0')], background = color.get('color0'), this_current_screen_border = color.get('color6'), + fontsize = 15, + font = 'Liberation Sans' ), widget.TextBox( @@ -735,6 +717,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/cusmodules/colors.py b/cusmodules/colors.py index f25c3c7..c9a3cbc 100755 --- a/cusmodules/colors.py +++ b/cusmodules/colors.py @@ -22,6 +22,7 @@ import wallpaper from pathlib import Path from random import randint from subprocess import run +import openrazer.client def random(colors): colorcount = len(colors) - 1 @@ -51,9 +52,15 @@ def setColor(home, color_dir, choice, **kwargs): #run(['qtile', 'shell', '-c', 'restart()']) #run(['kill', '-SIGUSR1', os.popen('pidof qtile').read().strip('\n')]) - run([f'{home}/git/qtile/bin/qtile', 'shell', '-c', 'reload_config()']) + run([f'{home}/git/qtile/.venv/bin/qtile', 'shell', '-c', 'reload_config()']) run([f'{home}/.local/bin/pywalfox', 'update']) + rgb = tuple(int(bottom_color.lstrip('#')[i:i+2], 16) for i in (0, 2, 4)) + devman = openrazer.client.DeviceManager() + + for device in devman.devices: + device.fx.static(rgb[0], rgb[1], rgb[2]) + return 0 def main(argc, argv): diff --git a/cusmodules/cuswidgets/ticker_gecko.py b/cusmodules/cuswidgets/ticker_gecko.py index d58e458..94fd1c6 100755 --- a/cusmodules/cuswidgets/ticker_gecko.py +++ b/cusmodules/cuswidgets/ticker_gecko.py @@ -111,7 +111,7 @@ def main(): return crprices[:15] except Exception as e: - with open(f'{home}/.local/share/ticker_gecko/ticker_gecko.log', 'w') as f: + with open(f'{home}/.local/share/ticker_gecko/ticker_gecko.log', 'w+') as f: f.write(e) return f'ERROR! Check "{home}/.local/share/ticker_gecko/ticker_gecko.log".' diff --git a/cusmodules/wallpaper.py b/cusmodules/wallpaper.py index 226fe52..711c507 100755 --- a/cusmodules/wallpaper.py +++ b/cusmodules/wallpaper.py @@ -1,5 +1,4 @@ #!/usr/bin/env python - #Copyright (C) 2024 Michael Kantor #This program is free software: you can redistribute it and/or modify @@ -20,6 +19,7 @@ import sys import json import toml import signal +import openrazer.client from PIL import Image from pathlib import Path from random import randint @@ -176,7 +176,7 @@ if __name__ == '__main__': #subprocess.check_call(['qtile', 'shell', '-c', 'restart()']) #run(['kill', '-SIGUSR1', os.popen('pidof qtile').read().strip('\n')]) #run(['qtile', 'shell', '-c', 'restart()']) - run([f'{home}/git/qtile/bin/qtile', 'shell', '-c', 'reload_config()']) + run([f'{home}/git/qtile/.venv/bin/qtile', 'shell', '-c', 'reload_config()']) except: os.system('killall dwm') @@ -277,7 +277,13 @@ if __name__ == '__main__': #subprocess.check_call(['qtile', 'shell', '-c', 'restart()']) #run(['qtile', 'shell', '-c', 'restart()']) #run(['kill', '-SIGUSR1', os.popen('pidof qtile').read().strip('\n')]) - run([f'{home}/git/qtile/bin/qtile', 'shell', '-c', 'reload_config()']) + run([f'{home}/git/qtile/.venv/bin/qtile', 'shell', '-c', 'reload_config()']) + + rgb = tuple(int(bottom_color.lstrip('#')[i:i+2], 16) for i in (0, 2, 4)) + devman = openrazer.client.DeviceManager() + + for device in devman.devices: + device.fx.static(rgb[0], rgb[1], rgb[2]) #os.system('qtile shell -c "restart()"') except: 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 @@ -1,2 +1,3 @@ #!/bin/sh +amixer -q set Capture toggle notify-send "$(amixer | grep Capture)" 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 |