Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mouse-click-effects@anaximeno: Version 0.4.0 #672

Merged
merged 2 commits into from
Jul 15, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const Main = imports.ui.main;
const Settings = imports.ui.settings;
const Gettext = imports.gettext;
const SignalManager = imports.misc.signalManager;
const ByteArray = imports.byteArray;
const { Atspi, GLib, Gio } = imports.gi;
const { ClickAnimationFactory } = require("./clickAnimations.js");
const { Debouncer } = require("./helpers.js");
Expand All @@ -40,8 +41,11 @@ const ClickType = {
LEFT: "left_click",
MIDDLE: "middle_click",
RIGHT: "right_click",
PAUSE: "pause_bind",
};

const PAUSE_OFF_COLOR = "#E5E4E2";
const PAUSE_ON_COLOR = "#71797E";

class MouseClickEffects {
constructor(metadata) {
Expand Down Expand Up @@ -108,6 +112,11 @@ class MouseClickEffects {
value: "middle_click_effect_enabled",
cb: null,
},
{
key: "pause-animation-effects-enabled",
value: "pause_animation_effects_enabled",
cb: null,
},
{
key: "left-click-color",
value: "left_click_color",
Expand Down Expand Up @@ -179,10 +188,10 @@ class MouseClickEffects {

_on_pause_toggled() {
this.set_active(!this.enabled);
}

on_effects_enabled_updated(event) {
thib.on_property_updated(event);
if (this.pause_animation_effects_enabled) {
this.display_click(ClickType.PAUSE, this.enabled ? PAUSE_OFF_COLOR : PAUSE_ON_COLOR);
}
}

on_fullscreen_changed() {
Expand Down Expand Up @@ -229,6 +238,8 @@ class MouseClickEffects {
}

update_colored_icons() {
this._create_colored_icon_data(ClickType.PAUSE, PAUSE_ON_COLOR);
this._create_colored_icon_data(ClickType.PAUSE, PAUSE_OFF_COLOR);
this._create_colored_icon_data(ClickType.LEFT, this.left_click_color);
this._create_colored_icon_data(ClickType.MIDDLE, this.middle_click_color);
this._create_colored_icon_data(ClickType.RIGHT, this.right_click_color);
Expand All @@ -250,12 +261,12 @@ class MouseClickEffects {

_create_colored_icon_data(click_type, color) {
if (this.get_colored_icon(this.icon_mode, click_type, color))
return;
return true;

let source = Gio.File.new_for_path(`${this.app_icons_dir}/${this.icon_mode}.svg`);
let [l_success, contents] = source.load_contents(null);
contents = imports.byteArray.toString(contents);

contents = ByteArray.toString(contents);
// Replace to new color
contents = contents.replace('fill="#000000"', `fill="${color}"`);

Expand All @@ -268,14 +279,13 @@ class MouseClickEffects {
}

let [r_success, tag] = dest.replace_contents(contents, null, false, Gio.FileCreateFlags.REPLACE_DESTINATION, null);
return r_success;
}

_animate_click(click_type, color) {
let icon;
this.update_animation_mode();

let icon = this.get_colored_icon(this.icon_mode, click_type, color);

if (icon) {
if (icon = this.get_colored_icon(this.icon_mode, click_type, color)) {
this._click_animation.animateClick(icon, {
opacity: this.general_opacity,
icon_size: this.size,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@
"default": true,
"description": "Enable Right Click Effect"
},
"pause-animation-effects-enabled": {
"type": "checkbox",
"default": true,
"description": "Enable Pause Animation Effects"
},

"colors-section": {
"type": "section",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"uuid": "mouse-click-effects@anaximeno",
"name": "Mouse Click Effects",
"version": "0.3.3",
"version": "0.4.0",
"description": "Display mouse click effects on Cinnamon.",
"url": "https://github.com/anaximeno/mouse-click-effects",
"website": "https://github.com/anaximeno/mouse-click-effects",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgstr ""
"Project-Id-Version: mouse-click-effects@anaximeno 0.1.0\n"
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
"extensions/issues\n"
"POT-Creation-Date: 2024-06-02 05:32-0100\n"
"POT-Creation-Date: 2024-07-15 04:30-0100\n"
"PO-Revision-Date: 2024-05-30 19:13-0400\n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down Expand Up @@ -178,6 +178,11 @@ msgstr "Activar el efecto de clic central"
msgid "Enable Right Click Effect"
msgstr "Activar el efecto del botón derecho"

#. 5.4->settings-schema.json->pause-animation-effects-enabled->description
#, fuzzy
msgid "Enable Pause Animation Effects"
msgstr "Activar el efecto de clic izquierdo"

#. 5.4->settings-schema.json->colors-section->description
msgid "Colors"
msgstr "Colores"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: mouse-click-effects@anaximeno 0.1.0\n"
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
"extensions/issues\n"
"POT-Creation-Date: 2024-06-02 05:32-0100\n"
"POT-Creation-Date: 2024-07-15 04:30-0100\n"
"PO-Revision-Date: 2024-05-30 9:50+1\n"
"Last-Translator: Muxutruk <[email protected]>\n"
"Language-Team: Basque <[email protected]>\n"
Expand Down Expand Up @@ -177,6 +177,11 @@ msgstr "Erdiko klik efektua aktibatu"
msgid "Enable Right Click Effect"
msgstr "Eskimako klik efektua aktibatu"

#. 5.4->settings-schema.json->pause-animation-effects-enabled->description
#, fuzzy
msgid "Enable Pause Animation Effects"
msgstr "Ezkerreko klik efektua aktibatu"

#. 5.4->settings-schema.json->colors-section->description
msgid "Colors"
msgstr "Koloreak"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgstr ""
"Project-Id-Version: mouse-click-effects@anaximeno 0.3.1\n"
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
"extensions/issues\n"
"POT-Creation-Date: 2024-06-02 05:32-0100\n"
"POT-Creation-Date: 2024-07-15 04:30-0100\n"
"PO-Revision-Date: 2024-06-18 11:01+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
Expand Down Expand Up @@ -180,6 +180,11 @@ msgstr "Középső kattintás effektus engedélyezése"
msgid "Enable Right Click Effect"
msgstr "Jobbra kattintás effekt engedélyezése"

#. 5.4->settings-schema.json->pause-animation-effects-enabled->description
#, fuzzy
msgid "Enable Pause Animation Effects"
msgstr "Balra kattintás effekt engedélyezése"

#. 5.4->settings-schema.json->colors-section->description
msgid "Colors"
msgstr "Színek"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: mouse-click-effects@anaximeno 0.3.1\n"
"Project-Id-Version: mouse-click-effects@anaximeno 0.4.0\n"
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
"extensions/issues\n"
"POT-Creation-Date: 2024-06-02 05:32-0100\n"
"POT-Creation-Date: 2024-07-15 04:30-0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -177,6 +177,10 @@ msgstr ""
msgid "Enable Right Click Effect"
msgstr ""

#. 5.4->settings-schema.json->pause-animation-effects-enabled->description
msgid "Enable Pause Animation Effects"
msgstr ""

#. 5.4->settings-schema.json->colors-section->description
msgid "Colors"
msgstr ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ msgstr ""
"Project-Id-Version: mouse-click-effects@anaximeno 0.1.0\n"
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
"extensions/issues\n"
"POT-Creation-Date: 2024-06-02 05:32-0100\n"
"PO-Revision-Date: 2024-06-02 05:36-0100\n"
"POT-Creation-Date: 2024-07-15 04:30-0100\n"
"PO-Revision-Date: 2024-07-15 04:31-0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: pt\n"
Expand Down Expand Up @@ -160,8 +160,7 @@ msgstr "Atalho de Teclado para Pausar os Efeitos"

#. 5.4->settings-schema.json->pause-effects-binding->tooltip
msgid "Set keybinding to pause or continue the effects"
msgstr ""
"Define um atalho de teclado para pausar ou continuar os efeitos"
msgstr "Define um atalho de teclado para pausar ou continuar os efeitos"

#. 5.4->settings-schema.json->events-section->description
msgid "Events"
Expand All @@ -179,6 +178,10 @@ msgstr "Ativar Efeito do Clique do Meio"
msgid "Enable Right Click Effect"
msgstr "Ativar Efeito do Clique Direito"

#. 5.4->settings-schema.json->pause-animation-effects-enabled->description
msgid "Enable Pause Animation Effects"
msgstr "Ativar Efeitos de Animação da Pausa"

#. 5.4->settings-schema.json->colors-section->description
msgid "Colors"
msgstr "Cores"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: mouse-click-effects@anaximeno 0.1.0\n"
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
"extensions/issues\n"
"POT-Creation-Date: 2024-06-02 05:32-0100\n"
"POT-Creation-Date: 2024-07-15 04:30-0100\n"
"PO-Revision-Date: 2024-05-28 11:48+0800\n"
"Last-Translator: 张鹏 <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -178,6 +178,11 @@ msgstr "启用中键点击特效"
msgid "Enable Right Click Effect"
msgstr "启用右键点击特效"

#. 5.4->settings-schema.json->pause-animation-effects-enabled->description
#, fuzzy
msgid "Enable Pause Animation Effects"
msgstr "启用左键点击特效"

#. 5.4->settings-schema.json->colors-section->description
msgid "Colors"
msgstr "颜色"
Expand Down