Skip to content

Commit

Permalink
Seperator pipes are now in seperate labels rather than in the same la…
Browse files Browse the repository at this point in the history
…bel as the title
  • Loading branch information
sakithb committed Aug 28, 2021
1 parent a0855ed commit a55d05a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
34 changes: 31 additions & 3 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ let buttonNext,
iconPlay,
iconPrev,
iconPlayer,
labelText;
labelText,
labelSeperatorStart,
labelSeperatorEnd;

// Button trigger methods

Expand Down Expand Up @@ -160,11 +162,21 @@ const addContent = () => {
currentIndex++;
}
if (!hideTrackName) {
Main.panel[positions[extensionPosition]].insert_child_at_index(
labelSeperatorStart,
extensionIndex + currentIndex
);
currentIndex++;
Main.panel[positions[extensionPosition]].insert_child_at_index(
buttonLabel,
extensionIndex + currentIndex
);
currentIndex++;
Main.panel[positions[extensionPosition]].insert_child_at_index(
labelSeperatorEnd,
extensionIndex + currentIndex
);
currentIndex++;
}
if (!hideControls) {
Main.panel[positions[extensionPosition]].insert_child_at_index(
Expand Down Expand Up @@ -325,7 +337,7 @@ const updateContent = () => {
iconPlayer.set_icon_name(playerIcon);
lastPlayerChanged = false;
}
labelText.set_text(`| ${displayText} |`);
labelText.set_text(`${displayText}`);
};

// Lifecycle methods
Expand All @@ -351,6 +363,9 @@ const enable = () => {

onMaxLengthChanged = settings.connect("changed::max-text-length", () => {
maxDisplayLength = settings.get_int("max-text-length");
// buttonLabel.set_style(
// `width: ${maxDisplayLength}px;text-overflow: clip;`
// );
// log(`Updated setting "maxDisplayLength": ${maxDisplayLength}`);
});

Expand Down Expand Up @@ -463,7 +478,18 @@ const enable = () => {

labelText = new St.Label({
text: "No player found",
// style: "font-family: monospace, monospace;",
y_align: Clutter.ActorAlign.CENTER,
});

labelSeperatorStart = new St.Label({
text: "|",
style: "padding-right: 2px;",
y_align: Clutter.ActorAlign.CENTER,
});

labelSeperatorEnd = new St.Label({
text: "|",
style: "padding-left: 2px;",
y_align: Clutter.ActorAlign.CENTER,
});

Expand All @@ -480,6 +506,8 @@ const enable = () => {
buttonLabel.set_child(labelText);
buttonLabel.connect("button-release-event", _mouseAction);

// buttonLabel.set_style(`width: ${maxDisplayLength}px;`);

// Initialize content
updatePlayerIconEffects();

Expand Down
2 changes: 1 addition & 1 deletion prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function buildPrefsWidget() {
let entryMaxDisplayLength = new Gtk.SpinButton({
adjustment: new Gtk.Adjustment({
lower: 1,
upper: 100,
upper: 300,
step_increment: 1,
}),
visible: true,
Expand Down

0 comments on commit a55d05a

Please sign in to comment.