diff --git a/mintoo@sujitagarwal/files/mintoo@sujitagarwal/desklet.js b/mintoo@sujitagarwal/files/mintoo@sujitagarwal/desklet.js index 77d655639..2a39eefe9 100644 --- a/mintoo@sujitagarwal/files/mintoo@sujitagarwal/desklet.js +++ b/mintoo@sujitagarwal/files/mintoo@sujitagarwal/desklet.js @@ -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); } diff --git a/mintoo@sujitagarwal/files/mintoo@sujitagarwal/image/logout.png b/mintoo@sujitagarwal/files/mintoo@sujitagarwal/image/logout.png index bcec0bea4..4332c0ec2 100644 Binary files a/mintoo@sujitagarwal/files/mintoo@sujitagarwal/image/logout.png and b/mintoo@sujitagarwal/files/mintoo@sujitagarwal/image/logout.png differ diff --git a/mintoo@sujitagarwal/files/mintoo@sujitagarwal/image/move.png b/mintoo@sujitagarwal/files/mintoo@sujitagarwal/image/move.png deleted file mode 100644 index d8462fadb..000000000 Binary files a/mintoo@sujitagarwal/files/mintoo@sujitagarwal/image/move.png and /dev/null differ diff --git a/mintoo@sujitagarwal/files/mintoo@sujitagarwal/image/reboot.png b/mintoo@sujitagarwal/files/mintoo@sujitagarwal/image/reboot.png index fdaa2f05a..2a7058fb1 100644 Binary files a/mintoo@sujitagarwal/files/mintoo@sujitagarwal/image/reboot.png and b/mintoo@sujitagarwal/files/mintoo@sujitagarwal/image/reboot.png differ diff --git a/mintoo@sujitagarwal/files/mintoo@sujitagarwal/metadata.json b/mintoo@sujitagarwal/files/mintoo@sujitagarwal/metadata.json index 439051883..d1dcaba79 100644 --- a/mintoo@sujitagarwal/files/mintoo@sujitagarwal/metadata.json +++ b/mintoo@sujitagarwal/files/mintoo@sujitagarwal/metadata.json @@ -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 } diff --git a/mintoo@sujitagarwal/files/mintoo@sujitagarwal/stylesheet.css b/mintoo@sujitagarwal/files/mintoo@sujitagarwal/stylesheet.css index cdd53610a..63090d1db 100644 --- a/mintoo@sujitagarwal/files/mintoo@sujitagarwal/stylesheet.css +++ b/mintoo@sujitagarwal/files/mintoo@sujitagarwal/stylesheet.css @@ -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'); } diff --git a/mintoo@sujitagarwal/screenshot.png b/mintoo@sujitagarwal/screenshot.png index 0668406a4..894b228ab 100644 Binary files a/mintoo@sujitagarwal/screenshot.png and b/mintoo@sujitagarwal/screenshot.png differ