Skip to content

Commit 199c286

Browse files
committed
IconGroup: change focused style
1 parent ad315c8 commit 199c286

File tree

4 files changed

+79
-23
lines changed

4 files changed

+79
-23
lines changed

data/Application.css

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,24 @@ icongroup .icon-group-box {
8282
0 1px 4px alpha(@borders, 0.4);
8383
border-radius: 6px;
8484
border-spacing: 3px;
85+
transition:
86+
background 200ms cubic-bezier(0.4, 0, 0.2, 1),
87+
box-shadow 200ms cubic-bezier(0.4, 0, 0.2, 1);
8588
}
8689

87-
.reduce-transparency icongroup box {
90+
icongroup.running .icon-group-box {
91+
background: alpha(@base_color, 0.7);
92+
box-shadow:
93+
inset 0 -1px 0 0 alpha(@highlight_color, 0.2),
94+
inset 0 1px 0 0 alpha(@highlight_color, 0.3),
95+
inset 1px 0 0 0 alpha(@highlight_color, 0.07),
96+
inset -1px 0 0 0 alpha(@highlight_color, 0.07),
97+
0 0 0 1px alpha(@borders, 0.3),
98+
0 4px 6px -1px alpha(@borders, 0.8),
99+
0 3px 2px -1px alpha(@borders, 0.6);
100+
}
101+
102+
.reduce-transparency icongroup .icon-group-box {
88103
background: @base_color;
89104
}
90105

src/AppSystem/Launcher.vala

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,39 @@ public class Dock.Launcher : BaseItem {
2525

2626
public App app { get; construct; }
2727

28+
private bool _moving;
29+
public new bool moving {
30+
get { return _moving; }
31+
set {
32+
_moving = value;
33+
34+
if (value) {
35+
bin.width_request = bin.get_width ();
36+
bin.height_request = bin.get_height ();
37+
} else {
38+
bin.width_request = -1;
39+
bin.height_request = -1;
40+
}
41+
42+
overlay.visible = !value;
43+
running_revealer.reveal_child = !value && state != HIDDEN;
44+
}
45+
}
46+
47+
private State _state;
48+
public new State state {
49+
get { return _state; }
50+
set {
51+
_state = value;
52+
running_revealer.reveal_child = (value != HIDDEN) && !moving;
53+
running_revealer.sensitive = value == ACTIVE;
54+
}
55+
}
56+
2857
private Gtk.Image image;
2958
private Gtk.Revealer progress_revealer;
3059
private Gtk.Revealer badge_revealer;
60+
private Gtk.Revealer running_revealer;
3161
private Adw.TimedAnimation bounce_up;
3262
private Adw.TimedAnimation bounce_down;
3363
private Gtk.PopoverMenu popover;
@@ -101,6 +131,24 @@ public class Dock.Launcher : BaseItem {
101131

102132
tooltip_text = app.app_info.get_display_name ();
103133

134+
var running_indicator = new Gtk.Image.from_icon_name ("pager-checked-symbolic");
135+
running_indicator.add_css_class ("running-indicator");
136+
137+
running_box = new Gtk.Box (HORIZONTAL, 0) {
138+
halign = CENTER
139+
};
140+
running_box.append (running_indicator);
141+
142+
running_revealer = new Gtk.Revealer () {
143+
can_target = false,
144+
child = running_box,
145+
overflow = VISIBLE,
146+
transition_type = CROSSFADE,
147+
valign = END
148+
};
149+
150+
append (running_revealer);
151+
104152
insert_action_group (ACTION_GROUP_PREFIX, app.action_group);
105153

106154
// We have to destroy the progressbar when it is not needed otherwise it will

src/BaseIconGroup.vala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,20 @@ public abstract class Dock.BaseIconGroup : BaseItem {
1111

1212
public ListModel icons { get; construct; }
1313

14+
private State _state;
15+
public new State state {
16+
get { return _state; }
17+
set {
18+
_state = value;
19+
20+
if ((value != HIDDEN) && !moving) {
21+
add_css_class ("running");
22+
} else if (has_css_class ("running")) {
23+
remove_css_class("running");
24+
}
25+
}
26+
}
27+
1428
private Gtk.Grid grid;
1529

1630
class construct {

src/BaseItem.vala

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public class Dock.BaseItem : Gtk.Box {
4949
}
5050

5151
overlay.visible = !value;
52-
running_revealer.reveal_child = !value && state != HIDDEN;
5352
}
5453
}
5554

@@ -58,17 +57,14 @@ public class Dock.BaseItem : Gtk.Box {
5857
get { return _state; }
5958
set {
6059
_state = value;
61-
running_revealer.reveal_child = (value != HIDDEN) && !moving;
62-
running_revealer.sensitive = value == ACTIVE;
6360
}
6461
}
6562

6663
protected Gtk.Overlay overlay;
6764
protected Gtk.GestureClick gesture_click;
6865
protected Gtk.Box running_box;
6966

70-
private Granite.Bin bin;
71-
private Gtk.Revealer running_revealer;
67+
protected Granite.Bin bin { get; private set; }
7268

7369
private Adw.TimedAnimation fade;
7470
private Adw.TimedAnimation reveal;
@@ -89,24 +85,7 @@ public class Dock.BaseItem : Gtk.Box {
8985
child = overlay
9086
};
9187

92-
var running_indicator = new Gtk.Image.from_icon_name ("pager-checked-symbolic");
93-
running_indicator.add_css_class ("running-indicator");
94-
95-
running_box = new Gtk.Box (HORIZONTAL, 0) {
96-
halign = CENTER
97-
};
98-
running_box.append (running_indicator);
99-
100-
running_revealer = new Gtk.Revealer () {
101-
can_target = false,
102-
child = running_box,
103-
overflow = VISIBLE,
104-
transition_type = CROSSFADE,
105-
valign = END
106-
};
107-
10888
append (bin);
109-
append (running_revealer);
11089

11190
icon_size = dock_settings.get_int ("icon-size");
11291
dock_settings.changed["icon-size"].connect (() => {

0 commit comments

Comments
 (0)