Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JiaWei committed Mar 22, 2024
0 parents commit 9717186
Show file tree
Hide file tree
Showing 69 changed files with 8,141 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build

on:
push:
tags:
- "v*"

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [macos-latest, windows-latest]

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
cache: "yarn"

- name: Install Dependencies
run: yarn

- name: Build Release Files
run: yarn build
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
release/*/*.dmg
release/*/*.exe
release/*/*.blockmap
release/*/latest*.yml
draft: false
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
dist-electron
release
*.local

# Editor directories and files
.vscode/.debug.env
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

#lockfile
pnpm-lock.yaml
/test-results/
/playwright-report/
/playwright/.cache/



/wallpaper
/userData
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist=true
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Jarvay

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.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<div align="center">
<h1>Workpaper</h1>
<a href="https://github.com/Jarvay/Workpaper/actions">
<img src="https://github.com/Jarvay/Workpaper/actions/workflows/main.yml/badge.svg" alt="">
</a>
<a href="https://github.com/Jarvay/Workpaper/releases">
<img src="https://img.shields.io/github/downloads/Jarvay/Workpaper/total.svg?style=flat-square" alt="">
</a>
<a href="https://github.com/Jarvay/Workpaper/releases/latest">
<img src="https://img.shields.io/github/release/Jarvay/Workpaper.svg?style=flat-square" alt="">
</a>
</div>

## 一个定时换壁纸的软件,你可以在不同时间段设置不同的壁纸。

比如在工作日9:00-10:30显示壁纸[摸鱼中],<br>
10:31-11:59显示壁纸[今天吃什么],<br>
12:00开始显示[干饭],<br>
在周五整天显示[老子明天不上班]

### 支持功能
- 支持Mac及Windows
- 支持动态及静态壁纸
- 支持不同屏幕显示不同壁纸
- 支持按时间段显示固定壁纸或定时更换壁纸


### 使用方法
[release](https://github.com/Jarvay/Workpaper/release)中下载并安装即可

Binary file added build/icon.icns
Binary file not shown.
Binary file added build/icon.ico
Binary file not shown.
Binary file added build/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions cross/consts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { WallpaperType } from './enums';

export const IMAGE_EXT_LIST = ['jpg', 'jpeg', 'png', 'heic', 'webp'];

export const VIDEO_EXT_LIST = ['mp4'];

export const WALLPAPER_TYPE_ROUTES = {
[WallpaperType.Image]: 'static',
[WallpaperType.Video]: 'live',
};
8 changes: 8 additions & 0 deletions cross/date.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import dayjs from 'dayjs';

export function timeToSeconds(timeStr: string) {
const day = '2001-01-01';
const dateStart = dayjs(`${day} 00:00`);
const timeDayjs = dayjs(`${day} ${timeStr}`);
return timeDayjs.diff(dateStart, 'seconds');
}
81 changes: 81 additions & 0 deletions cross/enums.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
export enum ChangeType {
Fixed,
AutoChange,
}

export enum FormMode {
Create,
Update,
}

export enum Events {
SelectImage = 'SelectImage',
SelectVideo = 'SelectVideo',
SelectDir = 'SelectDir',

ResetSchedule = 'ResetSchedule',

SaveRules = 'SaveRules',
SaveWeekdays = 'SaveWeekdays',

GetLocale = 'GetLocale',
SettingsChange = 'SettingsChange',
InitSettings = 'InitSettings',

GetPlatform = 'GetPlatform',

SetStaticWallpaper = 'SetStaticWallpaper',
SetLiveWallpaper = 'SetLiveWallpaper',
SetLiveWallpaperMuted = 'SetLiveWallpaperMuted',
SetLiveWallpaperVolume = 'SetLiveWallpaperVolume',

SetDBItem = 'SetDBItem',
GetDBItem = 'GetDBItem',

WallpaperWinReady = 'WallpaperWinReady',
LiveWallpaperLoaded = 'LiveWallpaperLoaded',
StaticWallpaperLoaded = 'StaticWallpaperLoaded',

GetVersion = 'GetVersion',
OpenExternal = 'OpenExternal',
}

export enum Locale {
zhCN = 'zhCN',
enUS = 'enUS',
}

export enum WindowsScaleMode {
Center = 'center',
Stretch = 'stretch',
Fit = 'fit',
Fill = 'fill',
Span = 'span',
Tile = 'tile',
}

export enum MacOSScaleMode {
Center = 'center',
Stretch = 'stretch',
Fit = 'fit',
Fill = 'fill',
Auto = 'auto',
}

export enum WebScaleMode {
Fill = 'fill',
Contain = 'contain',
Cover = 'cover',
None = 'none',
ScaleDown = 'scale-down',
}

export enum WallpaperType {
Image = 'Image',
Video = 'Video',
}

export enum WallpaperMode {
Replace = 'replace',
Cover = 'cover',
}
69 changes: 69 additions & 0 deletions cross/interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { ModalProps } from 'antd';
import {
ChangeType,
FormMode,
Locale,
MacOSScaleMode,
WallpaperMode,
WallpaperType,
WebScaleMode,
WindowsScaleMode,
} from './enums';
import { ITranslation } from './locale/i-translation';

export interface ModalFormProps<ValueType = any> extends ModalProps {
values?: ValueType;
onChange?: (data?: ValueType) => Promise<void> | void;
mode?: FormMode;
}

export interface Rule {
start: string;
end: string;
wallpaperType: WallpaperType;
type: ChangeType;
path: string;
paths: string[];
interval?: number;
id?: string;
weekdayId: Weekday['id'];
remark?: string;
isRandom?: boolean;
screenRandom?: boolean;
}

export interface Weekday {
days: number[];
id?: string | number;
}

export interface Settings {
locale: Locale;
scaleMode?: WindowsScaleMode | MacOSScaleMode | null;
webScaleMode: WebScaleMode;
wallpaperMode: WallpaperMode;
volume: number;
muted: boolean;
autoCheckUpdate: boolean;
openAtLogin: boolean;
}

export type TranslationFunc = (key: keyof ITranslation) => string;

export interface DBData {
rules: Rule[];
weekdays: Weekday[];
settings: Settings;
currentIndex: number;
}

export interface IDBService {
setItem<Key extends keyof DBData>(
key: Key,
data: DBData[Key],
): void | Promise<void>;

getItem<Key extends keyof DBData>(
key: Key,
): DBData[Key] | Promise<DBData[Key]>;
}
78 changes: 78 additions & 0 deletions cross/locale/en/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { ITranslation } from '../i-translation';

export const en: ITranslation = {
showWindow: 'Show window',
startAtLogin: 'Start at login',
exit: 'Exit',
debug: 'Debug',
help: 'Help',
checkUpdate: 'Check update',
autoCheckUpdate: 'Auto check update',
download: 'Download',
update: 'Update',
currentVersion: 'Current version',
latestVersion: 'Latest version',
close: 'Close',
wallpaperMode: 'Wallpaper Mode',
'wallpaperMode.replace': 'Replace system wallpaper',
'wallpaperMode.cover': 'Cover on current wallpaper',

check: 'Detail',
create: 'Create',
edit: 'Edit',
delete: 'Delete',
yes: 'Yes',
no: 'No',

monday: 'Mon',
tuesday: 'Tue',
wednesday: 'Wed',
thursday: 'Thu',
friday: 'Fri',
saturday: 'Sat',
sunday: 'Sun',

operationSuccess: 'Success',
deleteConfirmTips: 'Are you sure to delete this item?',
selectPeriodTips: 'Please select period',

operation: 'Operation',
choose: 'Choose',
language: 'Language',
settings: 'Settings',

'rule.timeSlot': 'Time slot',
'rule.period': 'Period',
'rule.wallpaperType': 'Wallpaper type',
'rule.wallpaperType.image': 'Image',
'rule.wallpaperType.video': 'Video',
'rule.type': 'Type',
'rule.type.fixed': 'Fixed',
'rule.type.autoChange': 'Auto change',
'rule.path': 'Path/Directory',
'rule.screen': 'Screen',
'rule.interval': 'Change interval(seconds)',
'rule.errMsg.interval.conflicts': 'Interval is conflicting',
'rule.remark': 'Remark',
'rule.isRandom': 'Random',
'rule.screenRandom': 'Random alone every screen',
'rule.addScreen': 'Add screen',
'rule.paths.requiredMessage': 'Please select wallpaper',

scaleMode: 'Scale Mode',
'scaleMode.default': 'Default',
'scaleMode.auto': 'Auto',
'scaleMode.center': 'Center',
'scaleMode.fill': 'Fill',
'scaleMode.fit': 'Fit',
'scaleMode.span': 'Span',
'scaleMode.stretch': 'Stretch',
'scaleMode.tile': 'Tile',

'webScaleMode.fill': 'Stretch',
'webScaleMode.contain': 'Fit',
'webScaleMode.cover': 'Fill',

'settings.mute': 'Mute',
'settings.volume': 'Volume',
};
Loading

0 comments on commit 9717186

Please sign in to comment.