forked from elfenware/badger
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
387 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<schemalist> | ||
<schema | ||
path="/com/github/dar5hak/badger/reminders/" | ||
id="com.github.dar5hak.badger.reminders" | ||
gettext-domain="com.github.dar5hak.badger"> | ||
<key name="eyes" type="b"> | ||
<default>true</default> | ||
<summary>Remind the user to blink their eyes</summary> | ||
</key> | ||
<key name="fingers" type="b"> | ||
<default>true</default> | ||
<summary>Remind the user to stretch their fingers</summary> | ||
</key> | ||
<key name="legs" type="b"> | ||
<default>true</default> | ||
<summary>Remind the user to stretch their legs</summary> | ||
</key> | ||
<key name="arms" type="b"> | ||
<default>true</default> | ||
<summary>Remind the user to stretch their arms</summary> | ||
</key> | ||
<key name="neck" type="b"> | ||
<default>true</default> | ||
<summary>Remind the user to stretch their neck</summary> | ||
</key> | ||
</schema> | ||
<schema | ||
path="/com/github/dar5hak/badger/window-state/" | ||
id="com.github.dar5hak.badger.window-state" | ||
gettext-domain="com.github.dar5hak.badger"> | ||
<key name="window-width" type="i"> | ||
<default>280</default> | ||
<summary>The saved width of the window.</summary> | ||
<description>The saved width of the window.</description> | ||
</key> | ||
<key name="window-height" type="i"> | ||
<default>320</default> | ||
<summary>The saved height of the window.</summary> | ||
<description>The saved height of the window.</description> | ||
</key> | ||
<key name="window-x" type="i"> | ||
<default>250</default> | ||
<summary></summary> | ||
<description></description> | ||
</key> | ||
<key name="window-y" type="i"> | ||
<default>250</default> | ||
<summary></summary> | ||
<description></description> | ||
</key> | ||
</schema> | ||
</schemalist> |
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import subprocess | ||
|
||
prefix = os.environ.get('MESON_INSTALL_PREFIX', '/usr/local') | ||
datadir = os.path.join(prefix, 'share') | ||
schemadir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas') | ||
|
||
# Packaging tools define DESTDIR and this isn't needed for them | ||
if 'DESTDIR' not in os.environ: | ||
print('Updating icon cache...') | ||
icon_cache_dir = os.path.join(datadir, 'icons', 'hicolor') | ||
if not os.path.exists(icon_cache_dir): | ||
os.makedirs(icon_cache_dir) | ||
subprocess.call(['gtk-update-icon-cache', '-qtf', icon_cache_dir]) | ||
|
||
print('Updating desktop database...') | ||
desktop_database_dir = os.path.join(datadir, 'applications') | ||
if not os.path.exists(desktop_database_dir): | ||
os.makedirs(desktop_database_dir) | ||
subprocess.call(['update-desktop-database', '-q', desktop_database_dir]) | ||
|
||
print('Compiling gsettings schemas...') | ||
subprocess.call(['glib-compile-schemas', schemadir]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,103 @@ | ||
/* | ||
* Copyright (c) {{yearrange}} Darshak (https://dubiousdisc.xyz) | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public | ||
* License along with this program; if not, write to the | ||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
* Boston, MA 02110-1301 USA | ||
* | ||
* Authored by: Darshak <https://dubiousdisc.xyz> | ||
*/ | ||
* Copyright (C) 2019 Darshak Parikh | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
* | ||
* Authored by: Darshak Parikh <darshak@protonmail.com> | ||
* | ||
*/ | ||
|
||
using Granite; | ||
using Granite.Widgets; | ||
using Gtk; | ||
|
||
namespace ErgoBadger { | ||
public class Application : Granite.Application { | ||
public class Badger.Application : Granite.Application { | ||
|
||
public Application () { | ||
Object( | ||
application_id: "com.github.dar5hak.ergobadger", | ||
flags: ApplicationFlags.FLAGS_NONE | ||
); | ||
} | ||
private Badger.MainWindow window; | ||
|
||
protected override void activate () { | ||
var window = new Gtk.ApplicationWindow (this); | ||
var main = new Gtk.Grid (); | ||
public Application () { | ||
Object( | ||
application_id: "com.github.dar5hak.badger", | ||
flags: ApplicationFlags.FLAGS_NONE | ||
); | ||
} | ||
|
||
window.title = "ErgoBadger"; | ||
window.set_default_size (640, 480); | ||
window.add (main); | ||
window.show_all (); | ||
protected override void activate () { | ||
if (window != null) { | ||
window.present (); | ||
return; | ||
} | ||
|
||
public static int main (string[] args) { | ||
var app = new ergobadger.Application (); | ||
return app.run (args); | ||
} | ||
window = new MainWindow (this); | ||
|
||
var reminders = set_up_reminders (); | ||
var main = new MainGrid (reminders); | ||
|
||
window.add (main); | ||
window.show_all (); | ||
} | ||
|
||
public static int main (string[] args) { | ||
var app = new Badger.Application (); | ||
|
||
return app.run (args); | ||
} | ||
|
||
private Reminder[] set_up_reminders () { | ||
Reminder[] reminders = new Reminder[5]; | ||
reminders[0] = new Reminder ( | ||
"eyes", | ||
"Blink your eyes", | ||
"Look away from the screen and blink your eyes for 10 seconds.", | ||
"Blink eyes:", | ||
300, | ||
this | ||
); | ||
reminders[1] = new Reminder ( | ||
"fingers", | ||
"Stretch your fingers", | ||
"Spread out your palm wide, then close it into a fist. Repeat 10 times.", | ||
"Stretch fingers:", | ||
500, | ||
this | ||
); | ||
reminders[2] = new Reminder ( | ||
"legs", | ||
"Stretch your legs", | ||
"Stand up, twist your ankles, raise each leg and bend your knee.", | ||
"Stretch legs", | ||
700, | ||
this | ||
); | ||
reminders[3] = new Reminder ( | ||
"arms", | ||
"Stretch your arms", | ||
"Stretch and twist your arms, elbows and wrists for 10 seconds.", | ||
"Stretch arms", | ||
800, | ||
this | ||
); | ||
reminders[4] = new Reminder ( | ||
"neck", | ||
"Twist your neck", | ||
"Turn your head in all directions. Repeat 5 times.", | ||
"Twist neck", | ||
600, | ||
this | ||
); | ||
|
||
return reminders; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright (C) 2019 Darshak Parikh | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
* | ||
* Authored by: Darshak Parikh <darshak@protonmail.com> | ||
* | ||
*/ | ||
|
||
using Granite; | ||
using Granite.Widgets; | ||
using Gtk; | ||
|
||
public class Badger.MainGrid : Gtk.Grid { | ||
|
||
public Reminder[] reminders; | ||
|
||
public MainGrid (Reminder[] reminders) { | ||
this.reminders = reminders; | ||
|
||
var settings = new GLib.Settings ("com.github.dar5hak.badger.reminders"); | ||
|
||
row_spacing = 6; | ||
column_spacing = 12; | ||
margin = 12; | ||
|
||
attach (new Granite.HeaderLabel ("Reminders"), 0, 0, 2, 1); | ||
|
||
Gtk.Switch[] switches = new Gtk.Switch[reminders.length]; | ||
|
||
for (int index = 0; index < reminders.length; index++) { | ||
var label = new Gtk.Label (reminders[index].switch_label); | ||
switches[index] = new Gtk.Switch (); | ||
|
||
label.margin_start = 12; | ||
label.halign = Gtk.Align.END; | ||
switches[index].halign = Gtk.Align.START; | ||
switches[index].valign = Gtk.Align.CENTER; | ||
|
||
attach (label, 0, index + 1, 1, 1); | ||
attach_next_to (switches[index], label, Gtk.PositionType.RIGHT, 1, 1); | ||
|
||
settings.bind (reminders[index].name, switches[index], "active", GLib.SettingsBindFlags.DEFAULT); | ||
} | ||
} | ||
} |
Oops, something went wrong.