This commit is contained in:
sankalp committed 2024-07-02 08:57:20 +05:45
1 parent 3494e3b1dd
commit 2079a9f505
6 files changed
+224 -69

No files matched your search

+16 -10
View File
@@ -130,11 +130,13 @@ function RecentPage() {
});
box.hook(recent, (self) => {
Utils.idle(() => {
const flow = Widget.FlowBox();
const flow = Widget.FlowBox({
homogeneous: true
});
flow.set_min_children_per_line(5);
flow.set_max_children_per_line(25);
for (const emojiKey in recent.value) {
let emoji = emojiList[emojiKey];
flow.set_min_children_per_line(5);
flow.set_max_children_per_line(25);
flow.add(Widget.Button({
class_name: "standard_icon_button emoji",
label: emoji,
@@ -170,11 +172,13 @@ function SearchPage(search: VType<string>) {
Utils.idle(() => {
if (search.value.length == 0)
return
const flow = Widget.FlowBox();
const flow = Widget.FlowBox({
homogeneous: true
});
flow.set_min_children_per_line(5);
flow.set_max_children_per_line(25);
for (const emojiKey in emojiList) {
let emoji = emojiList[emojiKey];
flow.set_min_children_per_line(5);
flow.set_max_children_per_line(25);
if (searchString(emojiKey, search.value))
flow.add(Widget.Button({
class_name: "standard_icon_button emoji",
@@ -215,12 +219,14 @@ function Page(category) {
hpack: "start",
}), false, false, 0
)
const flow = Widget.FlowBox();
const flow = Widget.FlowBox({
homogeneous: true
});
flow.set_min_children_per_line(5);
flow.set_max_children_per_line(25);
let emojis = category[subcategoryKey];
for (let emojiKey in emojis) {
let emoji = emojis[emojiKey];
flow.set_min_children_per_line(5);
flow.set_max_children_per_line(25);
flow.add(Widget.Button({
class_name: "standard_icon_button emoji",
label: emoji,
@@ -325,7 +331,7 @@ export const EmojisWindow = () => {
let window = RegularWindow({
title: "Emoji Picker",
default_height: 600,
default_width: 700,
default_width: 530,
class_name: "emojis",
child: EmojiList(),
setup(win: any) {
+3 -2
View File
@@ -78,7 +78,7 @@ function AppItem(app: Application): Box<any, any> {
button.connect('clicked', () => {
clickCount++;
if (clickCount === 1) {
if (clickCount === 2) {
incrementLaunchCount(app.name);
App.closeWindow(WINDOW_NAME);
app.launch();
@@ -144,7 +144,7 @@ const Applauncher = ({ width = 500, height = 500, spacing = 12 }) => {
margin_left: 14,
children: [
entry,
Widget.Separator(),
Widget.Scrollable({
hscroll: "never",
css: `min-width: ${width}px;`
@@ -175,5 +175,6 @@ export const applauncher = popupwindow({
height: 500,
spacing: 0,
}),
//anchor: ["top", "left"]
anchor: ["bottom", "left"]
})
+2 -1
View File
@@ -27,7 +27,7 @@ function ClipHistItem(entry: string) {
button.connect('clicked', () => {
clickCount++;
if (clickCount === 1) {
if (clickCount === 2) {
App.closeWindow(WINDOW_NAME);
Utils.execAsync(`${App.configDir}/scripts/cliphist.sh --copy-by-id ${id}`)
clickCount = 0;
@@ -97,6 +97,7 @@ function ClipHistWidget({ width = 500, height = 500, spacing = 12 }) {
margin_right: 14,
children: [
entry,
Widget.Separator(),
Widget.Scrollable({
hscroll: "never",
css: `min-width: ${width}px;`
+112
View File
@@ -0,0 +1,112 @@
const WINDOW_NAME = "musicplayer";
import popupwindow from './misc/popupwindow.ts';
import Box from 'types/widgets/box.js';
import Gtk from "gi://Gtk?version=3.0";
import GLib from "gi://GLib?version=2.0";
type Track = {
id: string;
title: string;
artist: string;
url: string; // Assuming we use URLs for identification, but not playback.
};
function MusicPlayerItem(track: Track) {
let button = Widget.Button({
class_name: "track_container",
child: Widget.Label({
label: `${track.title} - ${track.artist}`,
class_name: "track_label",
xalign: 0,
vpack: "center",
truncate: "end",
})
});
button.connect('clicked', () => {
playTrack(track); // Function to handle playback
});
return Widget.Box({
orientation: Gtk.Orientation.VERTICAL,
children: [
button,
Widget.Separator({
orientation: Gtk.Orientation.HORIZONTAL
})
]
});
}
async function playTrack(track: Track) {
try {
// Placeholder for playing audio via libcanberra or other suitable GTK audio APIs
GLib.spawn_command_line_async(`canberra-gtk-play -i audio-file-id`);
} catch (error) {
console.error(`Error playing track: ${error}`);
}
}
function MusicPlayerWidget({ width = 500, height = 500, spacing = 12 }) {
let tracks: Track[] = [
{ id: "1", title: "Track 1", artist: "Artist 1", url: "1" },
{ id: "2", title: "Track 2", artist: "Artist 2", url: "2" },
{ id: "3", title: "Track 3", artist: "Artist 3", url: "3" }
// Add more tracks as needed
];
let widgets: Box<any, any>[] = tracks.map(track => MusicPlayerItem(track));
const list = Widget.Box({
vertical: true,
spacing,
children: widgets
});
const entry = Widget.Entry({
hexpand: true,
class_name: "musicplayer_entry",
placeholder_text: "Search",
on_change: ({ text }) => widgets.forEach(item => {
item.visible = item.attribute.content.match(text ?? "")
}),
});
return Widget.Box({
vertical: true,
class_name: "musicplayer_box",
margin_top: 14,
margin_right: 14,
children: [
entry,
Widget.Scrollable({
hscroll: "never",
css: `min-width: ${width}px;`
+ `min-height: ${height}px;`,
child: list,
}),
],
setup: self => self.hook(App, (_, windowName, visible) => {
if (windowName !== WINDOW_NAME)
return;
if (visible) {
entry.text = "";
}
}),
});
}
export const musicplayer = popupwindow({
name: WINDOW_NAME,
class_name: "musicplayer",
visible: false,
keymode: "exclusive",
child: MusicPlayerWidget({
width: 500,
height: 500,
spacing: 0,
}),
anchor: ["bottom", "right"]
});
+14 -3
View File
@@ -1,5 +1,6 @@
@import "./colors.css";
/* -----------------------------------------------------
* Settings
* ----------------------------------------------------- */
@@ -147,14 +148,16 @@
border-color: @outlineVariant;
}
.settings entry, .settings combobox {
.settings entry,
.settings combobox {
min-width: 30px;
min-height: 32px;
border-radius: 4px;
background-color: @surfaceContainerHigh;
}
.settings entry label, .settings combobox label {
.settings entry label,
.settings combobox label {
color: @onSurface;
font-weight: normal;
}
@@ -249,15 +252,23 @@
}
.emojis .emoji {
font-weight: 300;
min-height: 35px;
min-width: 35px;
padding: 0px;
}
.emojis .emoji:active {
background-color: @secondaryContainer;
}
.emojis .emoji label {
font-size: 20px;
}
.emojis .title {
padding-left: 16px;
color: @onSurfaceVariant;
margin-top: 3px;
}
.emojis button:focus {
+77 -53
View File
@@ -248,11 +248,13 @@ window.notification-popups box.notifications {
border-color: @outlineVariant;
}
.applauncher_box {
padding: 11px;
.applauncher_box separator {
margin: 0px;
}
.applauncher_entry {
margin: 11px;
background-color: @surfaceContainerHigh;
border: none;
outline: none;
@@ -269,30 +271,31 @@ window.notification-popups box.notifications {
}
.application_container {
border-radius: 100px;
border-radius: 0px;
border: none;
outline: none;
margin: 0px;
min-height: 47px;
}
.application_container image {
margin-left: 11px;
}
.application_container:hover {
background-color: @surfaceContainerHighest;
}
.application_container:focus label {
color: @onPrimary;
background-color: mix(@onSurface, @surface, 0.92)
}
.application_container:focus {
background-color: @primary;
background-color: mix(@onSurface, @surface, 0.8);
border: 0px solid;
border-radius: 34px;
border: none;
outline: none;
}
.application_divider {
color: @outline;
margin: 5px 0px 5px 0px;
margin: 0px 0px 0px 0px;
}
.application_label {
@@ -308,15 +311,15 @@ window.notification-popups box.notifications {
* Clipboard history
* ----------------------------------------------------- */
.cliphistory_box {
.cliphistory_box {
border-radius: 24px;
background-color: @background;
border: 2px solid;
border-color: @outlineVariant;
}
.cliphistory_box {
padding: 11px;
.cliphistory_box separator {
margin: 0px;
}
.cliphistory_entry {
@@ -328,34 +331,35 @@ window.notification-popups box.notifications {
margin-bottom: 16px;
padding: 5px;
padding-left: 25px;
margin: 11px;
}
.entry_container {
border-radius: 100px;
border: none;
outline: none;
min-height: 30px;
border-radius: 0px;
min-height: 40px;
}
.entry_container label {
margin-left: 11px;
margin-right: 11px;
}
.entry_container:hover {
background-color: @surfaceContainerHighest;
}
.entry_container:focus .entry_label {
color: @onPrimary;
background-color: mix(@onSurface, @surface, 0.92)
}
.entry_container:focus {
background-color: @primary;
background-color: mix(@onSurface, @surface, 0.8);
border: 0px solid;
border-radius: 34px;
border: none;
outline: none;
}
.entry_divider {
color: @outline;
margin: 5px 0px 5px 0px;
margin: 0px;
}
.entry_label {
@@ -564,7 +568,7 @@ window.notification-popups box.notifications {
color: @onPrimary
}
.management_button.active .icon{
.management_button.active .icon {
color: @onPrimary;
font-weight: normal;
}
@@ -641,7 +645,7 @@ window.notification-popups box.notifications {
}
.system_scale.backlight {
margin-bottom: 25px;
margin-bottom: 29px;
}
.system_scale.brightness slider {
@@ -669,7 +673,9 @@ window.notification-popups box.notifications {
background-color: @primary;
}
.system_box .slider_box, .system_box .usage_box, .system_box .info_box {
.system_box .slider_box,
.system_box .usage_box,
.system_box .info_box {
background-color: @surfaceContainerLowest;
padding: 26px;
border-radius: 14px;
@@ -734,8 +740,7 @@ window.notification-popups box.notifications {
color: @surfaceContainerHigh;
}
.dotbutton:hover {
}
.dotbutton:hover {}
.dotbutton.active label {
color: @secondary;
@@ -755,8 +760,10 @@ window.notification-popups box.notifications {
padding-right: 24px;
}
.outline_button label, .outline_button .icon,
.outline_button .awesome_icon, .outline_button image {
.outline_button label,
.outline_button .icon,
.outline_button .awesome_icon,
.outline_button image {
color: @primary;
font-weight: 300;
}
@@ -779,8 +786,10 @@ window.notification-popups box.notifications {
padding: 0px;
}
.filled_tonal_button label, .filled_tonal_button .icon,
.filled_tonal_button .awesome_icon, .filled_tonal_button image {
.filled_tonal_button label,
.filled_tonal_button .icon,
.filled_tonal_button .awesome_icon,
.filled_tonal_button image {
color: @onSecondaryContainer;
font-weight: 400;
margin: 0px;
@@ -795,6 +804,7 @@ window.notification-popups box.notifications {
background-color: mix(@secondaryContainer, @onSecondaryContainer, 0.1);
box-shadow: none;
}
/* standard icon button */
.standard_icon_button {
border-radius: 100px;
@@ -802,8 +812,10 @@ window.notification-popups box.notifications {
color: @onSurfaceVariant;
}
.standard_icon_button label, .standard_icon_button .icon,
.standard_icon_button .awesome_icon, .standard_icon_button image {
.standard_icon_button label,
.standard_icon_button .icon,
.standard_icon_button .awesome_icon,
.standard_icon_button image {
color: @onSurfaceVariant;
margin: 0px;
padding: 0px;
@@ -826,8 +838,10 @@ window.notification-popups box.notifications {
padding-right: 24px;
}
.standard_button label, .standard_button .icon,
.standard_button .awesome_icon, .standard_button image {
.standard_button label,
.standard_button .icon,
.standard_button .awesome_icon,
.standard_button image {
color: @onSurfaceVariant;
margin: 0px;
padding: 0px;
@@ -845,8 +859,10 @@ window.notification-popups box.notifications {
background-color: transparent;
}
.standard_button.disabled label, .standard_button.disabled .icon,
.standard_button.disabled .awesome_icon, .standard_button.disabled image {
.standard_button.disabled label,
.standard_button.disabled .icon,
.standard_button.disabled .awesome_icon,
.standard_button.disabled image {
color: mix(@onSurface, transparent, 0.38);
}
@@ -859,8 +875,10 @@ window.notification-popups box.notifications {
padding-right: 24px;
}
.filled_button label, .filled_button .icon,
.filled_button .awesome_icon, .filled_button image {
.filled_button label,
.filled_button .icon,
.filled_button .awesome_icon,
.filled_button image {
color: @onPrimary;
margin: 0px;
padding: 0px;
@@ -879,8 +897,10 @@ window.notification-popups box.notifications {
color: mix(@onSurface, @surface, 0.38);
}
.filled_button.disabled label, .filled_button.disabled .icon,
filled_button.disabled .awesome_icon, .filled_button.disabled image {
.filled_button.disabled label,
.filled_button.disabled .icon,
filled_button.disabled .awesome_icon,
.filled_button.disabled image {
color: mix(@onSurface, @surface, 0.38);
}
@@ -889,7 +909,7 @@ filled_button.disabled .awesome_icon, .filled_button.disabled image {
* ----------------------------------------------------- */
.navigation {
.navigation {
background-color: @surfaceContainer;
padding-top: 3px;
padding-bottom: 3px;
@@ -946,7 +966,7 @@ filled_button.disabled .awesome_icon, .filled_button.disabled image {
switch {
border: 2px solid;
border: 2px solid;
border-radius: 100px;
border-color: @outline;
background-color: @surfaceContainerHighest;
@@ -966,7 +986,7 @@ switch slider {
}
switch:disabled {
background-color: mix(@surfaceContainerHighest, transparent, 0.3);
background-color: mix(@surfaceContainerHighest, transparent, 0.3);
border-color: mix(@onSurface, transparent, 0.3);
}
@@ -974,16 +994,18 @@ switch:disabled slider {
background-color: mix(@onSurface, transparent, 0.3);
}
switch:hover, switch:active {
switch:hover,
switch:active {
background-color: mix(@surfaceContainerHighest, @onSurface, 0.08);
}
switch:hover slider, switch:active slider {
switch:hover slider,
switch:active slider {
background-color: @onSurfaceVariant;
}
switch:checked {
background-color: @primary;
background-color: @primary;
border-color: transparent;
}
@@ -996,7 +1018,7 @@ switch:checked slider {
}
switch:checked:disabled {
background-color: mix(@onSurface, transparent, 0.3);
background-color: mix(@onSurface, transparent, 0.3);
border-color: transparent;
}
@@ -1004,11 +1026,13 @@ switch:checked:disabled slider {
background-color: mix(@surface, transparent, 0.3);
}
switch:checked:hover, switch:checked:active {
background-color: @primary;
switch:checked:hover,
switch:checked:active {
background-color: @primary;
}
switch:checked:hover slider, switch:checked:active slider {
switch:checked:hover slider,
switch:checked:active slider {
background-color: @primaryContainer;
}