commit 819522f1a2783d8164beedffb2478efa681baa03 Author: Vivianne Langdon Date: Thu Mar 17 22:18:31 2022 -0700 initial commit of fun stuff diff --git a/.buildconfig b/.buildconfig new file mode 100644 index 0000000..22790ed --- /dev/null +++ b/.buildconfig @@ -0,0 +1,14 @@ +[default] +name=Default +runtime=host +toolchain=default +config-opts= +run-opts= +prefix=/home/vv/.cache/gnome-builder/install/deskcandy/host +app-id= +postbuild= +prebuild= +default=true + +[default.environment] +VALAC=valac-0.52 diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..e5dc687 --- /dev/null +++ b/COPYING @@ -0,0 +1,24 @@ +Copyright (C) 2022 Vivianne Langdon +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name(s) of the above copyright +holders shall not be used in advertising or otherwise to promote the sale, +use or other dealings in this Software without prior written +authorization. diff --git a/build-aux/meson/postinstall.py b/build-aux/meson/postinstall.py new file mode 100755 index 0000000..6a3ea97 --- /dev/null +++ b/build-aux/meson/postinstall.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 + +from os import environ, path +from subprocess import call + +prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local') +datadir = path.join(prefix, 'share') +destdir = environ.get('DESTDIR', '') + +# Package managers set this so we don't need to run +if not destdir: + print('Updating icon cache...') + call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')]) + + print('Updating desktop database...') + call(['update-desktop-database', '-q', path.join(datadir, 'applications')]) + + print('Compiling GSettings schemas...') + call(['glib-compile-schemas', path.join(datadir, 'glib-2.0', 'schemas')]) + + diff --git a/data/icons/hicolor/scalable/apps/moe.solarpunk.DeskCandy.svg b/data/icons/hicolor/scalable/apps/moe.solarpunk.DeskCandy.svg new file mode 100644 index 0000000..a74c4df --- /dev/null +++ b/data/icons/hicolor/scalable/apps/moe.solarpunk.DeskCandy.svg @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + application-x-executable + + + + + + + + + + + + + + + + diff --git a/data/icons/hicolor/symbolic/apps/moe.solarpunk.DeskCandy-symbolic.svg b/data/icons/hicolor/symbolic/apps/moe.solarpunk.DeskCandy-symbolic.svg new file mode 100644 index 0000000..0444828 --- /dev/null +++ b/data/icons/hicolor/symbolic/apps/moe.solarpunk.DeskCandy-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/data/icons/meson.build b/data/icons/meson.build new file mode 100644 index 0000000..d7fb101 --- /dev/null +++ b/data/icons/meson.build @@ -0,0 +1,13 @@ +application_id = 'moe.solarpunk.DeskCandy' + +scalable_dir = join_paths('hicolor', 'scalable', 'apps') +install_data( + join_paths(scalable_dir, ('@0@.svg').format(application_id)), + install_dir: join_paths(get_option('datadir'), 'icons', scalable_dir) +) + +symbolic_dir = join_paths('hicolor', 'symbolic', 'apps') +install_data( + join_paths(symbolic_dir, ('@0@-symbolic.svg').format(application_id)), + install_dir: join_paths(get_option('datadir'), 'icons', symbolic_dir) +) diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 0000000..40aa84d --- /dev/null +++ b/data/meson.build @@ -0,0 +1,43 @@ +desktop_file = i18n.merge_file( + input: 'moe.solarpunk.DeskCandy.desktop.in', + output: 'moe.solarpunk.DeskCandy.desktop', + type: 'desktop', + po_dir: '../po', + install: true, + install_dir: join_paths(get_option('datadir'), 'applications') +) + +desktop_utils = find_program('desktop-file-validate', required: false) +if desktop_utils.found() + test('Validate desktop file', desktop_utils, + args: [desktop_file] + ) +endif + +appstream_file = i18n.merge_file( + input: 'moe.solarpunk.DeskCandy.appdata.xml.in', + output: 'moe.solarpunk.DeskCandy.appdata.xml', + po_dir: '../po', + install: true, + install_dir: join_paths(get_option('datadir'), 'appdata') +) + +appstream_util = find_program('appstream-util', required: false) +if appstream_util.found() + test('Validate appstream file', appstream_util, + args: ['validate', appstream_file] + ) +endif + +install_data('moe.solarpunk.DeskCandy.gschema.xml', + install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas') +) + +compile_schemas = find_program('glib-compile-schemas', required: false) +if compile_schemas.found() + test('Validate schema file', compile_schemas, + args: ['--strict', '--dry-run', meson.current_source_dir()] + ) +endif + +subdir('icons') diff --git a/data/moe.solarpunk.DeskCandy.appdata.xml.in b/data/moe.solarpunk.DeskCandy.appdata.xml.in new file mode 100644 index 0000000..e24e5f9 --- /dev/null +++ b/data/moe.solarpunk.DeskCandy.appdata.xml.in @@ -0,0 +1,8 @@ + + + moe.solarpunk.DeskCandy.desktop + CC0-1.0 + MIT + + + diff --git a/data/moe.solarpunk.DeskCandy.desktop.in b/data/moe.solarpunk.DeskCandy.desktop.in new file mode 100644 index 0000000..c93bfea --- /dev/null +++ b/data/moe.solarpunk.DeskCandy.desktop.in @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=deskcandy +Exec=deskcandy +Icon=moe.solarpunk.DeskCandy +Terminal=false +Type=Application +Categories=GTK; +StartupNotify=true diff --git a/data/moe.solarpunk.DeskCandy.gschema.xml b/data/moe.solarpunk.DeskCandy.gschema.xml new file mode 100644 index 0000000..615caae --- /dev/null +++ b/data/moe.solarpunk.DeskCandy.gschema.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..25ef5d3 --- /dev/null +++ b/meson.build @@ -0,0 +1,14 @@ +project('deskcandy', ['c', 'vala'], + version: '0.1.0', + meson_version: '>= 0.50.0', + default_options: [ 'warning_level=2', + ], +) + +i18n = import('i18n') + +subdir('data') +subdir('src') +subdir('po') + +meson.add_install_script('build-aux/meson/postinstall.py') diff --git a/moe.solarpunk.DeskCandy.json b/moe.solarpunk.DeskCandy.json new file mode 100644 index 0000000..a8ffd06 --- /dev/null +++ b/moe.solarpunk.DeskCandy.json @@ -0,0 +1,38 @@ +{ + "app-id" : "moe.solarpunk.DeskCandy", + "runtime" : "org.gnome.Platform", + "runtime-version" : "40", + "sdk" : "org.gnome.Sdk", + "command" : "deskcandy", + "finish-args" : [ + "--share=network", + "--share=ipc", + "--socket=fallback-x11", + "--socket=wayland" + ], + "cleanup" : [ + "/include", + "/lib/pkgconfig", + "/man", + "/share/doc", + "/share/gtk-doc", + "/share/man", + "/share/pkgconfig", + "/share/vala", + "*.la", + "*.a" + ], + "modules" : [ + { + "name" : "deskcandy", + "builddir" : true, + "buildsystem" : "meson", + "sources" : [ + { + "type" : "git", + "url" : "file:///home/vv/Projects/deskcandy" + } + ] + } + ] +} diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..e69de29 diff --git a/po/POTFILES b/po/POTFILES new file mode 100644 index 0000000..1b5ecb5 --- /dev/null +++ b/po/POTFILES @@ -0,0 +1,7 @@ +data/moe.solarpunk.DeskCandy.desktop.in +data/moe.solarpunk.DeskCandy.appdata.xml.in +data/moe.solarpunk.DeskCandy.gschema.xml +src/window.ui +src/main.vala +src/window.vala + diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 0000000..812da91 --- /dev/null +++ b/po/meson.build @@ -0,0 +1 @@ +i18n.gettext('deskcandy', preset: 'glib') diff --git a/src/application.vala b/src/application.vala new file mode 100644 index 0000000..bce6ac9 --- /dev/null +++ b/src/application.vala @@ -0,0 +1,22 @@ + +namespace Deskcandy { + public class Application : Gtk.Application { + private Gtk.Window window; + + public Application() { + Object(application_id: "moe.solarpunk.Deskcandy"); + } + + public override void activate() { + this.window = this.active_window; + if (this.window == null) { + this.window = new Window(this); + } + + this.window.present(); + + var desktop_win = new DesktopWindow(this); + desktop_win.present(); + } + } +} diff --git a/src/deskcandy.gresource.xml b/src/deskcandy.gresource.xml new file mode 100644 index 0000000..e955b28 --- /dev/null +++ b/src/deskcandy.gresource.xml @@ -0,0 +1,8 @@ + + + + window.ui + desktop_window.ui + main_menu.ui + + diff --git a/src/desktop_window.ui b/src/desktop_window.ui new file mode 100644 index 0000000..b9a5933 --- /dev/null +++ b/src/desktop_window.ui @@ -0,0 +1,21 @@ + + + + + + diff --git a/src/desktop_window.vala b/src/desktop_window.vala new file mode 100644 index 0000000..08f6aed --- /dev/null +++ b/src/desktop_window.vala @@ -0,0 +1,27 @@ +namespace Deskcandy { + [GtkTemplate(ui = "/moe/solarpunk/Deskcandy/desktop_window.ui")] + public class DesktopWindow : Gtk.Window { + public DesktopWindow(Gtk.Application app) { + Object(application: app); + Gdk.Rectangle rect = this.get_display().get_primary_monitor().get_geometry(); + this.set_default_size(rect.width, rect.height); + this.set_keep_below(true); + + this.refresh_socket(); + } + + public void refresh_socket() { + Gtk.Socket socket = new Gtk.Socket(); + socket.set_visible(true); + this.add(socket); + + var id = (uint)socket.get_id(); + + try { + Subprocess proc = new Subprocess(SubprocessFlags.NONE, "/usr/lib64/misc/xscreensaver/unknownpleasures", "-window-id", id.to_string()); + } catch (GLib.Error e) { + error(e.message); + } + } + } +} diff --git a/src/main.vala b/src/main.vala new file mode 100644 index 0000000..0168764 --- /dev/null +++ b/src/main.vala @@ -0,0 +1,6 @@ +namespace Deskcandy { + int main (string[] args) { + var app = new Application(); + return app.run (args); + } +} diff --git a/src/main_menu.ui b/src/main_menu.ui new file mode 100644 index 0000000..edaec64 --- /dev/null +++ b/src/main_menu.ui @@ -0,0 +1,19 @@ + + + +
+ + About + app.about + + + Preferences + app.prefs + + + Quit + app.quit + +
+
+
diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..d45e0e6 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,23 @@ +deskcandy_sources = [ + 'main.vala', + 'window.vala', + 'desktop_window.vala', + 'application.vala', +] + +deskcandy_deps = [ + dependency('gio-2.0', version: '>= 2.50'), + dependency('gtk+-3.0', version: '>= 3.22'), +] + +gnome = import('gnome') + +deskcandy_sources += gnome.compile_resources('deskcandy-resources', + 'deskcandy.gresource.xml', + c_name: 'deskcandy' +) + +executable('deskcandy', deskcandy_sources, + vala_args: '--target-glib=2.50', dependencies: deskcandy_deps, + install: true, +) diff --git a/src/window.ui b/src/window.ui new file mode 100644 index 0000000..df01565 --- /dev/null +++ b/src/window.ui @@ -0,0 +1,923 @@ + + + + + + 150 + False + 10 + + + True + False + vertical + 5 + + + True + False + Confirm Delete + 0 + + + + + + False + True + 5 + 0 + + + + + True + False + Are you sure you want to delete this preset? + True + 0 + + + False + True + 1 + + + + + True + False + 5 + end + + + Cancel + True + True + True + True + True + + + + True + True + 0 + + + + + Delete + True + True + True + presets.delete + + + True + True + 1 + + + + + False + True + 2 + + + + + + + 150 + False + + + True + False + 10 + vertical + 5 + + + True + False + New Preset + 0 + + + + + + False + True + 0 + + + + + True + False + Enter a name for the new preset: + 0 + + + False + True + 1 + + + + + True + True + + + False + True + 2 + + + + + True + False + 5 + True + end + + + Cancel + True + True + True + + + + True + True + 0 + + + + + Create + True + True + True + True + True + presets.create + + + True + True + 1 + + + + + False + True + 3 + + + + + + + 100 + 1 + 10 + + + + + + + + + + + + + + + Cats + cats are cool creatures + camera-video-symbolic + True + + + + + + + + + + + + + Screen Saver 1 + The alpha and the omega + + + + + + video/* + + + + + True + False + camera-video-symbolic + + diff --git a/src/window.vala b/src/window.vala new file mode 100644 index 0000000..d27056b --- /dev/null +++ b/src/window.vala @@ -0,0 +1,17 @@ +using GLib; + +namespace Deskcandy { + [GtkTemplate (ui = "/moe/solarpunk/Deskcandy/window.ui")] + public class Window : Gtk.ApplicationWindow { + + public Window (Gtk.Application app) { + Object (application: app); + } + + [GtkCallback] + private void on_window_destroy(Gtk.Widget self) { + message("bye"); + this.application.quit(); + } + } +}