this fucking library

This commit is contained in:
MeowcaTheoRange 2023-04-24 01:47:34 -05:00
commit 0c9c0f1b3d
24 changed files with 944 additions and 0 deletions

202
COPYING Normal file
View file

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -0,0 +1,75 @@
<svg width="128" height="128" viewBox="0 0 128 128" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="20" y="8" width="88" height="100" rx="8" fill="#B5835A"/>
<rect x="28" y="32" width="72" height="16" rx="4" fill="#865E3C"/>
<rect x="28" y="32" width="72" height="16" rx="4" fill="url(#paint0_linear_1_894)"/>
<rect x="28" y="30" width="72" height="16" rx="4" fill="#CDAB8F"/>
<rect x="59" y="35" width="12" height="6" rx="2" fill="#865E3C"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M71 39.0034C70.9982 40.1064 70.1034 41 69 41H61C59.8954 41 59 40.1046 59 39V38.9964C59.002 37.8935 59.8966 37 61 37H69C70.1046 37 71 37.8954 71 39V39.0034Z" fill="#CDAB8F"/>
<rect x="28" y="54" width="72" height="16" rx="4" fill="#865E3C"/>
<rect x="28" y="54" width="72" height="16" rx="4" fill="url(#paint1_linear_1_894)"/>
<rect x="28" y="52" width="72" height="16" rx="4" fill="#CDAB8F"/>
<rect x="59" y="57" width="12" height="6" rx="2" fill="#865E3C"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M71 61.0034C70.9982 62.1064 70.1034 63 69 63H61C59.8954 63 59 62.1046 59 61V60.9964C59.002 59.8935 59.8966 59 61 59H69C70.1046 59 71 59.8954 71 61V61.0034Z" fill="#CDAB8F"/>
<rect x="28" y="76" width="72" height="16" rx="4" fill="#865E3C"/>
<rect x="28" y="76" width="72" height="16" rx="4" fill="url(#paint2_linear_1_894)"/>
<rect x="28" y="74" width="72" height="16" rx="4" fill="#CDAB8F"/>
<rect x="59" y="79" width="12" height="6" rx="2" fill="#865E3C"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M71 83.0034C70.9982 84.1064 70.1034 85 69 85H61C59.8954 85 59 84.1046 59 83V82.9964C59.002 81.8935 59.8966 81 61 81H69C70.1046 81 71 81.8954 71 83V83.0034Z" fill="#CDAB8F"/>
<path d="M12 96C12 93.7909 13.7909 92 16 92H18C19.1046 92 20 92.8954 20 94C20 95.1046 20.8954 96 22 96H106C107.105 96 108 95.1046 108 94C108 92.8954 108.895 92 110 92H112C114.209 92 116 93.7909 116 96V116C116 118.209 114.209 120 112 120H16C13.7909 120 12 118.209 12 116V96Z" fill="url(#paint3_linear_1_894)"/>
<path d="M12 96C12 93.7909 13.7909 92 16 92H18C19.1046 92 20 92.8954 20 94C20 95.1046 20.8954 96 22 96H106C107.105 96 108 95.1046 108 94C108 92.8954 108.895 92 110 92H112C114.209 92 116 93.7909 116 96V100C116 102.209 114.209 104 112 104H16C13.7909 104 12 102.209 12 100V96Z" fill="#CDAB8F"/>
<path d="M12 12C12 9.79086 13.7909 8 16 8H112C114.209 8 116 9.79086 116 12V32C116 34.2091 114.209 36 112 36H108.01H108V35.99V24H20V35.99V36H19.99H16C13.7909 36 12 34.2091 12 32V12Z" fill="url(#paint4_linear_1_894)"/>
<rect x="12" y="8" width="104" height="12" rx="4" fill="url(#paint5_linear_1_894)"/>
<path d="M72.8284 32.8284L71.1716 31.1716C70.4214 30.4214 69.404 30 68.3431 30H93.6569C92.596 30 91.5786 30.4214 90.8284 31.1716L88.4142 33.5858C88.149 33.851 87.7893 34 87.4142 34C86.6332 34 86 34.6332 86 35.4142V37.1716C86 37.702 85.7893 38.2107 85.4142 38.5858C84.6332 39.3668 83.3668 39.3668 82.5858 38.5858C82.2107 38.2107 82 37.702 82 37.1716V36.8284C82 35.0466 79.8457 34.1543 78.5858 35.4142C78.2107 35.7893 78 36.298 78 36.8284V41.1716C78 41.702 77.7893 42.2107 77.4142 42.5858C76.6332 43.3668 75.3668 43.3668 74.5858 42.5858C74.2107 42.2107 74 41.702 74 41.1716V35.6569C74 34.596 73.5786 33.5786 72.8284 32.8284Z" fill="url(#paint6_linear_1_894)"/>
<defs>
<linearGradient id="paint0_linear_1_894" x1="100" y1="48" x2="28" y2="48" gradientUnits="userSpaceOnUse">
<stop stop-color="#865E3C"/>
<stop offset="0.0192311" stop-color="#A4744E"/>
<stop offset="0.0576501" stop-color="#865E3C"/>
<stop offset="0.942247" stop-color="#865E3C"/>
<stop offset="0.98079" stop-color="#A4744E"/>
<stop offset="1" stop-color="#865E3C"/>
</linearGradient>
<linearGradient id="paint1_linear_1_894" x1="100" y1="70" x2="28" y2="70" gradientUnits="userSpaceOnUse">
<stop stop-color="#865E3C"/>
<stop offset="0.0192311" stop-color="#A4744E"/>
<stop offset="0.0576501" stop-color="#865E3C"/>
<stop offset="0.942247" stop-color="#865E3C"/>
<stop offset="0.98079" stop-color="#A4744E"/>
<stop offset="1" stop-color="#865E3C"/>
</linearGradient>
<linearGradient id="paint2_linear_1_894" x1="100" y1="92" x2="28" y2="92" gradientUnits="userSpaceOnUse">
<stop stop-color="#865E3C"/>
<stop offset="0.0192311" stop-color="#A4744E"/>
<stop offset="0.0576501" stop-color="#865E3C"/>
<stop offset="0.942247" stop-color="#865E3C"/>
<stop offset="0.98079" stop-color="#A4744E"/>
<stop offset="1" stop-color="#865E3C"/>
</linearGradient>
<linearGradient id="paint3_linear_1_894" x1="116" y1="120" x2="12" y2="120" gradientUnits="userSpaceOnUse">
<stop stop-color="#865E3C"/>
<stop offset="0.0192311" stop-color="#B5835A"/>
<stop offset="0.0576501" stop-color="#865E3C"/>
<stop offset="0.942247" stop-color="#865E3C"/>
<stop offset="0.98079" stop-color="#B5835A"/>
<stop offset="1" stop-color="#865E3C"/>
</linearGradient>
<linearGradient id="paint4_linear_1_894" x1="116" y1="36" x2="12" y2="36" gradientUnits="userSpaceOnUse">
<stop stop-color="#865E3C"/>
<stop offset="0.0192311" stop-color="#B5835A"/>
<stop offset="0.0576501" stop-color="#865E3C"/>
<stop offset="0.942247" stop-color="#865E3C"/>
<stop offset="0.98079" stop-color="#B5835A"/>
<stop offset="1" stop-color="#865E3C"/>
</linearGradient>
<linearGradient id="paint5_linear_1_894" x1="64" y1="8" x2="64" y2="20" gradientUnits="userSpaceOnUse">
<stop stop-color="#DEDDDA"/>
<stop offset="0.498372" stop-color="#DEDDDA"/>
<stop offset="0.499023" stop-color="#CDAB8F"/>
<stop offset="1" stop-color="#CDAB8F"/>
</linearGradient>
<linearGradient id="paint6_linear_1_894" x1="81" y1="30" x2="81" y2="44" gradientUnits="userSpaceOnUse">
<stop stop-color="#F6D32D"/>
<stop offset="1" stop-color="#F5C211"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 5.5 KiB

View file

@ -0,0 +1,17 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_4_30)">
<path d="M0 1C0 0.447715 0.447715 0 1 0H15C15.5523 0 16 0.447715 16 1V3H0V1Z" fill="#2E3436"/>
<rect y="12" width="16" height="4" rx="1" fill="#2E3436"/>
<path d="M3 2H2V15H14V2H13V14H3V2Z" fill="#2E3436"/>
<rect x="4" y="4.25" width="8" height="1.5" rx="0.5" fill="#2E3436"/>
<rect x="4" y="6.75" width="8" height="1.5" rx="0.5" fill="#2E3436"/>
<rect x="4" y="9.25" width="8" height="1.5" rx="0.5" fill="#2E3436"/>
<path d="M0 2H2V4H1C0.447715 4 0 3.55228 0 3V2Z" fill="#2E3436"/>
<path d="M14 2H16V3C16 3.55228 15.5523 4 15 4H14V2Z" fill="#2E3436"/>
</g>
<defs>
<clipPath id="clip0_4_30">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 792 B

13
data/icons/meson.build Normal file
View file

@ -0,0 +1,13 @@
application_id = 'xyz.trollcall.Beekeeper'
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)
)

43
data/meson.build Normal file
View file

@ -0,0 +1,43 @@
desktop_file = i18n.merge_file(
input: 'xyz.trollcall.Beekeeper.desktop.in',
output: 'xyz.trollcall.Beekeeper.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: 'xyz.trollcall.Beekeeper.appdata.xml.in',
output: 'xyz.trollcall.Beekeeper.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('xyz.trollcall.Beekeeper.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')

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<name>Beekeeper</name>
<id>xyz.trollcall.Beekeeper.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license></project_license>
<description>
<p>No description</p>
</description>
</component>

View file

@ -0,0 +1,8 @@
[Desktop Entry]
Name=Beekeeper
Exec=xyz.trollcall.Beekeeper
Icon=xyz.trollcall.Beekeeper
Terminal=false
Type=Application
Categories=GTK;
StartupNotify=true

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="beekeeper">
<schema id="xyz.trollcall.Beekeeper" path="/xyz/trollcall/Beekeeper/">
</schema>
</schemalist>

23
meson.build Normal file
View file

@ -0,0 +1,23 @@
project('beekeeper',
version: '0.1.0',
meson_version: '>= 0.59.0',
default_options: [ 'warning_level=2',
'werror=false',
],
)
i18n = import('i18n')
gnome = import('gnome')
subdir('data')
subdir('src')
subdir('po')
gnome.post_install(
glib_compile_schemas: true,
gtk_update_icon_cache: true,
update_desktop_database: true,
)

0
po/LINGUAS Normal file
View file

8
po/POTFILES Normal file
View file

@ -0,0 +1,8 @@
data/xyz.trollcall.Beekeeper.desktop.in
data/xyz.trollcall.Beekeeper.appdata.xml.in
data/xyz.trollcall.Beekeeper.gschema.xml
src/window.ui
src/main.js
src/window.js
src/folders.js

1
po/meson.build Normal file
View file

@ -0,0 +1 @@
i18n.gettext('beekeeper', preset: 'glib')

89
src/folders.js Normal file
View file

@ -0,0 +1,89 @@
import Gtk from 'gi://Gtk';
import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
export function getFilesInFolder(folderPath) {
let folder = Gio.File.new_for_path(folderPath);
let files = folder.enumerate_children(
"*",
Gio.FileQueryInfoFlags.NONE,
null,
);
let file = files.next_file(null);
let fileNames = [];
while (file !== null) {
if (file.get_file_type() === Gio.FileType.DIRECTORY)
fileNames.push({
name: file.get_name(),
icon: file.get_icon(),
hidden: file.get_is_hidden(),
time:
(file.get_modification_date_time() ??
file.get_creation_date_time() ??
GLib.DateTime.new_from_unix_utc(0)).to_unix(),
});
file = files.next_file(null);
}
return fileNames.sort((a,b) => b.time - a.time);
}
export function indexObjects(array) {
return array.map(item => {
const mainRow = new Gtk.ListBoxRow();
const itemBox = new Gtk.Box({
marginBottom: 12,
marginEnd: 12,
marginStart: 12,
marginTop: 12,
spacing: 16,
});
let iconConfig = {
icon_size: Gtk.IconSize.LARGE,
name: "stridersBeats"
};
iconConfig.icon_name = item.icon?.to_string()?.split(" ")[3] ?? "folder";
const innerImage = new Gtk.Image(iconConfig);
itemBox.append(innerImage);
const nameBox = new Gtk.Box({
hexpand: true,
orientation: 1,
spacing: 4,
});
const name = new Gtk.Label({
cssClasses: ["heading"],
ellipsize: "end",
label: item.name,
valign: "baseline",
xalign: 0.0,
});
nameBox.append(name);
const path = new Gtk.Label({
cssClasses: ["dim-label"],
ellipsize: "end",
label: GLib.DateTime.new_from_unix_utc(item.time).format("%x, %X"),
valign: "baseline",
xalign: 0.0,
});
nameBox.append(path);
itemBox.append(nameBox);
mainRow.set_child(itemBox);
return mainRow;
})
}

29
src/gtk/help-overlay.ui Normal file
View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkShortcutsWindow" id="help_overlay">
<property name="modal">True</property>
<child>
<object class="GtkShortcutsSection">
<property name="section-name">shortcuts</property>
<property name="max-height">10</property>
<child>
<object class="GtkShortcutsGroup">
<property name="title" translatable="yes" context="shortcut window">General</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="title" translatable="yes" context="shortcut window">Show Shortcuts</property>
<property name="action-name">win.show-help-overlay</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="title" translatable="yes" context="shortcut window">Quit</property>
<property name="action-name">app.quit</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

61
src/gtk/modal.ui Normal file
View file

@ -0,0 +1,61 @@
<?xml version='1.0' encoding='UTF-8'?>
<interface>
<requires lib="gtk" version="4.6"/>
<object class="GtkWindow" id="modalWindow">
<property name="accessible-role">note</property>
<property name="modal">True</property>
<property name="title">Cum Balance</property>
<property name="titlebar">header_bar</property>
<child>
<object class="GtkHeaderBar" id="header_bar">
<property name="decoration-layout">:close</property>
<style>
<class name="flat"/>
</style>
</object>
</child>
<child>
<object class="GtkBox">
<property name="margin-bottom">16</property>
<property name="margin-end">16</property>
<property name="margin-start">16</property>
<property name="margin-top">16</property>
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<property name="valign">center</property>
<child>
<object class="GtkImage">
<property name="icon-name">folder</property>
<property name="icon-size">large</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="css-classes">title-2</property>
<property name="label">Cambalache</property>
</object>
</child>
<child>
<object class="GtkSeparator">
<property name="margin-bottom">8</property>
<property name="margin-top">8</property>
</object>
</child>
<child>
<object class="GtkBox" id="buttonHolder">
<property name="halign">center</property>
<property name="spacing">8</property>
<child>
<object class="GtkButton">
<property name="css-classes">circular</property>
<property name="halign">center</property>
<property name="icon-name">accessories-calculator</property>
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

74
src/main.js Normal file
View file

@ -0,0 +1,74 @@
/* main.js
*
* Copyright 2023 MeowcaTheoRange
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import GObject from 'gi://GObject';
import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
import Gtk from 'gi://Gtk?version=4.0';
import Adw from 'gi://Adw?version=1';
import { BeekeeperWindow } from './window.js';
pkg.initGettext();
pkg.initFormat();
export const BeekeeperApplication = GObject.registerClass(
class BeekeeperApplication extends Adw.Application {
constructor() {
super({application_id: 'xyz.trollcall.Beekeeper', flags: Gio.ApplicationFlags.FLAGS_NONE});
const quit_action = new Gio.SimpleAction({name: 'quit'});
quit_action.connect('activate', action => {
this.quit();
});
this.add_action(quit_action);
this.set_accels_for_action('app.quit', ['<primary>q']);
const show_about_action = new Gio.SimpleAction({name: 'about'});
show_about_action.connect('activate', action => {
let aboutParams = {
authors: [
'MeowcaTheoRange'
],
version: '0.1.0',
logo_icon_name: 'xyz.trollcall.Beekeeper',
license_type: Gtk.License.APACHE_2_0,
program_name: 'Beekeeper',
transient_for: this.active_window,
modal: true,
};
const aboutDialog = new Gtk.AboutDialog(aboutParams);
aboutDialog.present();
});
this.add_action(show_about_action);
}
vfunc_activate() {
let {active_window} = this;
if (!active_window)
active_window = new BeekeeperWindow(this);
active_window.present();
}
}
);
export function main(argv) {
const application = new BeekeeperApplication();
return application.run(argv);
}

33
src/meson.build Normal file
View file

@ -0,0 +1,33 @@
pkgdatadir = join_paths(get_option('datadir'), meson.project_name())
gnome = import('gnome')
src_res = gnome.compile_resources('xyz.trollcall.Beekeeper.src',
'xyz.trollcall.Beekeeper.src.gresource.xml',
gresource_bundle: true,
install: true,
install_dir: pkgdatadir,
)
data_res = gnome.compile_resources('xyz.trollcall.Beekeeper.data',
'xyz.trollcall.Beekeeper.data.gresource.xml',
gresource_bundle: true,
install: true,
install_dir: pkgdatadir,
)
bin_conf = configuration_data()
bin_conf.set('GJS', find_program('gjs').full_path())
bin_conf.set('PACKAGE_VERSION', meson.project_version())
bin_conf.set('PACKAGE_NAME', meson.project_name())
bin_conf.set('prefix', get_option('prefix'))
bin_conf.set('libdir', join_paths(get_option('prefix'), get_option('libdir')))
bin_conf.set('datadir', join_paths(get_option('prefix'), get_option('datadir')))
bin_conf.set('resource_path', '/xyz/trollcall/Beekeeper')
configure_file(
input: 'xyz.trollcall.Beekeeper.in',
output: 'xyz.trollcall.Beekeeper',
configuration: bin_conf,
install: true,
install_dir: get_option('bindir')
)

3
src/style.css Normal file
View file

@ -0,0 +1,3 @@
#main-button {
background-color: @accent_bg_color;
}

60
src/window.js Normal file
View file

@ -0,0 +1,60 @@
/* window.js
*
* Copyright 2023 MeowcaTheoRange
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import GObject from 'gi://GObject';
import Gtk from 'gi://Gtk';
import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
import { getFilesInFolder, indexObjects } from './folders.js';
export const BeekeeperWindow = GObject.registerClass({
GTypeName: 'BeekeeperWindow',
Template: 'resource:///xyz/trollcall/Beekeeper/window.ui',
InternalChildren: ['label', 'folders', 'bigBox', 'userName', 'timeThingy'],
}, class BeekeeperWindow extends Gtk.ApplicationWindow {
#_folders;
#_bigBox;
#_userName;
#_timeThingy;
_init(application) {
super._init({application})
this._userName.set_text(`Welcome, ${GLib.get_real_name().split(" ")[0]}!`);
this._timeThingy.set_text(`It is ${GLib.DateTime.new_now_local().format("%X")}.`);
setInterval(() => this._timeThingy.set_text(`It is ${GLib.DateTime.new_now_local().format("%X")}.`), 500);
const getModal = (row) => {
let builder = Gtk.Builder.new_from_resource("/xyz/trollcall/Beekeeper/gtk/modal.ui");
let modalWindow = builder.get_object("modalWindow");
modalWindow.set_modal(true);
modalWindow.set_transient_for(this);
print(row);
const recommendedTypes = Gio.AppInfo.get_recommended_for_type(row.get_child().get_child_at_index(0).icon_name);
modalWindow.present();
}
this._bigBox.connect("row_activated", getModal);
this._folders.connect("row_activated", getModal);
let folderPath = "Documents/github/";
let files = getFilesInFolder(folderPath);
let GtkBoxThings = indexObjects(files);
GtkBoxThings.splice(0, 3).map(x => this._bigBox.append(x));
GtkBoxThings.map(x => this._folders.append(x));
}
});

124
src/window.ui Normal file
View file

@ -0,0 +1,124 @@
<?xml version='1.0' encoding='UTF-8'?>
<interface>
<requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.1"/>
<template class="BeekeeperWindow" parent="GtkApplicationWindow">
<property name="default-height">600</property>
<property name="default-width">400</property>
<property name="title">Beekeeper</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="header_bar">
<child type="start">
<object class="GtkMenuButton">
<property name="icon-name">open-menu-symbolic</property>
<property name="menu-model">primary_menu</property>
</object>
</child>
<style>
<class name="flat"/>
</style>
</object>
</child>
<child>
<object class="GtkBox" id="label">
<property name="orientation">1</property>
<child>
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="min-content-height">400</property>
<property name="min-content-width">400</property>
<child>
<object class="AdwClamp" id="child">
<property name="margin-end">16</property>
<property name="margin-start">16</property>
<property name="maximum-size">400</property>
<property name="tightening-threshold">400</property>
<property name="vexpand">True</property>
<child>
<object class="GtkBox">
<property name="margin-bottom">16</property>
<property name="margin-top">8</property>
<property name="orientation">1</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="userName">
<property name="label"></property>
<property name="xalign">0.5</property>
<style>
<class name="title-1"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel" id="timeThingy">
<property name="label"></property>
<property name="xalign">0.5</property>
<style>
<class name="title-2"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Continue</property>
<property name="xalign">0</property>
<style>
<class name="heading"/>
</style>
</object>
</child>
<child>
<object class="GtkListBox" id="bigBox">
<property name="name">main-button</property>
<property name="selection-mode">browse</property>
<style>
<class name="boxed-list"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Earlier</property>
<property name="xalign">0</property>
<style>
<class name="heading"/>
</style>
</object>
</child>
<child>
<object class="GtkListBox" id="folders">
<property name="margin-end">8</property>
<property name="margin-start">8</property>
<property name="selection-mode">browse</property>
<style>
<class name="boxed-list"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
<menu id="primary_menu">
<section>
<item>
<attribute name="label" translatable="yes">_Preferences</attribute>
<attribute name="action">app.preferences</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
<attribute name="action">win.show-help-overlay</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About Beekeeper</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
</menu>
</interface>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/xyz/trollcall/Beekeeper">
<file>style.css</file>
<file>window.ui</file>
<file>gtk/help-overlay.ui</file>
<file>gtk/modal.ui</file>
</gresource>
</gresources>

11
src/xyz.trollcall.Beekeeper.in Executable file
View file

@ -0,0 +1,11 @@
#!@GJS@
imports.package.init({
name: "@PACKAGE_NAME@",
version: "@PACKAGE_VERSION@",
prefix: "@prefix@",
libdir: "@libdir@",
datadir: "@datadir@",
});
import("resource://@resource_path@/js/main.js")
.then((main) => imports.package.run(main))
.catch(logError);

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/xyz/trollcall/Beekeeper/js">
<file>main.js</file>
<file>window.js</file>
<file>folders.js</file>
</gresource>
</gresources>

View file

@ -0,0 +1,38 @@
{
"app-id" : "xyz.trollcall.Beekeeper",
"runtime" : "org.gnome.Platform",
"runtime-version" : "master",
"sdk" : "org.gnome.Sdk",
"command" : "xyz.trollcall.Beekeeper",
"finish-args" : [
"--share=network",
"--share=ipc",
"--socket=fallback-x11",
"--device=dri",
"--socket=wayland"
],
"cleanup" : [
"/include",
"/lib/pkgconfig",
"/man",
"/share/doc",
"/share/gtk-doc",
"/share/man",
"/share/pkgconfig",
"*.la",
"*.a"
],
"modules" : [
{
"name" : "beekeeper",
"builddir" : true,
"buildsystem" : "meson",
"sources" : [
{
"type" : "git",
"url" : "file:///home/theorange/Projects/Beekeeper"
}
]
}
]
}