Skip to content

Commit

Permalink
mintoo@sujitagarwal: Version 1.1 (#1269)
Browse files Browse the repository at this point in the history
* Code optimization, Performance & UI Enhancements, Drag-Drop icon removal & Power Icon changes
  • Loading branch information
sujitagarwal authored Aug 27, 2024
1 parent f84fa65 commit bb17124
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 167 deletions.
81 changes: 40 additions & 41 deletions mintoo@sujitagarwal/files/mintoo@sujitagarwal/desklet.js
Original file line number Diff line number Diff line change
@@ -1,75 +1,74 @@
const St = imports.gi.St;
const Desklet = imports.ui.desklet;
const Lang = imports.lang;
const GLib = imports.gi.GLib;
const Util = imports.misc.util;
const Gettext = imports.gettext;

const uuid = "mintoo@sujitagarwal";

Gettext.bindtextdomain(uuid, GLib.get_home_dir() + "/.local/share/locale")
Gettext.bindtextdomain(uuid, GLib.get_home_dir() + "/.local/share/locale");

function _(str) {
return Gettext.dgettext(uuid, str);
return Gettext.dgettext(uuid, str);
}

function MintooDesklet(metadata) {
this._init(metadata);
}
class MintooDesklet extends Desklet.Desklet {
constructor(metadata) {
super(metadata);
this.metadata = metadata;
this.uuid = this.metadata["uuid"];

MintooDesklet.prototype = {
__proto__: Desklet.Desklet.prototype,
this._createUI();
}

_init: function (metadata) {
Desklet.Desklet.prototype._init.call(this, metadata);
_createUI() {
this._container = new St.BoxLayout({ vertical: true, style_class: "mintoo-main-container" });

this.metadata = metadata;
this.uuid = this.metadata["uuid"];
this._row1 = new St.BoxLayout({ style_class: "mintoo-row-container" });
this._row2 = new St.BoxLayout({ style_class: "mintoo-row-container" });

this._container = new St.BoxLayout({vertical:true, style_class: "MintooMainContainer"});
this._row1 = new St.BoxLayout({style_class: "MintooRowContainer"});
this._row2 = new St.BoxLayout({style_class: "MintooRowContainer"});
this._mintoolabel = new St.Label({ style_class: "mintoo-button-move" });

this._mintoolabel = new St.Label({style_class: "MintooButtonMove"});
this._container.add(this._mintoolabel);
const buttonSettings = [
{ className: "mintoo-button mintoo-button-one", action: this._lockClickAction },
{ className: "mintoo-button mintoo-button-two", action: this._logoutClickAction },
{ className: "mintoo-button mintoo-button-three", action: this._shutdownClickAction },
{ className: "mintoo-button mintoo-button-four", action: this._rebootClickAction }
];

this._btnLockDesktop = new St.Button({style_class: "MintooButtonOne"});
this._btnLogoutSession = new St.Button({style_class: "MintooButtonTwo"});
this._btnLogoutSession.connect("clicked", Lang.bind(this, this._logoutClickAction));
this._btnLockDesktop.connect("clicked", Lang.bind(this, this._lockClickAction));
buttonSettings.forEach((btn, index) => {
const button = new St.Button({ style_class: btn.className });
button.connect("clicked", btn.action.bind(this));
if (index < 2) {
this._row1.add(button);
} else {
this._row2.add(button);
}
});

this._row1.add(this._btnLockDesktop);
this._row1.add(this._btnLogoutSession);
this._container.add(this._row1);

this._btnShutdown = new St.Button({style_class: "MintooButtonThree"});
this._btnReboot = new St.Button({style_class: "MintooButtonFour"});
this._btnShutdown.connect("clicked", Lang.bind(this, this._shutdownClickAction));
this._btnReboot.connect("clicked", Lang.bind(this, this._rebootClickAction));
this._row2.add(this._btnShutdown);
this._row2.add(this._btnReboot);
this._container.add(this._row2);

this.setContent(this._container);
},
}

_lockClickAction: function () {
_lockClickAction() {
Util.spawnCommandLine("cinnamon-screensaver-command -l");
},
}

_logoutClickAction: function () {
_logoutClickAction() {
Util.spawnCommandLine("cinnamon-session-quit --logout");
},
}

_shutdownClickAction: function () {
_shutdownClickAction() {
Util.spawnCommandLine("cinnamon-session-quit --power-off");
},
}

_rebootClickAction: function () {
_rebootClickAction() {
Util.spawnCommandLine("cinnamon-session-quit --reboot");
}
}

function main(metadata, desklet_id) {
let desklet = new MintooDesklet(metadata, desklet_id);
return desklet;
function main(metadata) {
return new MintooDesklet(metadata);
}
Binary file modified mintoo@sujitagarwal/files/mintoo@sujitagarwal/image/logout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified mintoo@sujitagarwal/files/mintoo@sujitagarwal/image/reboot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"uuid": "mintoo@sujitagarwal",
"name": "Mintoo - The Mint Assistant",
"description": "A friendly assistant for your Linux Mint.",
"version": "1.0",
"version": "1.1",
"max-instances": "1",
"prevent-decorations": true
}
165 changes: 40 additions & 125 deletions mintoo@sujitagarwal/files/mintoo@sujitagarwal/stylesheet.css
Original file line number Diff line number Diff line change
@@ -1,138 +1,53 @@
.MintooMainContainer {
min-width:92px;
/* General Container Styles */
.mintoo-main-container,
.mintoo-row-container {
min-width: 92px;
}

.MintooRowContainer {
min-width:92px;
/* Button Base Styles */
.mintoo-button {
background-color: #333333;
text-decoration: none;
text-indent: 0;
line-height: 30px;
display: inline-block;
font-size: 20px;
color: #ffffff;
width: 30px;
height: 30px;
padding: 20px;
border: 0 solid #aba367;
background-position: 20px 20px;
background-size: 32px 32px;
cursor: pointer;
}

.MintooButtonMove {
cursor:pointer;
color:#ffffff;
font-family:Arial;
font-size: 8px;
padding: 0px 16px;
min-height:14px;
min-width:92px;
text-decoration:none;
text-shadow:0px 1px 0px #2f6627;
background-position: 46px -5px;
background-size: 32px 32px;
background-image: url('image/move.png');
margin-bottom: 5px;
margin-right: 5px;
cursor:move;
}
.MintooButtonMove:hover {
background-color:#5cbf2a;
.mintoo-button:hover {
background-color: #5cbf2a;
}

.MintooButtonOne {
background-color:#333333;
text-decoration:none;
text-indent:0px;
line-height:30px;
-moz-border-radius:30px 30px 0 30px;
-webkit-border-radius:30px 30px 0 30px;
border-radius:30px 30px 0 30px;
display:inline-block;
font-size:20px;
color:#ffffff;
width:30px;
height:30px;
padding:15px;
border-color:#aba367;
border-width:0px;
border-style:solid;
background-position: 15px 15px;
background-size: 32px 32px;
background-image: url('image/lock.png');
margin-bottom: 5px;
margin-right: 5px;
cursor:pointer;
}
.MintooButtonOne:hover {
background-color:#5cbf2a;
}
/* Button-Specific Styles */

.MintooButtonTwo {
background-color:#333333;
text-decoration:none;
text-indent:0px;
line-height:30px;
-moz-border-radius:30px 30px 30px 0;
-webkit-border-radius:30px 30px 30px 0;
border-radius:30px 30px 30px 0;
display:inline-block;
font-size:20px;
color:#ffffff;
width:30px;
height:30px;
padding:15px;
border-color:#aba367;
border-width:0px;
border-style:solid;
background-position: 15px 15px;
background-size: 32px 32px;
background-image: url('image/logout.png');
margin-bottom: 5px;
cursor:pointer;
}
.MintooButtonTwo:hover {
background-color:#5cbf2a;
.mintoo-button-one {
border-radius: 30px 30px 0 30px;
background-image: url('image/lock.png');
margin-right: 10px;
margin-bottom: 10px;
}

.MintooButtonThree {
background-color:#333333;
text-decoration:none;
text-indent:0px;
line-height:30px;
-moz-border-radius:30px 0px 30px 30px;
-webkit-border-radius:30px 0px 30px 30px;
border-radius:30px 0px 30px 30px;
display:inline-block;
font-size:20px;
color:#ffffff;
width:30px;
height:30px;
padding:15px;
border-color:#aba367;
border-width:0px;
border-style:solid;
background-position: 15px 15px;
background-size: 32px 32px;
background-image: url('image/shutdown.png');
margin-bottom: 5px;
margin-right: 5px;
cursor:pointer;
}
.MintooButtonThree:hover {
background-color:#5cbf2a;
.mintoo-button-two {
border-radius: 30px 30px 30px 0;
background-image: url('image/logout.png');
margin-bottom: 10px;
}

.MintooButtonFour {
background-color:#333333;
text-decoration:none;
text-indent:0px;
line-height:30px;
-moz-border-radius:0 30px 30px 30px;
-webkit-border-radius:0 30px 30px 30px;
border-radius:0 30px 30px 30px;
display:inline-block;
font-size:20px;
color:#ffffff;
width:30px;
height:30px;
padding:15px;
border-color:#aba367;
border-width:0px;
border-style:solid;
background-position: 15px 15px;
background-size: 32px 32px;
background-image: url('image/reboot.png');
margin-bottom: 5px;
cursor:pointer;
.mintoo-button-three {
border-radius: 30px 0 30px 30px;
background-image: url('image/shutdown.png');
margin-right: 10px;
}
.MintooButtonFour:hover {
background-color:#5cbf2a;

.mintoo-button-four {
border-radius: 0 30px 30px 30px;
background-image: url('image/reboot.png');
}
Binary file modified mintoo@sujitagarwal/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bb17124

Please sign in to comment.