Skip to content

Commit

Permalink
add "always on top" option
Browse files Browse the repository at this point in the history
  • Loading branch information
zuluwi committed Jan 24, 2024
1 parent b387343 commit fd58746
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/language/locale/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default {
Port: "Port",
"Enter the port for the server that will be opened to control VLC Player": "Enter the port for the server that will be opened to control VLC Player",
//
"Always show VLC Player on top": "Always show VLC Player on top",
"Pause video while pasting timestamp": "Pause video while pasting timestamp",
"Pause video while pasting snapshot": "Pause video while pasting snapshot",
//
Expand Down
1 change: 1 addition & 0 deletions src/language/locale/tr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default {
Port: "Port",
"Enter the port for the server that will be opened to control VLC Player": "VLC Player'ı kontrol etmek için açılacak server için port giriniz",
//
"Always show VLC Player on top": "VLC Player'ı her zaman üstte göster",
"Pause video while pasting timestamp": "Zaman damgası yapıştırırken videoyu duraklat",
"Pause video while pasting snapshot": "Snapshot yapıştırırken videoyu duraklat",
//
Expand Down
27 changes: 18 additions & 9 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface VBPluginSettings {
lang: string;
normalSeek: number;
largeSeek: number;
alwaysOnTop: boolean;
pauseOnPasteLink: boolean;
pauseOnPasteSnapshot: boolean;
}
Expand All @@ -29,6 +30,7 @@ export const DEFAULT_SETTINGS: VBPluginSettings = {
lang: "en",
normalSeek: 5,
largeSeek: 60,
alwaysOnTop: true,
pauseOnPasteLink: false,
pauseOnPasteSnapshot: false,
};
Expand Down Expand Up @@ -75,9 +77,9 @@ export class VBPluginSettingsTab extends PluginSettingTab {
const setCopyBtnDesc = () => {
copyUrlEl.setDesc(`http://:${this.plugin.settings.port}@localhost:${this.plugin.settings.password}/`);
copyCommandEl.setDesc(`"${this.plugin.settings.vlcPath}" ${this.plugin.vlcExecOptions().join(" ")}`);
copyArgEl.setDesc(`${this.plugin.vlcExecOptions().join(" ").replace(/["]/g, "")}`).descEl.createEl("div", {
text: t("Note: If the `--snapshot-path` option contains spaces, the snapshot command will not work (this only happens for Syncplay arguments)"),
});
// copyArgEl.setDesc(`${this.plugin.vlcExecOptions().join(" ").replace(/["]/g, "")}`).descEl.createEl("div", {
// text: t("Note: If the `--snapshot-path` option contains spaces, the snapshot command will not work (this only happens for Syncplay arguments)"),
// });
};

var selectVLCDescEl: HTMLElement;
Expand Down Expand Up @@ -127,6 +129,13 @@ export class VBPluginSettingsTab extends PluginSettingTab {
})
);

new Setting(containerEl).setName(t("Always show VLC Player on top")).addToggle((toggle) => {
toggle.setValue(this.plugin.settings.alwaysOnTop).onChange(async (value) => {
this.plugin.settings.alwaysOnTop = value;
await this.plugin.saveSettings();
setCopyBtnDesc();
});
});
new Setting(containerEl).setName(t("Pause video while pasting timestamp")).addToggle((toggle) => {
toggle.setValue(this.plugin.settings.pauseOnPasteLink).onChange((value) => {
this.plugin.settings.pauseOnPasteLink = value;
Expand Down Expand Up @@ -226,12 +235,12 @@ export class VBPluginSettingsTab extends PluginSettingTab {
new Notice(t("Copied to clipboard"));
})
);
copyArgEl = new Setting(containerEl).setName(t("Copy arguments for starting VLC (for Syncplay)")).addButton((btn) =>
btn.setButtonText(t("Copy to clipboard")).onClick(async () => {
await navigator.clipboard.writeText(`${this.plugin.vlcExecOptions().join(" ")}`);
new Notice(t("Copied to clipboard"));
})
);
// copyArgEl = new Setting(containerEl).setName(t("Copy arguments for starting VLC (for Syncplay)")).addButton((btn) =>
// btn.setButtonText(t("Copy to clipboard")).onClick(async () => {
// await navigator.clipboard.writeText(`${this.plugin.vlcExecOptions().join(" ")}`);
// new Notice(t("Copied to clipboard"));
// })
// );
setCopyBtnDesc();

//
Expand Down
1 change: 1 addition & 0 deletions src/vlcHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export function passPlugin(plugin: VLCBridgePlugin) {
`--snapshot-format="${plugin.settings.snapshotExt}"`,
`--snapshot-prefix="${plugin.settings.snapshotPrefix}-"`,
`--drawable-hwnd=1`,
`${plugin.settings.alwaysOnTop ? "--video-on-top" : ""}`,
];

const launchVLC = () => {
Expand Down

0 comments on commit fd58746

Please sign in to comment.