Codebase list gnome-shell-extension-appindicator / ce31b42
testTool: Replace icons on scroll events Go through the scrolling event actions and based on that update the icon. Marco Trevisan (TreviƱo) 3 years ago
1 changed file(s) with 15 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
2525 'emoji-food-symbolic',
2626 ];
2727
28 const ScrollType = {
29 UP: 0,
30 DOWN: 1,
31 };
32
2833 (() => {
2934
3035 var app = new Gtk.Application({
213218 });
214219 indicator.connect("scroll-event", (indicator, steps, direction) => {
215220 print(`Signal \"scroll-event\" emitted. Steps: ${steps}, Direction: ${direction}`);
221 let currentIndex = iconsPool.indexOf(indicator.get_icon());
222 let iconIndex;
223
224 if (direction == ScrollType.UP) {
225 iconIndex = (currentIndex + 1) % iconsPool.length;
226 } else {
227 iconIndex = (currentIndex <= 0 ? iconsPool.length : currentIndex) - 1;
228 }
229
230 indicator.set_icon(iconsPool[iconIndex]);
216231 });
217232 });
218233 app.run(ARGV);