Skip to content

Commit

Permalink
v1.2.0: Introduces action delayers to avoid errors (#6736)
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiux authored Jan 4, 2025
1 parent 4e7c108 commit f2d8b76
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 13 deletions.
3 changes: 3 additions & 0 deletions xsession@claudiux/files/xsession@claudiux/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### v1.2.0~20250104
* Introduces action delayers to avoid errors.

### v1.1.0~20241005
* Opens the settings for the spices you use.

Expand Down
76 changes: 64 additions & 12 deletions xsession@claudiux/files/xsession@claudiux/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,14 @@ class LGS extends Applet.IconApplet {
});
itemWatchXSE.connect(
"activate",
() => Util.spawnCommandLineAsync("bash -c '"+WATCHXSE_SCRIPT+"'")
() => {
if (this.menu.isOpen) this.menu.close();
let to = setTimeout( () => {
Util.spawnCommandLineAsync("bash -c '"+WATCHXSE_SCRIPT+"'");
clearTimeout(to);
},
300);
}
);

this.menu.addMenuItem(itemWatchXSE);
Expand All @@ -156,7 +163,11 @@ class LGS extends Applet.IconApplet {
"activate",
() => {
if (this.menu.isOpen) this.menu.close();
restartCinnamon(true)
let to = setTimeout( () => {
restartCinnamon(true);
clearTimeout(to);
},
300);
}
);

Expand All @@ -178,7 +189,11 @@ class LGS extends Applet.IconApplet {
});
s.connect("activate", () => {
if (this.menu.isOpen) this.menu.close();
reloadExtension(applet, Type.APPLET)
let to = setTimeout( () => {
reloadExtension(applet, Type.APPLET);
clearTimeout(to);
},
300);
});
this.subMenuReloadApplets.menu.addMenuItem(s)
}
Expand All @@ -193,7 +208,11 @@ class LGS extends Applet.IconApplet {
});
s.connect("activate", () => {
if (this.menu.isOpen) this.menu.close();
reloadExtension(desklet, Type.DESKLET)
let to = setTimeout( () => {
reloadExtension(desklet, Type.DESKLET);
clearTimeout(to);
},
300);
});
this.subMenuReloadDesklets.menu.addMenuItem(s)
}
Expand All @@ -208,7 +227,11 @@ class LGS extends Applet.IconApplet {
});
s.connect("activate", () => {
if (this.menu.isOpen) this.menu.close();
reloadExtension(extension, Type.EXTENSION)
let to = setTimeout( () => {
reloadExtension(extension, Type.EXTENSION);
clearTimeout(to);
},
300);
});
this.subMenuReloadExtensions.menu.addMenuItem(s)
}
Expand All @@ -229,7 +252,11 @@ class LGS extends Applet.IconApplet {
});
s.connect("activate", () => {
if (this.menu.isOpen) this.menu.close();
Util.spawnCommandLineAsync('bash -c "cinnamon-settings applets %s"'.format(applet))
let to = setTimeout( () => {
Util.spawnCommandLineAsync('bash -c "cinnamon-settings applets %s"'.format(applet));
clearTimeout(to);
},
300);
});
this.subMenuSettingsApplets.menu.addMenuItem(s)
}
Expand All @@ -244,7 +271,11 @@ class LGS extends Applet.IconApplet {
});
s.connect("activate", () => {
if (this.menu.isOpen) this.menu.close();
Util.spawnCommandLineAsync('bash -c "cinnamon-settings desklets %s"'.format(desklet))
let to = setTimeout( () => {
Util.spawnCommandLineAsync('bash -c "cinnamon-settings desklets %s"'.format(desklet));
clearTimeout(to);
},
300);
});
this.subMenuSettingsDesklets.menu.addMenuItem(s)
}
Expand All @@ -259,7 +290,11 @@ class LGS extends Applet.IconApplet {
});
s.connect("activate", () => {
if (this.menu.isOpen) this.menu.close();
Util.spawnCommandLineAsync('bash -c "cinnamon-settings extensions %s"'.format(extension))
let to = setTimeout( () => {
Util.spawnCommandLineAsync('bash -c "cinnamon-settings extensions %s"'.format(extension));
clearTimeout(to);
},
300);
});
this.subMenuSettingsExtensions.menu.addMenuItem(s)
}
Expand All @@ -280,7 +315,11 @@ class LGS extends Applet.IconApplet {
});
s.connect("activate", () => {
if (this.menu.isOpen) this.menu.close();
Util.spawnCommandLineAsync('bash -c "xdg-open %s/applets/%s/"'.format(SPICES_DIR, applet))
let to = setTimeout( () => {
Util.spawnCommandLineAsync('bash -c "xdg-open %s/applets/%s/"'.format(SPICES_DIR, applet));
clearTimeout(to);
},
300);
});
this.subMenuCodeApplets.menu.addMenuItem(s)
}
Expand All @@ -295,7 +334,11 @@ class LGS extends Applet.IconApplet {
});
s.connect("activate", () => {
if (this.menu.isOpen) this.menu.close();
Util.spawnCommandLineAsync('bash -c "xdg-open %s/desklets/%s/"'.format(SPICES_DIR, desklet))
let to = setTimeout( () => {
Util.spawnCommandLineAsync('bash -c "xdg-open %s/desklets/%s/"'.format(SPICES_DIR, desklet));
clearTimeout(to);
},
300);
});
this.subMenuCodeDesklets.menu.addMenuItem(s)
}
Expand All @@ -310,15 +353,24 @@ class LGS extends Applet.IconApplet {
});
s.connect("activate", () => {
if (this.menu.isOpen) this.menu.close();
Util.spawnCommandLineAsync('bash -c "xdg-open %s/extensions/%s/"'.format(SPICES_DIR, extension))
let to = setTimeout( () => {
Util.spawnCommandLineAsync('bash -c "xdg-open %s/extensions/%s/"'.format(SPICES_DIR, extension));
clearTimeout(to);
},
300);
});
this.subMenuCodeExtensions.menu.addMenuItem(s)
}

}; // End of makeMenu

on_applet_middle_clicked(event) {
Util.spawnCommandLineAsync("bash -c '"+WATCHXSE_SCRIPT+"'")
if (this.menu.isOpen) this.menu.close();
let to = setTimeout( () => {
Util.spawnCommandLineAsync("bash -c '"+WATCHXSE_SCRIPT+"'");
clearTimeout(to);
},
300);
}
} // End of class LGS

Expand Down
2 changes: 1 addition & 1 deletion xsession@claudiux/files/xsession@claudiux/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Xsession",
"max-instances": "1",
"hide-configuration": true,
"version": "1.1.0",
"version": "1.2.0",
"description": "Restart, access source code and configure your Spices (Applets, Desklets, Extensions). View the contents of your .xsession-errors file in real time. Restart Cinnamon.",
"author": "claudiux"
}

0 comments on commit f2d8b76

Please sign in to comment.