Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ $(CSSOUT): $(THEMES)/stylesheet.css $(CSSSRCS)
$(ZIP): out
printf -- 'NEEDED: zip\n'
mkdir -p $(DIST)
(cd $(BUILD) && zip ../../$(ZIP) -9r ./)
(cd $(BUILD) && zip ../../$(ZIP) -9r ./ -x'./schemas/gschemas.compiled')

# Updates all existing po files by merging them with the pot.
# If already present, the pot is removed and recreated.
Expand Down
22 changes: 22 additions & 0 deletions scripts/shexli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

shopt -s nullglob

printf 'NEEDED: python-uv\n'

zips=(dist/*.zip)

# If there's more than 1 zip
if (( ${#zips[@]} > 1 )); then
make clean
fi

# Make sure there is a zip
make pack

uvx --python 3.12 \
--from 'shexli==0.2.1' \
--with 'tree-sitter==0.25.2' \
--with 'tree-sitter-javascript==0.25.0' \
shexli $zips | less

31 changes: 26 additions & 5 deletions src/autoConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,37 @@ import { AutoConfigFailError } from "./errors.js";
// Denmark, Finland, Sweden, Norway, Iceland, Faroe Islands, Greenland
const NORDIC : string[] = [ "DK", "FI", "SE", "NO", "IS", "FO", "GL" ];

async function readFileAsync(path : string) : Promise<string | null> {

const f = Gio.File.new_for_path(path);
return new Promise<string | null>(resolve => {
f.load_contents_async(null, (_, res) => {
try {
const [ ok, contents ] = f.load_contents_finish(res);
if(!ok) {
resolve(null);
return;
}
const str = new TextDecoder().decode(contents);
resolve(str);
return;
} catch(e) {
resolve(null);
return;
}
});
});
}

/**
* Tests if this computer is a desktop.
* @returns True if a desktop, otherwise false if not or unknown.
*/
function isDesktop() : boolean {
const fileResult = GLib.file_get_contents("/sys/class/dmi/id/chassis_type");
async function isDesktop() : Promise<boolean> {
const str = await readFileAsync("/sys/class/dmi/id/chassis_type");
// Return false if file read failed
if(!fileResult[0]) return false;
if(!str) return false;

const str = new TextDecoder().decode(fileResult[1]);
// Chassis 3 = desktop
return str === "3\n";
}
Expand All @@ -55,7 +76,7 @@ export async function setFirstTimeConfig(settings : Gio.Settings) {
}

// If it isn't a laptop then set your location once and never query the server again
if(isDesktop()) {
if(await isDesktop()) {
const loc = Location.newCoords(myLoc.city ?? _g("My Location"), myLoc.lat, myLoc.lon);
const strArr = [ loc.toString() ];
settings.set_value("locations", writeGTypeAS(strArr));
Expand Down
6 changes: 6 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,12 @@ export default class SimpleWeatherExtension extends Extension {
this.#panelIcon = undefined;
this.#panelLabel = undefined;
this.#secondPanelLabel = undefined;

this.#sunTimeIcon?.destroy();
this.#sunTimeIcon = undefined;
this.#sunTimeLabel?.destroy();
this.#sunTimeLabel = undefined;

this.#indicator?.destroy();
this.#indicator = undefined;

Expand Down
2 changes: 1 addition & 1 deletion static/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"shell-version": [
"46", "48", "49", "50"
],
"version-name": "50.1.0"
"version-name": "50.1.1"
}
Loading