Skip to content

Commit

Permalink
v3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MickeyUK committed Jul 12, 2024
1 parent 4875c11 commit 883dc5c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
27 changes: 22 additions & 5 deletions frontend/src/widgets/WidgetChat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ export default {
config: window.$config.chat,
messages: [] as (Message)[],
bubbles: [] as (Message)[],
isFocused: false
isFocused: false,
bubbleTimeout: 5000
}),
computed: {
messagesLimited() {
return this.messages.slice(0, 100);
},
historyEnabled() {
return (this.showHistory && this.isFocused) || window.$designMode;
return (this.config.showHistory && this.isFocused) || window.$designMode;
}
},
methods: {
Expand Down Expand Up @@ -89,7 +90,8 @@ export default {
this.isFocused = true;
EventsEmit('app:focus');
setTimeout(() => {
this.$refs['input-chat'].focus();
this.$refs['input-chat']?.focus();
this.$refs['input-chat']?.focus();
}, 100);
},
Expand Down Expand Up @@ -123,8 +125,7 @@ export default {
message.type,
message.user
));
// Give the bubble a timeout
setTimeout(() => {
const bubble = this.bubbles.find(b => b.id === id);
if (bubble) {
Expand All @@ -139,6 +140,22 @@ export default {
// Clear the input
this.$refs['input-chat'].value = '';
},
findCSSRule(className, property) {
const sheets = document.styleSheets;
for (let i = 0; i < sheets.length; i++) {
const rules = sheets[i].cssRules || sheets[i].rules;
for (let j = 0; j < rules.length; j++) {
const rule = rules[j] as CSSStyleRule;
if (rule.selectorText && rule.selectorText.includes(className)) {
if (rule.style && rule.style[property] !== undefined) {
return rule.style[property];
}
}
}
}
return null;
}
},
mounted() {
Expand Down
17 changes: 6 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,13 @@ func toggleClickThrough() {

// Set the window to be click-through
func focus() {
if designMode {
return
}
exStyle := win.GetWindowLong(hwnd, win.GWL_EXSTYLE)
exStyle &^= win.WS_EX_TRANSPARENT
win.SetWindowLong(hwnd, win.GWL_EXSTYLE, exStyle)
}

// Set the window to be interactable
func blur() {
if designMode {
return
}
exStyle := win.GetWindowLong(hwnd, win.GWL_EXSTYLE)
exStyle |= win.WS_EX_TRANSPARENT
win.SetWindowLong(hwnd, win.GWL_EXSTYLE, exStyle)
Expand All @@ -128,12 +122,11 @@ func startup(ctx context.Context) {
if !designMode {
exStyle &^= win.WS_EX_APPWINDOW
}

win.SetWindowLong(hwnd, win.GWL_EXSTYLE, exStyle)

// Set the window to be click-through
if !designMode {
toggleClickThrough()
}
toggleClickThrough()

// Set window position
if monitor, ok := getProp("Overlay", "monitor"); ok {
Expand Down Expand Up @@ -383,9 +376,11 @@ func main() {
// Create application with options
err := wails.Run(&options.App{
Title: "smash-soda-overlay",
Frameless: !designMode,
WindowStartState: options.Maximised,
Fullscreen: true,
Frameless: true,
WindowStartState: options.Fullscreen,
AlwaysOnTop: true,
DisableResize: true,
BackgroundColour: &options.RGBA{R: 0, G: 0, B: 0, A: 0},
AssetServer: &assetserver.Options{
Assets: assets,
Expand Down

0 comments on commit 883dc5c

Please sign in to comment.