From 81c81e6c346a808654e8573024ab934097d431aa Mon Sep 17 00:00:00 2001 From: SubhadeepJasu Date: Wed, 15 Sep 2021 21:01:16 +0530 Subject: [PATCH 1/7] Use knobs instead of sliders --- data/Application.css | 22 +++ ...b.elementaryrevivals.sundown.gresource.xml | 6 + meson.build | 18 ++- src/Knob.vala | 139 ++++++++++++++++++ src/Sundown.vala | 31 +++- 5 files changed, 212 insertions(+), 4 deletions(-) create mode 100644 data/Application.css create mode 100644 data/com.github.elementaryrevivals.sundown.gresource.xml create mode 100644 src/Knob.vala diff --git a/data/Application.css b/data/Application.css new file mode 100644 index 0000000..028aaa9 --- /dev/null +++ b/data/Application.css @@ -0,0 +1,22 @@ +.knob-socket-graphic { + background-image:linear-gradient(alpha(#56626f, 0.5), alpha(#aebac6, 0.5), alpha(#fff, 0.5)); + border-radius: 50%; + margin-left: -2px; + margin-top: -2px; + margin-right: 2px; + margin-bottom: 2px +} +.knob-cover-graphic { + background-image:linear-gradient(alpha(#aebac6, 0.9), alpha(#fff, 0.7)); + border: 1px solid #56626f; + box-shadow: inset 0 1px 0 alpha(#fff, 0.5), inset 0 -1px 0 alpha(#000, 0.5), + 0 2px 4px alpha(#000, 0.5), 0 -3px 4px alpha(#fff, 1.0); + border-radius: 50%; + margin: 6px +} +window { + background-image:linear-gradient(#eef0f2, #a7b3c1); +} +.flat { + background-color: #eef0f2; +} diff --git a/data/com.github.elementaryrevivals.sundown.gresource.xml b/data/com.github.elementaryrevivals.sundown.gresource.xml new file mode 100644 index 0000000..ebed4ad --- /dev/null +++ b/data/com.github.elementaryrevivals.sundown.gresource.xml @@ -0,0 +1,6 @@ + + + + Application.css + + diff --git a/meson.build b/meson.build index 982dd6c..41ce910 100644 --- a/meson.build +++ b/meson.build @@ -8,6 +8,9 @@ project ( # Translation module i18n = import ('i18n') +# GNOME module +gnome = import ('gnome') + # Project arguments add_project_arguments ( '-DGETTEXT_PACKAGE="@0@"'.format (meson.project_name ()), @@ -23,12 +26,23 @@ add_project_arguments( # Listing dependencies dependencies = [ dependency('gtk+-3.0'), - dependency('gee-0.8') + dependency('gee-0.8'), + meson.get_compiler ('c').find_library ('m', required : false) ] +# Compiling resources +asresources = gnome.compile_resources ( + 'as-resources', + 'data/' + meson.project_name () + '.gresource.xml', + source_dir: 'data', + c_name: 'as' +) + # Executable executable ( meson.project_name (), + asresources, + 'src/Knob.vala', 'src/Sundown.vala', dependencies: dependencies, install: true @@ -37,4 +51,4 @@ executable ( subdir ('data') subdir ('po') -meson.add_install_script ('meson/post_install.py') \ No newline at end of file +meson.add_install_script ('meson/post_install.py') diff --git a/src/Knob.vala b/src/Knob.vala new file mode 100644 index 0000000..a08452e --- /dev/null +++ b/src/Knob.vala @@ -0,0 +1,139 @@ +/*- + * Copyright (c) 2021-2022 Subhadeep Jasu + * + * 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 . + * + * Authored by: Subhadeep Jasu + */ + +public class Knob : Gtk.Overlay { + public string tooltip; + public bool dragging; + private double dragging_direction; + + public double value = 27; + protected Gtk.Box knob_socket_graphic; + protected Gtk.Box knob_cover; + protected Gtk.Box knob_background; + protected Gtk.Fixed fixed; + protected int center; + + protected const double RADIUS = 20; + + public signal void change_value (double value); + + public Knob () { + center = 45; + knob_socket_graphic = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); + knob_socket_graphic.width_request = 20; + knob_socket_graphic.height_request = 20; + knob_socket_graphic.get_style_context ().add_class ("knob-socket-graphic"); + + knob_cover = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); + knob_cover.get_style_context ().add_class ("knob-cover-graphic"); + knob_cover.halign = Gtk.Align.START; + knob_cover.valign = Gtk.Align.START; + knob_cover.width_request = 100; + knob_cover.height_request = 100; + + fixed = new Gtk.Fixed (); + fixed.halign = Gtk.Align.START; + fixed.valign = Gtk.Align.START; + fixed.width_request = 100; + fixed.height_request = 100; + double px = RADIUS * GLib.Math.cos (value / Math.PI); + double py = RADIUS * GLib.Math.sin (value / Math.PI); + fixed.put (knob_socket_graphic, (int)(px + center), (int)(py + center)); + + knob_background = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); + knob_background.halign = Gtk.Align.START; + knob_background.valign = Gtk.Align.START; + knob_background.width_request = 100; + knob_background.height_request = 100; + + var event_box = new Gtk.EventBox (); + event_box.event.connect (handle_event); + event_box.hexpand = true; + event_box.vexpand = true; + + add_overlay (knob_background); + add_overlay (knob_cover); + add_overlay (fixed); + add_overlay (event_box); + + this.hexpand = false; + this.vexpand = true; + this.width_request = 58; + } + + public void rotate_dial (double value) { + double px = RADIUS * GLib.Math.cos (value / Math.PI); + double py = RADIUS * GLib.Math.sin (value / Math.PI); + fixed.move (knob_socket_graphic, (int)(px + center), (int)(py + center)); + change_value ((value - 27.0) / 15.0); + } + + public void set_value (double _value) { + value = 15 * _value + 27; + double px = RADIUS * GLib.Math.cos (value / Math.PI); + double py = RADIUS * GLib.Math.sin (value / Math.PI); + fixed.move (knob_socket_graphic, (int)(px + center), (int)(py + center)); + } + + public bool handle_event (Gdk.Event event) { + // if (event.type == Gdk.EventType.ENTER_NOTIFY) { + // this.get_toplevel.set_cursor (Gdk.CursorType.HAND1)); + // } + // if (event.type == Gdk.EventType.LEAVE_NOTIFY) { + // fixed.set_cursor (Gdk.CursorType.ARROW); + // } + if (event.type == Gdk.EventType.BUTTON_PRESS) { + dragging = true; + } + if (event.type == Gdk.EventType.BUTTON_RELEASE) { + dragging = false; + dragging_direction = 0; + } + + if (event.type == Gdk.EventType.MOTION_NOTIFY && dragging) { + if (dragging_direction == 0) { + dragging_direction = event.motion.y - event.motion.x; + } + if (dragging_direction > event.motion.y - event.motion.x || + event.motion.y_root == 0 || + event.motion.x_root == 0) { + value += 0.5; + if (value < 27) { + value = 27; + } + if (value > 42) { + value = 42; + } + rotate_dial (value); + dragging_direction = event.motion.y - event.motion.x; + } else { + value -= 0.5; + if (value < 27) { + value = 27; + } + if (value > 42) { + value = 42; + } + rotate_dial (value); + dragging_direction = event.motion.y - event.motion.x; + } + } + return false; + } +} diff --git a/src/Sundown.vala b/src/Sundown.vala index 6fb20eb..e5486e0 100644 --- a/src/Sundown.vala +++ b/src/Sundown.vala @@ -8,12 +8,18 @@ using Gtk; using Gee; public class Sundown : Gtk.Application { + Gtk.CssProvider css_provider; public static Gtk.Scale slider; public static Gtk.Scale slider1; public static Gtk.Scale slider2; public static Gtk.Scale slider3; public static Gtk.Scale slider4; + public static Knob knob; + public static Knob knob1; + public static Knob knob2; + public static Knob knob3; + public static Label label1; public static Label label2; public static Label label3; @@ -32,14 +38,31 @@ public class Sundown : Gtk.Application { } protected override void activate () { + var header_bar = new Gtk.HeaderBar (); + //header_bar.set_decoration_layout ("default-decoration"); + header_bar.set_show_close_button (true); + header_bar.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT); + header_bar.get_style_context ().add_class ("default-decoration"); + header_bar.set_title ("Sundown"); + if (css_provider == null) { + css_provider = new Gtk.CssProvider (); + css_provider.load_from_resource ("/com/github/elementaryrevivals/sundown/Application.css"); + // CSS Provider + Gtk.StyleContext.add_provider_for_screen ( + Gdk.Screen.get_default (), + css_provider, + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION + ); + } Window window = new Gtk.ApplicationWindow (this); - window.title = "Sundown"; + window.set_titlebar (header_bar); window.window_position = WindowPosition.CENTER; window.set_decorated (true); window.set_deletable (true); window.set_resizable (false); window.destroy.connect (Gtk.main_quit); window.border_width = 20; + window.get_style_context ().add_class ("rounded"); var vbox_main = new Box (Orientation.VERTICAL, 0); vbox_main.homogeneous = false; @@ -72,6 +95,8 @@ public class Sundown : Gtk.Application { //this is my main slider slider = new Scale.with_range (Orientation.HORIZONTAL, 40, 150, 1); slider.set_size_request (380, 50); + knob = new Knob (); + knob.set_size_request (102, 102); if (lines.size > 1) { var hbox_all = new Box (Orientation.HORIZONTAL, 0); @@ -86,6 +111,7 @@ public class Sundown : Gtk.Application { switcher.state_flags_changed.connect (() => { if (switcher.active == true) { slider.visible = true; + knob.visible = true; vbox_ind.visible = false; //initialization @@ -93,6 +119,7 @@ public class Sundown : Gtk.Application { } else { slider.visible = false; + knob.visible = false; vbox_ind.visible = true; //initialization @@ -227,7 +254,7 @@ public class Sundown : Gtk.Application { }); //.v.positioning - vbox_main.add (slider); + vbox_main.add (knob); if (lines.size > 1) { for (int i = 0; i < lines.size; i++) { From 2307c02c8f8cc989589ad50e91a68cdcb33e7d0e Mon Sep 17 00:00:00 2001 From: SubhadeepJasu Date: Wed, 15 Sep 2021 23:47:38 +0530 Subject: [PATCH 2/7] Implement knob functionality --- .dimmer_all_monitors.txt | 1 + data/Application.css | 24 +++++++--- ...b.elementaryrevivals.sundown.gresource.xml | 3 ++ data/images/knob_meter.svg | 21 +++++++++ src/Knob.vala | 46 ++++++++++++++++--- src/Sundown.vala | 16 ++++++- src/svg.svg | 19 ++++++++ 7 files changed, 117 insertions(+), 13 deletions(-) create mode 100644 .dimmer_all_monitors.txt create mode 100644 data/images/knob_meter.svg create mode 100644 src/svg.svg diff --git a/.dimmer_all_monitors.txt b/.dimmer_all_monitors.txt new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/.dimmer_all_monitors.txt @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/data/Application.css b/data/Application.css index 028aaa9..b713fa3 100644 --- a/data/Application.css +++ b/data/Application.css @@ -1,3 +1,9 @@ +window { + background-image:linear-gradient(#eef0f2, #a7b3c1); +} +.flat { + background-color: #eef0f2; +} .knob-socket-graphic { background-image:linear-gradient(alpha(#56626f, 0.5), alpha(#aebac6, 0.5), alpha(#fff, 0.5)); border-radius: 50%; @@ -7,16 +13,22 @@ margin-bottom: 2px } .knob-cover-graphic { - background-image:linear-gradient(alpha(#aebac6, 0.9), alpha(#fff, 0.7)); + background-image:linear-gradient(#e6eaed, #abb8c4); border: 1px solid #56626f; - box-shadow: inset 0 1px 0 alpha(#fff, 0.5), inset 0 -1px 0 alpha(#000, 0.5), + box-shadow: inset 0 1px 0 alpha(#fff, 0.7), inset 0 -1px 0 alpha(#56626f, 0.9), 0 2px 4px alpha(#000, 0.5), 0 -3px 4px alpha(#fff, 1.0); border-radius: 50%; margin: 6px } -window { - background-image:linear-gradient(#eef0f2, #a7b3c1); +.knob-meter-graphic { + background-image:url("resource://com/github/elementaryrevivals/sundown/images/knob_meter.svg"); + background-size: 132px; + background-position: center center; } -.flat { - background-color: #eef0f2; +.knob-meter-label { + font-size: 0.8rem; + margin-bottom: 4px; + color: #677892; + font-weight: 700; + text-shadow: 0 1px alpha(#fff, 0.5); } diff --git a/data/com.github.elementaryrevivals.sundown.gresource.xml b/data/com.github.elementaryrevivals.sundown.gresource.xml index ebed4ad..029ae5a 100644 --- a/data/com.github.elementaryrevivals.sundown.gresource.xml +++ b/data/com.github.elementaryrevivals.sundown.gresource.xml @@ -3,4 +3,7 @@ Application.css + + images/knob_meter.svg + diff --git a/data/images/knob_meter.svg b/data/images/knob_meter.svg new file mode 100644 index 0000000..4b702c4 --- /dev/null +++ b/data/images/knob_meter.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Knob.vala b/src/Knob.vala index a08452e..f4da1cd 100644 --- a/src/Knob.vala +++ b/src/Knob.vala @@ -23,18 +23,22 @@ public class Knob : Gtk.Overlay { private double dragging_direction; public double value = 27; + public int initial_value = 0; protected Gtk.Box knob_socket_graphic; protected Gtk.Box knob_cover; protected Gtk.Box knob_background; protected Gtk.Fixed fixed; protected int center; + private Gtk.Label knob_label_dark; + private Gtk.Label knob_label_light; + protected const double RADIUS = 20; public signal void change_value (double value); public Knob () { - center = 45; + center = 42; knob_socket_graphic = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); knob_socket_graphic.width_request = 20; knob_socket_graphic.height_request = 20; @@ -44,6 +48,7 @@ public class Knob : Gtk.Overlay { knob_cover.get_style_context ().add_class ("knob-cover-graphic"); knob_cover.halign = Gtk.Align.START; knob_cover.valign = Gtk.Align.START; + knob_cover.margin = 14; knob_cover.width_request = 100; knob_cover.height_request = 100; @@ -52,15 +57,30 @@ public class Knob : Gtk.Overlay { fixed.valign = Gtk.Align.START; fixed.width_request = 100; fixed.height_request = 100; + fixed.margin = 14; double px = RADIUS * GLib.Math.cos (value / Math.PI); double py = RADIUS * GLib.Math.sin (value / Math.PI); fixed.put (knob_socket_graphic, (int)(px + center), (int)(py + center)); knob_background = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); + knob_background.get_style_context ().add_class ("knob-meter-graphic"); knob_background.halign = Gtk.Align.START; knob_background.valign = Gtk.Align.START; - knob_background.width_request = 100; - knob_background.height_request = 100; + knob_background.width_request = 128; + knob_background.height_request = 128; + + knob_label_dark = new Gtk.Label (_("DARK")); + knob_label_dark.halign = Gtk.Align.START; + knob_label_dark.valign = Gtk.Align.END; + knob_label_dark.get_style_context ().add_class ("knob-meter-label"); + + knob_label_light = new Gtk.Label (_("LIGHT")); + knob_label_light.halign = Gtk.Align.END; + knob_label_light.valign = Gtk.Align.END; + knob_label_light.get_style_context ().add_class ("knob-meter-label"); + + knob_background.pack_start (knob_label_dark, true); + knob_background.pack_end (knob_label_light, true); var event_box = new Gtk.EventBox (); event_box.event.connect (handle_event); @@ -74,7 +94,8 @@ public class Knob : Gtk.Overlay { this.hexpand = false; this.vexpand = true; - this.width_request = 58; + this.width_request = 128; + this.height_request = 128; } public void rotate_dial (double value) { @@ -100,6 +121,7 @@ public class Knob : Gtk.Overlay { // } if (event.type == Gdk.EventType.BUTTON_PRESS) { dragging = true; + initial_value = 0; } if (event.type == Gdk.EventType.BUTTON_RELEASE) { dragging = false; @@ -114,23 +136,35 @@ public class Knob : Gtk.Overlay { event.motion.y_root == 0 || event.motion.x_root == 0) { value += 0.5; + initial_value += 1; if (value < 27) { value = 27; } if (value > 42) { value = 42; } - rotate_dial (value); + if (value > 33 && value < 37 && initial_value < 10) { + value = 35.2; + rotate_dial (value); + } else { + rotate_dial (value); + } dragging_direction = event.motion.y - event.motion.x; } else { value -= 0.5; + initial_value -= 1; if (value < 27) { value = 27; } if (value > 42) { value = 42; } - rotate_dial (value); + if (value > 33 && value < 37 && initial_value > -10) { + value = 35.2; + rotate_dial (value); + } else { + rotate_dial (value); + } dragging_direction = event.motion.y - event.motion.x; } } diff --git a/src/Sundown.vala b/src/Sundown.vala index e5486e0..fb4887c 100644 --- a/src/Sundown.vala +++ b/src/Sundown.vala @@ -96,7 +96,6 @@ public class Sundown : Gtk.Application { slider = new Scale.with_range (Orientation.HORIZONTAL, 40, 150, 1); slider.set_size_request (380, 50); knob = new Knob (); - knob.set_size_request (102, 102); if (lines.size > 1) { var hbox_all = new Box (Orientation.HORIZONTAL, 0); @@ -252,6 +251,21 @@ public class Sundown : Gtk.Application { else slider.tooltip_text = ""; } catch (SpawnError se) {} }); + knob.change_value.connect ((value) => { + var val = 40 + ((150.0 - 40.0) * value); + //print ("%lf\n", val); + string edited = ((int)val / 100.0).to_string (); + Idle.add (() => { + try { + for (int i = 0; i < lines.size; i++) GLib.Process.spawn_command_line_async ("xrandr --output " + lines.get (i) + " --brightness " + edited); + //save_value (".dimmer_all_monitors.txt", edited); + if (((int)val / 100.0) > 1.2) knob.tooltip_text = "Too Bright"; + else if (((int)val / 100.0) < 0.6) knob.tooltip_text = "Too Dark"; + else knob.tooltip_text = ""; + } catch (SpawnError se) {} + return false; + }); + }); //.v.positioning vbox_main.add (knob); diff --git a/src/svg.svg b/src/svg.svg new file mode 100644 index 0000000..5f007d5 --- /dev/null +++ b/src/svg.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + From b38b6fcffea1efcf6b0b34b753b06765e128e560 Mon Sep 17 00:00:00 2001 From: SubhadeepJasu Date: Thu, 16 Sep 2021 12:57:01 +0530 Subject: [PATCH 3/7] Add accent color lights, improve contrast --- data/Application.css | 12 ++++++++++ data/images/knob_meter.svg | 45 +++++++++++++++++++++----------------- src/Knob.vala | 14 ++++++++++++ 3 files changed, 51 insertions(+), 20 deletions(-) diff --git a/data/Application.css b/data/Application.css index b713fa3..4e3fed6 100644 --- a/data/Application.css +++ b/data/Application.css @@ -32,3 +32,15 @@ window { font-weight: 700; text-shadow: 0 1px alpha(#fff, 0.5); } +.knob-rim { + border: 1px solid shade(@accent_color, 1.3); + box-shadow: 0 0 4px @accent_color, 0 0 0 1px alpha(@accent_color, 0.2), inset 0 0 1px 1px @accent_color; + border-radius: 50%; + margin: 6px; + opacity: 1; + transition: opacity 1s ease; +} + +.knob-rim-hidden { + opacity: 0; +} diff --git a/data/images/knob_meter.svg b/data/images/knob_meter.svg index 4b702c4..0f3a6c0 100644 --- a/data/images/knob_meter.svg +++ b/data/images/knob_meter.svg @@ -1,21 +1,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Knob.vala b/src/Knob.vala index f4da1cd..a0f8c1d 100644 --- a/src/Knob.vala +++ b/src/Knob.vala @@ -27,6 +27,7 @@ public class Knob : Gtk.Overlay { protected Gtk.Box knob_socket_graphic; protected Gtk.Box knob_cover; protected Gtk.Box knob_background; + protected Gtk.Box knob_rim; protected Gtk.Fixed fixed; protected int center; @@ -82,6 +83,14 @@ public class Knob : Gtk.Overlay { knob_background.pack_start (knob_label_dark, true); knob_background.pack_end (knob_label_light, true); + knob_rim = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); + knob_rim.get_style_context ().add_class ("knob-rim"); + knob_rim.halign = Gtk.Align.START; + knob_rim.valign = Gtk.Align.START; + knob_rim.margin = 14; + knob_rim.width_request = 100; + knob_rim.height_request = 100; + var event_box = new Gtk.EventBox (); event_box.event.connect (handle_event); event_box.hexpand = true; @@ -90,6 +99,7 @@ public class Knob : Gtk.Overlay { add_overlay (knob_background); add_overlay (knob_cover); add_overlay (fixed); + add_overlay (knob_rim); add_overlay (event_box); this.hexpand = false; @@ -145,8 +155,10 @@ public class Knob : Gtk.Overlay { } if (value > 33 && value < 37 && initial_value < 10) { value = 35.2; + knob_rim.get_style_context ().add_class ("knob-rim-hidden"); rotate_dial (value); } else { + knob_rim.get_style_context ().remove_class ("knob-rim-hidden"); rotate_dial (value); } dragging_direction = event.motion.y - event.motion.x; @@ -161,8 +173,10 @@ public class Knob : Gtk.Overlay { } if (value > 33 && value < 37 && initial_value > -10) { value = 35.2; + knob_rim.get_style_context ().add_class ("knob-rim-hidden"); rotate_dial (value); } else { + knob_rim.get_style_context ().remove_class ("knob-rim-hidden"); rotate_dial (value); } dragging_direction = event.motion.y - event.motion.x; From 3d90b75c2e5b8f0d67f828ac385f40c92aa0f8ad Mon Sep 17 00:00:00 2001 From: SubhadeepJasu Date: Thu, 16 Sep 2021 15:14:39 +0530 Subject: [PATCH 4/7] Change all sliders to knob --- ...hub.elementaryrevivals.sundown.gschema.xml | 27 ++ data/meson.build | 6 + src/Knob.vala | 3 + src/Sundown.vala | 270 ++++++++---------- 4 files changed, 155 insertions(+), 151 deletions(-) create mode 100644 data/com.github.elementaryrevivals.sundown.gschema.xml diff --git a/data/com.github.elementaryrevivals.sundown.gschema.xml b/data/com.github.elementaryrevivals.sundown.gschema.xml new file mode 100644 index 0000000..1035f63 --- /dev/null +++ b/data/com.github.elementaryrevivals.sundown.gschema.xml @@ -0,0 +1,27 @@ + + + + + + 1.0 + Brightness settings of all monitors + + + 1.0 + Brightness settings for specific monitor + + + 1.0 + Brightness settings for specific monitor + + + 1.0 + Brightness settings for specific monitor + + + 1.0 + Brightness settings for specific monitor + + + diff --git a/data/meson.build b/data/meson.build index c41d03a..975a179 100644 --- a/data/meson.build +++ b/data/meson.build @@ -30,3 +30,9 @@ i18n.merge_file ( install: true, install_dir: join_paths (get_option ('datadir'), 'metainfo') ) + +install_data( + 'com.github.elementaryrevivals.sundown.gschema.xml', + rename: meson.project_name() + '.gschema.xml', + install_dir: get_option('datadir') / 'glib-2.0' / 'schemas' +) diff --git a/src/Knob.vala b/src/Knob.vala index a0f8c1d..6eb5e76 100644 --- a/src/Knob.vala +++ b/src/Knob.vala @@ -119,6 +119,9 @@ public class Knob : Gtk.Overlay { value = 15 * _value + 27; double px = RADIUS * GLib.Math.cos (value / Math.PI); double py = RADIUS * GLib.Math.sin (value / Math.PI); + if (value == 35.2) { + knob_rim.get_style_context ().add_class ("knob-rim-hidden"); + } fixed.move (knob_socket_graphic, (int)(px + center), (int)(py + center)); } diff --git a/src/Sundown.vala b/src/Sundown.vala index fb4887c..72b2221 100644 --- a/src/Sundown.vala +++ b/src/Sundown.vala @@ -6,19 +6,21 @@ using Gtk; using Gee; +GLib.Settings settings; public class Sundown : Gtk.Application { Gtk.CssProvider css_provider; - public static Gtk.Scale slider; - public static Gtk.Scale slider1; - public static Gtk.Scale slider2; - public static Gtk.Scale slider3; - public static Gtk.Scale slider4; + // public static Gtk.Scale slider; + // public static Gtk.Scale slider1; + // public static Gtk.Scale slider2; + // public static Gtk.Scale slider3; + // public static Gtk.Scale slider4; public static Knob knob; public static Knob knob1; public static Knob knob2; public static Knob knob3; + public static Knob knob4; public static Label label1; public static Label label2; @@ -38,8 +40,11 @@ public class Sundown : Gtk.Application { } protected override void activate () { + settings = new GLib.Settings ("com.github.elementaryrevivals.sundown"); + init_theme (); + Gtk.Settings gsettings = Gtk.Settings.get_default (); + gsettings.gtk_application_prefer_dark_theme = false; var header_bar = new Gtk.HeaderBar (); - //header_bar.set_decoration_layout ("default-decoration"); header_bar.set_show_close_button (true); header_bar.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT); header_bar.get_style_context ().add_class ("default-decoration"); @@ -62,12 +67,13 @@ public class Sundown : Gtk.Application { window.set_resizable (false); window.destroy.connect (Gtk.main_quit); window.border_width = 20; + window.width_request = 268; window.get_style_context ().add_class ("rounded"); var vbox_main = new Box (Orientation.VERTICAL, 0); vbox_main.homogeneous = false; - var vbox_ind = new Box (Orientation.VERTICAL, 0); + var vbox_ind = new Box (Orientation.HORIZONTAL, 0); vbox_ind.homogeneous = false; string current_brightness, /*currentGm,*/ names; @@ -92,9 +98,9 @@ public class Sundown : Gtk.Application { for (int i = 0; i < temp_lines.length; i++) if (temp_lines[i] != "") lines.add (temp_lines[i]); - //this is my main slider - slider = new Scale.with_range (Orientation.HORIZONTAL, 40, 150, 1); - slider.set_size_request (380, 50); + //this is my main knob + // slider = new Scale.with_range (Orientation.HORIZONTAL, 40, 150, 1); + // slider.set_size_request (380, 50); knob = new Knob (); if (lines.size > 1) { @@ -109,7 +115,7 @@ public class Sundown : Gtk.Application { switcher.active = true; switcher.state_flags_changed.connect (() => { if (switcher.active == true) { - slider.visible = true; + // slider.visible = true; knob.visible = true; vbox_ind.visible = false; @@ -117,7 +123,7 @@ public class Sundown : Gtk.Application { set_value_for_all (); } else { - slider.visible = false; + // slider.visible = false; knob.visible = false; vbox_ind.visible = true; @@ -142,125 +148,103 @@ public class Sundown : Gtk.Application { for (int i = 0; i < lines.size; i++) monitors[i] = lines.get (i); if (lines.size > 1) { - //slider1 + //knob1 label1 = new Label (monitors[0]); label1.halign = Align.START; - slider1 = new Scale.with_range (Orientation.HORIZONTAL, 40, 150, 1); - slider1.set_size_request (380, 30); - slider1.adjustment.value_changed.connect (() => { - try { - string edited = (slider1.adjustment.value / 100).to_string (); - - //if ((slider1.adjustment.value / 100) >= 1.0) { - //GLib.Process.spawn_command_line_async("xrandr --output " + monitors[0] + " --gamma " + edited + ":" + edited + ":" + edited); - //} - //else - GLib.Process.spawn_command_line_async ("xrandr --output " + monitors[0] + " --brightness " + edited); - - save_value (".dimmer_" + monitors[0] + ".txt", edited); - - if ((slider1.adjustment.value / 100) > 1.2) slider1.tooltip_text = "Too Bright"; - else if ((slider1.adjustment.value / 100) < 0.6) slider1.tooltip_text = "Too Dark"; - else slider1.tooltip_text = ""; - } catch (SpawnError se) {} + knob1 = new Knob (); + knob1.change_value.connect ((value) => { + double val = (int)(40 + (110.0 * value)) / 100.0; + //print ("%lf\n", val); + Idle.add (() => { + try { + GLib.Process.spawn_command_line_async ("xrandr --output " + monitors[0] + " --brightness " + val.to_string ()); + settings.set_double ("monitors-1-brightness", value); + if (val > 1.2) knob.tooltip_text = "Too Bright"; + else if (val < 0.6) knob.tooltip_text = "Too Dark"; + else knob.tooltip_text = ""; + } catch (SpawnError se) {} + return false; + }); }); - slider1.set_margin_bottom (30); - - //slider2 + //knob2 label2 = new Label (monitors[1]); label2.halign = Align.START; - slider2 = new Scale.with_range (Orientation.HORIZONTAL, 40, 150, 1); - slider2.set_size_request (380, 30); - slider2.adjustment.value_changed.connect (() => { - try { - string edited = (slider2.adjustment.value / 100).to_string (); - - GLib.Process.spawn_command_line_async ("xrandr --output " + monitors[1] + " --brightness " + edited); - - save_value (".dimmer_" + monitors[1] + ".txt", edited); - - if ((slider2.adjustment.value / 100) > 1.2) slider2.tooltip_text = "Too Bright"; - else if ((slider2.adjustment.value / 100) < 0.6) slider2.tooltip_text = "Too Dark"; - else slider2.tooltip_text = ""; - } catch (SpawnError se) {} + knob2 = new Knob (); + knob2.change_value.connect ((value) => { + double val = (int)(40 + (110.0 * value)) / 100.0; + //print ("%lf\n", val); + Idle.add (() => { + try { + GLib.Process.spawn_command_line_async ("xrandr --output " + monitors[1] + " --brightness " + val.to_string ()); + settings.set_double ("monitors-2-brightness", value); + if (val > 1.2) knob.tooltip_text = "Too Bright"; + else if (val < 0.6) knob.tooltip_text = "Too Dark"; + else knob.tooltip_text = ""; + } catch (SpawnError se) {} + return false; + }); }); - slider2.set_margin_bottom (30); - //slider3 + //knob3 label3 = new Label (monitors[2]); label3.halign = Align.START; - slider3 = new Scale.with_range (Orientation.HORIZONTAL, 40, 150, 1); - slider3.set_size_request (380, 30); - slider3.adjustment.value_changed.connect (() => { - try { - string edited = (slider3.adjustment.value / 100).to_string (); - - GLib.Process.spawn_command_line_async ("xrandr --output " + monitors[2] + " --brightness " + edited); - - save_value (".dimmer_" + monitors[2] + ".txt", edited); - - if ((slider3.adjustment.value / 100) > 1.2) slider3.tooltip_text = "Too Bright"; - else if ((slider3.adjustment.value / 100) < 0.6) slider3.tooltip_text = "Too Dark"; - else slider3.tooltip_text = ""; - } catch (SpawnError se) {} + knob3 = new Knob (); + knob3.change_value.connect ((value) => { + double val = (int)(40 + (110.0 * value)) / 100.0; + //print ("%lf\n", val); + Idle.add (() => { + try { + GLib.Process.spawn_command_line_async ("xrandr --output " + monitors[2] + " --brightness " + val.to_string ()); + settings.set_double ("monitors-3-brightness", value); + if (val > 1.2) knob.tooltip_text = "Too Bright"; + else if (val < 0.6) knob.tooltip_text = "Too Dark"; + else knob.tooltip_text = ""; + } catch (SpawnError se) {} + return false; + }); }); - slider3.set_margin_bottom (30); - //slider4 + //knob4 label4 = new Label (monitors[3]); label4.halign = Align.START; - slider4 = new Scale.with_range (Orientation.HORIZONTAL, 40, 150, 1); - slider4.set_size_request (380, 30); - slider4.adjustment.value_changed.connect (() => { - try { - string edited = (slider4.adjustment.value / 100).to_string (); - - GLib.Process.spawn_command_line_async ("xrandr --output " + monitors[3] + " --brightness " + edited); - - save_value (".dimmer_" + monitors[3] + ".txt", edited); - - if ((slider4.adjustment.value / 100) > 1.2) slider4.tooltip_text = "Too Bright"; - else if ((slider4.adjustment.value / 100) < 0.6) slider4.tooltip_text = "Too Dark"; - else slider4.tooltip_text = ""; - } catch (SpawnError se) {} + knob4 = new Knob (); + knob4.change_value.connect ((value) => { + double val = (int)(40 + (110.0 * value)) / 100.0; + //print ("%lf\n", val); + Idle.add (() => { + try { + GLib.Process.spawn_command_line_async ("xrandr --output " + monitors[3] + " --brightness " + val.to_string ()); + settings.set_double ("monitors-4-brightness", value); + if (val > 1.2) knob.tooltip_text = "Too Bright"; + else if (val < 0.6) knob.tooltip_text = "Too Dark"; + else knob.tooltip_text = ""; + } catch (SpawnError se) {} + return false; + }); }); //set the values at start (when more than 1 exists) set_values_for_every_monitor (); - if (slider1.get_value () != slider2.get_value ()) { + if (knob1.value != knob2.value) { switcher.set_active (false); } } - //action for main slider - slider.adjustment.value_changed.connect (() => { - try { - string edited = (slider.adjustment.value / 100).to_string (); - - for (int i = 0; i < lines.size; i++) GLib.Process.spawn_command_line_async ("xrandr --output " + lines.get (i) + " --brightness " + edited); - - save_value (".dimmer_all_monitors.txt", edited); - - if ((slider.adjustment.value / 100) > 1.2) slider.tooltip_text = "Too Bright"; - else if ((slider.adjustment.value / 100) < 0.6) slider.tooltip_text = "Too Dark"; - else slider.tooltip_text = ""; - } catch (SpawnError se) {} - }); + //action for main knob knob.change_value.connect ((value) => { - var val = 40 + ((150.0 - 40.0) * value); + double val = (int)(40 + (110.0 * value)) / 100.0; //print ("%lf\n", val); - string edited = ((int)val / 100.0).to_string (); Idle.add (() => { try { - for (int i = 0; i < lines.size; i++) GLib.Process.spawn_command_line_async ("xrandr --output " + lines.get (i) + " --brightness " + edited); - //save_value (".dimmer_all_monitors.txt", edited); - if (((int)val / 100.0) > 1.2) knob.tooltip_text = "Too Bright"; - else if (((int)val / 100.0) < 0.6) knob.tooltip_text = "Too Dark"; + for (int i = 0; i < lines.size; i++) GLib.Process.spawn_command_line_async ("xrandr --output " + lines.get (i) + " --brightness " + val.to_string ()); + settings.set_double ("all-monitors-brightness", value); + if (val > 1.2) knob.tooltip_text = "Too Bright"; + else if (val < 0.6) knob.tooltip_text = "Too Dark"; else knob.tooltip_text = ""; } catch (SpawnError se) {} return false; @@ -274,19 +258,19 @@ public class Sundown : Gtk.Application { for (int i = 0; i < lines.size; i++) { if (i == 0) { vbox_ind.add (label1); - vbox_ind.add (slider1); + vbox_ind.add (knob1); } else if (i == 1) { vbox_ind.add (label2); - vbox_ind.add (slider2); + vbox_ind.add (knob2); } else if (i == 2) { vbox_ind.add (label3); - vbox_ind.add (slider3); + vbox_ind.add (knob3); } else if (i == 3) { vbox_ind.add (label4); - vbox_ind.add (slider4); + vbox_ind.add (knob4); } } } @@ -300,28 +284,15 @@ public class Sundown : Gtk.Application { //also, if only 1 monitor exists private static void set_value_for_all () { - string prev_value; - - if (FileUtils.test (".dimmer_all_monitors.txt", GLib.FileTest.EXISTS) == true) { - try { - FileUtils.get_contents (".dimmer_all_monitors.txt", out prev_value); - } - catch (Error e) { - prev_value = "1.00"; - stderr.printf ("Error: %s\n", e.message); - } - } - else { - prev_value = "1.00"; //default - } + double value = settings.get_double ("all-monitors-brightness"); + double prev_value = (int)(40 + (110.0 * value)) / 100.0; - double dprev_value = double.parse (prev_value); - if (dprev_value < 0.4) dprev_value = 0.4; - if (dprev_value > 1.5) dprev_value = 1.5; + if (prev_value < 0.4) prev_value = 0.4; + if (prev_value > 1.5) prev_value = 1.5; - slider.adjustment.value = dprev_value * 100; + knob.set_value (value); - string edited = dprev_value.to_string (); + string edited = prev_value.to_string (); try { for (int i = 0; i < lines.size; i++) GLib.Process.spawn_command_line_async ("xrandr --output " + lines.get (i) + " --brightness " + edited); @@ -331,32 +302,20 @@ public class Sundown : Gtk.Application { //if more than 1 monitor exists private static void set_values_for_every_monitor () { for (int i = 0; i < lines.size; i++) { - string prev_value; if (monitors[i] != "") { - if (FileUtils.test (".dimmer_" + monitors[i] + ".txt", GLib.FileTest.EXISTS) == true) { - try { - FileUtils.get_contents (".dimmer_" + monitors[i] + ".txt", out prev_value); - } - catch (Error e) { - prev_value = "1.00"; - stderr.printf ("Error: %s\n", e.message); - } - } - else { - prev_value = "1.00"; //default - } + double value = settings.get_double ("all-monitors-brightness"); + double prev_value = (int)(40 + (110.0 * value)) / 100.0; - double dprev_value = double.parse (prev_value); - if (dprev_value < 0.4) dprev_value = 0.4; - if (dprev_value > 1.5) dprev_value = 1.5; + if (prev_value < 0.4) prev_value = 0.4; + if (prev_value > 1.5) prev_value = 1.5; - if (i == 0) slider1.adjustment.value = dprev_value * 100; - else if (i == 1) slider2.adjustment.value = dprev_value * 100; - else if (i == 2) slider3.adjustment.value = dprev_value * 100; - else if (i == 3) slider4.adjustment.value = dprev_value * 100; + if (i == 0) knob1.set_value (value); + else if (i == 1) knob2.set_value (value); + else if (i == 2) knob3.set_value (value); + else if (i == 3) knob4.set_value (value); - string edited = dprev_value.to_string (); + string edited = prev_value.to_string (); try { GLib.Process.spawn_command_line_async ("xrandr --output " + monitors[i] + " --brightness " + edited); @@ -365,12 +324,21 @@ public class Sundown : Gtk.Application { } } - private static void save_value (string filename, string value_to_save) { - try { - FileUtils.set_contents (filename, value_to_save); - } - catch (Error e) { - stderr.printf ("Error: %s\n", e.message); + // private static void save_value (string filename, string value_to_save) { + // try { + // FileUtils.set_contents (filename, value_to_save); + // } + // catch (Error e) { + // stderr.printf ("Error: %s\n", e.message); + // } + // } + + private void init_theme () { + GLib.Value value = GLib.Value (GLib.Type.STRING); + Gtk.Settings.get_default ().get_property ("gtk-theme-name", ref value); + if (!value.get_string ().has_prefix ("io.elementary.")) { + Gtk.Settings.get_default ().set_property ("gtk-icon-theme-name", "elementary"); + Gtk.Settings.get_default ().set_property ("gtk-theme-name", "io.elementary.stylesheet.blueberry"); } } From 601096d67d9dfca2206046fb11c9cf360c5b1325 Mon Sep 17 00:00:00 2001 From: SubhadeepJasu Date: Thu, 16 Sep 2021 15:16:40 +0530 Subject: [PATCH 5/7] Change default --- data/com.github.elementaryrevivals.sundown.gschema.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/data/com.github.elementaryrevivals.sundown.gschema.xml b/data/com.github.elementaryrevivals.sundown.gschema.xml index 1035f63..ebf2f48 100644 --- a/data/com.github.elementaryrevivals.sundown.gschema.xml +++ b/data/com.github.elementaryrevivals.sundown.gschema.xml @@ -4,23 +4,23 @@ - 1.0 + 0.54666666666666686 Brightness settings of all monitors - 1.0 + 0.54666666666666686 Brightness settings for specific monitor - 1.0 + 0.54666666666666686 Brightness settings for specific monitor - 1.0 + 0.54666666666666686 Brightness settings for specific monitor - 1.0 + 0.54666666666666686 Brightness settings for specific monitor From 7823234c945998b933a08f3708af95986e53b750 Mon Sep 17 00:00:00 2001 From: SubhadeepJasu Date: Thu, 16 Sep 2021 22:13:10 +0530 Subject: [PATCH 6/7] Refine Knob mouse control --- src/Knob.vala | 90 +++++++++++++++++++++++++++++---------------------- 1 file changed, 51 insertions(+), 39 deletions(-) diff --git a/src/Knob.vala b/src/Knob.vala index 6eb5e76..75afaf3 100644 --- a/src/Knob.vala +++ b/src/Knob.vala @@ -20,10 +20,12 @@ public class Knob : Gtk.Overlay { public string tooltip; public bool dragging; - private double dragging_direction; + private double dragging_direction_x; + private double dragging_direction_y; + bool locked; public double value = 27; - public int initial_value = 0; + public int drag_force = 0; protected Gtk.Box knob_socket_graphic; protected Gtk.Box knob_cover; protected Gtk.Box knob_background; @@ -134,56 +136,66 @@ public class Knob : Gtk.Overlay { // } if (event.type == Gdk.EventType.BUTTON_PRESS) { dragging = true; - initial_value = 0; + drag_force = 0; } if (event.type == Gdk.EventType.BUTTON_RELEASE) { dragging = false; - dragging_direction = 0; + dragging_direction_x = 0; + dragging_direction_y = 0; } if (event.type == Gdk.EventType.MOTION_NOTIFY && dragging) { - if (dragging_direction == 0) { - dragging_direction = event.motion.y - event.motion.x; + if (dragging_direction_x == 0) { + dragging_direction_x = event.motion.x; } - if (dragging_direction > event.motion.y - event.motion.x || - event.motion.y_root == 0 || - event.motion.x_root == 0) { - value += 0.5; - initial_value += 1; - if (value < 27) { - value = 27; - } - if (value > 42) { - value = 42; - } - if (value > 33 && value < 37 && initial_value < 10) { - value = 35.2; - knob_rim.get_style_context ().add_class ("knob-rim-hidden"); - rotate_dial (value); - } else { - knob_rim.get_style_context ().remove_class ("knob-rim-hidden"); - rotate_dial (value); + if (dragging_direction_y == 0) { + dragging_direction_y = event.motion.y; + } + double delta = 0.0; + if (dragging_direction_x > event.motion.x || event.motion.x_root == 0) { + delta -= 0.1 * (dragging_direction_x - event.motion.x); + if (locked) { + drag_force += 1; } - dragging_direction = event.motion.y - event.motion.x; + dragging_direction_x = event.motion.x; } else { - value -= 0.5; - initial_value -= 1; - if (value < 27) { - value = 27; + delta += 0.1 * (event.motion.x - dragging_direction_x); + if (locked) { + drag_force -= 1; } - if (value > 42) { - value = 42; + dragging_direction_x = event.motion.x; + } + if (dragging_direction_y > event.motion.y || event.motion.y_root == 0) { + delta += 0.1 * (dragging_direction_y - event.motion.y); + if (locked) { + drag_force += 1; } - if (value > 33 && value < 37 && initial_value > -10) { - value = 35.2; - knob_rim.get_style_context ().add_class ("knob-rim-hidden"); - rotate_dial (value); - } else { - knob_rim.get_style_context ().remove_class ("knob-rim-hidden"); - rotate_dial (value); + dragging_direction_y = event.motion.y; + } else { + delta -= 0.1 * (event.motion.y - dragging_direction_y); + if (locked) { + drag_force -= 1; } - dragging_direction = event.motion.y - event.motion.x; + dragging_direction_y = event.motion.y; + } + value += delta; + if (value < 27) { + value = 27; + } + if (value > 42) { + value = 42; + } + if (value > 33.5 && value < 36.5 && !locked) { + value = 35.2; + locked = true; + knob_rim.get_style_context ().add_class ("knob-rim-hidden"); + } else { + knob_rim.get_style_context ().remove_class ("knob-rim-hidden"); + } + if (drag_force < -1 || drag_force > 1) { + locked = false; } + rotate_dial (value); } return false; } From 75d1c4170a2e5f521e3d39978318846b534b7c3a Mon Sep 17 00:00:00 2001 From: SubhadeepJasu Date: Sun, 19 Sep 2021 10:55:33 +0530 Subject: [PATCH 7/7] Corrections for flatpak build --- data/Application.css | 2 +- ...ce.xml => com.github.watsonprojects.sundown.gresource.xml} | 4 ++-- ...hema.xml => com.github.watsonprojects.sundown.gschema.xml} | 4 ++-- data/meson.build | 2 +- src/Sundown.vala | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) rename data/{com.github.elementaryrevivals.sundown.gresource.xml => com.github.watsonprojects.sundown.gresource.xml} (66%) rename data/{com.github.elementaryrevivals.sundown.gschema.xml => com.github.watsonprojects.sundown.gschema.xml} (86%) diff --git a/data/Application.css b/data/Application.css index 4e3fed6..07817f8 100644 --- a/data/Application.css +++ b/data/Application.css @@ -21,7 +21,7 @@ window { margin: 6px } .knob-meter-graphic { - background-image:url("resource://com/github/elementaryrevivals/sundown/images/knob_meter.svg"); + background-image:url("resource://com/github/watsonprojects/sundown/images/knob_meter.svg"); background-size: 132px; background-position: center center; } diff --git a/data/com.github.elementaryrevivals.sundown.gresource.xml b/data/com.github.watsonprojects.sundown.gresource.xml similarity index 66% rename from data/com.github.elementaryrevivals.sundown.gresource.xml rename to data/com.github.watsonprojects.sundown.gresource.xml index 029ae5a..d7c6a16 100644 --- a/data/com.github.elementaryrevivals.sundown.gresource.xml +++ b/data/com.github.watsonprojects.sundown.gresource.xml @@ -1,9 +1,9 @@ - + Application.css - + images/knob_meter.svg diff --git a/data/com.github.elementaryrevivals.sundown.gschema.xml b/data/com.github.watsonprojects.sundown.gschema.xml similarity index 86% rename from data/com.github.elementaryrevivals.sundown.gschema.xml rename to data/com.github.watsonprojects.sundown.gschema.xml index ebf2f48..eca2fc0 100644 --- a/data/com.github.elementaryrevivals.sundown.gschema.xml +++ b/data/com.github.watsonprojects.sundown.gschema.xml @@ -1,8 +1,8 @@ - + 0.54666666666666686 Brightness settings of all monitors diff --git a/data/meson.build b/data/meson.build index 975a179..b4999f6 100644 --- a/data/meson.build +++ b/data/meson.build @@ -32,7 +32,7 @@ i18n.merge_file ( ) install_data( - 'com.github.elementaryrevivals.sundown.gschema.xml', + 'com.github.watsonprojects.sundown.gschema.xml', rename: meson.project_name() + '.gschema.xml', install_dir: get_option('datadir') / 'glib-2.0' / 'schemas' ) diff --git a/src/Sundown.vala b/src/Sundown.vala index 835ab26..83f977d 100644 --- a/src/Sundown.vala +++ b/src/Sundown.vala @@ -40,7 +40,7 @@ public class Sundown : Gtk.Application { } protected override void activate () { - settings = new GLib.Settings ("com.github.elementaryrevivals.sundown"); + settings = new GLib.Settings ("com.github.watsonprojects.sundown"); init_theme (); Gtk.Settings gsettings = Gtk.Settings.get_default (); gsettings.gtk_application_prefer_dark_theme = false; @@ -51,7 +51,7 @@ public class Sundown : Gtk.Application { header_bar.set_title ("Sundown"); if (css_provider == null) { css_provider = new Gtk.CssProvider (); - css_provider.load_from_resource ("/com/github/elementaryrevivals/sundown/Application.css"); + css_provider.load_from_resource ("/com/github/watsonprojects/sundown/Application.css"); // CSS Provider Gtk.StyleContext.add_provider_for_screen ( Gdk.Screen.get_default (),