add mode hooks

This commit is contained in:
Elizabeth Hunt 2024-05-26 13:23:12 -07:00
parent 4ace256118
commit 7a5c74b916
Signed by: simponic
GPG Key ID: 2909B9A7FF6213EE
37 changed files with 491 additions and 516 deletions

1
.config/alacritty/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
theme.toml

View File

@ -1,3 +1,5 @@
import = ["~/.config/alacritty/theme.toml"]
[cursor]
style = "Block"
unfocused_hollow = false
@ -25,6 +27,7 @@ y = 0
[window]
dynamic_padding = true
option_as_alt = "Both"
decorations = "Buttonless"
[window.padding]
x = 12

View File

@ -0,0 +1,75 @@
[colors.primary]
background = "#eff1f5"
foreground = "#4c4f69"
dim_foreground = "#8c8fa1"
bright_foreground = "#4c4f69"
[colors.cursor]
text = "#eff1f5"
cursor = "#dc8a78"
[colors.vi_mode_cursor]
text = "#eff1f5"
cursor = "#7287fd"
[colors.search.matches]
foreground = "#eff1f5"
background = "#6c6f85"
[colors.search.focused_match]
foreground = "#eff1f5"
background = "#40a02b"
[colors.footer_bar]
foreground = "#eff1f5"
background = "#6c6f85"
[colors.hints.start]
foreground = "#eff1f5"
background = "#df8e1d"
[colors.hints.end]
foreground = "#eff1f5"
background = "#6c6f85"
[colors.selection]
text = "#eff1f5"
background = "#dc8a78"
[colors.normal]
black = "#bcc0cc"
red = "#d20f39"
green = "#40a02b"
yellow = "#df8e1d"
blue = "#1e66f5"
magenta = "#ea76cb"
cyan = "#179299"
white = "#5c5f77"
[colors.bright]
black = "#acb0be"
red = "#d20f39"
green = "#40a02b"
yellow = "#df8e1d"
blue = "#1e66f5"
magenta = "#ea76cb"
cyan = "#179299"
white = "#6c6f85"
[colors.dim]
black = "#bcc0cc"
red = "#d20f39"
green = "#40a02b"
yellow = "#df8e1d"
blue = "#1e66f5"
magenta = "#ea76cb"
cyan = "#179299"
white = "#5c5f77"
[[colors.indexed_colors]]
index = 16
color = "#fe640b"
[[colors.indexed_colors]]
index = 17
color = "#dc8a78"

View File

@ -1,4 +1,4 @@
import = [
"~/.config/alacritty/catppucin-mocha.toml",
"~/.config/alacritty/base.toml"
"~/.config/alacritty/config.toml"
]

View File

@ -1,4 +1,4 @@
import = [
"~/.config/alacritty/gruvbox-medium-light.toml",
"~/.config/alacritty/base.toml"
"~/.config/alacritty/catppucin-latte.toml",
"~/.config/alacritty/config.toml"
]

View File

@ -19,5 +19,3 @@ end
vim.opt.rtp:prepend(lazypath)
require "plugins"
vim.cmd.colorscheme "catppuccin-mocha"

View File

@ -1,26 +1,27 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "be7be2ca7f55bb881a7ffc16b2efa5af034ab06b" },
"bufferline.nvim": { "branch": "main", "commit": "64e2c5def50dfd6b6f14d96a45fa3d815a4a1eef" },
"catppuccin": { "branch": "main", "commit": "02bdd749931a5d739063562e57531c118e081882" },
"LuaSnip": { "branch": "master", "commit": "878ace11983444d865a72e1759dbcc331d1ace4c" },
"auto-dark-mode.nvim": { "branch": "master", "commit": "2b8c938da9a7c9432120266b92936b2c22e8cfb8" },
"bufferline.nvim": { "branch": "main", "commit": "99337f63f0a3c3ab9519f3d1da7618ca4f91cffe" },
"catppuccin": { "branch": "main", "commit": "5215ea59df6d0a7e27da9a5cd1165e06d1b04cbe" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" },
"friendly-snippets": { "branch": "main", "commit": "ea068f1becd91bcd4591fceb6420d4335e2e14d3" },
"gitsigns.nvim": { "branch": "main", "commit": "c097cb255096f333e14d341082a84f572b394fa2" },
"indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
"lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" },
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
"mini.statusline": { "branch": "main", "commit": "b1a8020aead3f12885aa539a46c07b02b036ac05" },
"nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" },
"nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" },
"nvim-lspconfig": { "branch": "master", "commit": "e25c4cdecd3d58c0deccce0f372426c8c480bcce" },
"nvim-tree.lua": { "branch": "master", "commit": "81eb8d519233c105f30dc0a278607e62b20502fd" },
"nvim-treesitter": { "branch": "master", "commit": "2bad828b48aed74efe8f7e4ea15550e18c7b482d" },
"nvim-web-devicons": { "branch": "master", "commit": "6e355632387a085f15a66ad68cf681c1d7374a04" },
"plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
"telescope.nvim": { "branch": "0.1.x", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" }
"conform.nvim": { "branch": "master", "commit": "f3b930db4964d60e255c8f9e37b7f2218dfc08cb" },
"friendly-snippets": { "branch": "main", "commit": "dd2fd1281d4b22e7b4a5bfafa3e142d958e251f2" },
"gitsigns.nvim": { "branch": "main", "commit": "cdfcd9d39d23c46ae9a040de2c6a8b8bf868746e" },
"indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" },
"lazy.nvim": { "branch": "main", "commit": "24fa2a97085ca8a7220b5b078916f81e316036fd" },
"mason.nvim": { "branch": "main", "commit": "49ff59aded1047a773670651cfa40e76e63c6377" },
"mini.statusline": { "branch": "main", "commit": "b5d23c5356e837f9e6426ffeed9f5acd0629bc07" },
"nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" },
"nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" },
"nvim-lspconfig": { "branch": "master", "commit": "b972e7154bc94ab4ecdbb38c8edbccac36f83996" },
"nvim-tree.lua": { "branch": "master", "commit": "517e4fbb9ef3c0986da7047f44b4b91a2400f93c" },
"nvim-treesitter": { "branch": "master", "commit": "245da4eb2e52d14b034bbbedec9671e997ede764" },
"nvim-web-devicons": { "branch": "master", "commit": "b77921fdc44833c994fdb389d658ccbce5490c16" },
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
"telescope.nvim": { "branch": "master", "commit": "349660c0d35da06459ee8589af77de2086b652ce" }
}

View File

@ -153,6 +153,22 @@ local plugins = {
require("Comment").setup()
end,
},
-- auto dark mode
{
"f-person/auto-dark-mode.nvim",
opts = {
update_interval = 1000,
set_dark_mode = function()
vim.api.nvim_set_option("background", "dark")
vim.cmd("colorscheme catppuccin-mocha")
end,
set_light_mode = function()
vim.api.nvim_set_option("background", "light")
vim.cmd("colorscheme catppuccin-latte")
end,
},
},
}
require("lazy").setup(plugins, require "plugins.configs.lazy")

View File

@ -0,0 +1,10 @@
local colors = require("colors")
-- Equivalent to the --bar domain
sbar.bar({
topmost = "window",
height = 40,
color = colors.bar.bg,
padding_right = 2,
padding_left = 2,
})

View File

@ -0,0 +1,68 @@
function ReadAll(file)
local f = assert(io.open(file, "rb"))
local content = f:read("*all")
f:close()
return content
end
local theme = ReadAll(os.getenv("HOME") .. "/theme")
if string.gsub(theme, "%s+", "") == "light" then
return {
black = 0xdce0e8ff,
white = 0xff4c4f69,
red = 0xfffc5d7c,
green = 0xff9ed072,
blue = 0xff76cce0,
yellow = 0xffe7c664,
orange = 0xfff39660,
magenta = 0xffb39df3,
grey = 0xff6c6f85,
transparent = 0x00000000,
bar = {
--bg = 0xf02c2e34,
bg = 0x00000000,
border = 0xdce0e800,
},
popup = {
bg = 0xc02c2e34,
border = 0xff7f8490
},
bg1 = 0xeff1f5ff,
bg2 = 0x04a5e500,
with_alpha = function(color, alpha)
if alpha > 1.0 or alpha < 0.0 then return color end
return (color & 0x00ffffff) | (math.floor(alpha * 255.0) << 24)
end,
}
end
return {
black = 0xff181819,
white = 0xffe2e2e3,
red = 0xfffc5d7c,
green = 0xff9ed072,
blue = 0xff76cce0,
yellow = 0xffe7c664,
orange = 0xfff39660,
magenta = 0xffb39df3,
grey = 0xff7f8490,
transparent = 0x00000000,
bar = {
--bg = 0xf02c2e34,
bg = 0x00000000,
border = 0xff2c2e34,
},
popup = {
bg = 0xc02c2e34,
border = 0xff7f8490
},
bg1 = 0xff363944,
bg2 = 0xff414550,
with_alpha = function(color, alpha)
if alpha > 1.0 or alpha < 0.0 then return color end
return (color & 0x00ffffff) | (math.floor(alpha * 255.0) << 24)
end,
}

View File

@ -0,0 +1,52 @@
local settings = require("settings")
local colors = require("colors")
-- Equivalent to the --default domain
sbar.default({
updates = "when_shown",
icon = {
font = {
family = settings.font.text,
style = settings.font.style_map["Bold"],
size = 14.0
},
color = colors.white,
padding_left = settings.paddings,
padding_right = settings.paddings,
background = { image = { corner_radius = 9 } },
},
label = {
font = {
family = settings.font.text,
style = settings.font.style_map["Semibold"],
size = 13.0
},
color = colors.white,
padding_left = settings.paddings,
padding_right = settings.paddings,
},
background = {
height = 28,
corner_radius = 9,
border_width = 2,
border_color = colors.bg2,
image = {
corner_radius = 9,
border_color = colors.grey,
border_width = 1
}
},
popup = {
background = {
border_width = 2,
corner_radius = 9,
border_color = colors.popup.border,
color = colors.popup.bg,
shadow = { drawing = true },
},
blur_radius = 50,
},
padding_left = 5,
padding_right = 5,
scroll_texts = true,
})

1
.config/sketchybar/helpers/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
bin

View File

@ -0,0 +1,92 @@
local settings = require("settings")
local icons = {
sf_symbols = {
plus = "􀅼",
loading = "􀖇",
apple = "􀣺",
gear = "􀍟",
cpu = "􀫥",
clipboard = "􀉄",
switch = {
on = "􁏮",
off = "􁏯",
},
volume = {
_100="􀊩",
_66="􀊧",
_33="􀊥",
_10="􀊡",
_0="􀊣",
},
battery = {
_100 = "􀛨",
_75 = "􀺸",
_50 = "􀺶",
_25 = "􀛩",
_0 = "􀛪",
charging = "􀢋"
},
wifi = {
upload = "􀄨",
download = "􀄩",
connected = "􀙇",
disconnected = "􀙈",
router = "􁓤",
},
media = {
back = "􀊊",
forward = "􀊌",
play_pause = "􀊈",
},
},
-- Alternative NerdFont icons
nerdfont = {
plus = "",
loading = "",
apple = "",
gear = "",
cpu = "",
clipboard = "Missing Icon",
switch = {
on = "󱨥",
off = "󱨦",
},
volume = {
_100="",
_66="",
_33="",
_10="",
_0="",
},
battery = {
_100 = "",
_75 = "",
_50 = "",
_25 = "",
_0 = "",
charging = ""
},
wifi = {
upload = "",
download = "",
connected = "󰖩",
disconnected = "󰖪",
router = "Missing Icon"
},
media = {
back = "",
forward = "",
play_pause = "",
},
},
}
if not (settings.icons == "NerdFont") then
return icons.sf_symbols
else
return icons.nerdfont
end

View File

@ -0,0 +1,16 @@
-- Require the sketchybar module
sbar = require("sketchybar")
-- Set the bar name, if you are using another bar instance than sketchybar
-- sbar.set_bar_name("bottom_bar")
-- Bundle the entire initial configuration into a single message to sketchybar
sbar.begin_config()
require("bar")
require("default")
require("items")
sbar.end_config()
-- Run the event loop of the sketchybar module (without this there will be no
-- callback functions executed in the lua module)
sbar.event_loop()

View File

@ -0,0 +1,22 @@
return {
paddings = 3,
group_paddings = 5,
icons = "sf-symbols", -- alternatively available: NerdFont
-- This is a font configuration for SF Pro and SF Mono (installed manually)
-- font = require("helpers.default_font"),
-- Alternatively, this is a font config for JetBrainsMono Nerd Font
font = {
text = "JetBrainsMono Nerd Font", -- Used for text
numbers = "JetBrainsMono Nerd Font", -- Used for numbers
style_map = {
["Regular"] = "Regular",
["Semibold"] = "Medium",
["Bold"] = "SemiBold",
["Heavy"] = "Bold",
["Black"] = "ExtraBold",
},
},
}

View File

@ -0,0 +1,5 @@
#!/usr/bin/env lua
-- Load the sketchybar-package and prepare the helper binaries
require("helpers")
require("init")

View File

@ -1 +1,2 @@
(setq package-enable-at-startup t)
(add-to-list 'default-frame-alist '(undecorated-round . t))

View File

@ -102,38 +102,27 @@
(set-face-attribute 'default nil :font font)
(set-frame-font font nil t))
#+END_SRC
** Doom-themes
#+BEGIN_SRC emacs-lisp
(use-package doom-themes
:ensure t
:config
;; Global settings (defaults)
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled
doom-themes-enable-italic t) ; if nil, italics is universally disabled
;; Enable flashing mode-line on errors
(doom-themes-visual-bell-config)
;; Enable custom neotree theme (all-the-icons must be installed!)
(doom-themes-neotree-config)
;; or for treemacs users
(setq doom-themes-treemacs-theme "doom-atom") ; use "doom-colors" for less minimal icon theme
(doom-themes-treemacs-config)
;; Corrects (and improves) org-mode's native fontification.
(doom-themes-org-config))
#+END_SRC
** Catpuccin
** Catppuccin and theme notify watcher
#+BEGIN_SRC emacs-lisp
(use-package catppuccin-theme
:ensure t)
#+END_SRC
(require 'filenotify)
** Set theme according to DARK_MODE env var
#+BEGIN_SRC emacs-lisp
(cond
((getenv "DARK_MODE")
(load-theme 'catppuccin :no-confirm))
(t (load-theme 'doom-gruvbox-light t)))
#+END_SRC
(setq *theme-file* "~/theme")
(defun set-system-theme ()
(let ((theme
(with-temp-buffer
(insert-file-contents *theme-file*)
(buffer-string)))
(current-flavor catppuccin-flavor))
(setq catppuccin-flavor (if (string-prefix-p "dark" theme) 'mocha 'latte))
(if (not (eq catppuccin-flavor current-flavor))
(catppuccin-reload))))
(set-system-theme)
(file-notify-add-watch *theme-file* '(change)
#'(lambda (event) (set-system-theme)))
#+END_SRC
** Doom-modeline
#+BEGIN_SRC emacs-lisp
(use-package doom-modeline

4
.gitignore vendored
View File

@ -30,6 +30,10 @@
!.config/picom
!.config/picom/*
!.config
!.config/sketchybar
!.config/sketchybar/*
!.config
!.config/wofi
!.config/wofi/*

View File

@ -11,8 +11,7 @@ bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
set -g @catppucin_flavour 'mocha'
source-file ~/.tmux/colors
set -g @catppuccin_window_left_separator "█"
set -g @catppuccin_window_right_separator "█ "
set -g @catppuccin_window_number_position "right"

BIN
Wallpapers/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -1,5 +1,2 @@
#!/bin/bash
CONFIG=$([ -z "$DARK_MODE" ] && echo "light.toml" || echo "dark.toml")
alacritty --config-file=$HOME/.config/alacritty/$CONFIG
alacritty --config-file=$HOME/.config/alacritty/theme.toml

View File

@ -1 +0,0 @@
. /opt/asdf-vm/asdf.sh

View File

@ -1,83 +0,0 @@
#!/bin/sh
# after archinstall...
# Some packages
sudo pacman -S git vim \
networkmanager firefox alacritty zsh \
sway inetutils playerctl rustup tmux \
openssl-1.1 bluez bluez-utils wget \
base-devel dunst wofi noto-fonts-emoji \
light brightnessctl pass docker \
pavucontrol seahorse man xorg xorg-xwayland \
lxappearance wl-clipboard python-hatchling
# VARS
USER=lizzy
MACHINE_ZSH=~/scripts/machine-specific-zsh/$(hostname).zsh
CURSOR_THEME="Oxygen 19 Pink Blossom"
# rustup
rustup default stable
# Submodules - zsh stuff and pikaur
git submodule init
git submodule sync
git submodule update
# pikaur
cd ~/src/pikaur
makepkg -si
cd ~
# AUR packages
pikaur -S xremap-x11-bin spotify-tui-bin \
betterdiscord-installer-bin discord obs-studio \
nerd-fonts-cozette-ttf ttf-font-awesome cozette-ttf waybar \
swaybg emacs-gcc-wayland-devel-bin swaylock-corrupter \
waybar-mpris-git
# Copy cursors
sudo cp -r ~/.icons/"$CURSOR_THEME" /usr/share/icons
# xremap
sudo groupadd input
lsmod | grep uinput || echo 'uinput' | sudo tee /etc/modules-load.d/uinput.conf && \
echo 'KERNEL=="uinput", GROUP="input", TAG+="uaccess"' | sudo tee /etc/udev/rules.d/99-input.rules
sudo usermod -aG input $USER
systemctl enable --user xremap
# spotifyd
pikaur -S spotifyd
systemctl enable --user spotifyd
# chsh to zsh
chsh $USER --shell /bin/zsh
# Docker
sudo systemctl enable --now docker
sudo groupadd docker
sudo usermod -aG docker $USER
# Setup asdf-vm, thefuck
pikaur -S asdf-vm thefuck
echo ". /opt/asdf-vm/asdf.sh" >> $MACHINE_ZSH
echo "eval \$(thefuck --alias)" >> $MACHINE_ZSH
# setup node versions
. /opt/asdf-vm/asdf.sh
asdf plugin add nodejs
asdf install nodejs latest:18
asdf global nodejs latest:18
# Now, generate ssh key
ssh-keygen -t ed25519
echo "Now, you still need to:"
echo " . Import your GPG key and --edit-key with ultimate trust"
echo " . pass --init <gpg-key-id>"
echo " . Setup spotify-tui with client id from spotify.com"
echo " . Put spotify password in `pass insert spotify` for spotifyd"
echo " . Login to firefox"
echo " . Put ssh key into GitHub, change remote origin in ~"
echo " . Add waybar config in .config/waybar/local.d"
echo " . If streaming, install v4l2loopback-dkms, obs-studio-tytan652"

Binary file not shown.

View File

@ -1,69 +0,0 @@
jar = {
"lineSkips": 1, # Skip the base of the jar
"height": 11, # Height you want filled to, 12 will be the very top of the jar
"width": 20,
"fillLines": [(3,16),(2,17),(2,17),(2,17),(2,17),(2,17),(2,17),(2,17),(2,17),(2,17),(2,17),(3,16)],
"text":""" | |
| |
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
\\\\ //
--------------"""}
class AwesomeJar:
def __init__(self, jarObject):
self.jarObject = jarObject
self.progress = 0.00
self.dropletLine = 0
self.dropletDelta = 1
def drawJar(self):
jarRepresentation = self.jarObject["text"].split("\n")
linesToFill = int(self.progress * self.jarObject["height"])
dropletX = self.jarObject["width"] // 2
if (self.progress < 1):
jarRepresentation[self.dropletLine] = jarRepresentation[self.dropletLine][0:dropletX] + "O" + jarRepresentation[self.dropletLine][(dropletX+1):]
for y_fill in range(self.jarObject["height"] - linesToFill + self.jarObject["lineSkips"], self.jarObject["height"]+self.jarObject["lineSkips"]):
jarRepresentation[y_fill] = "".join(list(map(lambda x:
"X" if x in range(self.jarObject["fillLines"][y_fill][0],self.jarObject["fillLines"][y_fill][1]+1)
else jarRepresentation[y_fill][x], range(len(jarRepresentation[y_fill])))))
return jarRepresentation
def setProgress(self, progress):
linesToFill = int(self.progress * self.jarObject["height"])
self.dropletLine += self.dropletDelta
if self.dropletLine > self.jarObject["height"]-linesToFill:
self.progress = progress
self.dropletLine = 0
def __str__(self):
return "".join([x + "\n" for x in self.drawJar()])
if __name__ == "__main__":
newJar = AwesomeJar(jar)
print(newJar.drawJar())
print(newJar.drawJar())
print(newJar.drawJar())
print(newJar.drawJar())
print(newJar.drawJar())
print(newJar.drawJar())
print(newJar.drawJar())
print(newJar.drawJar())
newJar.setProgress(0.2)
print(newJar.drawJar())
print(newJar.drawJar())
print(newJar.drawJar())
print(newJar.drawJar())
print(newJar.drawJar())
print(newJar.drawJar())
print(newJar.drawJar())

View File

@ -1,99 +0,0 @@
#!/usr/bin/python3
import re
import time as t
import curses
import sys
import os
import jar
def formatTime(time):
return ((str(time[0]).zfill(2) + ":") if time[0] else "") + ((str(time[1]).zfill(2) + ":") if time[1] or time[0] else "") + (str(time[2]).zfill(2))
def timeToSeconds(time):
return time[2] + 60*time[1] + 3600*time[0]
def secondsToTime(seconds):
return [seconds // 3600, (seconds - (seconds // 3600) * 3600) // 60, seconds % 60]
def decrementTime(time):
return secondsToTime(timeToSeconds(time) - 1)
class MyTimerWindow:
def __init__(self, message="Timer"):
self.message = message
self.screen = curses.initscr()
curses.noecho()
curses.cbreak()
self.dimensions = self.screen.getmaxyx()
self.screen.keypad(True)
self.jar = jar.AwesomeJar(jar.jar)
def update(self, time, beginningTime):
self.jar.setProgress((timeToSeconds(beginningTime) - timeToSeconds(time))/timeToSeconds(beginningTime))
def step(self, time):
self.screen.clear()
self.screen.addstr(1, self.dimensions[1]//2 - len(self.message)//2, self.message)
self.screen.addstr(3, self.dimensions[1]//2 - len(formatTime(time))//2, formatTime(time))
list(map(lambda x: self.screen.addstr(8+x, self.dimensions[1]//2 - self.jar.jarObject["width"]//2, self.jar.drawJar()[x]), range(0, len(self.jar.drawJar()))))
self.screen.addstr(25,0,"")
self.screen.refresh()
def stop(self):
curses.nocbreak()
self.screen.keypad(False)
curses.echo()
curses.endwin()
os.system("aplay alarm.wav")
def main():
p = re.compile('(^[0-9]*)(?::|^)([0-9]*(?=:)):([0-9]*$)')
beginning_time = list(map(lambda x: int(x) if x else 0, p.match(sys.argv[1]).groups()))
time = beginning_time.copy()
iteration_time = t.time()
if not "file" in sys.argv:
timer = MyTimerWindow() if len(sys.argv) < 3 else MyTimerWindow(sys.argv[2])
timer.update(time, beginning_time)
while any(time):
try:
timer.step(time)
t.sleep(1)
if (t.time() - iteration_time >= 1):
iteration_time = t.time()
time = decrementTime(time)
timer.update(time, beginning_time)
timer.step(time)
except KeyboardInterrupt:
break
timer.stop()
print("\nDONE")
else:
iteration_time = t.time()
try:
pid = open("/home/logan/scripts/state-files/take/pid.txt", "r")
os.system(f"kill -9 {pid.read()} 2> /dev/null")
pid.close()
except:
os.system("mkdir -p /home/logan/scripts/state-files/take")
pass
pid = open("/home/logan/scripts/state-files/take/pid.txt", "w")
pid.write(str(os.getpid()))
pid.close()
while any(time):
t.sleep(.1)
try:
if (t.time() - iteration_time >= 1):
iteration_time = t.time()
file = open("/home/logan/scripts/state-files/take/current-time.txt", "w")
file.write(formatTime(time))
file.close()
time = decrementTime(time)
except KeyboardInterrupt:
break
file = open("/home/logan/scripts/state-files/take/current-time.txt", "w")
file.write("Not Timing")
if __name__ == "__main__":
main()

View File

@ -1,166 +0,0 @@
#!/usr/bin/env python3
import argparse
import logging
import sys
import signal
import gi
import json
import threading
gi.require_version('Playerctl', '2.0')
from gi.repository import Playerctl, GLib
logger = logging.getLogger(__name__)
cache = {"i": 0, "stopped": True, "text": "Initializing"}
print_thread = None
def wrap_text(text, width, update):
if len(text) <= width:
return text
t = text + " | "
n = update % len(t)
return "".join((t[n:] + t[:n])[0:width])
def print_from_cache():
if cache["stopped"]:
cache["text"] = "" + cache["text"]
sys.stdout.write(json.dumps(cache) + '\n')
sys.stdout.flush()
def print_every_second(width, period=1):
global print_thread
print_thread = threading.Timer(period, print_every_second, [width, period])
print_thread.start()
cache["i"] += 1
if "formattedText" in cache:
cache["text"] = wrap_text(cache["formattedText"], width, cache["i"])
print_from_cache()
def save_in_cache(formattedText, player):
logger.info('Writing output')
cache["formattedText"] = formattedText
cache["class"] = f"custom-{player.props.player_name}"
cache["alt"] = player.props.player_name
def on_play(player, status, manager):
logger.info('Received new playback status')
on_metadata(player, player.props.metadata, manager)
def on_metadata(player, metadata, manager):
logger.info('Received new metadata')
cache["stopped"] = False
track_info = ''
if player.props.player_name == 'spotify' and \
'mpris:trackid' in metadata.keys() and \
':ad:' in player.props.metadata['mpris:trackid']:
track_info = 'AD PLAYING'
elif player.get_artist() != '' and player.get_title() != '':
track_info = '{artist} - {title}'.format(artist=player.get_artist(),
title=player.get_title())
else:
track_info = player.get_title()
if player.props.status != 'Playing' and track_info:
cache["stopped"] = True
save_in_cache(track_info, player)
print_from_cache()
def on_player_appeared(manager, player, selected_player=None):
if player is not None and (selected_player is None or player.name == selected_player):
cache["stopped"] = False
init_player(manager, player)
else:
logger.debug("New player appeared, but it's not the selected player, skipping")
def on_player_vanished(manager, player):
logger.info('Player has vanished')
cache["stopped"] = True
sys.stdout.write('\n')
sys.stdout.flush()
def init_player(manager, name):
logger.debug('Initialize player: {player}'.format(player=name.name))
player = Playerctl.Player.new_from_name(name)
player.connect('playback-status', on_play, manager)
player.connect('metadata', on_metadata, manager)
manager.manage_player(player)
on_metadata(player, player.props.metadata, manager)
def signal_handler(sig, frame):
logger.debug('Received signal to stop, exiting')
cache["stopped"] = True
print_thread.cancel()
sys.stdout.write('\n')
sys.stdout.flush()
# loop.quit()
sys.exit(0)
def parse_arguments():
parser = argparse.ArgumentParser()
# Increase verbosity with every occurrence of -v
parser.add_argument('-v', '--verbose', action='count', default=0)
# Define for which player we're listening
parser.add_argument('--player')
parser.add_argument('--width', default=20)
parser.add_argument('--period', default=1)
return parser.parse_args()
def main():
arguments = parse_arguments()
# Initialize logging
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG,
format='%(name)s %(levelname)s %(message)s')
# Logging is set by default to WARN and higher.
# With every occurrence of -v it's lowered by one
logger.setLevel(max((3 - arguments.verbose) * 10, 0))
# Log the sent command line arguments
logger.debug('Arguments received {}'.format(vars(arguments)))
manager = Playerctl.PlayerManager()
loop = GLib.MainLoop()
manager.connect('name-appeared', lambda *args: on_player_appeared(*args, arguments.player))
manager.connect('player-vanished', on_player_vanished)
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
for player in manager.props.player_names:
if arguments.player is not None and arguments.player != player.name:
logger.debug('{player} is not the filtered player, skipping it'
.format(player=player.name)
)
continue
init_player(manager, player)
print_every_second(int(arguments.width), float(arguments.period))
loop.run()
if __name__ == '__main__':
main()

View File

@ -1,13 +0,0 @@
#!/bin/sh
case "$1" in
start)
$0 stop
pactl load-module module-simple-protocol-tcp rate=48000 format=s16le channels=2 source=alsa_output.pci-0000_03_00.1.hdmi-stereo-extra1 record=true port=8000
;;
stop)
pactl unload-module `pactl list | grep tcp -B1 | grep M | sed 's/[^0-9]//g'`
;;
*)
echo "Usage: $0 start|stop" >&2
;;
esac

1
scripts/theme/README.md Normal file
View File

@ -0,0 +1 @@
https://github.com/remy/light-dark-switcher/releases/tag/1.0.1

View File

@ -0,0 +1,8 @@
#!/bin/bash
OLD_THEME=$1
NEW_THEME=$2
echo "import = [
\"~/.config/alacritty/$NEW_THEME.toml\",
]" > ~/.config/alacritty/theme.toml

View File

@ -0,0 +1,12 @@
#!/bin/bash
NEW_THEME=$2
function wallpaper() {
osascript -e "tell application \"Finder\" to set desktop picture to POSIX file \"$1\""
}
wp=$(find $HOME/Wallpapers/$NEW_THEME/* | shuf -n1)
wallpaper $wp
echo $wp

View File

@ -0,0 +1,4 @@
#!/bin/bash
brew services stop sketchybar
brew services start sketchybar

15
scripts/theme/hooks/tmux.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
OLD_THEME=$1
NEW_THEME=$2
function catflavor() {
flavor="mocha"
if [ $1 = "light" ]; then
flavor="latte"
fi
echo $flavor
}
echo "set -g @catppuccin_flavour $(catflavor $NEW_THEME)" > ~/.tmux/colors
tmux source-file ~/.tmux.conf

44
scripts/theme/watch.sh Executable file
View File

@ -0,0 +1,44 @@
#!/bin/bash
HOOKS_PATH=~/scripts/theme/hooks
CURRENT_THEME="light"
check_gnome_theme() {
gsettings get org.gnome.desktop.interface gtk-theme | grep -i "dark" > /dev/null
if [ $? -eq 0 ]; then
echo "dark"
else
echo "light"
fi
}
check_macos_theme() {
osascript -e 'tell application "System Events" to tell appearance preferences to return dark mode' | grep -i "true" > /dev/null
if [ $? -eq 0 ]; then
echo "dark"
else
echo "light"
fi
}
while true; do
if [ "$(uname)" == "Darwin" ]; then
NEW_THEME=$(check_macos_theme)
elif [ "$(uname)" == "Linux" ]; then
NEW_THEME=$(check_gnome_theme)
else
echo "Unsupported OS"
exit
fi
if [ $NEW_THEME != $CURRENT_THEME ]; then
echo "$NEW_THEME" > ~/theme
for hook in "$HOOKS_PATH"/*.sh; do
echo "changing theme: $hook"
bash -c "$hook $CURRENT_THEME $NEW_THEME" &
done
fi
CURRENT_THEME=$NEW_THEME
sleep 1
done

View File

@ -1,11 +0,0 @@
#!/bin/sh
echo 'NOTE: This script will only work if launched via source or .' >&2
echo -n 'Login password: ' >&2
read -s _UNLOCK_PASSWORD || return
killall -q -u "$(whoami)" gnome-keyring-daemon
eval $(echo -n "${_UNLOCK_PASSWORD}" \
| gnome-keyring-daemon --daemonize --login \
| sed -e 's/^/export /')
unset _UNLOCK_PASSWORD
echo '' >&2

View File

@ -1,17 +0,0 @@
#!/bin/sh
socket=/tmp/aggietimed.sock
env_file=/home/lizzy/work/simple_scripts/aggietime_cli/.env
export $(cat $env_file | xargs)
while true
do
aggietimed -d -s $socket
if [ $? -eq 0 ]
then
break
else
sleep 1
fi
done