Skip to content

Commit 34965c0

Browse files
github-contribution-grid@KopfdesDaemons: Version 2.0.0 (#1757)
* fallbacks for imports, desklet entry, settings cleanup * add ui helper * separate render functions, update settings changed handler * fix blocking on grid rendering * skeleton grid for setup and error ui * decoration toggle * scale size setting * color settings * color presets * tabs for settings * menu action, show reload button setting * readme * translation * fix block size * more robust fallback for imports * screenshot * use get_user_data_dir() + Util.spawn() * use get_user_data_dir() in ui helper * update version order in `CHANGELOG.md`
1 parent 07f2142 commit 34965c0

14 files changed

Lines changed: 1278 additions & 270 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Changelog
2+
3+
## [2.0.0] 25.02.026
4+
5+
- New features:
6+
- Added skeleton grid for setup and error UI
7+
- Added decoration toggle setting
8+
- Added Desklet scale size setting based on system font size
9+
- Added block color settings
10+
- Added color presets
11+
- Added reload action to right click menu
12+
- Added setting to hide reload button
13+
- Fixes
14+
- Fixed blocking on grid rendering
15+
- Refactoring:
16+
- UI logic extracted into `UiHelper`
17+
- Added `deskletManager` as Fallback for `require` imports
18+
- Changed Desklet entry point to `on_desklet_added_to_desktop`
19+
- Added settings cleanup on Desklet removal
20+
- Added Soup 2 compatibility
21+
- Added `README.md`
22+
23+
## [1.0.0] 09.12.2025
24+
25+
- Initial Release
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Setup personal access token
2+
3+
1. Visit the [GitHub page for token creation](https://github.com/settings/tokens/new?description=Cinnamon%20Desklet)
4+
2. Select an expiration date
5+
3. Don't select a scope
6+
4. Press "Generate token"
7+
5. Copy the generated token
8+
6. Right-click on the desklet to open the desklet settings
9+
7. Paste the token into the "GitHub token" field
10+
8. Enter a GitHub username into the "GitHub username" field

github-contribution-grid@KopfdesDaemons/files/github-contribution-grid@KopfdesDaemons/desklet.js

Lines changed: 170 additions & 134 deletions
Large diffs are not rendered by default.
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
var ColorPresetsHelper = class ColorPresetsHelper {
2+
static setPreset(presetName, settings) {
3+
switch (presetName) {
4+
case "default":
5+
settings.setValue("color-0", "#151b23");
6+
settings.setValue("color-1", "#033a16");
7+
settings.setValue("color-4", "#196c2e");
8+
settings.setValue("color-6", "#196c2e");
9+
settings.setValue("color-9", "#2ea043");
10+
settings.setValue("color-10", "#56d364");
11+
break;
12+
case "blue-dark":
13+
settings.setValue("color-0", "#151b23");
14+
settings.setValue("color-1", "#1a5fb4");
15+
settings.setValue("color-4", "#1c71d8");
16+
settings.setValue("color-6", "#3584e4");
17+
settings.setValue("color-9", "#62a0ea");
18+
settings.setValue("color-10", "#99c1f1");
19+
break;
20+
case "green-dark":
21+
settings.setValue("color-0", "#151b23");
22+
settings.setValue("color-1", "#26a269");
23+
settings.setValue("color-4", "#2ec27e");
24+
settings.setValue("color-6", "#33d17a");
25+
settings.setValue("color-9", "#57e389");
26+
settings.setValue("color-10", "#8ff0a4");
27+
break;
28+
case "yellow-dark":
29+
settings.setValue("color-0", "#151b23");
30+
settings.setValue("color-1", "#e5a50a");
31+
settings.setValue("color-4", "#f5c211");
32+
settings.setValue("color-6", "#f6d32d");
33+
settings.setValue("color-9", "#f8e45c");
34+
settings.setValue("color-10", "#f9f06b");
35+
break;
36+
case "orange-dark":
37+
settings.setValue("color-0", "#151b23");
38+
settings.setValue("color-1", "#c64600");
39+
settings.setValue("color-4", "#e66100");
40+
settings.setValue("color-6", "#ff7800");
41+
settings.setValue("color-9", "#ffa348");
42+
settings.setValue("color-10", "#ffbe6f");
43+
break;
44+
case "red-dark":
45+
settings.setValue("color-0", "#151b23");
46+
settings.setValue("color-1", "#a51d2d");
47+
settings.setValue("color-4", "#c01c28");
48+
settings.setValue("color-6", "#e01b24");
49+
settings.setValue("color-9", "#ed333b");
50+
settings.setValue("color-10", "#f66151");
51+
break;
52+
case "magenta-dark":
53+
settings.setValue("color-0", "#151b23");
54+
settings.setValue("color-1", "#410041");
55+
settings.setValue("color-4", "#6B006B");
56+
settings.setValue("color-6", "#960096");
57+
settings.setValue("color-9", "#C900C9");
58+
settings.setValue("color-10", "#FF00FF");
59+
break;
60+
case "purple-dark":
61+
settings.setValue("color-0", "#151b23");
62+
settings.setValue("color-1", "#613583");
63+
settings.setValue("color-4", "#813d9c");
64+
settings.setValue("color-6", "#9141ac");
65+
settings.setValue("color-9", "#c061cb");
66+
settings.setValue("color-10", "#dc8add");
67+
break;
68+
case "gruvbox-dark":
69+
settings.setValue("color-0", "#282828");
70+
settings.setValue("color-1", "#665c54");
71+
settings.setValue("color-4", "#bdae93");
72+
settings.setValue("color-6", "#bdae93");
73+
settings.setValue("color-9", "#ebdbb2");
74+
settings.setValue("color-10", "#ebdbb2");
75+
break;
76+
case "default-light":
77+
settings.setValue("color-0", "#EBEBEB");
78+
settings.setValue("color-1", "#033a16");
79+
settings.setValue("color-4", "#196c2e");
80+
settings.setValue("color-6", "#196c2e");
81+
settings.setValue("color-9", "#2ea043");
82+
settings.setValue("color-10", "#56d364");
83+
break;
84+
case "blue-light":
85+
settings.setValue("color-0", "#EBEBEB");
86+
settings.setValue("color-1", "#1a5fb4");
87+
settings.setValue("color-4", "#1c71d8");
88+
settings.setValue("color-6", "#3584e4");
89+
settings.setValue("color-9", "#62a0ea");
90+
settings.setValue("color-10", "#99c1f1");
91+
break;
92+
case "green-light":
93+
settings.setValue("color-0", "#EBEBEB");
94+
settings.setValue("color-1", "#26a269");
95+
settings.setValue("color-4", "#2ec27e");
96+
settings.setValue("color-6", "#33d17a");
97+
settings.setValue("color-9", "#57e389");
98+
settings.setValue("color-10", "#8ff0a4");
99+
break;
100+
case "yellow-light":
101+
settings.setValue("color-0", "#EBEBEB");
102+
settings.setValue("color-1", "#e5a50a");
103+
settings.setValue("color-4", "#f5c211");
104+
settings.setValue("color-6", "#f6d32d");
105+
settings.setValue("color-9", "#f8e45c");
106+
settings.setValue("color-10", "#f9f06b");
107+
break;
108+
case "orange-light":
109+
settings.setValue("color-0", "#EBEBEB");
110+
settings.setValue("color-1", "#c64600");
111+
settings.setValue("color-4", "#e66100");
112+
settings.setValue("color-6", "#ff7800");
113+
settings.setValue("color-9", "#ffa348");
114+
settings.setValue("color-10", "#ffbe6f");
115+
break;
116+
case "red-light":
117+
settings.setValue("color-0", "#EBEBEB");
118+
settings.setValue("color-1", "#a51d2d");
119+
settings.setValue("color-4", "#c01c28");
120+
settings.setValue("color-6", "#e01b24");
121+
settings.setValue("color-9", "#ed333b");
122+
settings.setValue("color-10", "#f66151");
123+
break;
124+
case "magenta-light":
125+
settings.setValue("color-0", "#EBEBEB");
126+
settings.setValue("color-1", "#410041");
127+
settings.setValue("color-4", "#6B006B");
128+
settings.setValue("color-6", "#960096");
129+
settings.setValue("color-9", "#C900C9");
130+
settings.setValue("color-10", "#FF00FF");
131+
break;
132+
case "purple-light":
133+
settings.setValue("color-0", "#EBEBEB");
134+
settings.setValue("color-1", "#613583");
135+
settings.setValue("color-4", "#813d9c");
136+
settings.setValue("color-6", "#9141ac");
137+
settings.setValue("color-9", "#c061cb");
138+
settings.setValue("color-10", "#dc8add");
139+
break;
140+
case "gruvbox-light":
141+
settings.setValue("color-0", "#EBEBEB");
142+
settings.setValue("color-1", "#665c54");
143+
settings.setValue("color-4", "#bdae93");
144+
settings.setValue("color-6", "#bdae93");
145+
settings.setValue("color-9", "#ebdbb2");
146+
settings.setValue("color-10", "#ebdbb2");
147+
break;
148+
default:
149+
break;
150+
}
151+
}
152+
};

github-contribution-grid@KopfdesDaemons/files/github-contribution-grid@KopfdesDaemons/helpers/github.helper.js renamed to github-contribution-grid@KopfdesDaemons/files/github-contribution-grid@KopfdesDaemons/helpers/github.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@ const Soup = imports.gi.Soup;
22
const ByteArray = imports.byteArray;
33
const GLib = imports.gi.GLib;
44

5-
const _httpSession = new Soup.Session();
5+
let _httpSession;
6+
if (Soup.MAJOR_VERSION == 2) {
7+
_httpSession = new Soup.SessionAsync();
8+
} else {
9+
//version 3
10+
_httpSession = new Soup.Session();
11+
}
612

7-
class GitHubHelper {
8-
static gitHubTokenCrationURL = "https://github.com/settings/tokens/new?description=Cinnamon%20Desklet";
13+
var GitHubHelper = class GitHubHelper {
14+
static gitHubTokenCreationURL = "https://github.com/settings/tokens/new?description=Cinnamon%20Desklet";
915

1016
static async getContributionData(username, token) {
1117
const query = `
@@ -59,13 +65,4 @@ class GitHubHelper {
5965
});
6066
});
6167
}
62-
63-
static getContributionColor(count) {
64-
if (count >= 10) return "#56d364";
65-
if (count >= 9) return "#2ea043";
66-
if (count >= 6) return "#196c2e";
67-
if (count >= 4) return "#196c2e";
68-
if (count > 0) return "#033a16";
69-
if (count === 0) return "#151b23";
70-
}
71-
}
68+
};

0 commit comments

Comments
 (0)