summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-04-02 23:38:04 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-04-02 23:38:04 +1100
commit65d05114085ccd6717c8c4805da85a5e2d80ecf3 (patch)
tree282fb6fdb3cca799512b30218fa3b8c45ed4981c /src
parentlauncher: fix typeerror (diff)
downloadcaelestia-shell-65d05114085ccd6717c8c4805da85a5e2d80ecf3.tar.gz
caelestia-shell-65d05114085ccd6717c8c4805da85a5e2d80ecf3.tar.bz2
caelestia-shell-65d05114085ccd6717c8c4805da85a5e2d80ecf3.zip
bar: fix workspaces visual glitch
Also use gtk truncate for active window and media playing For some reason, odd numbers of workspaces need the adjustment, but even don't
Diffstat (limited to 'src')
-rw-r--r--src/modules/bar.tsx18
-rw-r--r--src/utils/strings.ts2
2 files changed, 10 insertions, 10 deletions
diff --git a/src/modules/bar.tsx b/src/modules/bar.tsx
index c5a4fbb..731e3e7 100644
--- a/src/modules/bar.tsx
+++ b/src/modules/bar.tsx
@@ -3,7 +3,6 @@ import type { Monitor } from "@/services/monitors";
import Players from "@/services/players";
import Updates from "@/services/updates";
import { getAppCategoryIcon } from "@/utils/icons";
-import { ellipsize } from "@/utils/strings";
import { bindCurrentTime, osIcon } from "@/utils/system";
import type { AstalWidget } from "@/utils/types";
import { setupCustomTooltip } from "@/utils/widgets";
@@ -146,12 +145,11 @@ const ActiveWindow = ({ monitor, ...props }: ModuleProps) => (
}
/>
<label
+ truncate
angle={bind(config.vertical).as(v => (v ? 270 : 0))}
setup={self => {
const update = () =>
- (self.label = hyprland.focusedClient?.title
- ? ellipsize(hyprland.focusedClient.title, config.vertical.get() ? 25 : 40)
- : "Desktop");
+ (self.label = hyprland.focusedClient?.title ? hyprland.focusedClient.title : "Desktop");
hookFocusedClientProp(self, "title", update);
self.hook(config.vertical, update);
}}
@@ -192,11 +190,10 @@ const MediaPlaying = ({ monitor, ...props }: ModuleProps) => {
}
/>
<label
+ truncate
angle={bind(config.vertical).as(v => (v ? 270 : 0))}
setup={self => {
- // TODO: scroll text when playing or hover
- const update = () =>
- (self.label = ellipsize(getLabel("No media"), config.vertical.get() ? 25 : 40));
+ const update = () => (self.label = getLabel("No media"));
players.hookLastPlayer(self, ["notify::title", "notify::artist"], update);
self.hook(config.vertical, update);
}}
@@ -255,7 +252,12 @@ const Workspaces = ({ monitor, ...props }: ModuleProps) => (
hyprland.dispatch("workspace", (event.delta_y < 0 ? "-" : "+") + 1);
}}
>
- <box vertical={bind(config.vertical)} className={`module workspaces ${getClassName(props)}`}>
+ <box
+ vertical={bind(config.vertical)}
+ className={bind(config.modules.workspaces.shown).as(
+ s => `module workspaces ${s % 2 === 0 ? "even" : "odd"} ${getClassName(props)}`
+ )}
+ >
{bind(config.modules.workspaces.shown).as(
n => Array.from({ length: n }).map((_, idx) => <Workspace idx={idx + 1} />) // Start from 1
)}
diff --git a/src/utils/strings.ts b/src/utils/strings.ts
index 4aaa916..4786c6b 100644
--- a/src/utils/strings.ts
+++ b/src/utils/strings.ts
@@ -1,5 +1,3 @@
-export const ellipsize = (str: string, len: number) => (str.length > len ? `${str.slice(0, len - 1)}…` : str);
-
export const basename = (path: string, stripExt = true) => {
const lastSlash = path.lastIndexOf("/");
const lastDot = path.lastIndexOf(".");