aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2023-03-01 13:48:46 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2023-03-01 13:48:46 +0100
commit15a2c211e2e13f18bc9e32b5b71c0a0f7da83f1e (patch)
treee25337a1cbde6445bf785513ebc924b3ef5d17eb
parenta4537a44bffc689d71714ac0d6b327877af237cc (diff)
downloadarctica-greeter-15a2c211e2e13f18bc9e32b5b71c0a0f7da83f1e.tar.gz
arctica-greeter-15a2c211e2e13f18bc9e32b5b71c0a0f7da83f1e.tar.bz2
arctica-greeter-15a2c211e2e13f18bc9e32b5b71c0a0f7da83f1e.zip
src/toggle-box.vala: Allow for more fine-grained color-tweaking of the toggle box (session selector box) via gsettings.
-rw-r--r--data/org.ArcticaProject.arctica-greeter.gschema.xml37
-rw-r--r--src/settings.vala7
-rw-r--r--src/toggle-box.vala52
3 files changed, 88 insertions, 8 deletions
diff --git a/data/org.ArcticaProject.arctica-greeter.gschema.xml b/data/org.ArcticaProject.arctica-greeter.gschema.xml
index 98ce440..ddf730f 100644
--- a/data/org.ArcticaProject.arctica-greeter.gschema.xml
+++ b/data/org.ArcticaProject.arctica-greeter.gschema.xml
@@ -6,16 +6,45 @@
<summary>Background file to use, either an image path or a color (e.g. #772953)</summary>
</key>
<key name="background-color" type="s">
- <default>'#2F70C6'</default>
+ <default>'#4B1635'</default>
<summary>Background color (e.g. #772953), set before wallpaper is seen</summary>
</key>
<key name="togglebox-font-fgcolor" type="s">
+ <default>'#808080'</default>
+ <summary>Font foreground color (e.g. #A0A0A0) for non-active/-hovered and non-selected session names in the session list</summary>
+ </key>
+ <key name="togglebox-font-fgcolor-active" type="s">
<default>'#A0A0A0'</default>
- <summary>Font foreground color (e.g. #A0A0A0) for selected session names in session list</summary>
+ <summary>Font foreground color (e.g. #A0A0A0) for the active/hovered-above session name in the session list</summary>
+ </key>
+ <key name="togglebox-font-fgcolor-selected" type="s">
+ <default>'#F0F0F0'</default>
+ <summary>Font foreground color (e.g. #A0A0A0) for the selected session name in the session list</summary>
</key>
<key name="togglebox-button-bgcolor" type="s">
- <default>'#2F70C6'</default>
- <summary>Font foreground color (e.g. #202020) for selected session names in session list</summary>
+ <default>'#4B1635'</default>
+ <summary>Background color (e.g. #391C31) for non-active/-hovered and non-selected session names in the session list</summary>
+ </key>
+ <key name="togglebox-button-bgcolor-active" type="s">
+ <default>'#391C31'</default>
+ <summary>Background color (e.g. #391C31) for the active/hovered-above session name in the session list</summary>
+ </key>
+ <key name="togglebox-button-bgcolor-selected" type="s">
+ <default>'#391C31'</default>
+ <summary>Background color (e.g. #391C31) for the selected session name in the session list</summary>
+ </key>
+ <key name="togglebox-button-bordercolor" type="s">
+ <default>'#4B1635'</default>
+ <summary>Border color (e.g. #391C31) for non-active/-hovered and non-selected session names in the session list</summary>
+ </key>
+ <key name="togglebox-button-bordercolor-active" type="s">
+ <default>'#391C31'</default>
+ <summary>Border color (e.g. #391C31) for the active/hovered-above session name in the session list</summary>
+ </key>
+ <key name="togglebox-button-bordercolor-selected" type="s">
+ <default>'#391C31'</default>
+ <summary>Border color (e.g. #391C31) for the selected session name in the session list</summary>
+ </key>
<key name="flatbutton-bgcolor" type="s">
<default>'#4B1635'</default>
<summary>Background color (e.g. #391C31) of flat buttons (e.g. the session chooser icon)</summary>
diff --git a/src/settings.vala b/src/settings.vala
index c90f3da..a2dabd0 100644
--- a/src/settings.vala
+++ b/src/settings.vala
@@ -54,7 +54,14 @@ public class AGSettings : Object
public const string KEY_ONLY_ON_MONITOR = "only-on-monitor";
public const string KEY_REMOTE_SERVICE_CONFIGURE_URI = "remote-service-configure-uri";
public const string KEY_TOGGLEBOX_FONT_FGCOLOR = "togglebox-font-fgcolor";
+ public const string KEY_TOGGLEBOX_FONT_FGCOLOR_ACTIVE = "togglebox-font-fgcolor-active";
+ public const string KEY_TOGGLEBOX_FONT_FGCOLOR_SELECTED = "togglebox-font-fgcolor-selected";
public const string KEY_TOGGLEBOX_BUTTON_BGCOLOR = "togglebox-button-bgcolor";
+ public const string KEY_TOGGLEBOX_BUTTON_BGCOLOR_ACTIVE = "togglebox-button-bgcolor-active";
+ public const string KEY_TOGGLEBOX_BUTTON_BGCOLOR_SELECTED = "togglebox-button-bgcolor-selected";
+ public const string KEY_TOGGLEBOX_BUTTON_BORDERCOLOR = "togglebox-button-bordercolor";
+ public const string KEY_TOGGLEBOX_BUTTON_BORDERCOLOR_ACTIVE = "togglebox-button-bordercolor-active";
+ public const string KEY_TOGGLEBOX_BUTTON_BORDERCOLOR_SELECTED = "togglebox-button-bgcolor-selected";
public const string KEY_FLATBUTTON_BGCOLOR = "flatbutton-bgcolor";
public const string KEY_FLATBUTTON_BORDERCOLOR = "flatbutton-bordercolor";
public const string KEY_ENABLE_HIDPI = "enable-hidpi";
diff --git a/src/toggle-box.vala b/src/toggle-box.vala
index ada1947..0c6bf57 100644
--- a/src/toggle-box.vala
+++ b/src/toggle-box.vala
@@ -45,6 +45,32 @@ public class ToggleBox : Gtk.Box
scrolled_window.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
scrolled_window.set_shadow_type (Gtk.ShadowType.NONE);
+ try
+ {
+ /* Tighten padding on buttons to not be so large, default color scheme for buttons */
+ var style = new Gtk.CssProvider ();
+ style.load_from_data ("* {\n"+
+ " background-color: %s;\n".printf(AGSettings.get_string (AGSettings.KEY_TOGGLEBOX_BUTTON_BGCOLOR))+
+ " background-image: none;"+
+ " border-color: %s\n;".printf(AGSettings.get_string (AGSettings.KEY_TOGGLEBOX_BUTTON_BORDERCOLOR))+
+ "}\n" +
+ "*.high_contrast {\n" +
+ " background-color: %s;\n".printf ("rgba(255, 255, 255, 1.0)") +
+ " border-color: %s\n;".printf ("rgba(0, 0, 0, 1.0)") +
+ "}\n" +
+ "*.high_contrast:hover,\n" +
+ "*.high_contrast:active,\n" +
+ "*.high_contrast:hover:active,\n" +
+ "*.high_contrast.selected {\n" +
+ " background-color: %s;\n".printf ("rgba(0, 0, 0, 1.0)") +
+ "}\n", -1);
+ scrolled_box.get_style_context ().add_provider (style, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+ }
+ catch (Error e)
+ {
+ debug ("Internal error loading session chooser style: %s", e.message);
+ }
+
/* Split font family and size via regular expression. */
Regex font_regexp = new Regex ("^([[:blank:]]*)(?<font_family>[ a-zA-Z0-9]+) (?<font_size>[0-9]+)([[:blank:]]*)$");
MatchInfo font_info;
@@ -77,14 +103,22 @@ public class ToggleBox : Gtk.Box
var style = new Gtk.CssProvider ();
style.load_from_data ("* {padding: 8px;}\n"+
"GtkButton, button {\n"+
- " background-color: %s;\n".printf("rgba(0,0,0,0)")+
+ " color: %s;\n".printf (AGSettings.get_string (AGSettings.KEY_TOGGLEBOX_FONT_FGCOLOR)) +
+ " background-color: %s;\n".printf(AGSettings.get_string (AGSettings.KEY_TOGGLEBOX_BUTTON_BGCOLOR))+
" background-image: none;"+
+ " border-color: %s\n;".printf(AGSettings.get_string (AGSettings.KEY_TOGGLEBOX_BUTTON_BORDERCOLOR))+
"}\n"+
"button:hover,\n"+
"button:active,\n" +
- "button:hover:active,\n" +
+ "button:hover:active {\n"+
+ " color: %s;\n".printf (AGSettings.get_string (AGSettings.KEY_TOGGLEBOX_FONT_FGCOLOR_ACTIVE)) +
+ " background-color: %s;\n".printf(AGSettings.get_string (AGSettings.KEY_TOGGLEBOX_BUTTON_BGCOLOR_ACTIVE))+
+ " border-color: %s\n;".printf(AGSettings.get_string (AGSettings.KEY_TOGGLEBOX_BUTTON_BORDERCOLOR_ACTIVE))+
+ "}\n" +
"button.selected {\n"+
- " background-color: %s;\n".printf(AGSettings.get_string (AGSettings.KEY_TOGGLEBOX_BUTTON_BGCOLOR))+
+ " color: %s;\n".printf (AGSettings.get_string (AGSettings.KEY_TOGGLEBOX_FONT_FGCOLOR_SELECTED)) +
+ " background-color: %s;\n".printf(AGSettings.get_string (AGSettings.KEY_TOGGLEBOX_BUTTON_BGCOLOR_SELECTED))+
+ " border-color: %s\n;".printf(AGSettings.get_string (AGSettings.KEY_TOGGLEBOX_BUTTON_BORDERCOLOR_SELECTED))+
"}\n" +
"button.high_contrast {\n" +
" background-color: %s;\n".printf ("rgba(70, 70, 70, 1.0)") +
@@ -134,6 +168,17 @@ public class ToggleBox : Gtk.Box
item.clicked.connect (button_clicked_cb);
var hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
+ try {
+ var style = new Gtk.CssProvider ();
+ style.load_from_data ("* {\n"+
+ " outline-width: 0px;\n" +
+ "}\n", -1);
+ hbox.get_style_context().add_provider (style, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+ }
+ catch (Error e)
+ {
+ debug ("Internal error loading session chooser hbox style: %s", e.message);
+ }
if (icon != null)
{
@@ -156,7 +201,6 @@ public class ToggleBox : Gtk.Box
style.load_from_data ("label {\n" +
" font-family: \"%s\", sans-serif;\n".printf (font_family) +
" font-size: %d;\n".printf (font_size + 2) +
- " color: %s;\n".printf (AGSettings.get_string (AGSettings.KEY_TOGGLEBOX_FONT_FGCOLOR)) +
"}\n" +
"label.high_contrast {\n" +
" color: %s;\n".printf ("rgba(255, 255, 255, 1.0)") +