chezmoi: windows migration dir

This commit is contained in:
js0ny 2025-10-20 03:58:34 +01:00
parent 52b70819bf
commit c24adf35d4
51 changed files with 3403 additions and 3840 deletions

View file

@ -0,0 +1,22 @@
{
"$schema": "https://github.com/glzr-io/zebar/raw/v2.4.0/resources/widget-schema.json",
"htmlPath": "./index.html",
"zOrder": "normal",
"shownInTaskbar": false,
"focused": false,
"resizable": false,
"transparent": true,
"presets": [
{
"name": "default",
"anchor": "top_left",
"offsetX": "0px",
"offsetY": "0px",
"width": "100%",
"height": "40px",
"monitorSelection": {
"type": "all"
}
}
]
}

View file

@ -0,0 +1,29 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Base styles for better consistency across platforms (aka. CSS reset). -->
<link rel="stylesheet" type="text/css" href="../normalize.css" />
<!-- Custom styles. -->
<link rel="stylesheet" type="text/css" href="./styles.css" />
<!-- Add empty favicon to suppress not found errors. -->
<link rel="icon" href="data:;" />
<!-- Allows React to be run buildless via "text/babel" script below. -->
<script
src="https://unpkg.com/@babel/standalone@7.25.6/babel.min.js"
integrity="sha256-aS0B0wnsaDByLfE16h4MDCP1fQFccysd1YWOcV+gbBo="
crossorigin="anonymous"
></script>
</head>
<body>
<div id="root"></div>
<script type="text/babel" data-type="module" src="./scripts.jsx">
</script>
</body>
</html>

View file

@ -0,0 +1,197 @@
import React, {
useState,
useEffect,
} from 'https://esm.sh/react@18?dev';
import { createRoot } from 'https://esm.sh/react-dom@18/client?dev';
import * as zebar from 'https://esm.sh/zebar@2';
const providers = zebar.createProviderGroup({
// network: { type: 'network' },
glazewm: { type: 'glazewm' },
cpu: { type: 'cpu' },
date: { type: 'date', formatting: 'HH:mm:ss MMM月d日 EEE', locale: 'zh-CN' },
battery: { type: 'battery' },
memory: { type: 'memory' },
weather: { type: 'weather' },
});
function getNetworkIcon(networkOutput) {
switch (networkOutput.defaultInterface?.type) {
case 'ethernet':
return <i className="nf nf-md-ethernet_cable"></i>;
case 'wifi':
if (networkOutput.defaultGateway?.signalStrength >= 80) {
return <i className="nf nf-md-wifi_strength_4"></i>;
} else if (
networkOutput.defaultGateway?.signalStrength >= 65
) {
return <i className="nf nf-md-wifi_strength_3"></i>;
} else if (
networkOutput.defaultGateway?.signalStrength >= 40
) {
return <i className="nf nf-md-wifi_strength_2"></i>;
} else if (
networkOutput.defaultGateway?.signalStrength >= 25
) {
return <i className="nf nf-md-wifi_strength_1"></i>;
} else {
return <i className="nf nf-md-wifi_strength_outline"></i>;
}
default:
return (
<i className="nf nf-md-wifi_strength_off_outline"></i>
);
}
}
// Get icon to show for how much of the battery is charged.
function getBatteryIcon(batteryOutput) {
if (batteryOutput.chargePercent > 90)
return <i className="nf nf-fa-battery_4"></i>;
if (batteryOutput.chargePercent > 70)
return <i className="nf nf-fa-battery_3"></i>;
if (batteryOutput.chargePercent > 40)
return <i className="nf nf-fa-battery_2"></i>;
if (batteryOutput.chargePercent > 20)
return <i className="nf nf-fa-battery_1"></i>;
return <i className="nf nf-fa-battery_0"></i>;
}
// Get icon to show for current weather status.
function getWeatherIcon(weatherOutput) {
switch (weatherOutput.status) {
case 'clear_day':
return <i className="nf nf-weather-day_sunny"></i>;
case 'clear_night':
return <i className="nf nf-weather-night_clear"></i>;
case 'cloudy_day':
return <i className="nf nf-weather-day_cloudy"></i>;
case 'cloudy_night':
return <i className="nf nf-weather-night_alt_cloudy"></i>;
case 'light_rain_day':
return <i className="nf nf-weather-day_sprinkle"></i>;
case 'light_rain_night':
return <i className="nf nf-weather-night_alt_sprinkle"></i>;
case 'heavy_rain_day':
return <i className="nf nf-weather-day_rain"></i>;
case 'heavy_rain_night':
return <i className="nf nf-weather-night_alt_rain"></i>;
case 'snow_day':
return <i className="nf nf-weather-day_snow"></i>;
case 'snow_night':
return <i className="nf nf-weather-night_alt_snow"></i>;
case 'thunder_day':
return <i className="nf nf-weather-day_lightning"></i>;
case 'thunder_night':
return <i className="nf nf-weather-night_alt_lightning"></i>;
}
}
createRoot(document.getElementById('root')).render(<App />);
function App() {
const [output, setOutput] = useState(providers.outputMap);
useEffect(() => {
providers.onOutput(() => setOutput(providers.outputMap));
}, []);
return (
<div className="app">
<div className="left">
<i className="logo nf nf-custom-windows"></i>
{output.glazewm && (
<div className="workspaces">
{output.glazewm.currentWorkspaces.map(workspace => (
<button
className={`workspace ${workspace.hasFocus && 'focused'} ${workspace.isDisplayed && 'displayed'}`}
onClick={() =>
output.glazewm.runCommand(
`focus --workspace ${workspace.name}`,
)
}
key={workspace.name}
>
{workspace.displayName ?? workspace.name}
</button>
))}
</div>
)}
</div>
<div className="center">{output.date?.formatted}</div>
<div className="right">
{output.glazewm && (
<>
{output.glazewm.bindingModes.map(bindingMode => (
<button
className="binding-mode"
key={bindingMode.name}
onClick={() =>
output.glazewm.runCommand(
`wm-disable-binding-mode --name ${bindingMode.name}`,
)
}
>
{bindingMode.displayName ?? bindingMode.name}
</button>
))}
<button
className={`tiling-direction nf ${output.glazewm.tilingDirection === 'horizontal' ? 'nf-md-swap_horizontal' : 'nf-md-swap_vertical'}`}
onClick={() =>
output.glazewm.runCommand('toggle-tiling-direction')
}
></button>
</>
)}
{output.network && (
<div className="network">
{getNetworkIcon(output.network)}
{output.network.defaultGateway?.ssid}
</div>
)}
{output.memory && (
<div className="memory">
<i className="nf nf-fae-chip"></i>
{Math.round(output.memory.usage)}%
</div>
)}
{output.cpu && (
<div className="cpu">
<i className="nf nf-oct-cpu"></i>
{/* Change the text color if the CPU usage is high. */}
<span
className={output.cpu.usage > 85 ? 'high-usage' : ''}
>
{Math.round(output.cpu.usage)}%
</span>
</div>
)}
{output.battery && (
<div className="battery">
{/* Show icon for whether battery is charging. */}
{output.battery.isCharging && (
<i className="nf nf-md-power_plug charging-icon"></i>
)}
{getBatteryIcon(output.battery)}
{Math.round(output.battery.chargePercent)}%
</div>
)}
{output.weather && (
<div className="weather">
{getWeatherIcon(output.weather)}
{Math.round(output.weather.celsiusTemp)}°C
</div>
)}
</div>
</div>
);
}

View file

@ -0,0 +1,115 @@
/**
* Import the Nerdfonts icon font.
* Ref https://www.nerdfonts.com/cheat-sheet for a cheatsheet of available Nerdfonts icons.
*/
@import 'https://www.nerdfonts.com/assets/css/webfont.css';
i {
color: rgb(115 130 175 / 95%);
margin-right: 7px;
}
body {
color: rgb(255 255 255 / 90%);
font-family: "JetBrainsMono Nerd Font", "LXGW Wenkai", ui-monospace, monospace;
font-size: 12px;
overflow: hidden;
}
html,
body,
#root {
height: 100%;
}
#root {
border-bottom: 1px solid rgb(255 255 255 / 5%);
background: linear-gradient(rgb(0 0 0 / 90%), rgb(5 2 20 / 85%));
}
.app {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
align-items: center;
height: 100%;
padding: 4px 1.5vw;
}
.left,
.center,
.right {
display: flex;
align-items: center;
}
.center {
justify-self: center;
}
.right {
justify-self: end;
}
.logo,
.binding-mode,
.tiling-direction,
.network,
.memory,
.cpu,
.battery {
margin-right: 20px;
}
.workspaces {
display: flex;
align-items: center;
}
.workspace {
background: rgb(255 255 255 / 5%);
margin-right: 4px;
padding: 4px 8px;
color: rgb(255 255 255 / 90%);
border: none;
border-radius: 2px;
cursor: pointer;
&.displayed {
background: rgb(255 255 255 / 15%);
}
&.focused,
&:hover {
background: rgb(75 115 255 / 50%);
}
}
.binding-mode,
.tiling-direction {
background: rgb(255 255 255 / 15%);
color: rgb(255 255 255 / 90%);
border-radius: 2px;
line-height: 1;
padding: 4px 8px;
border: 0;
cursor: pointer;
}
.binding-mode {
margin-right: 4px;
}
.cpu .high-usage {
color: #900029;
}
.battery {
position: relative;
}
.battery .charging-icon {
position: absolute;
font-size: 7px;
left: -8px;
top: 3px;
}

204
home/dot_glzr/zebar/normalize.css vendored Normal file
View file

@ -0,0 +1,204 @@
/**
* Base CSS styles for better consistency across platforms.
* Yoinked from: https://github.com/sindresorhus/modern-normalize
*/
/*
Document
========
*/
/**
Use a better box model (opinionated).
*/
*,
::before,
::after {
box-sizing: border-box;
}
html {
/* Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3) */
font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,
'Apple Color Emoji', 'Segoe UI Emoji';
line-height: 1.15; /* 1. Correct the line height in all browsers. */
-webkit-text-size-adjust: 100%; /* 2. Prevent adjustments of font size after orientation changes in iOS. */
tab-size: 4; /* 3. Use a more readable tab size (opinionated). */
}
/*
Sections
========
*/
body {
margin: 0; /* Remove the margin in all browsers. */
}
/*
Text-level semantics
====================
*/
/**
Add the correct font weight in Chrome and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
1. Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)
2. Correct the odd 'em' font sizing in all browsers.
*/
code,
kbd,
samp,
pre {
font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono',
Menlo, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
Prevent 'sub' and 'sup' elements from affecting the line height in all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/*
Tabular data
============
*/
/**
Correct table border color inheritance in Chrome and Safari. (https://issues.chromium.org/issues/40615503, https://bugs.webkit.org/show_bug.cgi?id=195016)
*/
table {
border-color: currentcolor;
}
/*
Forms
=====
*/
/**
1. Change the font styles in all browsers.
2. Remove the margin in Firefox and Safari.
*/
button,
input,
optgroup,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 1 */
line-height: 1.15; /* 1 */
margin: 0; /* 2 */
}
/**
Correct the inability to style clickable types in iOS and Safari.
*/
button,
[type='button'],
[type='reset'],
[type='submit'] {
-webkit-appearance: button;
}
/**
Remove the padding so developers are not caught out when they zero out 'fieldset' elements in all browsers.
*/
legend {
padding: 0;
}
/**
Add the correct vertical alignment in Chrome and Firefox.
*/
progress {
vertical-align: baseline;
}
/**
Correct the cursor style of increment and decrement buttons in Safari.
*/
::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
height: auto;
}
/**
1. Correct the odd appearance in Chrome and Safari.
2. Correct the outline style in Safari.
*/
[type='search'] {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
Remove the inner padding in Chrome and Safari on macOS.
*/
::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
1. Correct the inability to style clickable types in iOS and Safari.
2. Change font properties to 'inherit' in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}
/*
Interactive
===========
*/
/*
Add the correct display in Chrome and Safari.
*/
summary {
display: list-item;
}

View file

@ -0,0 +1,9 @@
{
"$schema": "https://github.com/glzr-io/zebar/raw/v2.4.0/resources/settings-schema.json",
"startupConfigs": [
{
"path": "neobrutal/bar.zebar.json",
"preset": "default"
}
]
}