Skip to content

Commit

Permalink
fix: fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarvay committed Apr 5, 2024
1 parent 93d5142 commit dd390d6
Show file tree
Hide file tree
Showing 23 changed files with 556 additions and 388 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<div align="center">
<h1>Workpaper</h1>
<a target="_blank" href="https://github.com/siyuan-note/siyuan/actions/workflows/build.yml">
<img src="https://img.shields.io/github/actions/workflow/status/Jarvay/Workpaper/build.yml?style=flat-square" alt="">
</a>
<a href="https://github.com/Jarvay/Workpaper/actions">
<img src="https://github.com/Jarvay/Workpaper/actions/workflows/main.yml/badge.svg" alt="">
</a>
Expand All @@ -9,6 +12,8 @@
<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>

<img src="https://img.shields.io/badge/platform-Windows%20%7C%20MacOS%20%7C%20Linux-lightgrey" alt="" />
</div>

## 一个定时换壁纸的软件,你可以在不同时间段设置不同的壁纸。
Expand All @@ -19,12 +24,13 @@
在周五整天显示[老子明天不上班]

### 支持功能
- 支持Mac及Windows

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


### 使用方法

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

15 changes: 11 additions & 4 deletions cross/consts.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import { WallpaperType } from './enums';
import {
MacOSScaleMode,
WallpaperType,
WebScaleMode,
WindowsScaleMode,
} 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',
export const DEFAULT_WEB_SCALE_MODE = WebScaleMode.Cover;

export const DEFAULT_NATIVE_SCALE_MODE = {
win32: WindowsScaleMode.Fill,
darwin: MacOSScaleMode.Auto,
};
6 changes: 6 additions & 0 deletions cross/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export enum Events {

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

export enum Locale {
Expand Down Expand Up @@ -79,3 +80,8 @@ export enum WallpaperMode {
Replace = 'replace',
Cover = 'cover',
}

export enum ScaleType {
Web = 'web',
Native = 'native',
}
7 changes: 6 additions & 1 deletion cross/locale/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export const en: ITranslation = {
update: 'Update',
currentVersion: 'Current version',
latestVersion: 'Latest version',
close: 'Close',
wallpaperMode: 'Wallpaper Mode',
'wallpaperMode.replace': 'Replace system wallpaper',
'wallpaperMode.cover': 'Cover on current wallpaper',
Expand All @@ -23,6 +22,10 @@ export const en: ITranslation = {
delete: 'Delete',
yes: 'Yes',
no: 'No',
ok: 'Ok',
cancel: 'Cancel',
close: 'Close',
apply: 'Apply',

monday: 'Mon',
tuesday: 'Tue',
Expand All @@ -40,6 +43,8 @@ export const en: ITranslation = {
choose: 'Choose',
language: 'Language',
settings: 'Settings',
about: 'About',
updateTips: 'Download completed, do you want to install it now?',

'rule.timeSlot': 'Time slot',
'rule.period': 'Period',
Expand Down
7 changes: 6 additions & 1 deletion cross/locale/i-translation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export interface ITranslation {
update: string;
currentVersion: string;
latestVersion: string;
close: string;
wallpaperMode: string;
'wallpaperMode.replace': string;
'wallpaperMode.cover': string;
Expand All @@ -21,6 +20,10 @@ export interface ITranslation {
delete: string;
yes: string;
no: string;
ok: string;
cancel: string;
close: string;
apply: string;

monday: string;
tuesday: string;
Expand All @@ -38,6 +41,8 @@ export interface ITranslation {
choose: string;
language: string;
settings: string;
about: string;
updateTips: string;

'rule.timeSlot': string;
'rule.period': string;
Expand Down
7 changes: 6 additions & 1 deletion cross/locale/zh-cn/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export const zhCN: ITranslation = {
update: '更新',
currentVersion: '当前版本',
latestVersion: '最新版本',
close: '关闭',
wallpaperMode: '壁纸模式',
'wallpaperMode.replace': '替换原壁纸',
'wallpaperMode.cover': '覆盖在原壁纸上',
Expand All @@ -23,6 +22,10 @@ export const zhCN: ITranslation = {
delete: '删除',
yes: '是',
no: '否',
ok: '确定',
cancel: '取消',
close: '关闭',
apply: '应用',

monday: '星期一',
tuesday: '星期二',
Expand All @@ -40,6 +43,8 @@ export const zhCN: ITranslation = {
choose: '选择',
language: '语言',
settings: '设置',
about: '关于',
updateTips: '下载完毕,是否立即安装?',

'rule.timeSlot': '时间段',
'rule.period': '周期',
Expand Down
4 changes: 4 additions & 0 deletions electron/main/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ export function registerHandlers(createWindow: () => Promise<BrowserWindow>) {
shell.openExternal(url);
});

ipcMain.handle(Events.IsPackaged, () => {
return app.isPackaged;
});

powerMonitor.on('resume', async () => {
await resetSchedule();
});
Expand Down
2 changes: 2 additions & 0 deletions electron/main/services/wallpaper-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ export function detachWallpaperWin() {
}
win.hide();
});
windowsMap.clear();
}

export function closeWallpaperWin() {
Expand All @@ -230,6 +231,7 @@ export function closeWallpaperWin() {
refresh();
}
});
windowsMap.clear();
}

export function setLiveWallpaperMuted(muted: boolean) {
Expand Down
1 change: 1 addition & 0 deletions electron/main/services/wallpaper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ function getWeekdayById(id: string) {

export async function resetSchedule() {
await gracefulShutdown();
detachWallpaperWin();

for (const timerMapElement of timerMap) {
const [, timer] = timerMapElement;
Expand Down
7 changes: 0 additions & 7 deletions electron/main/tray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ export function setTray(
});
},
},
{
label: t('checkUpdate'),
type: 'normal',
click: async () => {
await createWindow();
},
},
{
label: t('autoCheckUpdate'),
type: 'checkbox',
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "workpaper",
"version": "0.0.3",
"version": "0.0.4",
"description": "A wallpaper schedule",
"author": {
"name": "Jarvay",
Expand Down Expand Up @@ -39,7 +39,7 @@
"antd": "^5.10.2",
"autoprefixer": "^10.4.16",
"dayjs": "^1.11.10",
"electron": "29.0.0-alpha.5",
"electron": "^30.0.0-beta.5",
"electron-builder": "^24.6.3",
"electron-devtools-installer": "^3.2.0",
"i18next": "^23.6.0",
Expand All @@ -58,7 +58,7 @@
"rxjs": "^7.8.1",
"tailwindcss": "^3.3.3",
"typescript": "^5.1.6",
"vite": "5.0.5",
"vite": "^5.2.7",
"vite-plugin-electron": "^0.13.0-beta.3",
"vite-plugin-electron-renderer": "^0.14.5",
"vite-plugin-esmodule": "^1.5.0"
Expand Down
41 changes: 0 additions & 41 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,6 @@
overflow-y: hidden;
}

.logo-box {
position: relative;
height: 9em;
}

.logo {
position: absolute;
left: calc(50% - 4.5em);
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}

.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}

@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

@media (prefers-reduced-motion: no-preference) {
.logo.electron {
animation: logo-spin infinite 20s linear;
}
}

.card {
padding: 2em;
}

.read-the-docs {
color: #888;
}

.flex-center {
display: flex;
align-items: center;
Expand Down
Loading

0 comments on commit dd390d6

Please sign in to comment.