mirror of
https://github.com/thisthethe/MicroMike.git
synced 2026-07-22 03:20:31 +00:00
Twilight 1
This commit is contained in:
parent
3412b571fc
commit
89cd400672
43 changed files with 4104 additions and 42 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -14,6 +14,7 @@ dist-ssr
|
|||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
ExternalTheme/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
|
|
|
|||
6
src/.vscode/settings.json
vendored
6
src/.vscode/settings.json
vendored
|
|
@ -11,5 +11,9 @@
|
|||
"savePath": null,
|
||||
"savePathReplacementPairs": null
|
||||
}
|
||||
]
|
||||
],
|
||||
"files.exclude": {
|
||||
"**/*.css": true,
|
||||
"**/*.css.map": true
|
||||
}
|
||||
}
|
||||
|
|
@ -119,6 +119,8 @@
|
|||
border: solid 1px #000;
|
||||
border-bottom: 0px;
|
||||
background: linear-gradient(var(--d8d7), var(--d8d9) 50%, var(--d8dA) 50%, var(--d8dC));
|
||||
//old linear-gradient(var(--d8d7), var(--d8d9) 50%, var(--d8dA) 50%, var(--d8dC));
|
||||
// new linear-gradient(var(--d8d7), var(--d8dB) 50%, var(--d8d9) 50%, var(--d8d8));
|
||||
box-shadow: inset 0 0 0 1px #fff1, 0 0 0 1px #fff1;
|
||||
&:hover
|
||||
{
|
||||
|
|
|
|||
3649
src/ExternalTheme/velocity.scss
Normal file
3649
src/ExternalTheme/velocity.scss
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -1,8 +1,5 @@
|
|||
.factorio
|
||||
{
|
||||
.workspace-tabs
|
||||
{
|
||||
}
|
||||
.workspace-tab-header-container-inner
|
||||
{
|
||||
overflow: visible;
|
||||
|
|
@ -19,6 +16,12 @@
|
|||
border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kTtIw1AUhv+miiIVBzuICEaoThbEF45ahSJUCLVCqw4mN31Bk4YkxcVRcC04+FisOrg46+rgKgiCDxBHJydFFynx3KTQIsYDl/vx3/P/3HsuINRKTLPaxgBNt81kPCamM6tixysCGEQIQ5iSmWXMSVICvvV1T91Ud1Ge5d/3Z3WrWYsBAZF4lhmmTbxBPL1pG5z3icOsIKvE58SjJl2Q+JHrisdvnPMuCzwzbKaS88RhYjHfwkoLs4KpEU8SR1RNp3wh7bHKeYuzVqqwxj35C0NZfWWZ67QGEMciliBBhIIKiijBRpR2nRQLSTqP+fj7Xb9ELoVcRTByLKAMDbLrB/+D37O1chPjXlIoBrS/OM7HMNCxC9SrjvN97Dj1EyD4DFzpTX+5Bsx8kl5tapEjoGcbuLhuasoecLkD9D0Zsim7UpCWkMsB72f0TRmg9xboWvPm1jjH6QOQolklboCDQ2AkT9nrPu/ubJ3bvz2N+f0As9tywbHNoQUAAAAGYktHRAD+AP4A+5tyIA0AAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfmAgMMDCIUc1k9AAAAGXRFWHRDb21tZW50AENyZWF0ZWQgd2l0aCBHSU1QV4EOFwAAAV1JREFUOMutk8Fu4zAMRN/I2nRzWOx+VoHe9v//IV4nbWJZJPcgO3bS5tCiAgxJBjkczlD6+/Icv37/4Wm/p+sykkDi4YogIjCrjOczx389eegPSAn34Mduh1ICaGDv8qPt7kyl8HY6MvQH8nHoUZcxN3Y/90jpMZuZRYRTLmdeTyeOQ08eS2U4HChlYvf0hlLX2EiIFSiIBuJOuFHGkcvribFUsgdMHnC5UM1R133MZsMizKhTYfLAA7IkJKGU2qd1vwchHBxIMce03MwCMldu5wTprh2BPIGCuMvJa6n151WPDRNFA1oKsSmQ+Ib1LSCbdpr6itlKtRbuLV5cgtiAXK3bBIQjT02DG4v9Jm455+XShsibmD4r+WhO5tglN1dzUMUJJrM2sRu7b97NtaDhbng1qjl5qpViRoxbS/Xo6axaRCCahrmYUT0wj0+70iWRk8iTOV/IB8C8tfcfVY4Z65JAVxwAAAAASUVORK5CYII=) 8 / 4px repeat;
|
||||
|
||||
}
|
||||
.workspace-tab-header-inner-title
|
||||
{
|
||||
font-weight: 600;
|
||||
background-color: #8e8e8e;
|
||||
color: #1d1c1d;
|
||||
}
|
||||
.workspace-tab-header
|
||||
{
|
||||
z-index: 1;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
body
|
||||
{
|
||||
--resizeBarsColor: #363636;
|
||||
--resizeBarsColorHover: #454545;
|
||||
--topBackgroundFocusAbstraction: var(--background-secondary-alt)
|
||||
}
|
||||
body:not(.is-focused)
|
||||
{
|
||||
--topBackgroundFocusAbstraction: var(--background-secondary)
|
||||
}
|
||||
body:is(.inherit, .dtm08)
|
||||
body:is(.inherit, .dtm08, .twilight)
|
||||
{
|
||||
//Tabs
|
||||
.workspace-split.mod-root .workspace-tabs,
|
||||
|
|
@ -23,13 +25,13 @@ body:is(.inherit, .dtm08)
|
|||
//Resize Bars
|
||||
.workspace-leaf-resize-handle
|
||||
{
|
||||
background-color: #363636;
|
||||
border-color: #363636;
|
||||
background-color: var(--resizeBarsColor);
|
||||
border-color: var(--resizeBarsColor);
|
||||
}
|
||||
.workspace-leaf-resize-handle:hover
|
||||
{
|
||||
background-color: #454545;
|
||||
border-color: #454545;
|
||||
background-color: var(--resizeBarsColorHover);
|
||||
border-color: var(--resizeBarsColorHover);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ body
|
|||
--bevelStyleTreeItem_invert: inset -1px -1px var(--separatorColor);
|
||||
}
|
||||
|
||||
body:not(.disableBevels):not(.dtm08):not(.factorio):not(.prismic) {
|
||||
body:not(.disableBevels):not(.dtm08):not(.factorio):not(.prismic):not(.twilight) {
|
||||
--bevelStyleButton: inset -1px -1px var(--bevelDark1), inset 1px 1px var(--bevelBright2), inset -2px -2px var(--bevelDark2), inset 2px 2px var(--bevelBright1);
|
||||
--bevelStyleContainer: inset -1px -1px var(--bevelBright1), inset 1px 1px var(--bevelDark2), inset -2px -2px var(--bevelBright2), inset 2px 2px var(--bevelDark1);
|
||||
--bevelStyleContainerOuter:
|
||||
|
|
@ -25,7 +25,7 @@ body:not(.disableBevels):not(.dtm08):not(.factorio):not(.prismic) {
|
|||
-2px 2px var(--bevelBright2),
|
||||
2px -2px var(--bevelBright2);
|
||||
}
|
||||
body:not(.disableBevels):not(.dtm08):not(.factorio):not(.prismic)
|
||||
body:not(.disableBevels):not(.dtm08):not(.factorio):not(.prismic):not(.twilight)
|
||||
{
|
||||
&.theme-dark
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ body
|
|||
--linkBrightnessAdditive: 1
|
||||
}
|
||||
|
||||
body:not(.classicMicroMike):not(.inherit):not(.oldAndroid):not(.dtm08):not(.factorio):not(.prismic)
|
||||
body:not(.classicMicroMike):not(.inherit):not(.oldAndroid):not(.dtm08):not(.factorio):not(.prismic):not(.twilight)
|
||||
{
|
||||
/* Hierarchical palette */
|
||||
--bottom: #000000;
|
||||
|
|
@ -105,7 +105,7 @@ body.classicMicroMike {
|
|||
}
|
||||
|
||||
// Pesudo-support for Micro Mike color in non-themed areas; classic & accent
|
||||
body:not(.inherit):not(.oldAndroid):not(.dtm08):not(.factorio):not(.prismic) {
|
||||
body:not(.inherit):not(.oldAndroid):not(.dtm08):not(.factorio):not(.prismic):not(.twilight) {
|
||||
--background-primary: var(--level1_a);
|
||||
--background-primary-alt: var(--level1_b);
|
||||
--background-secondary: var(--level1);
|
||||
|
|
@ -120,7 +120,7 @@ body:not(.inherit):not(.oldAndroid):not(.dtm08):not(.factorio):not(.prismic) {
|
|||
|
||||
|
||||
|
||||
body:not(.inherit):not(.oldAndroid):not(.dtm08):not(.factorio):not(.prismic)
|
||||
body:not(.inherit):not(.oldAndroid):not(.dtm08):not(.factorio):not(.prismic):not(.twilight)
|
||||
{
|
||||
/* Button Component */
|
||||
&.theme-dark
|
||||
|
|
|
|||
66
src/MicroMikeMinimal/Resizebars copy.sass
Normal file
66
src/MicroMikeMinimal/Resizebars copy.sass
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/* Resize Bars */
|
||||
|
||||
body
|
||||
--divider-width: var(--handleSize)
|
||||
|
||||
|
||||
//.horizontal-main-container > div:nth-of-type(1) > div:nth-of-type(2)
|
||||
|
||||
|
||||
.workspace-split.mod-horizontal.mod-left-split > *:not(hr)
|
||||
position: relative
|
||||
left: var(--handleSize)
|
||||
width: calc(100% - var(--handleSize))
|
||||
|
||||
.workspace-split.mod-horizontal.mod-right-split > *:not(hr)
|
||||
position: relative
|
||||
right: var(--handleSize)
|
||||
width: calc(100% - var(--handleSize))
|
||||
|
||||
.mod-left-split .workspace-tabs
|
||||
position: relative
|
||||
top: var(--handleSize)
|
||||
width: calc(100% - var(--handleSize))
|
||||
|
||||
.mod-right-split .workspace-tabs
|
||||
position: relative
|
||||
bottom: var(--handleSize)
|
||||
width: calc(100% - var(--handleSize))
|
||||
|
||||
.workspace-split.mod-left-split .workspace-sidedock-vault-profile .workspace-drawer-vault-actions
|
||||
position: relative
|
||||
left: calc(var(--handleSize))
|
||||
width: calc(100% - var(--handleSize))
|
||||
|
||||
.workspace-ribbon.side-dock-ribbon
|
||||
border-right: 0px
|
||||
|
||||
.mod-right-split .workspace-tabs:last-of-type,
|
||||
.mod-left-split .workspace-tabs:last-of-type
|
||||
padding-bottom: 0
|
||||
|
||||
/* Vertical */
|
||||
.mod-left-split > hr,
|
||||
.mod-right-split > hr
|
||||
width: var(--handleSize) !important
|
||||
right: calc(0 - var(--handleSize))
|
||||
box-sizing: border-box
|
||||
display: flex
|
||||
z-index: 99
|
||||
color: transparent
|
||||
|
||||
/* Vertical */
|
||||
.mod-left-split > hr:hover,
|
||||
.mod-right-split > hr:hover
|
||||
color: var(--divider-color-hover)
|
||||
|
||||
/* Horizontal */
|
||||
.mod-horizontal>div>hr:not(.mod-root hr)
|
||||
display: flex
|
||||
width: 100% !important
|
||||
height: var(--handleSize) !important
|
||||
flex-direction: column-reverse
|
||||
border-bottom: 0px !important
|
||||
|
||||
.mod-root .workspace-leaf-resize-handle
|
||||
--divider-width: 3px
|
||||
|
|
@ -6,10 +6,12 @@ body
|
|||
|
||||
//.horizontal-main-container > div:nth-of-type(1) > div:nth-of-type(2)
|
||||
|
||||
.workspace-split.mod-horizontal.mod-left-split, .workspace-split.mod-horizontal.mod-right-split
|
||||
overflow: hidden
|
||||
|
||||
.workspace-split.mod-horizontal.mod-left-split > *:not(hr)
|
||||
padding-right: var(--handleSize)
|
||||
|
||||
|
||||
.workspace-split.mod-horizontal.mod-right-split > *:not(hr)
|
||||
padding-left: var(--handleSize)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
body
|
||||
--changeTest: true5
|
||||
|
||||
--levelLayer: #ffffff18
|
||||
--levelHover: #ffffff11
|
||||
--separatorColor: #ffffff18
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@ settings:
|
|||
- accentMicroMike
|
||||
- classicMicroMike
|
||||
- dtm08
|
||||
- factorio
|
||||
- prismic
|
||||
- twilight
|
||||
-
|
||||
id: disableBevels
|
||||
title: Disable Bevels
|
||||
|
|
|
|||
5
src/Twilight/_art.scss
Normal file
5
src/Twilight/_art.scss
Normal file
File diff suppressed because one or more lines are too long
20
src/Twilight/_components.scss
Normal file
20
src/Twilight/_components.scss
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
%verticalMenuButton
|
||||
{
|
||||
text-shadow: 0 1px 3px #0008;
|
||||
&:hover
|
||||
{
|
||||
background: linear-gradient(#373B4288, #3F434B88 50%, #2F333A88 50%, #272B3188);
|
||||
box-shadow: inset 0 1px #fff2, 0 1px 2px #0008;
|
||||
}
|
||||
&:active
|
||||
{
|
||||
background: linear-gradient(var(--d8dB), var(--d8dC) 50%, var(--d8dB) 50%, var(--d8dA));
|
||||
box-shadow: inset 0 1px 4px #000, 0 1px #fff2;
|
||||
}
|
||||
&.is-active
|
||||
{
|
||||
background: linear-gradient(var(--d8d8), var(--d8d7) 50%, var(--d8d9) 50%, var(--d8dA));
|
||||
box-shadow: inset 0 0 0 1px #fff1, inset 0 1px #fff3, 0 0 0 1px #000b, 0 1px 3px #0008;
|
||||
text-shadow: 0 1px 3px #000e;
|
||||
}
|
||||
}
|
||||
26
src/Twilight/_varsT.scss
Normal file
26
src/Twilight/_varsT.scss
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
.twilight
|
||||
{
|
||||
--background-primary: rgba(255,255,255,0.0);
|
||||
--background-primary-alt: rgba(255,255,255,0.0);
|
||||
--background-secondary: rgba(255,255,255,0.0);
|
||||
--background-secondary-alt: rgba(255,255,255,0.0);
|
||||
--background-modifier-hover: rgba(var(--mono-rgb-100), 0.067);
|
||||
--background-modifier-active-hover: hsla(var(--interactive-accent-hsl), 0.1);
|
||||
--background-modifier-border: var(--color-base-30);
|
||||
--background-modifier-border-hover: var(--color-base-35);
|
||||
--background-modifier-border-focus: var(--color-base-40);
|
||||
--background-modifier-error-rgb: var(--color-red-rgb);
|
||||
--background-modifier-error: var(--color-red);
|
||||
--background-modifier-error-hover: var(--color-red);
|
||||
--background-modifier-success-rgb: var(--color-green-rgb);
|
||||
--background-modifier-success: var(--color-green);
|
||||
--background-modifier-message: rgba(0, 0, 0, 0.9);
|
||||
--background-modifier-form-field: var(--color-base-00);
|
||||
--background-modifier-form-field-hover: var(--background-modifier-form-field);
|
||||
--tab-container-background: rgba(255,255,255,0.0);
|
||||
--titlebar-background: var(--background-secondary);
|
||||
--titlebar-background-focused: var(--background-secondary-alt);
|
||||
|
||||
--resizeBarsColor: transparent;
|
||||
--resizeBarsColorHover: transparent;
|
||||
}
|
||||
47
src/Twilight/bodyT.scss
Normal file
47
src/Twilight/bodyT.scss
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
.twilight.is-frameless.is-hidden-frameless:not(.in-progress)
|
||||
{
|
||||
padding: 10px;
|
||||
padding-top: 10px !important;
|
||||
|
||||
background-image: var(--backgroundSunflower);
|
||||
app-region: drag;
|
||||
}
|
||||
.twilight
|
||||
{
|
||||
.app-container {
|
||||
position: relative; // needed for absolute children to anchor to
|
||||
border-top: 1px solid transparent;
|
||||
border-image: linear-gradient(
|
||||
to right,
|
||||
#767A88 1px,
|
||||
#434757 7px,
|
||||
#434757 calc(100% - 7px),
|
||||
#767A88 calc(100%)
|
||||
) 1;
|
||||
background-image: var(--backgroundCornerPiece);
|
||||
background-size: 140px auto;
|
||||
box-shadow: 0px 0px 14px hsla(0, 0%, 0%, .35), 0px 0px 24px hsla(0, 88%, 6%, .45), 0 1px 0 0 black;
|
||||
background-color: #292C5133;
|
||||
app-region: no-drag;
|
||||
}
|
||||
|
||||
.app-container::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0; // anchor to left edge
|
||||
height: 100%;
|
||||
width: 1px;
|
||||
background: linear-gradient(to bottom, #767A88, #434757 7px, #000000);
|
||||
}
|
||||
|
||||
.app-container::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0; // anchor to right edge
|
||||
height: 100%;
|
||||
width: 1px;
|
||||
background: linear-gradient(to bottom, #767A88, #434757 7px, #000000);
|
||||
}
|
||||
}
|
||||
7
src/Twilight/cSidebarLayoutT.scss
Normal file
7
src/Twilight/cSidebarLayoutT.scss
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
.twilight
|
||||
{
|
||||
.mod-sidedock .workspace-tabs
|
||||
{
|
||||
border: 1px solid #76789B;
|
||||
}
|
||||
}
|
||||
12
src/Twilight/editorDashboardT.scss
Normal file
12
src/Twilight/editorDashboardT.scss
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
.twilight
|
||||
{
|
||||
.view-header-title
|
||||
{
|
||||
font-size:30px;
|
||||
text-shadow: 2px 2px 2px black;
|
||||
}
|
||||
.workspace-tab-header.is-active
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
7
src/Twilight/index7.sass
Normal file
7
src/Twilight/index7.sass
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
@use "_art.scss"
|
||||
@use "_varsT.scss"
|
||||
@use "bodyT.scss"
|
||||
@use "sidebarViewT.scss"
|
||||
@use "editorDashboardT.scss"
|
||||
@use "sidebarDashboardT.scss"
|
||||
@use "cSidebarLayoutT.scss"
|
||||
11
src/Twilight/sidebarDashboardT.scss
Normal file
11
src/Twilight/sidebarDashboardT.scss
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
.twilight
|
||||
{
|
||||
.workspace-tab-header
|
||||
{
|
||||
|
||||
}
|
||||
.workspace-tab-header.is-active
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
4
src/Twilight/sidebarViewT.scss
Normal file
4
src/Twilight/sidebarViewT.scss
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
.twilight
|
||||
{
|
||||
|
||||
}
|
||||
11
src/Twilight/tabsT.scss
Normal file
11
src/Twilight/tabsT.scss
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
.twilight
|
||||
{
|
||||
.workspace-tab-header
|
||||
{
|
||||
|
||||
}
|
||||
.workspace-tab-header.is-active
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -4,25 +4,25 @@
|
|||
* https://github.com/khang-nd/7.css/blob/main/LICENSE
|
||||
*/
|
||||
|
||||
@import "_variables.scss";
|
||||
@import "_global.scss";
|
||||
@import "_balloon.scss";
|
||||
@import "_button.scss";
|
||||
@import "_checkbox.scss";
|
||||
@import "_collapse.scss";
|
||||
@import "_combobox.scss";
|
||||
@import "_dropdown.scss";
|
||||
@import "_groupbox.scss";
|
||||
@import "_listbox.scss";
|
||||
@import "_menu.scss";
|
||||
@import "_progressbar.scss";
|
||||
@import "_radiobutton.scss";
|
||||
@import "_scrollbar.scss";
|
||||
@import "_searchbox.scss";
|
||||
@import "_slider.scss";
|
||||
@import "_spinner.scss";
|
||||
@import "_tabs.scss";
|
||||
@import "_textbox.scss";
|
||||
@import "_treeview.scss";
|
||||
@import "_typography.scss";
|
||||
@import "_window.scss";
|
||||
@use "_variables.scss";
|
||||
@use "_global.scss";
|
||||
@use "_balloon.scss";
|
||||
@use "_button.scss";
|
||||
@use "_checkbox.scss";
|
||||
@use "_collapse.scss";
|
||||
@use "_combobox.scss";
|
||||
@use "_dropdown.scss";
|
||||
@use "_groupbox.scss";
|
||||
@use "_listbox.scss";
|
||||
@use "_menu.scss";
|
||||
@use "_progressbar.scss";
|
||||
@use "_radiobutton.scss";
|
||||
@use "_scrollbar.scss";
|
||||
@use "_searchbox.scss";
|
||||
@use "_slider.scss";
|
||||
@use "_spinner.scss";
|
||||
@use "_tabs.scss";
|
||||
@use "_textbox.scss";
|
||||
@use "_treeview.scss";
|
||||
@use "_typography.scss";
|
||||
@use "_window.scss";
|
||||
|
|
|
|||
180
src/copyWatcher2.py
Normal file
180
src/copyWatcher2.py
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
CSS File Monitor and Copy Script
|
||||
Monitors theme.css for changes and copies it to predefined locations.
|
||||
"""
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import time
|
||||
from pathlib import Path
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.events import FileSystemEventHandler
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
# Configuration
|
||||
SOURCE_FILE = "theme.css"
|
||||
DESTINATION_PATHS = [
|
||||
# Add your destination paths here
|
||||
"C:/Users/Tim/Documents/pim3/newtekgit/.obsidian/themes/Art Deco CSS/theme.css"
|
||||
# Add more paths as needed
|
||||
]
|
||||
|
||||
# Setup logging
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format='%(asctime)s - %(levelname)s - %(message)s',
|
||||
handlers=[
|
||||
logging.FileHandler('css_monitor.log', encoding='utf-8'),
|
||||
logging.StreamHandler()
|
||||
]
|
||||
)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class CSSFileHandler(FileSystemEventHandler):
|
||||
"""Handler for CSS file change events."""
|
||||
|
||||
def __init__(self, source_file, destinations):
|
||||
self.source_file = Path(source_file).resolve()
|
||||
self.destinations = [Path(dest) for dest in destinations]
|
||||
self.last_modified = 0
|
||||
|
||||
def _handle_event(self, event):
|
||||
"""Shared handler for modified and created events."""
|
||||
if event.is_directory:
|
||||
return
|
||||
|
||||
file_path = Path(event.src_path).resolve()
|
||||
|
||||
if file_path == self.source_file:
|
||||
current_time = time.time()
|
||||
if current_time - self.last_modified < 2: # 2 second cooldown
|
||||
return
|
||||
self.last_modified = current_time
|
||||
self.copy_file()
|
||||
|
||||
def on_modified(self, event):
|
||||
"""Handle file modification events."""
|
||||
self._handle_event(event)
|
||||
|
||||
def on_created(self, event):
|
||||
"""Handle file creation events (catches atomic saves via temp file rename)."""
|
||||
self._handle_event(event)
|
||||
|
||||
def copy_file(self):
|
||||
"""Copy the CSS file to all destination paths."""
|
||||
if not self.source_file.exists():
|
||||
logger.error(f"Source file {self.source_file} does not exist!")
|
||||
return
|
||||
|
||||
logger.info(f"Detected change in {self.source_file.name}")
|
||||
|
||||
# Wait for file to be fully written (some editors write in chunks)
|
||||
time.sleep(0.1)
|
||||
|
||||
# Check if file has content before copying
|
||||
try:
|
||||
file_size = self.source_file.stat().st_size
|
||||
if file_size == 0:
|
||||
logger.warning("Source file is empty, waiting for content...")
|
||||
time.sleep(0.5) # Wait a bit more
|
||||
file_size = self.source_file.stat().st_size
|
||||
if file_size == 0:
|
||||
logger.error("Source file is still empty, skipping copy")
|
||||
return
|
||||
except Exception as e:
|
||||
logger.error(f"Error checking file size: {e}")
|
||||
return
|
||||
|
||||
logger.info(f"File size: {file_size} bytes")
|
||||
|
||||
success_count = 0
|
||||
for dest_path in self.destinations:
|
||||
try:
|
||||
# Create destination directory if it doesn't exist
|
||||
dest_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# Copy the file
|
||||
shutil.copy2(self.source_file, dest_path)
|
||||
|
||||
# Verify the copy was successful
|
||||
if dest_path.exists():
|
||||
dest_size = dest_path.stat().st_size
|
||||
if dest_size == file_size:
|
||||
logger.info(f"SUCCESS: Copied to: {dest_path} ({dest_size} bytes)")
|
||||
success_count += 1
|
||||
else:
|
||||
logger.warning(f"Copy size mismatch: {dest_path} (expected {file_size}, got {dest_size})")
|
||||
else:
|
||||
logger.error(f"Copy failed: {dest_path} does not exist after copy")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"FAILED: Could not copy to {dest_path}: {e}")
|
||||
|
||||
logger.info(f"Copy operation completed: {success_count}/{len(self.destinations)} successful")
|
||||
|
||||
def validate_paths(source_file, destinations):
|
||||
"""Validate source file and destination paths."""
|
||||
source_path = Path(source_file)
|
||||
|
||||
if not source_path.exists():
|
||||
logger.warning(f"Source file {source_path} does not exist yet. Monitoring will start once it's created.")
|
||||
|
||||
# Check if destination directories are accessible
|
||||
for dest in destinations:
|
||||
dest_path = Path(dest)
|
||||
try:
|
||||
dest_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
logger.info(f"Destination accessible: {dest_path}")
|
||||
except Exception as e:
|
||||
logger.warning(f"Destination may not be accessible: {dest_path} - {e}")
|
||||
|
||||
def main():
|
||||
"""Main function to start the file monitor."""
|
||||
print("CSS File Monitor Started")
|
||||
print("=" * 50)
|
||||
print(f"Monitoring: {SOURCE_FILE}")
|
||||
print("Destination paths:")
|
||||
for i, dest in enumerate(DESTINATION_PATHS, 1):
|
||||
print(f" {i}. {dest}")
|
||||
print("=" * 50)
|
||||
|
||||
# Validate paths
|
||||
validate_paths(SOURCE_FILE, DESTINATION_PATHS)
|
||||
|
||||
# Setup file handler
|
||||
event_handler = CSSFileHandler(SOURCE_FILE, DESTINATION_PATHS)
|
||||
|
||||
# Setup observer
|
||||
observer = Observer()
|
||||
|
||||
# Monitor the directory containing the CSS file
|
||||
watch_directory = Path(SOURCE_FILE).parent.resolve()
|
||||
observer.schedule(event_handler, str(watch_directory), recursive=False)
|
||||
|
||||
# Start monitoring
|
||||
observer.start()
|
||||
logger.info(f"Started monitoring {watch_directory}")
|
||||
|
||||
try:
|
||||
while True:
|
||||
time.sleep(1)
|
||||
except KeyboardInterrupt:
|
||||
logger.info("Stopping file monitor...")
|
||||
observer.stop()
|
||||
print("\nFile monitor stopped.")
|
||||
|
||||
observer.join()
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Check for required dependencies
|
||||
try:
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.events import FileSystemEventHandler
|
||||
except ImportError:
|
||||
print("Error: watchdog library not found!")
|
||||
print("Install it with: pip install watchdog")
|
||||
exit(1)
|
||||
|
||||
main()
|
||||
0
src/test
0
src/test
|
|
@ -1,7 +1,9 @@
|
|||
//@use "Anappuccin/theme.css"
|
||||
//@use "ExternalTheme/velocity.scss"
|
||||
@use "MicroMikeMinimal/index.sass" // <- perf
|
||||
@use "Win7Layer/index2.sass"
|
||||
@use "MMStyler/index3.sass"
|
||||
@use "DTM08/index4.sass"
|
||||
@use "Factorio/index5.sass"
|
||||
@use "Prismic/index6.sass"
|
||||
//@use "Factorio/index5.sass"
|
||||
//@use "Prismic/index6.sass"
|
||||
@use "Twilight/index7.sass"
|
||||
// useless
|
||||
Loading…
Reference in a new issue