Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workspace-grid@hernejj: Added the ability to change the color of the grid squares for the user interface in the applet #6191

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ const Lang = imports.lang;
const St = imports.gi.St;
const Clutter = imports.gi.Clutter;

function BarIndicatorStyle(applet, cols, rows, height) {
this._init(applet, cols, rows, height);
function BarIndicatorStyle(applet, cols, rows, height, uiColor) {
this._init(applet, cols, rows, height, uiColor);
}

BarIndicatorStyle.prototype = {

_init: function (applet, cols, rows, height) {
_init: function (applet, cols, rows, height, uiColor) {
this.applet = applet;
this.button = [];
this.uiColor = uiColor;
this.update_grid(cols, rows, height);
this.switch_id = global.window_manager.connect('switch-workspace', Lang.bind(this, this.update));
this.scroll_id = this.applet.actor.connect('scroll-event', Lang.bind(this, this.onMouseScroll));
Expand Down Expand Up @@ -153,10 +154,12 @@ BarIndicatorStyle.prototype = {
if (i == active_ws) {
this.button[i].get_child().set_text((i + 1).toString());
this.button[i].add_style_pseudo_class('outlined');
this.button[i].style = `background-color: ${this.uiColor};`;
}
else {
this.button[i].get_child().set_text((i + 1).toString());
this.button[i].remove_style_pseudo_class('outlined');
this.button[i].style = `border: 1px solid ${this.uiColor}; opacity: 1;`;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ MyApplet.prototype = {
this.settings.bindProperty(Settings.BindingDirection.IN, "style", "style", this.onUpdateStyle, null);
this.settings.bindProperty(Settings.BindingDirection.IN, "registerUpDownKeyBindings", "registerUpDownKeyBindings", this.onKeyBindingChanged, null);
this.settings.bindProperty(Settings.BindingDirection.IN, "scrollWheelBehavior", "scrollWheelBehavior", this.onUpdateScrollWheelBehavior, null);
this.settings.bindProperty(Settings.BindingDirection.IN, "uiColor", "uiColor", this.onUiColorChanged, null);

this.wscon = new WorkspaceController.WorkspaceController(this.numCols, this.numRows);
this.onUpdateStyle();
Expand Down Expand Up @@ -136,12 +137,16 @@ MyApplet.prototype = {
this.ui.update_grid(this.numCols, this.numRows, this._panelHeight);
},

onUiColorChanged: function() {
this.onUpdateStyle();
},

onUpdateStyle: function () {
if (this.ui) this.ui.cleanup();
if (this.style == 'single-row')
this.ui = new BarIndicatorStyle.BarIndicatorStyle(this, this.numCols, this.numRows, this._panelHeight);
this.ui = new BarIndicatorStyle.BarIndicatorStyle(this, this.numCols, this.numRows, this._panelHeight, this.uiColor);
else
this.ui = new GridStyle.GridStyle(this, this.numCols, this.numRows, this._panelHeight);
this.ui = new GridStyle.GridStyle(this, this.numCols, this.numRows, this._panelHeight, this.uiColor);
this.onUpdateScrollWheelBehavior();
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,10 @@
"Scroll By Column": "col",
"Scroll By Row": "row"
}
},
"uiColor": {
"type": "entry",
"default": "#0C75DE",
"description": "Choose the UI color by entering a hex color value:"
}
}