diff options
author | Michael Kantor <michael@mikekantor.xyz> | 2024-01-09 22:02:20 -0500 |
---|---|---|
committer | Michael Kantor <michael@mikekantor.xyz> | 2024-01-09 22:02:20 -0500 |
commit | 270f3e6d77cc720b1b3f3c529b1b6aa5c63578a2 (patch) | |
tree | c65da331bc5306f820918f3a54ef51ac2ab746d9 |
Recreated git repo as screenshots were too large.
-rw-r--r-- | .gitignore | 21 | ||||
-rw-r--r-- | README.md | 171 | ||||
-rw-r--r-- | bottomsnake.png | bin | 0 -> 12535 bytes | |||
-rw-r--r-- | colors/citystreets.json | 26 | ||||
-rw-r--r-- | colors/codeschool.json | 26 | ||||
-rw-r--r-- | colors/defaultcolors.json | 27 | ||||
-rw-r--r-- | colors/doomicide.json | 26 | ||||
-rw-r--r-- | colors/eighties.json | 26 | ||||
-rw-r--r-- | colors/euphrasia.json | 26 | ||||
-rw-r--r-- | colors/farside.json | 26 | ||||
-rw-r--r-- | colors/gotham.json | 27 | ||||
-rw-r--r-- | colors/halloweencolors.json | 27 | ||||
-rw-r--r-- | colors/jwrdark.json | 26 | ||||
-rw-r--r-- | colors/kasugano.json | 26 | ||||
-rw-r--r-- | colors/navyandivory.json | 26 | ||||
-rw-r--r-- | colors/suede.json | 26 | ||||
-rw-r--r-- | colors/teva.json | 26 | ||||
-rw-r--r-- | colors/thanksgivingcolors.json | 27 | ||||
-rw-r--r-- | colors/vacuous2.json | 26 | ||||
-rw-r--r-- | colors/xmascolors.json | 27 | ||||
-rw-r--r-- | config.py | 751 | ||||
-rwxr-xr-x | cusmodules/appimg.py | 33 | ||||
-rwxr-xr-x | cusmodules/colors.py | 83 | ||||
-rwxr-xr-x | cusmodules/cuswidgets/ticker_gecko.py | 126 | ||||
-rwxr-xr-x | cusmodules/holiday.py | 50 | ||||
-rwxr-xr-x | cusmodules/wallpaper.py | 270 | ||||
-rwxr-xr-x | mic.sh | 2 | ||||
-rw-r--r-- | pythonlogo.png | bin | 0 -> 25754 bytes | |||
-rw-r--r-- | topsnake.png | bin | 0 -> 12909 bytes |
29 files changed, 1954 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f10b17f --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +__pycache__ +archlogo.png +archlogo2.png +autostart.sh +border.png +config.py.migrate.bak +cusmodules/cuswidgets/doge_ticker.py +cusmodules/cuswidgets/fifo_ticker_gecko.py +cusmodules/cuswidgets/neo_ticker.py +cusmodules/cuswidgets/old_neo_ticker.py +cusmodules/cuswidgets/ticker_csv.py +cusmodules/cuswidgets/ticker_test.py +cusmodules/cuswidgets/time +cusmodules/keyboard.py +cusmodules/layout.py +doge.png +n_config.py +n_config.py.migrate.bak +py.png +python2logo.png +qswallow.patch diff --git a/README.md b/README.md new file mode 100644 index 0000000..b32c360 --- /dev/null +++ b/README.md @@ -0,0 +1,171 @@ +## Mike's Custom Qtile Config + +### Features +--- +- Pywal Integration. +- Window Swallowing. +- Cryptocurrency Widget. + +### Dependencies +--- +- [Mpd2](https://pypi.org/project/python-mpd2/). Host is ~/.mpd/socket. Port is 6600. +- Imagemagick. +- [Pywal.](https://github.com/dylanaraps/pywal) +- [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/) +- Powerline Symbols. + +### Defaults +--- +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 +--- +|Binding|Action| +|-|-| +|MODKEY + RETURN|Opens Terminal| +|MODKEY + [1-10]|Go to group.| +|MODKEY + SHIFT + [1-10]|Send window to group.| +|MODKEY + CONTROL + [1-10]|Send window to group and follow.| +|MODKEY + H|Switch to window on the left| +|MODKEY + L|Switch to window on the right| +|MODKEY + K|Switch to window above.| +|MODKEY + J|Switch to window below.| +|MODKEY + SHIFT + H|Move window to the left| +|MODKEY + SHIFT + L|Move window to the right| +|MODKEY + SHIFT + K|Move window up.| +|MODKEY + SHIFT + J|Move window down.| +|MODKEY + SHIFT + SPACE|Flip windows.| +|MODKEY +CONTROL + K|Grow window.| +|MODKEY + CONTROL + J|Shrink window.| +|MODKEY + ALT + K|Move to next group.| +|MODKEY + ALT + J|Move to previous group.| +|MODKEY + M|Mute/Unmute microphone.| +|MODKEY + ,|Mpd: Go to previous song.| +|MODKEY + SHIFT + ,|Mpd: Seek to begining of song.| +|MODKEY + .|Mpd: Play next song.| +|MODKEY + SHIFT + .|Mpd: Toggle repeat.| +|MODKEY + SHIFT + P|Mpd: Play/Pause song.| +|MODKEY + [|Mpd: Seek backward 10 seconds.| +|MODKEY + ]|Mpd: Seek forward 10 seconds.| +|MODKEY + SHIFT + [|Mpd: Seek backward 60 seconds.| +|MODKEY + SHIFT + ]|Mpd: Seek forward 60 seconds.| +|MODKEY + CONTROL + [|Mpd: Lower volume by 5%.| +|MODKEY + CONTROL + ]|Mpd: Raise volume by 5%.| +|MODKEY + TAB|Next layout.| +|MODKEY + SHIFT + F|Toggle floating window.| +|MODKEY + SPACE|Toggle fullscreen window.| +|MODKEY + W|Kill window.| +|MODKEY + CONTROL + R|Restart Qtile.| +|MODKEY + CONTROL + Q|Close Qtile.| +|MODKEY + B|Hide status bar.| +|MODKEY + C|Opens Xterm| +|MODKEY + P|Dmenu run.| +|MODKEY + R|Scratchpad.| +|MODKEY + I|Run an Appimage.| +|MODKEY + F|Open web browser.| +|MODKEY + CONTROL + F|Open private web browser.| +|MODKEY + SHIFT + S|Open flameshot.| +|MODKEY + CONTROL + C|Open colors menu.| +|MODKEY + CONTROL + L|Xautolock: lock now.| +|MODKEY + ALT + L|Xautolock: toggle.| +|MODKEY + CONTROL + N|Open wallpaper menu.| +|MODKEY + Z|Reload config.| +|MODKEY + CONTROL + Z|Manually unswallow window.| +|MODKEY + SHIFT + Z|Manually swallow window.| +|MODKEY + N|Pin window.| +|MODKEY + SHIFT + N|Unpin window.| +|MODKEY + U|Go to 'swallow' group.| +|MODKEY + SHIFT + U|Send window to 'swallow' group.| +|MODKEY + CONTROL + U|Send window to 'swallow' group and follow.| +|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. + +## Custom Modules + +### Appimage +--- +`appimg.py` + +Opens a dmenu that runs Appimages. Appimages must be located in the `Applications` directory in your home directory. + +### Colors +--- +`colors.py` + +Opens a dmenu prompt that loads a pywal `json` file. Files must be located in the `colors` directory in your `qtile` config folder. + +### Holiday +---- +`holiday.py` + +Tells `wallpaper.py` what holiday it is. Halloween, Thanksgiving, and Christmas are supported. + +### Wallpaper +--- +`wallpaper.py` + +Sets the wallpaper using pywal. Wallpapers can be set with nitrogen by adding ":nitro" behind the filename. Wallpapers must be located in `~/Pictures/Wallpapers/wallpapers/`. Halloween wallpapers must be located in `~/Pictures/Wallpapers/halloweenwallpapers/`. Christmas wallpapers must be located in `~/Pictures/Wallpapers/xmaswallpapers/`. The first prompt will be "All" and selecting it will show all wallpapers. Additional groups can be added by creating a folder in `~/Pictures/Wallpapers/wallpaperdirs/`. To add wallpapers to a group, add the wallpaper to the main wallpapers directory than touch a file or create a symbolic link under the group's folder with the same name. The wallpaper must be in the main wallpapers directory. + +Presets can be created by adding a pywal `json` file to `~/Pictures/presets/`. Presets must have the same name as the wallpaper sans the file extension. For example, a preset for `~/Pictures/Wallpapers/wallpapers/nature.jpg` would be `~/Pictures/Wallpapers/presets/nature.json`. The `json` files generated by pywal can be found in `~/.cache/wal/colors.json`. Presets can be overriden by adding ":auto" after the filename. + +To set a wallpaper from the shell, add "-i" and then the file path. +\ No newline at end of file + +## Custom Widgets +### Ticker Gecko +--- +`ticker_gecko.py` + +Gets the price of a cryptocurrency from [CoinGecko](https://www.coingecko.com/). Add the ticker to the option in `autostart.sh`. The free CoinGecko api allows for 30 calls/min. The daemon will calculate how much time to wait between calls. + +### Supported Currencies +--- +- BTC +- ETH +- XRP +- LTC +- BCH +- XMR +- DOGE + +More can be added to the "currencies" variable in the "match" function. + +## Screenshots +--- + +![Screenshot 1](screenshots/screenshot1.png) +![Wallpaper screenshot 1](screenshots/screenshotwallpaper1.png) +![Wallpaper screenshot 2](screenshots/screenshotwallpaper2.png) +![Colors screenshot 1](screenshots/screenshotcolors1.png) +![Halloween screenshot 1](screenshots/screenshothalloween1.png) +![Christmas screenshot 1](screenshots/screenshotxmas1.png) +![Swallowing screenrecord](screenshots/swallow.gif)
\ No newline at end of file diff --git a/bottomsnake.png b/bottomsnake.png Binary files differnew file mode 100644 index 0000000..f0773cc --- /dev/null +++ b/bottomsnake.png diff --git a/colors/citystreets.json b/colors/citystreets.json new file mode 100644 index 0000000..39ae33c --- /dev/null +++ b/colors/citystreets.json @@ -0,0 +1,26 @@ +{ + "alpha": "100", + "special": { + "background": "#000000", + "foreground": "#d3d3d3", + "cursor": "#cbddf6" + }, + "colors": { + "color0": "#201e24", + "color1": "#2d2b30", + "color2": "#3f3d40", + "color3": "#413c3e", + "color4": "#423e41", + "color5": "#4e4a4b", + "color6": "#6e6765", + "color7": "#837e81", + "color8": "#837c78", + "color9": "#89827d", + "color10": "#a7a099", + "color11": "#c2bec1", + "color12": "#c3bcb2", + "color13": "#cbc5ba", + "color14": "#e3ddd2", + "color15": "#efe8dc" + } +}
\ No newline at end of file diff --git a/colors/codeschool.json b/colors/codeschool.json new file mode 100644 index 0000000..8a7274c --- /dev/null +++ b/colors/codeschool.json @@ -0,0 +1,26 @@ +{ + "alpha": "100", + "special": { + "background": "#232c31", + "foreground": "#9ea7a6", + "cursor": "#cbddf6" + }, + "colors": { + "color0": "#232c31", + "color1": "#2a5491", + "color2": "#237986", + "color3": "#a03b1e", + "color4": "#484d79", + "color5": "#c59820", + "color6": "#b02f30", + "color7": "#9ea7a6", + "color8": "#3f4944", + "color9": "#2a5491", + "color10": "#237986", + "color11": "#a03b1e", + "color12": "#484d79", + "color13": "#c59820", + "color14": "#b02f30", + "color15": "#b5d8f6" + } +}
\ No newline at end of file diff --git a/colors/defaultcolors.json b/colors/defaultcolors.json new file mode 100644 index 0000000..74de917 --- /dev/null +++ b/colors/defaultcolors.json @@ -0,0 +1,27 @@ +{ + "alpha": "100", + + "special": { + "background": "#000000", + "foreground": "#ffffff", + "cursor": "#cbddf6" + }, + "colors": { + "color0": "#000000", + "color1": "#cc0403", + "color2": "#19cb00", + "color3": "#cecb00", + "color4": "#0d73cc", + "color5": "#cb1ed1", + "color6": "#0dcdcd", + "color7": "#dddddd", + "color8": "#767676", + "color9": "#f2201f", + "color10": "#23fd00", + "color11": "#fffd00", + "color12": "#1a8fff", + "color13": "#fd28ff", + "color14": "#14ffff", + "color15": "#ffffff" + } +} diff --git a/colors/doomicide.json b/colors/doomicide.json new file mode 100644 index 0000000..8f84804 --- /dev/null +++ b/colors/doomicide.json @@ -0,0 +1,26 @@ +{ + "alpha": "100", + "special": { + "background": "#000000", + "foreground": "#ffffff", + "cursor": "#cbddf6" + }, + "colors": { + "color0": "#000000", + "color1": "#571dc2", + "color2": "#14db49", + "color3": "#403d70", + "color4": "#385a70", + "color5": "#384894", + "color6": "#4f3a5e", + "color7": "#999999", + "color8": "#38372c", + "color9": "#7c54b0", + "color10": "#a2e655", + "color11": "#9c6f59", + "color12": "#323f5c", + "color13": "#5e6c99", + "color14": "#667d77", + "color15": "#ffffff" + } +}
\ No newline at end of file diff --git a/colors/eighties.json b/colors/eighties.json new file mode 100644 index 0000000..aeb3cfc --- /dev/null +++ b/colors/eighties.json @@ -0,0 +1,26 @@ +{ + "alpha": "100", + "special": { + "background": "#2d2d2d", + "foreground": "#d3d0c8", + "cursor": "#cbddf6" + }, + "colors": { + "color0": "#2d2d2d", + "color1": "#f2777a", + "color2": "#99cc99", + "color3": "#ffcc66", + "color4": "#6699cc", + "color5": "#cc99cc", + "color6": "#66cccc", + "color7": "#d3d0c8", + "color8": "#747369", + "color9": "#f2777a", + "color10": "#99cc99", + "color11": "#ffcc66", + "color12": "#6699cc", + "color13": "#cc99cc", + "color14": "#66cccc", + "color15": "#f2f0ec" + } +}
\ No newline at end of file diff --git a/colors/euphrasia.json b/colors/euphrasia.json new file mode 100644 index 0000000..38488e4 --- /dev/null +++ b/colors/euphrasia.json @@ -0,0 +1,26 @@ +{ + "alpha": "100", + "special": { + "background": "#cfcfd9", + "foreground": "#1c2027", + "cursor": "#cbddf6" + }, + "colors": { + "color0": "#192033", + "color1": "#a62a3e", + "color2": "#38912b", + "color3": "#b27d12", + "color4": "#355c9a", + "color5": "#7c4f9f", + "color6": "#258f8f", + "color7": "#77858c", + "color8": "#666666", + "color9": "#f04758", + "color10": "#93c724", + "color11": "#ddb62b", + "color12": "#45a3e6", + "color13": "#c953ef", + "color14": "#60c6c8", + "color15": "#c0c0c0" + } +}
\ No newline at end of file diff --git a/colors/farside.json b/colors/farside.json new file mode 100644 index 0000000..6791191 --- /dev/null +++ b/colors/farside.json @@ -0,0 +1,26 @@ +{ + "alpha": "100", + "special": { + "background": "#000000", + "foreground": "#919191", + "cursor": "#cbddf6" + }, + "colors": { + "color0": "#303030", + "color1": "#a43261", + "color2": "#006ca5", + "color3": "#007086", + "color4": "#6751a6", + "color5": "#913e88", + "color6": "#0061b1", + "color7": "#c6c6c6", + "color8": "#5e5e5e", + "color9": "#ff9fc9", + "color10": "#3bd6ff", + "color11": "#00ddf4", + "color12": "#d5b8ff", + "color13": "#ffa7f6", + "color14": "#93c9ff", + "color15": "#ffffff" + } +}
\ No newline at end of file diff --git a/colors/gotham.json b/colors/gotham.json new file mode 100644 index 0000000..f916591 --- /dev/null +++ b/colors/gotham.json @@ -0,0 +1,27 @@ +{ + "alpha": "100", + + "special": { + "background": "#0a0f14", + "foreground": "#98d1ce", + "cursor": "#cbddf6" + }, + "colors": { + "color0": "#0a0f14", + "color1": "#c33027", + "color2": "#26a98b", + "color3": "#edb54b", + "color4": "#195465", + "color5": "#4e5165", + "color6": "#33859d", + "color7": "#98d1ce", + "color8": "#10151b", + "color9": "#d26939", + "color10": "#081f2d", + "color11": "#245361", + "color12": "#093748", + "color13": "#888ba5", + "color14": "#599caa", + "color15": "#d3ebe9" + } +} diff --git a/colors/halloweencolors.json b/colors/halloweencolors.json new file mode 100644 index 0000000..613b357 --- /dev/null +++ b/colors/halloweencolors.json @@ -0,0 +1,27 @@ +{ + "alpha": "100", + + "special": { + "background": "#000000", + "foreground": "#ffffff", + "cursor": "#cbddf6" + }, + "colors": { + "color0": "#000000", + "color1": "#cc0403", + "color2": "#19cb00", + "color3": "#cecb00", + "color4": "#0d73cc", + "color5": "#cb1ed1", + "color6": "#F75F1C", + "color7": "#dddddd", + "color8": "#000000", + "color9": "#f2201f", + "color10": "#23fd00", + "color11": "#fffd00", + "color12": "#1a8fff", + "color13": "#fd28ff", + "color14": "#881EE4", + "color15": "#ffffff" + } +} diff --git a/colors/jwrdark.json b/colors/jwrdark.json new file mode 100644 index 0000000..9ff0402 --- /dev/null +++ b/colors/jwrdark.json @@ -0,0 +1,26 @@ +{ + "alpha": "100", + "special": { + "background": "#000000", + "foreground": "#ffffff", + "cursor": "#cbddf6" + }, + "colors": { + "color0": "#333333", + "color1": "#8c4665", + "color2": "#287373", + "color3": "#7c7c99", + "color4": "#395573", + "color5": "#5e468c", + "color6": "#31658c", + "color7": "#899ca1", + "color8": "#3d3d3d", + "color9": "#bf4d80", + "color10": "#53a6a6", + "color11": "#9e9ecb", + "color12": "#477ab3", + "color13": "#7e62b3", + "color14": "#6096bf", + "color15": "#c0c0c0" + } +}
\ No newline at end of file diff --git a/colors/kasugano.json b/colors/kasugano.json new file mode 100644 index 0000000..32a9953 --- /dev/null +++ b/colors/kasugano.json @@ -0,0 +1,26 @@ +{ + "alpha": "100", + "special": { + "background": "#1b1b1b", + "foreground": "#ffffff", + "cursor": "#cbddf6" + }, + "colors": { + "color0": "#3d3d3d", + "color1": "#6673bf", + "color2": "#3ea290", + "color3": "#b0ead9", + "color4": "#31658c", + "color5": "#596196", + "color6": "#8292b2", + "color7": "#c8cacc", + "color8": "#4d4d4d", + "color9": "#899aff", + "color10": "#52ad91", + "color11": "#98c9bb", + "color12": "#477ab3", + "color13": "#7882bf", + "color14": "#95a7cc", + "color15": "#edeff2" + } +}
\ No newline at end of file diff --git a/colors/navyandivory.json b/colors/navyandivory.json new file mode 100644 index 0000000..fded073 --- /dev/null +++ b/colors/navyandivory.json @@ -0,0 +1,26 @@ +{ + "alpha": "100", + "special": { + "background": "#021b21", + "foreground": "#e8dfd6", + "cursor": "#cbddf6" + }, + "colors": { + "color0": "#032c36", + "color1": "#c2454e", + "color2": "#7cbf9e", + "color3": "#8a7a63", + "color4": "#2e3340", + "color5": "#ff5879", + "color6": "#44b5b1", + "color7": "#f2f1b9", + "color8": "#065f73", + "color9": "#ef5847", + "color10": "#a2d9b1", + "color11": "#beb090", + "color12": "#61778d", + "color13": "#ff99a1", + "color14": "#9ed9d8", + "color15": "#f6f6c9" + } +}
\ No newline at end of file diff --git a/colors/suede.json b/colors/suede.json new file mode 100644 index 0000000..809c7de --- /dev/null +++ b/colors/suede.json @@ -0,0 +1,26 @@ +{ + "alpha": "100", + "special": { + "background": "#170f0d", + "foreground": "#746c48", + "cursor": "#cbddf6" + }, + "colors": { + "color0": "#392925", + "color1": "#98724c", + "color2": "#908f32", + "color3": "#aa964c", + "color4": "#7b854e", + "color5": "#6b5644", + "color6": "#5c5142", + "color7": "#c8b55b", + "color8": "#544b2e", + "color9": "#af652f", + "color10": "#c3c13d", + "color11": "#c8b55b", + "color12": "#70a16c", + "color13": "#98724c", + "color14": "#778725", + "color15": "#e4dc8c" + } +}
\ No newline at end of file diff --git a/colors/teva.json b/colors/teva.json new file mode 100644 index 0000000..92488f1 --- /dev/null +++ b/colors/teva.json @@ -0,0 +1,26 @@ +{ + "alpha": "100", + "special": { + "background": "#170f0d", + "foreground": "#746c48", + "cursor": "#cbddf6" + }, + "colors": { + "color0": "#191f31", + "color1": "#282e39", + "color2": "#303844", + "color3": "#3b444a", + "color4": "#3c4435", + "color5": "#4e534f", + "color6": "#5d5d35", + "color7": "#66695d", + "color8": "#706d56", + "color9": "#8b7852", + "color10": "#909581", + "color11": "#91703a", + "color12": "#948658", + "color13": "#a19662", + "color14": "#ad9152", + "color15": "#c6a13f" + } +}
\ No newline at end of file diff --git a/colors/thanksgivingcolors.json b/colors/thanksgivingcolors.json new file mode 100644 index 0000000..422d354 --- /dev/null +++ b/colors/thanksgivingcolors.json @@ -0,0 +1,27 @@ +{ + "alpha": "100", + + "special": { + "background": "#000000", + "foreground": "#ffffff", + "cursor": "#cbddf6" + }, + "colors": { + "color0": "#000000", + "color1": "#cc0403", + "color2": "#19cb00", + "color3": "#cecb00", + "color4": "#0d73cc", + "color5": "#cb1ed1", + "color6": "#996236", + "color7": "#dddddd", + "color8": "#F8B12C", + "color9": "#f2201f", + "color10": "#23fd00", + "color11": "#fffd00", + "color12": "#1a8fff", + "color13": "#fd28ff", + "color14": "#ED732E", + "color15": "#ffffff" + } +} diff --git a/colors/vacuous2.json b/colors/vacuous2.json new file mode 100644 index 0000000..74640d7 --- /dev/null +++ b/colors/vacuous2.json @@ -0,0 +1,26 @@ +{ + "alpha": "100", + "special": { + "background": "#101010", + "foreground": "#d2c5bc", + "cursor": "#cbddf6" + }, + "colors": { + "color0": "#202020", + "color1": "#b91e2e", + "color2": "#81957c", + "color3": "#f9bb80", + "color4": "#356579", + "color5": "#2d2031", + "color6": "#0b3452", + "color7": "#909090", + "color8": "#606060", + "color9": "#d14548", + "color10": "#a7b79a", + "color11": "#fae3a0", + "color12": "#7491a1", + "color13": "#87314e", + "color14": "#0f829d", + "color15": "#fff0f0" + } +}
\ No newline at end of file diff --git a/colors/xmascolors.json b/colors/xmascolors.json new file mode 100644 index 0000000..3083a21 --- /dev/null +++ b/colors/xmascolors.json @@ -0,0 +1,27 @@ +{ + "alpha": "100", + + "special": { + "background": "#000000", + "foreground": "#ffffff", + "cursor": "#cbddf6" + }, + "colors": { + "color0": "#000000", + "color1": "#cc0403", + "color2": "#19cb00", + "color3": "#cecb00", + "color4": "#0d73cc", + "color5": "#cb1ed1", + "color6": "#0D5901", + "color7": "#dddddd", + "color8": "#B3000C", + "color9": "#f2201f", + "color10": "#23fd00", + "color11": "#fffd00", + "color12": "#1a8fff", + "color13": "#fd28ff", + "color14": "#00B32C", + "color15": "#ffffff" + } +} diff --git a/config.py b/config.py new file mode 100644 index 0000000..c783d75 --- /dev/null +++ b/config.py @@ -0,0 +1,751 @@ +import os +import time +import json +import psutil +import subprocess +from random import randint +from threading import Thread + +import cusmodules.holiday +#from cusmodules import holiday +#from cusmodules.cuswidgets import fifo_ticker_gecko +from cusmodules.cuswidgets import ticker_gecko +from typing import List # noqa: F401 +from libqtile import extension +from libqtile.lazy import lazy +from libqtile import layout, bar, widget, hook, qtile +from libqtile.config import Key, KeyChord, Screen, Group, Drag, Click, DropDown, ScratchPad, Match + +from libqtile.utils import send_notification + +from libqtile.core.manager import Qtile +from libqtile.backend.base import Window + +@hook.subscribe.startup_once +def autostart(): + home = os.path.expanduser('~') + holiday = cusmodules.holiday.main() + os.system(f'{home}/.config/qtile/cusmodules/wallpaper.py {holiday}') + subprocess.Popen(f'{home}/.config/qtile/autostart.sh') + +@hook.subscribe.shutdown +def shutdown(): + home = os.path.expanduser('~') + os.system(f"mpc -h {home}/.mpd/socket -p 6600 stop") + +mod = "mod4" +home = os.path.expanduser('~') +#term = 'st' +term = 'alacritty' +browser = 'librewolf' +privatebrowser = f'{browser} --private-window' +mpc = f"mpc -h {home}/.mpd/socket -p 6600" +pythonlogo = '/tmp/python.png' + +terms = ['st', 'kitty', 'cool-retro-term', 'Alacritty'] +terminal_windows = [] +swallowed_wins = [] + +pinned_wins = [] + +fast_swallowed = None + +def pyimage(home): + if os.path.isfile(pythonlogo): + return pythonlogo + + else: + return f'{home}/.config/qtile/pythonlogo.png' + +with open(f"{home}/.cache/wal/colors.json", 'r') as f: + data = json.load(f) + + color = data["colors"] + +def isWhite(color): + whites = [] + h = color.strip('#') + rgb = tuple(int(h[i:i+2], 16) for i in (0, 2, 4)) + + for i in rgb: + whites.append(i in range(235, 255)) + + if False in whites: + return False + + else: + return True + +def invColor(color): + inv = () + h = color.strip('#') + rgb = tuple(int(h[i:i+2], 16) for i in (0, 2, 4)) + + for i in rgb: + g = 255 % i + inv += (g,) + + invert = '%02x%02x%02x' % inv + invcolor = f"#{invert}" + + return invcolor + +def highlight(ogcolor): + h = color.get(ogcolor).strip('#') + rgb = tuple(int(h[i:i+2], 16) for i in (0, 2, 4)) + rgb1, rgb2, rgb3 = rgb + rgb1 = rgb1 +40 + rgb2 = rgb2 +40 + rgb3 = rgb3 +40 + rgb4 = (rgb1, rgb2, rgb3) + tohex = '%02x%02x%02x' % rgb4 + return tohex + +def inactive(ogcolor): + h = color.get(ogcolor).strip('#') + rgb = tuple(int(h[i:i+2], 16) for i in (0, 2, 4)) + rgb1, rgb2, rgb3 = rgb + rgb1 = rgb1 +64 + rgb2 = rgb2 +64 + rgb3 = rgb3 +64 + rgb4 = (rgb1, rgb2, rgb3) + tohex = '%02x%02x%02x' % rgb4 + tohex = '#' + tohex + return tohex + +layouts = [ + layout.MonadTall(margin = 10, border_focus = color.get('color14'), border_normal = color.get('color0')), + layout.Max(), + layout.Stack(margin = 6, border_focus = color.get('color14'), border_normal = color.get('color0'), num_stacks=1), + # Try more layouts by unleashing below layouts. + # layout.Bsp(margin = 10, border_focus = '#00FFFF'), + layout.Columns(margin = 6, border_focus = color.get('color14'), border_normal = color.get('color0')), + layout.Matrix(margin = 6, border_focus = color.get('color14'), border_normal = color.get('color0')), + layout.MonadWide(margin = 10, border_focus = color.get('color14'), border_normal = color.get('color0')), + # layout.RatioTile(), + # layout.Tile(), + layout.TreeTab(sections = [''], active_bg = color.get('color14'), inactive_bg = color.get('color8'), bg_color = color.get('color6')), + layout.Floating(border_focus = color.get('color14'), border_normal = color.get('color0')), + # layout.VerticalTile(), + # layout.Zoomy(), +] + +def reload_conf_cmd(qtile): + qtile.reload_config() + +def pin_win(qtile): + global pinned_wins + + if qtile.current_window in pinned_wins: + pass + + else: + pinned_wins.append(qtile.current_window) + #with open('/tmp/wins.dict', 'w') as f: + # f.write(str(qtile.current_window)) + +def unpin_win(qtile): + global pinned_wins + + pinned_wins.remove(qtile.current_window) + +def move_floating(qtile, xMod, yMod): + x = qtile.current_window.get_position()[0] + xMod + y = qtile.current_window.get_position()[1] + 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())) + +def resize_floating(qtile, xMod, yMod): + x = qtile.current_window.get_size()[0] + xMod + y = qtile.current_window.get_size()[1] + yMod + + qtile.current_window.set_size_floating(x, y) + #qtile.current_window.resize_floating(1, 1) + +def fast_swallow(qtile): + #global fast_swallowed + + #qtile.current_window = fast_swallowed + #with open('/tmp/test.txt', 'w') as f: + #f.write(str(dir(qtile.groups))) + #f.write(str(dir(qtile.groups[10].windows))) + #f.write(str(qtile.groups[10].windows)) + #f.write(str(qtile.groups().get('swallow'))) + + qtile.current_window.togroup('swallow') + #qtile.current_window.hide() + +def fast_unswallow(qtile): + + for i in qtile.groups[10].windows: + i.togroup(qtile.current_group.name) + +def cycle_float(qtile, direc): + pass +# floating_wins = [] +# +# for window in qtile.current_group.windows: +# if window.floating: +# floating_wins.append(window) +# +# if not floating_wins: +# return +# +# try: +# win = floating_wins[floating_wins.index(qtile.current_window) + direc] +# win.focus() +# +# except: +# pass + +@hook.subscribe.setgroup +def move_pin(): + global pinned_wins + global qtile + + for i in pinned_wins: + name = i.info()['name'] + + #if name in qtile.groups().get('swallow').get('windows'): + # break + + i.togroup(str(qtile.current_group.name)) + + if 'mpv' in name: + i.disable_floating() + + #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 + global pinned_wins + global terminal_windows + global swallowed_wins + + if c in pinned_wins: + pinned_wins.remove(c) + + if name in terms: + for i in terminal_windows: + if c in i.values(): + terminal_windows.remove(i) + #with open('/tmp/wins.dict', 'w') as f: + # f.write(str(terminal_windows)) + + else: + for i in swallowed_wins: + if c in i.values(): + win_to_deswallow = i.get('swallowed') + + win_to_deswallow.togroup(c.info()['group']) + + swallowed_wins.remove(i) + + +@hook.subscribe.client_managed +def swallow(c): + global term + global terms + global terminal_windows + global swallowed_wins + + if str(c.get_wm_type()) == 'dialog': + return 0 + + name = c.info()['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: + pid = os.popen(f'pidof {name}').read().strip('\n').split(' ') + pid = pid[0] + + term_pids = os.popen(f'pidof {term}').read().strip('\n').split(' ') + + 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}) + #os.system('kill -SIGKILL 84993') + #with open('/tmp/wins.dict', 'w') as f: + # f.write(str(terminal_windows))#name))#.window.get_net_wm_pid())) + + elif ppid == 1 or ppid == 0: + return 0 + + else: + for i in terminal_windows: + if str(ppid) in i.keys(): + swallowed_wins.append({'swallowed' : i.get(str(ppid)), + 'swallowed_by': c}) + + win_to_swall = i.get(str(ppid)) + + win_to_swall.togroup('swallow') + + #f.write(str(swallowed_wins))#.window.get_net_wm_pid())) + + else: + pass + + #with open('/tmp/wins.dict', 'w') as f: + # f.write(f"{type(pid)}: {pid}\n{type(ppid)}: {ppid}\n{terminal_windows}\n{swallowed_wins}") + + +keys = [ + # Switch between windows + Key([mod], "h", lazy.layout.left()), + Key([mod], "l", lazy.layout.right()), + + Key([mod], "k", lazy.layout.up()), + Key([mod], "j", lazy.layout.down()), + + + # Move windows up or down in current stack + Key([mod, "shift"], "h", lazy.layout.shuffle_left()), + Key([mod, "shift"], "l", lazy.layout.shuffle_right()), + + Key([mod, "shift"], "k", lazy.layout.shuffle_up()), + Key([mod, "shift"], "j", lazy.layout.shuffle_down()), + + Key([mod, "shift"], "space", lazy.layout.flip()), + + + # Grow and shrink windows + Key([mod, "control"], "k", lazy.layout.grow()), + Key([mod, "control"], "j", lazy.layout.shrink()), + + # Move between Groups + + Key([mod, "mod1"], "k", lazy.screen.next_group()), + Key([mod, "mod1"], "j", lazy.screen.prev_group()), + + # Sound + Key([], "XF86AudioMute", lazy.spawn("amixer -q set Master toggle")), + Key([], "XF86AudioLowerVolume", lazy.spawn("amixer -q sset 'Master' 2%- unmute")), + Key([], "XF86AudioRaiseVolume", lazy.spawn("amixer -q sset 'Master' 2%+ unmute")), + Key([], "XF86AudioPlay", lazy.spawn(f"{mpc} play")), + 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], "comma", lazy.spawn(f"{mpc} prev")), + Key([mod, "shift"], "comma", lazy.spawn(f"{mpc} seek 0%")), + + Key([mod], "period", lazy.spawn(f"{mpc} next")), + Key([mod, "shift"], "period", lazy.spawn(f"{mpc} repeat")), + + Key([mod, "shift"], "p", lazy.spawn(f"{mpc} toggle")), + + Key([mod], "bracketleft", lazy.spawn(f"{mpc} seek -10")), + Key([mod], "bracketright", lazy.spawn(f"{mpc} seek +10")), + + Key([mod, "shift"], "bracketleft", lazy.spawn(f"{mpc} seek -60")), + Key([mod, "shift"], "bracketright", lazy.spawn(f"{mpc} seek +60")), + + Key([mod, "control"], "bracketleft", lazy.spawn(f"{mpc} volume -5")), + Key([mod, "control"], "bracketright", lazy.spawn(f"{mpc} volume +5")), + + + # Toggle between different layouts as defined below + Key([mod], "Tab", lazy.next_layout()), + Key([mod, "shift"], "f", lazy.window.toggle_floating()), + Key([mod], "space", lazy.window.toggle_fullscreen()), + + # Close Windows + Key([mod], "w", lazy.window.kill()), + + # Qtile Actions + Key([mod, "control"], "r", lazy.restart()), + Key([mod, "control"], "q", lazy.shutdown()), + Key([mod], "b", lazy.hide_show_bar("top")), + + # Programs and misc actions + Key([mod], "Return", lazy.spawn(term)), + Key([mod], "c", lazy.spawn("xterm")), + + Key([mod], "p", lazy.spawn("dmenu_run -p 'Run:'")), + + Key([mod], "r", lazy.group['scratchpad'].dropdown_toggle('term')), + + #Key([mod, "control"], "p", lazy.group['vimpc'].dropdown_toggle('vimpc')), + + Key([mod], "i", lazy.spawn(f"{home}/.config/qtile/cusmodules/appimg.py")), + + Key([mod], "f", lazy.spawn(browser)), + + Key([mod, "shift"], "s", lazy.spawn("flameshot gui")), + + Key([mod, "control"], "f", lazy.spawn(privatebrowser)), + + Key([mod, "control"], "c", lazy.spawn(f"{home}/.config/qtile/cusmodules/colors.py")), + + Key([mod, "control"], "l", lazy.spawn(f'xautolock -locknow')), + Key([mod, "mod1"], "l", lazy.spawn(f'xautolock -toggle')), + + Key([mod, "control"], "n", lazy.spawn(home + "/.config/qtile/cusmodules/wallpaper.py")), + + Key([mod], "z", lazy.function(reload_conf_cmd)), + + Key([mod, 'control'], "z", lazy.function(fast_unswallow)), + + Key([mod, 'shift'], "z", lazy.function(fast_swallow)), + + Key([mod], "n", lazy.function(pin_win)), + + Key([mod, 'shift'], "n", lazy.function(unpin_win)), + + #KeyChord([mod], "x", [ + # Key([], "h", lazy.function(move_floating, -8, 0)), + # Key([], "j", lazy.function(move_floating, 0, 8)), + # Key([], "k", lazy.function(move_floating, 0, -8)), + # Key([], "l", lazy.function(move_floating, 8, 0)), + # Key(['shift'], "h", lazy.function(resize_floating, -8, 0)), + # Key(['shift'], "j", lazy.function(resize_floating, 0, 50)), + # Key(['shift'], "k", lazy.function(resize_floating, 0, -8)), + # Key(['shift'], "l", lazy.function(resize_floating, 50, 0)), + # Key([], "f", lazy.window.toggle_floating()), + # Key([], "period", lazy.function(cycle_float, 1)), + # Key([], "w", lazy.window.kill()), + #], + # name='Floating' + #) + #Key([mod], "y", lazy.window.togroup('scratchpad')), + + #Key([mod], "u", lazy.group['scratchpad'].toscreen()), + + #Key([mod], "x", lazy.function(pinned.append, lazy.window)), + +] + +group_names = [("I", {'layout': 'monadtall'}), + ("II", {'layout': 'monadtall'}), + ("III", {'layout': 'monadtall'}), + ("IV", {'layout': 'monadtall'}), + ("V", {'layout': 'monadtall'}), + ("VI", {'layout': 'monadtall'}), + ("VII", {'layout': 'monadtall'}), + ("VIII", {'layout': 'monadtall'}), + ("IX", {'layout': 'monadtall'})] + +groups = [Group(name, **kwargs) for name, kwargs in group_names] + +groups.append(ScratchPad('swallow')) + +groups.append(ScratchPad('hidden')) + +groups.append(ScratchPad("scratchpad", [ DropDown("term", term, opacity=1) ])) + +groups.append(ScratchPad("vimpc", [ DropDown("vimpc", f"{term} -e vimpc -h {home}/.mpd/socket -p 6600", opacity=1) ])) + +groups.append(Group("X")) + +for i, (name, kwargs) in enumerate(group_names, 1): + keys.append(Key([mod], str(i), lazy.group[name].toscreen())) # Switch to another group + keys.append(Key([mod, "shift"], str(i), lazy.window.togroup(name))) # Send current window to another group + keys.append(Key([mod, "control"], str(i), lazy.window.togroup(name), lazy.group[name].toscreen())) # Send current window to another group + + +keys.append(Key([mod], 'u', lazy.group['swallow'].toscreen())) +keys.append(Key([mod, 'shift'], 'u', lazy.window.togroup('swallow'))) +keys.append(Key([mod, "control"], 'u', lazy.window.togroup("swallow"), lazy.group["swallow"].toscreen())) # Send current window to another group + +keys.append(Key([mod], 'y', lazy.group['hidden'].toscreen())) +keys.append(Key([mod, 'shift'], 'y', lazy.window.togroup('hidden'))) +keys.append(Key([mod, "control"], 'y', lazy.window.togroup("hiddden"), lazy.group["hidden"].toscreen())) # Send current window to another group + +keys.append(Key([mod], '0', lazy.group['X'].toscreen())) +keys.append(Key([mod, 'shift'], '0', lazy.window.togroup('X'))) +keys.append(Key([mod, "control"], '0', lazy.window.togroup('X'), lazy.group['X'].toscreen())) # Send current window to another group + +widget_defaults = { + 'font': 'Nimbus Sans', + 'fontsize': 13, + 'padding': 2, +} + +extension_defaults = widget_defaults.copy() + +lar = u'\ue0b2' +rar = u'\ue0b0' +plf = "Powerline Symbols" + +screens = [ + Screen( + top=bar.Bar( + [ + widget.Image( + filename = pyimage(home), + background = color.get('color7'), + margin = 2, + ), + + widget.TextBox( + text=rar, + background = color.get('color0'), + foreground = color.get('color7'), + font = plf, + padding = 0, + fontsize = 23 + ), + + widget.GroupBox( + margin_y = 6, + margin_x = 0, + padding_y = 5, + padding_x = 3, + borderwidth = 3, + active = '#ffffff', + inactive = inactive('color0'), + rounded = False, + highlight_method = "line", + highlight_color = [color.get('color0').strip('#'), highlight('color0')], + background = color.get('color0'), + this_current_screen_border = color.get('color6'), + ), + + widget.TextBox( + text=rar, + foreground = color.get('color0'), + font = plf, + padding = 0, + fontsize = 23 + ), + + widget.Spacer( + length=550 + ), + + widget.TextBox( + text=u'\ue0ba', + foreground = color.get('color0'), + padding = -0.5, + fontsize = 26 + ), + + widget.Mpd2( + host=f"{home}/.mpd/socket", + status_format='{play_status} {artist} - {title} [{elapsed}/{duration}] | {volume}%', + background = color.get('color0') + ), + + widget.TextBox( + text=u'\ue0bc', + foreground = color.get('color0'), + padding = -0.5, + fontsize = 26 + ), + + widget.Spacer(), + + widget.TextBox( + text=lar, + foreground = color.get('color6'), + font = plf, + padding = -0.5, + fontsize = 23, + ), + + widget.Systray( + background = color.get('color6'), + icon_size = 15), + + widget.TextBox( + text = lar, + background = color.get('color6'), + foreground = color.get('color8'), + font = plf, + padding = -0.5, + fontsize = 23 + ), + + widget.Volume( + background= color.get('color8'), + ), + + widget.Volume( + emoji = True, + background= color.get('color8'), + ), + + widget.Volume( + fmt= ' {} ๐๏ธ', + channel='Capture', + background= color.get('color8'), + ), + + widget.TextBox( + text=lar, + background= color.get('color8'), + foreground = color.get('color6'), + font = plf, + padding = -0.5, + fontsize = 23 + ), + + widget.GenPollText( + func=ticker_gecko.main, + update_interval= 0.5, + foreground = invColor(color.get('color6')) if isWhite(color.get('color6')) else '#FFFFFF', + background = color.get('color6'), + ), + + widget.TextBox( + text = '๐ช', + background = color.get('color6'), + ), + + widget.TextBox( + text=lar, + background = color.get('color6'), + foreground = color.get('color8'), + font = plf, + padding = -0.5, + fontsize = 23 + ), + + widget.Memory( + fmt = "{} ๐พ", + background = color.get('color8'), + ), + + widget.TextBox( + text=lar, + background= color.get('color8'), + foreground = color.get('color6'), + font = plf, + padding = -0.5, + fontsize = 23 + ), + + widget.CPU( + fmt = '{} ๐ป', + foreground = invColor(color.get('color6')) if isWhite(color.get('color6')) else '#FFFFFF', + background = color.get('color6'), + ), + + widget.TextBox( + text=lar, + background = color.get('color6'), + foreground = color.get('color8'), + font = plf, + padding = -0.5, + fontsize = 23 + ), + + widget.Net( + format= '{down:6.2f}{down_suffix} โฌ๏ธ {up:6.2f}{up_suffix} โฌ๏ธ ', + background = color.get('color8'), + ), + + widget.TextBox( + text=lar, + background = color.get('color8'), + foreground = color.get('color6'), + font = plf, + padding = -0.5, + fontsize = 23 + ), + + widget.Clock( + background = color.get('color6'), + foreground = invColor(color.get('color6')) if isWhite(color.get('color6')) else '#FFFFFF', + format='%m-%d-%Y %a ๐
%I:%M:%S %p ๐') + ], + 23, + background = (0, 0, 0, 0), + ), + ), +] + +# Drag floating layouts. +mouse = [ + Drag([mod], "Button1", lazy.window.set_position_floating(), + start=lazy.window.get_position()), + Drag([mod], "Button3", lazy.window.set_size_floating(), + start=lazy.window.get_size()), + Click([mod], "Button2", lazy.window.bring_to_front()) +] + +main = None +dgroups_key_binder = None +dgroups_app_rules = [] # type: List +follow_mouse_focus = True +bring_front_click = False +cursor_warp = False +floating_layout = layout.Floating(float_rules=[ + # Run the utility of `xprop` to see the wm class and name of an X client. + *layout.Floating.default_float_rules, + Match(wm_class='confirmreset'), + Match(wm_class='makebranch'), + Match(wm_class='maketag'), + Match(wm_class='ssh-askpass'), + Match(title='branchdialog'), + Match(title='pinentry'), + Match(title='xsnow'), + #{'wmclass': 'confirm'}, + #{'wmclass': 'dialog'}, + #{'wmclass': 'main.py'}, + #{'wmclass': 'download'}, + #{'wmclass': 'error'}, + #{'wmclass': 'file_progress'}, + #{'wmclass': 'notification'}, + #{'wmclass': 'splash'}, + #{'wmclass': 'toolbar'}, + #{'wmclass': 'confirmreset'}, # gitk + #{'wmclass': 'makebranch'}, # gitk + #{'wmclass': 'maketag'}, # gitk + #{'wname': 'branchdialog'}, # gitk + #{'wname': 'pinentry'}, # GPG key password entry + #{'wname': 'dialog'}, + #{'wmclass': 'ssh-askpass'}, # ssh-askpass +]) +auto_fullscreen = True +focus_on_window_activation = "smart" + +# XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this +# string besides java UI toolkits; you can see several discussions on the +# mailing lists, GitHub issues, and other WM documentation that suggest setting +# this string if your java app doesn't work correctly. We may as well just lie +# and say that we're a working one by default. +# +# We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in +# java that happens to be on java's whitelist. +wmname = "LG3D" diff --git a/cusmodules/appimg.py b/cusmodules/appimg.py new file mode 100755 index 0000000..d0f420e --- /dev/null +++ b/cusmodules/appimg.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +import os +import re +from wallpaper import dmenu + +def main(): + home = os.path.expanduser('~') + appdir = home + '/Applications/' + apps = os.popen(f"ls {appdir}").read().strip('\n') + appslist = apps.split('\n') + appsec = re.sub('[0-9]|x86|_|\.|\-|AppImage', '', apps) + app = dmenu(appsec, "Apps:") + + if app == '': + return 1 + + for i in appslist: + try: + fnm = re.search(app, i).span() + print(fnm) + id_ = appslist.index(i) + print(id_) + + except Exception as e: + print(e) + pass + + appnm = appslist[id_] + os.system(appdir + appnm) + +if __name__ == '__main__': + main() + diff --git a/cusmodules/colors.py b/cusmodules/colors.py new file mode 100755 index 0000000..295fbd4 --- /dev/null +++ b/cusmodules/colors.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python +import os +import sys +import json +import wallpaper +from pathlib import Path +from random import randint +from subprocess import run + +def random(colors): + colorcount = len(colors) - 1 + ranint = randint(0, colorcount) + rancol = colors[ranint] + + return rancol + +def setColor(home, color_dir, choice, **kwargs): + os.system(f'wal --theme {color_dir}/{choice}') + + with open(f"{home}/.cache/wal/colors.json", 'r') as f: + data = json.load(f) + + top_color = data["colors"].get('color8') + + bottom_color = data["colors"].get('color6') + + wallpaper.gen_pylogo(top_color, bottom_color) + + try: + if kwargs["norestart"] == True: + return 0 + + except: + pass + + #run(['qtile', 'shell', '-c', 'restart()']) + #run(['kill', '-SIGUSR1', os.popen('pidof qtile').read().strip('\n')]) + run(['qtile', 'shell', '-c', 'reload_config()']) + run([f'{home}/.local/bin/pywalfox', 'update']) + + return 0 + +def main(argc, argv): + home = str(Path.home()) + color_dir = f'{home}/.config/qtile/colors' + + try: + if argv[0] == '-c': + choice = argv[1] + + else: + choice = os.popen(f'ls {color_dir} | dmenu -p "Color:"').read().strip("\n") + + except: + choice = os.popen(f'ls {color_dir} | dmenu -p "Color:"').read().strip("\n") + + + if "" == choice: + return 0 + + elif "random" in choice: + colors = os.popen(f'ls {color_dir}').read().strip('\n').split('\n') + choice = random(colors) + + else: + pass + + setColor(home, color_dir, choice) + + return 0 + +if __name__ == '__main__': + sys.argv.pop(0) + argc = int(len(sys.argv)) + + try: + argv = sys.argv + + except: + argv = [] + + main(argc, argv) + diff --git a/cusmodules/cuswidgets/ticker_gecko.py b/cusmodules/cuswidgets/ticker_gecko.py new file mode 100755 index 0000000..1b7d1ee --- /dev/null +++ b/cusmodules/cuswidgets/ticker_gecko.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python +import os +import sys +import json +import time +import requests +import subprocess +from datetime import datetime +from threading import Thread + +def match(currency): + currencies = { + "BTC": "bitcoin", + "ETH": "ethereum", + "XRP": "xrp", + "LTC": "litecoin", + "BCH": "bitcoin-cash", + "XMR": "monero", + "DOGE": "dogecoin" + } + + return currencies[currency] + +def Gecko(currs): + #prices = '' + prices = {} + + for i in currs: + curr = match(i) + + source = requests.get(f'https://api.coingecko.com/api/v3/coins/{curr}/').text + + data = json.loads(source) + + price = str(data['market_data']['current_price']['usd']) + + try: + if len(price[:price.index('.')]) > 3: + price = price[:2] + ',' + price[2:] + + except: + price = price[:2] + ',' + price[2:] + + price = '$' + price + + price = {i: price} + + prices.update(price) + + with open('/tmp/crprices.json', 'w') as f: + f.write(str(prices).replace("'", '"')) + +def main(): + global crpos + home = os.path.expanduser('~') + currs = [] + priced = '' + + try: + crpos += 1 + + except: + crpos = 0 + + try: + with open('/tmp/crprices.json', 'r') as f: + prices_str = f.read() + prices = json.loads(prices_str) + + for i in prices: + currs += i + + for i in prices: + if currs[len(currs) - 1] == i: + price = f'{i}: {prices[i]} |' + + else: + price = f'{i}: {prices[i]} | ' + + priced += price + + leng = len(priced) + + #print(crpos >= leng) + if crpos >= leng: + crpos = 0 + + crprices = f"{priced[crpos:]} {priced[:crpos]}" + + #print(priced) + #print(crpos) + #print(leng) + #print(crprices) + #print(crprices[:15], '\n') + return crprices[:15] + + except Exception as e: + 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".' + +if __name__ == '__main__': + if sys.argv[1] == '--help' or sys.argv[1] == '-help' or sys.argv[1] == '--h' or sys.argv[1] == '-h': + print('Usage:\n\tStart server by running command: "/path/to/ticker_gecko.py".\n\tPut abbreviations of crypto in arguments: "/path/to/ticker_gecko.py BTC LTC" (will get price for bitcoin and litecoin)\n\tAdd main function to GenPollText widget in config.py: "\n\t\timport ticker_gecko\n\t\twidget.GenPollText(\n\t\t\tfunc=ticker_gecko.main,\n\t\t\tupdate_interval= 0.5),"') + sys.exit(0) + + currs = [] + argc = len(sys.argv) + for i in range(argc): + if i == 0: + pass + + else: + currs.append(sys.argv[i]) + + while True: + Gecko(currs) + + with open('/tmp/crprices.json', 'r') as f: + leng = len(f.read()) + + repeat_time = leng - ((len(currs) - 1) * 5) + + time.sleep(repeat_time) + diff --git a/cusmodules/holiday.py b/cusmodules/holiday.py new file mode 100755 index 0000000..a65a2a9 --- /dev/null +++ b/cusmodules/holiday.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +import os +import sys +from subprocess import run +from datetime import datetime +from os.path import expanduser +from calendar import monthrange + +def getHoliday(month, day): + if month == 1 and day == 1: + return 'none' + #return "new_year" + + #Arch birthday + elif month == 3 and day == 11: + return 'none' + #return 'arch_birthday' + + #April fools + elif month == 4 and day == 1: + return 'none' + #return 'april_fools' + + #Halloween + elif month == 10: + return 'halloween' + + #Thanksgiving + elif month == 11 and datetime.now().weekday() + 20 == day: + return 'thanksgiving' + + #Christmas + elif month == 12: + return 'xmas' + + else: + return 'none' + +def main(): + home = expanduser('~') + month = datetime.now().month + day = datetime.now().day + holiday = getHoliday(month, day) + + return holiday + +if __name__ == "__main__": + print(main()) + + sys.exit(0) diff --git a/cusmodules/wallpaper.py b/cusmodules/wallpaper.py new file mode 100755 index 0000000..8f02e4d --- /dev/null +++ b/cusmodules/wallpaper.py @@ -0,0 +1,270 @@ +#!/usr/bin/env python +import os +import sys +import json +import toml +import signal +from PIL import Image +from pathlib import Path +from random import randint +from subprocess import run + +import colors + +def dmenu(input_, prompt): + result = os.popen(f'echo "{input_}" | dmenu -p "{prompt}"').read().strip("\n") + + return result + +def gen_pylogo(top_color, bottom_color): + home = str(Path.home()) + run(['convert', f'{home}/.config/qtile/topsnake.png', '+level-colors', f"gray,'{top_color}'", '-transparent', 'gray', '/tmp/topsnake.png']) + + run(['convert', f'{home}/.config/qtile/bottomsnake.png', '+level-colors', f"gray,'{bottom_color}'", '-transparent', 'gray', '/tmp/bottomsnake.png']) + + run(['convert', '-size', '600x600', '-composite', '/tmp/bottomsnake.png', '/tmp/topsnake.png', '/tmp/python.png']) + + #run(['convert', '-size', '610x610', '-composite', f'{home}/.config/qtile/border.png', '/tmp/python.png', '/tmp/python.png']) + + run(['rm', '-r', '/tmp/topsnake.png', '/tmp/bottomsnake.png']) + +def preset(wall, mode): + global home + presets = os.popen(f"ls {home}/Pictures/Wallpapers/presets").read().strip('\n').split('\n') + wall = wall[:-3] + wall += 'json' + + if mode == 'find': + return wall in presets + + elif mode == 'set': + wall = presets.index(wall) + return presets[wall] + +def new(name, folder): + os.system(f"ln -s {home}/Pictures/Wallpapers/wallpapers/{name} {home}/Pictures/Wallpapers/wallpaperdirs/{folder}/{name}") + +def pywal(wall, loc): + global home + + if wall == 'archstylized.png': + nitro(wall, loc) + + os.system(f'wal --theme {home}/.config/qtile/colors/defaultcolors.json') + + return 0 + + + else: + pass + + os.system(f'wal -i {loc}/{wall}') + +def nitro(wall, loc): + global home + os.system(f'nitrogen --set-scaled {loc}/{wall}') + +def random(walls): + wallcount = len(walls) - 1 + ranint = randint(0, wallcount) + ranwall = walls[ranint] + + return ranwall + +if __name__ == '__main__': + #Set dir variables + home = str(Path.home()) + stdwalls = f'{home}/Pictures/Wallpapers/wallpapers' + hallo = f'{home}/Pictures/Wallpapers/halloweenwallpapers' + xmas = f'{home}/Pictures/Wallpapers/xmaswallpapers' + + if len(sys.argv) >= 2: + if sys.argv[1] == 'none': + wallpapers = os.popen(f'ls {stdwalls}').read().strip('\n').split('\n') + wall = random(wallpapers) + + if preset(wall, 'find'): + os.system(f'wal --theme {home}/Pictures/Wallpapers/presets/{preset(wall, "set")}') + run([f'{home}/.local/bin/pywalfox', 'update']) + + else: + + pywal(wall, stdwalls) + + with open(f"{home}/.cache/wal/colors.json", 'r') as f: + data = json.load(f) + + top_color = data["colors"].get('color8') + + bottom_color = data["colors"].get('color6') + + gen_pylogo(top_color, bottom_color) + + elif sys.argv[1] == 'halloween': + curr_dir = hallo + + wallpapers = os.popen(f'ls {curr_dir}').read().strip('\n').split('\n') + + walls = random(wallpapers) + + nitro(walls, curr_dir) + + colors.setColor(home, f'{home}/.config/qtile/colors', 'halloweencolors.json', norestart = True) + + run([f'{home}/.local/bin/pywalfox', 'update']) + + sys.exit(0) + + elif sys.argv[1] == 'xmas': + curr_dir = xmas + + wallpapers = os.popen(f'ls {curr_dir}').read().strip('\n').split('\n') + + walls = random(wallpapers) + + nitro(walls, curr_dir) + + colors.setColor(home, f'{home}/.config/qtile/colors', 'xmascolors.json', norestart = True) + + run([f'{home}/.local/bin/pywalfox', 'update']) + + sys.exit(0) + + elif sys.argv[1] == 'new': + new(sys.argv[2], sys.argv[3]) + + elif '-i' == sys.argv[1]: + if sys.argv[2][0] == '/': + indx = sys.argv[2].rindex('/') + curr_dir = sys.argv[2][:indx] + wall = sys.argv[2][indx + 1:] + + else: + curr_dir = os.getcwd() + wall = sys.argv[2] + + pywal(wall, curr_dir) + + run([f'{home}/.local/bin/pywalfox', 'update']) + + with open(f"{home}/.cache/wal/colors.json", 'r') as f: + data = json.load(f) + + top_color = data["colors"].get('color8') + + bottom_color = data["colors"].get('color6') + + gen_pylogo(top_color, bottom_color) + + try: + #subprocess.check_call(['qtile', 'shell', '-c', 'restart()']) + #run(['kill', '-SIGUSR1', os.popen('pidof qtile').read().strip('\n')]) + #run(['qtile', 'shell', '-c', 'restart()']) + run(['qtile', 'shell', '-c', 'reload_config()']) + + except: + os.system('killall dwm') + + elif 'a' in sys.argv[1]: + curr_dir = sys.argv[1] + 'wallpapers' + + wallpapers = os.popen(f'ls {home}/Pictures/Wallpapers/{curr_dir}').read().strip('\n').split('\n') + nitro(random(wallpapers), curr_dir) + + sys.exit(0) + + else: + pass + + #Inital prompt + walldirs = "All\n" + walldirs += os.popen(f"ls {home}/Pictures/Wallpapers/wallpaperdirs/").read().strip("\n") + #wallpaperchoice = os.popen(f'echo "{walldirs}" | dmenu -p "Wallpaper:"').read().strip("\n") + wallpaperchoice = dmenu(walldirs, "Wallpaper:") + + #Closes on ESC + if wallpaperchoice == '': + sys.exit(0) + + #Sets to other dirs + elif wallpaperchoice == "halloween": + #wallpaperchoice = os.popen(f'ls {hallo}/ | dmenu -p "Wallpaper:"').read().strip('\n') + wallpaperchoice = dmenu(os.popen(f"ls {hallo}").read().strip('\n'), "Wallpaper:") + + if wallpaperchoice == '': + sys.exit(0) + + curr_dir = hallo + + elif wallpaperchoice == "xmas": + #wallpaperchoice = os.popen(f'ls {xmas}/ | dmenu -p "Wallpaper:"').read().strip('\n') + wallpaperchoice = dmenu(os.popen(f"ls {xmas}").read().strip('\n'), "Wallpaper:") + + if wallpaperchoice == '': + sys.exit(0) + + curr_dir = xmas + + elif wallpaperchoice == "All": + #wallpaperchoice = os.popen(f'ls {stdwalls}/ | dmenu -p "Wallpaper:"').read().strip('\n') + wallpaperchoice = dmenu(os.popen(f"ls {stdwalls}").read().strip('\n'), "Wallpaper:") + + if wallpaperchoice == '': + sys.exit(0) + + curr_dir = stdwalls + + else: + #wallpaperchoice = os.popen(f'ls {home}/Pictures/Wallpapers/wallpaperdirs/{wallpaperchoice} | dmenu -p "Wallpaper:"').read().strip('\n') + wallpaperchoice = dmenu(os.popen(f"ls {home}/Pictures/Wallpapers/wallpaperdirs/{wallpaperchoice}").read().strip('\n'), "Wallpaper:") + + if wallpaperchoice == '': + sys.exit(0) + + curr_dir = stdwalls + + #Split to list + wallargs = wallpaperchoice.split(' ') + + #Handle random selection + if 'random' in wallargs: + wallpapers = os.popen(f'ls {home}/Pictures/Wallpapers/{curr_dir}').read().strip('\n').split('\n') + + wallargs[0] = random(wallpapers) + + #Set wallpaper with nitrogen + if ':nitro' in wallargs: + nitro(wallargs[0], curr_dir) + sys.exit(0) + + elif preset(wallargs[0], 'find') and ':auto' not in wallargs: + os.system(f'wal --theme {home}/Pictures/Wallpapers/presets/{preset(wallargs[0], "set")}') + + run([f'{home}/.local/bin/pywalfox', 'update']) + + #Set wallpaper with pywal + else: + pywal(wallargs[0], curr_dir) + run([f'{home}/.local/bin/pywalfox', 'update']) + + with open(f"{home}/.cache/wal/colors.json", 'r') as f: + data = json.load(f) + + top_color = data["colors"].get('color8') + + bottom_color = data["colors"].get('color6') + + gen_pylogo(top_color, bottom_color) + + try: + print('restarting qtile') + #subprocess.check_call(['qtile', 'shell', '-c', 'restart()']) + #run(['qtile', 'shell', '-c', 'restart()']) + #run(['kill', '-SIGUSR1', os.popen('pidof qtile').read().strip('\n')]) + run(['qtile', 'shell', '-c', 'reload_config()']) + #os.system('qtile shell -c "restart()"') + + except: + print('killing dwm') + os.system('killall dwm') + #pass @@ -0,0 +1,2 @@ +#!/bin/sh +notify-send "$(amixer | grep Capture)" diff --git a/pythonlogo.png b/pythonlogo.png Binary files differnew file mode 100644 index 0000000..5c0c3aa --- /dev/null +++ b/pythonlogo.png diff --git a/topsnake.png b/topsnake.png Binary files differnew file mode 100644 index 0000000..a181f9b --- /dev/null +++ b/topsnake.png |