Skip to content

Commit

Permalink
Style stacks (do not PR)
Browse files Browse the repository at this point in the history
  • Loading branch information
MeowcaTheoRange committed Oct 12, 2023
1 parent adeb087 commit 5a7a888
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 46 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
66 changes: 20 additions & 46 deletions src/stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import type { Entity } from './ecs';
import type { Ext } from './extension';
import type { ShellWindow } from './window';

import * as Ecs from 'ecs';
import * as a from 'arena';
import * as Ecs from 'ecs';
import * as utils from 'utils';

const Arena = a.Arena;
Expand Down Expand Up @@ -34,25 +34,26 @@ interface StackWidgets {
function stack_widgets_new(): StackWidgets {
let tabs = new St.BoxLayout({
style_class: 'pop-shell-stack',
x_expand: true
pack_start: true,
x_expand: false
});

tabs.get_layout_manager()?.set_homogeneous(true);
// tabs.get_layout_manager()?.set_homogeneous(true);

return { tabs };
}

const ContainerButton = GObject.registerClass({
Signals: { 'activate': {} },
}, class ImageButton extends St.Button {
_init(icon: St.Icon) {
super._init({
child: icon,
x_expand: true,
y_expand: true,
})
}
})
// const ContainerButton = GObject.registerClass({
// Signals: { 'activate': {} },
// }, class ImageButton extends St.Button {
// _init(icon: St.Icon) {
// super._init({
// child: icon,
// x_expand: true,
// y_expand: true,
// })
// }
// })

interface TabButton extends St.Button {
set_title: (title: string) => void;
Expand All @@ -62,49 +63,22 @@ const TabButton = GObject.registerClass({
Signals: { 'activate': {} },
}, class TabButton extends St.Button {
_init(window: ShellWindow) {
const icon = window.icon(window.ext, 24)
icon.set_x_align(Clutter.ActorAlign.START)

const label = new St.Label({
y_expand: true,
x_align: Clutter.ActorAlign.START,
y_align: Clutter.ActorAlign.CENTER,
style: "padding-left: 8px"
})

label.text = window.title()
const icon = window.icon(window.ext, TAB_HEIGHT)
icon.set_x_align(Clutter.ActorAlign.CENTER)

const container = new St.BoxLayout({
y_expand: true,
y_align: Clutter.ActorAlign.CENTER,
y_align: Clutter.ActorAlign.START
})

const close_button = new ContainerButton(new St.Icon({
icon_name: 'window-close-symbolic',
icon_size: 24,
y_align: Clutter.ActorAlign.CENTER,
}))

close_button.connect('clicked', () => {
window.meta.delete(global.get_current_time())
})

close_button.set_x_align(Clutter.ActorAlign.END)
close_button.set_y_align(Clutter.ActorAlign.CENTER)

container.add_actor(icon)
container.add_actor(label)
container.add_actor(close_button)

super._init({
child: container,
x_expand: true,
x_expand: false,
y_expand: true,
y_align: Clutter.ActorAlign.CENTER,
y_align: Clutter.ActorAlign.START,
})


this._title = label
}

set_title(text: string) {
Expand Down

0 comments on commit 5a7a888

Please sign in to comment.