diff --git a/watermark@mantve/README.md b/watermark@mantve/README.md new file mode 100644 index 000000000..297ad3bcd --- /dev/null +++ b/watermark@mantve/README.md @@ -0,0 +1,10 @@ +Watermark +====================== + +Displays a custom text as a watermark on your desktop + +## Changelog + +### v1.0.0 +* Initial release +* Add watermark font and shadow options diff --git a/watermark@mantve/files/watermark@mantve/desklet.js b/watermark@mantve/files/watermark@mantve/desklet.js new file mode 100644 index 000000000..6cd96857b --- /dev/null +++ b/watermark@mantve/files/watermark@mantve/desklet.js @@ -0,0 +1,63 @@ +const Desklet = imports.ui.desklet; +const St = imports.gi.St; +const Settings = imports.ui.settings; +const Pango = imports.gi.Pango; + +class WatermarkDesklet extends Desklet.Desklet { + constructor(metadata, desklet_id) { + super(metadata, desklet_id); + + this.settings = new Settings.DeskletSettings(this, this.metadata.uuid, desklet_id); + + const onSettingsChanged = this.on_settings_changed.bind(this); + this.settings.bind("title_text", "title_text", onSettingsChanged); + this.settings.bind("subtitle_text", "subtitle_text", onSettingsChanged); + this.settings.bind("font_setting", "font_setting", onSettingsChanged); + this.settings.bind("text_opacity", "text_opacity", onSettingsChanged); + this.settings.bind("subtitle_scale", "subtitle_scale", onSettingsChanged); + this.settings.bind("enable_shadow", "enable_shadow", onSettingsChanged); + + this.setupUI(); + } + + setupUI() { + this.windowContainer = new St.BoxLayout({ + vertical: true, + }); + + this.title_label = new St.Label(); + this.subtitle_label = new St.Label(); + + this.windowContainer.add_actor(this.title_label); + this.windowContainer.add_actor(this.subtitle_label); + + this.setContent(this.windowContainer); + this.on_settings_changed(); + } + + _applyTextStyle(label, text, fontFamily, fontSize) { + const style = + `font-family: '${fontFamily}'; ` + + `font-size: ${fontSize}px; ` + + `color: rgba(255, 255, 255, ${this.text_opacity}); ` + + `${this.enable_shadow ? 'text-shadow: 0 0 2px rgba(0, 0, 0, 0.6);' : ''}`; + + label.set_text(text); + label.set_style(style); + } + + on_settings_changed() { + const fontDescription = Pango.font_description_from_string(this.font_setting); + const fontFamily = fontDescription.get_family(); + const fontSize = fontDescription.get_size() / Pango.SCALE; + + this._applyTextStyle(this.title_label, this.title_text, fontFamily, fontSize); + + const subtitleSize = Math.round(fontSize * this.subtitle_scale); + this._applyTextStyle(this.subtitle_label, this.subtitle_text, fontFamily, subtitleSize); + } +} + +function main(metadata, desklet_id) { + return new WatermarkDesklet(metadata, desklet_id); +} \ No newline at end of file diff --git a/watermark@mantve/files/watermark@mantve/icon.png b/watermark@mantve/files/watermark@mantve/icon.png new file mode 100644 index 000000000..6ccb5ea6f Binary files /dev/null and b/watermark@mantve/files/watermark@mantve/icon.png differ diff --git a/watermark@mantve/files/watermark@mantve/metadata.json b/watermark@mantve/files/watermark@mantve/metadata.json new file mode 100644 index 000000000..a7612d25b --- /dev/null +++ b/watermark@mantve/files/watermark@mantve/metadata.json @@ -0,0 +1,9 @@ +{ + "max-instances": "10", + "description": "Displays a custom text as a watermark", + "name": "Watermark", + "version": "1.0.0", + "uuid": "watermark@mantve", + "author": "mantve", + "prevent-decorations": true +} \ No newline at end of file diff --git a/watermark@mantve/files/watermark@mantve/po/watermark@mantve.pot b/watermark@mantve/files/watermark@mantve/po/watermark@mantve.pot new file mode 100644 index 000000000..4126ba456 --- /dev/null +++ b/watermark@mantve/files/watermark@mantve/po/watermark@mantve.pot @@ -0,0 +1,54 @@ +# WATERMARK +# This file is put in the public domain. +# mantve, 2026 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: watermark@mantve 0.1\n" +"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-desklets/" +"issues\n" +"POT-Creation-Date: 2026-03-14 23:41+0200\n" +"PO-Revision-Date: \n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. metadata.json->description +msgid "Displays a custom text as a watermark" +msgstr "" + +#. metadata.json->name +msgid "Watermark" +msgstr "" + +#. settings-schema.json->layout->description +msgid "Text Configuration" +msgstr "" + +#. settings-schema.json->title_text->description +msgid "Main title text" +msgstr "" + +#. settings-schema.json->subtitle_text->description +msgid "Subtitle text" +msgstr "" + +#. settings-schema.json->font_setting->description +msgid "Font and Size" +msgstr "" + +#. settings-schema.json->enable_shadow->description +msgid "Enable text shadow" +msgstr "" + +#. settings-schema.json->subtitle_scale->description +msgid "Subtitle relative size" +msgstr "" + +#. settings-schema.json->text_opacity->description +msgid "Transparency" +msgstr "" diff --git a/watermark@mantve/files/watermark@mantve/settings-schema.json b/watermark@mantve/files/watermark@mantve/settings-schema.json new file mode 100644 index 000000000..efcc58bc5 --- /dev/null +++ b/watermark@mantve/files/watermark@mantve/settings-schema.json @@ -0,0 +1,42 @@ +{ + "layout": { + "type": "header", + "description": "Text Configuration" + }, + "title_text": { + "type": "entry", + "default": "Activate Linux", + "description": "Main title text" + }, + "subtitle_text": { + "type": "entry", + "default": "Go to Settings to activate Linux.", + "description": "Subtitle text" + }, + "font_setting": { + "type": "fontchooser", + "default": "Noto Sans 24", + "description": "Font and Size" + }, + "enable_shadow": { + "type": "checkbox", + "default": true, + "description": "Enable text shadow" + }, + "subtitle_scale": { + "type": "scale", + "default": 0.73, + "min": 0.01, + "max": 1.0, + "step": 0.01, + "description": "Subtitle relative size" + }, + "text_opacity": { + "type": "scale", + "default": 0.4, + "min": 0.1, + "max": 1.0, + "step": 0.01, + "description": "Transparency" + } +} \ No newline at end of file diff --git a/watermark@mantve/files/watermark@mantve/stylesheet.css b/watermark@mantve/files/watermark@mantve/stylesheet.css new file mode 100644 index 000000000..e69de29bb diff --git a/watermark@mantve/info.json b/watermark@mantve/info.json new file mode 100644 index 000000000..34461555b --- /dev/null +++ b/watermark@mantve/info.json @@ -0,0 +1,3 @@ +{ + "author": "mantve" +} diff --git a/watermark@mantve/screenshot.png b/watermark@mantve/screenshot.png new file mode 100644 index 000000000..988de1c0c Binary files /dev/null and b/watermark@mantve/screenshot.png differ