begin rust rewrite
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/target
|
1312
Cargo.lock
generated
Normal file
12
Cargo.toml
Normal file
@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "pika-gnome-layouts"
|
||||
version = "4.0.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
adw = { version = "0.7.0", package = "libadwaita", features = ["v1_5"] }
|
||||
gtk = { version = "0.9.0", package = "gtk4", features = ["v4_14"] }
|
||||
rust-i18n = "3.0.1"
|
||||
|
||||
[build-dependencies]
|
||||
glib-build-tools = "0.19.0"
|
9
build.rs
Normal file
@ -0,0 +1,9 @@
|
||||
// R1
|
||||
|
||||
fn main() {
|
||||
glib_build_tools::compile_resources(
|
||||
&["resources"],
|
||||
"resources/resources.gresource.xml",
|
||||
"resources.gresource",
|
||||
);
|
||||
}
|
24
data/com.github.pikaos-linux.pikagnomelayouts.gschema.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<schemalist>
|
||||
<schema id="com.github.pikaos-linux.pikagnomelayouts" path="/com/github/pikaos-linux/pikagnomelayouts/">
|
||||
<key name="window-width" type="i">
|
||||
<default>700</default>
|
||||
<summary>Default window width</summary>
|
||||
</key>
|
||||
<key name="window-height" type="i">
|
||||
<default>500</default>
|
||||
<summary>Default window height</summary>
|
||||
</key>
|
||||
<key name="is-maximized" type="b">
|
||||
<default>false</default>
|
||||
<summary>Default window maximized behaviour</summary>
|
||||
</key>
|
||||
<key type="i" name="layout-num">
|
||||
<default>0</default>
|
||||
<summary>What layout is selected.</summary>
|
||||
<description>
|
||||
What layout is selected.
|
||||
</description>
|
||||
</key>
|
||||
</schema>
|
||||
</schemalist>
|
19
data/polkit-1/actions/fkm.change.scx.policy
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/software/polkit/policyconfig-1.dtd">
|
||||
<policyconfig>
|
||||
|
||||
<action id="fkm.change.scx">
|
||||
<message>Authentication is required to change the SCX Scheduler</message>
|
||||
<icon_name>com.github.cosmicfusion.fedora-kernel-manager</icon_name>
|
||||
<defaults>
|
||||
<allow_any>auth_admin</allow_any>
|
||||
<allow_inactive>auth_admin</allow_inactive>
|
||||
<allow_active>auth_admin</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/lib/fedora-kernel-manager/scripts/change_scx.sh</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
19
data/polkit-1/actions/fkm.kernel.cachyos.init.policy
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/software/polkit/policyconfig-1.dtd">
|
||||
<policyconfig>
|
||||
|
||||
<action id="fkm.kernel.cachyos.init">
|
||||
<message>Authentication is required to initialize the Cachyos kernel repo</message>
|
||||
<icon_name>com.github.cosmicfusion.fedora-kernel-manager</icon_name>
|
||||
<defaults>
|
||||
<allow_any>auth_admin</allow_any>
|
||||
<allow_inactive>auth_admin</allow_inactive>
|
||||
<allow_active>auth_admin</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/lib/fedora-kernel-manager/scripts/kernel-cachyos-init.sh</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
19
data/polkit-1/actions/fkm.modify.package.policy
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE policyconfig PUBLIC
|
||||
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/software/polkit/policyconfig-1.dtd">
|
||||
<policyconfig>
|
||||
|
||||
<action id="fkm.modify.package">
|
||||
<message>Authentication is required to modify system packages</message>
|
||||
<icon_name>com.github.cosmicfusion.fedora-kernel-manager</icon_name>
|
||||
<defaults>
|
||||
<allow_any>auth_admin</allow_any>
|
||||
<allow_inactive>auth_admin</allow_inactive>
|
||||
<allow_active>auth_admin</allow_active>
|
||||
</defaults>
|
||||
<annotate key="org.freedesktop.policykit.exec.path">/usr/lib/fedora-kernel-manager/scripts/modify_package.sh</annotate>
|
||||
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
6
data/polkit-1/rules.d/99-fkm.kernel.cachyos.init.rules
Normal file
@ -0,0 +1,6 @@
|
||||
/* Allow passwordless auth for fkm.kernel.cachyos.init
|
||||
polkit.addRule(function(action, subject) {
|
||||
if (action.id == "fkm.kernel.cachyos.init") {
|
||||
return polkit.Result.YES;
|
||||
}
|
||||
});
|
6
debian/changelog
vendored
@ -1,3 +1,9 @@
|
||||
pika-gnome-layouts (4.0.0-100pika1) pika; urgency=low
|
||||
|
||||
* Port OS 4/Rust/GTK4/Libadwaita
|
||||
|
||||
-- Ward Nakchbandi <hotrod.master@hotmail.com> Sat, 01 Oct 2022 14:50:00 +0200
|
||||
|
||||
pika-gnome-layouts (3.0-100pika2) pikauwu; urgency=low
|
||||
|
||||
* Refine UI
|
||||
|
10
debian/control
vendored
@ -3,7 +3,15 @@ Section: misc
|
||||
Priority: optional
|
||||
Maintainer: Ward Nakchbandi <hotrod.master@hotmail.com>
|
||||
Standards-Version: 4.6.1
|
||||
Build-Depends: debhelper-compat (= 13)
|
||||
Build-Depends:
|
||||
debhelper-compat (= 13),
|
||||
build-essential,
|
||||
debhelper,
|
||||
# cargo,
|
||||
libadwaita-1-dev,
|
||||
libgtk-4-dev,
|
||||
desktop-file-utils,
|
||||
make,
|
||||
|
||||
Package: pika-gnome-layouts
|
||||
Architecture: all
|
||||
|
10
debian/pika-gnome-layouts.postinst
vendored
@ -1,2 +1,10 @@
|
||||
glib-compile-schemas /usr/share/glib-2.0/schemas/
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
update-mime-database /usr/share/mime
|
||||
update-desktop-database
|
||||
glib-compile-schemas /usr/share/glib-2.0/schemas
|
||||
|
||||
|
||||
|
10
debian/pika-gnome-layouts.postrm
vendored
@ -1,2 +1,10 @@
|
||||
glib-compile-schemas /usr/share/glib-2.0/schemas/
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
update-mime-database /usr/share/mime
|
||||
update-desktop-database
|
||||
glib-compile-schemas /usr/share/glib-2.0/schemas
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
20
resources/resources.gresource.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/com/github/pikaos-linux/pikagnomelayouts/">
|
||||
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/blue.svg</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/gray.svg</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/green.svg</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/orange.svg</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/pink.svg</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/purple.svg</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/red.svg</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/teal.svg</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">accent-color-icons/yellow.svg</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">previews/gnome.svg</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">previews/gnome2.svg</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">previews/pineapple.svg</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">previews/unity.svg</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">previews/traditional.svg</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">previews/eleven.svg</file>
|
||||
</gresource>
|
||||
</gresources>
|
81
src/build_ui.rs
Normal file
@ -0,0 +1,81 @@
|
||||
use gtk::{gio as gio, glib as glib, prelude::*};
|
||||
use glib::clone;
|
||||
use crate::{content, config::{APP_ID, APP_ICON, APP_GITHUB, VERSION}};
|
||||
|
||||
pub fn build_ui(app: &adw::Application) {
|
||||
gtk::glib::set_prgname(Some(t!("app_name").to_string()));
|
||||
glib::set_application_name(&t!("app_name").to_string());
|
||||
let glib_settings = gio::Settings::new(APP_ID);
|
||||
|
||||
let window_headerbar = adw::HeaderBar::builder()
|
||||
.title_widget(
|
||||
&adw::WindowTitle::builder()
|
||||
.title(t!("application_name"))
|
||||
.build(),
|
||||
)
|
||||
.build();
|
||||
|
||||
let content_stack = gtk::Stack::builder()
|
||||
.build();
|
||||
|
||||
content::content(&content_stack);
|
||||
|
||||
let window_toolbar = adw::ToolbarView::builder().content(&content_stack).build();
|
||||
|
||||
let window = adw::ApplicationWindow::builder()
|
||||
.title(t!("app_name"))
|
||||
.application(app)
|
||||
.content(&window_toolbar)
|
||||
.icon_name(APP_ICON)
|
||||
.default_width(glib_settings.int("window-width"))
|
||||
.default_height(glib_settings.int("window-height"))
|
||||
.width_request(700)
|
||||
.height_request(500)
|
||||
.startup_id(APP_ID)
|
||||
.build();
|
||||
|
||||
if glib_settings.boolean("is-maximized") == true {
|
||||
window.maximize()
|
||||
}
|
||||
|
||||
window_toolbar.add_top_bar(&window_headerbar);
|
||||
|
||||
window.connect_close_request(move |window| {
|
||||
if let Some(application) = window.application() {
|
||||
save_window_size(&window, &glib_settings);
|
||||
application.remove_window(window);
|
||||
}
|
||||
glib::Propagation::Proceed
|
||||
});
|
||||
|
||||
let credits_button = gtk::Button::builder()
|
||||
.icon_name("dialog-information-symbolic")
|
||||
.build();
|
||||
|
||||
let credits_window = adw::AboutWindow::builder()
|
||||
.application_icon(APP_ICON)
|
||||
.application_name(t!("application_name"))
|
||||
.transient_for(&window)
|
||||
.version(VERSION)
|
||||
.hide_on_close(true)
|
||||
.developer_name(t!("developer_name"))
|
||||
.license_type(gtk::License::Mpl20)
|
||||
.issue_url(APP_GITHUB.to_owned() + "/issues")
|
||||
.build();
|
||||
|
||||
window_headerbar.pack_end(&credits_button);
|
||||
credits_button.connect_clicked(
|
||||
move |_|
|
||||
credits_window.present()
|
||||
);
|
||||
|
||||
window.present();
|
||||
}
|
||||
|
||||
fn save_window_size(window: &adw::ApplicationWindow, glib_settings: &gio::Settings) {
|
||||
let size = window.default_size();
|
||||
|
||||
let _ = glib_settings.set_int("window-width", size.0);
|
||||
let _ = glib_settings.set_int("window-height", size.1);
|
||||
let _ = glib_settings.set_boolean("is-maximized", window.is_maximized());
|
||||
}
|
4
src/config.rs
Normal file
@ -0,0 +1,4 @@
|
||||
pub const APP_ID: &str = "com.github.pikaos-linux.pikagnomelayouts";
|
||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
pub const APP_ICON: &str = "com.github.pikaos-linux.pikagnomelayouts";
|
||||
pub const APP_GITHUB: &str = "https://git.pika-os.com/gnome-packages/pika-gnome-layouts";
|
64
src/content/mod.rs
Normal file
@ -0,0 +1,64 @@
|
||||
use gtk::prelude::*;
|
||||
|
||||
struct DesktopLayout {
|
||||
name: String,
|
||||
id: i32,
|
||||
}
|
||||
|
||||
pub fn content(
|
||||
content_stack: >k::Stack,
|
||||
) {
|
||||
let content_box = gtk::Box::builder()
|
||||
.orientation(gtk::Orientation::Vertical)
|
||||
.vexpand(true)
|
||||
.hexpand(true)
|
||||
.build();
|
||||
|
||||
let desktop_layouts = [
|
||||
&DesktopLayout {
|
||||
name: "gnome".to_string(),
|
||||
id: 0
|
||||
},
|
||||
&DesktopLayout {
|
||||
name: "traditional".to_string(),
|
||||
id: 0
|
||||
},
|
||||
&DesktopLayout {
|
||||
name: "eleven".to_string(),
|
||||
id: 0
|
||||
},
|
||||
&DesktopLayout {
|
||||
name: "pineapple".to_string(),
|
||||
id: 0
|
||||
},
|
||||
&DesktopLayout {
|
||||
name: "gnome2".to_string(),
|
||||
id: 0
|
||||
},
|
||||
&DesktopLayout {
|
||||
name: "unity".to_string(),
|
||||
id: 0
|
||||
},
|
||||
];
|
||||
|
||||
let null_checkbutton = gtk::CheckButton::builder()
|
||||
.build();
|
||||
|
||||
for layout in desktop_layouts {
|
||||
let layout_name = layout.name.clone();
|
||||
let layout_id = layout.id;
|
||||
|
||||
let layout_box = gtk::Box::builder()
|
||||
.orientation(gtk::Orientation::Horizontal)
|
||||
.build();
|
||||
let layout_preview = gtk::Image::builder()
|
||||
.resource(format!("/com/github/pikaos-linux/pikagnomelayouts/previews/{}.svg", &layout_name))
|
||||
.build();
|
||||
content_box.append(&layout_preview);
|
||||
}
|
||||
|
||||
content_stack.add_named(
|
||||
&content_box,
|
||||
Some("content_page"),
|
||||
);
|
||||
}
|
51
src/main.rs
Normal file
@ -0,0 +1,51 @@
|
||||
mod config;
|
||||
mod build_ui;
|
||||
mod content;
|
||||
|
||||
use std::env;
|
||||
use gtk::{gio,gdk,CssProvider,prelude::*, glib as glib};
|
||||
use config::APP_ID;
|
||||
|
||||
use crate::gdk::Display;
|
||||
|
||||
#[macro_use]
|
||||
extern crate rust_i18n;
|
||||
i18n!("locales", fallback = "en_US");
|
||||
|
||||
fn main() -> glib::ExitCode {
|
||||
let current_locale = match env::var_os("LANG") {
|
||||
Some(v) => v.into_string().unwrap().chars()
|
||||
.take_while(|&ch| ch != '.')
|
||||
.collect::<String>(),
|
||||
None => panic!("$LANG is not set"),
|
||||
};
|
||||
rust_i18n::set_locale(¤t_locale);
|
||||
|
||||
let app = adw::Application::builder().application_id(APP_ID).build();
|
||||
|
||||
app.connect_startup(|app| {
|
||||
load_gresource();
|
||||
load_css();
|
||||
app.connect_activate(build_ui::build_ui);
|
||||
});
|
||||
|
||||
// Run the application
|
||||
app.run()
|
||||
}
|
||||
|
||||
fn load_gresource() {
|
||||
gio::resources_register_include!("resources.gresource").expect("Failed to register resources.");
|
||||
}
|
||||
|
||||
fn load_css() {
|
||||
// Load the CSS file and add it to the provider
|
||||
/*let provider = CssProvider::new();
|
||||
provider.load_from_resource("/com/github/cosmicfusion/fedora-kernel-manager/css/style.css");
|
||||
|
||||
// Add the provider to the default screen
|
||||
gtk::style_context_add_provider_for_display(
|
||||
&Display::default().expect("Could not connect to a display."),
|
||||
&provider,
|
||||
gtk::STYLE_PROVIDER_PRIORITY_APPLICATION,
|
||||
);*/
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
#! /bin/bash
|
||||
if echo $XDG_SESSION_DESKTOP | grep -i ubuntu
|
||||
then
|
||||
python3 /usr/lib/pika/gnome-layouts/main.py
|
||||
else
|
||||
zenity --error --text="current session isn't gnome"
|
||||
fi
|
@ -1,10 +0,0 @@
|
||||
#! /bin/bash
|
||||
export ALL=True
|
||||
|
||||
for f in /etc/nobara/scripts/nobara-layouts/settings-scripts/*.sh; do
|
||||
bash "$f" enable
|
||||
done
|
||||
|
||||
export RELOG_NEEDED=1
|
||||
|
||||
/etc/nobara/scripts/nobara-layouts/reload.sh
|
@ -1,19 +0,0 @@
|
||||
#! /usr/bin/bash
|
||||
gnome-extensions enable user-theme@gnome-shell-extensions.gcampax.github.com
|
||||
if [[ $1 == Teal ]]
|
||||
then
|
||||
if dconf read /org/gnome/desktop/interface/color-scheme | grep dark
|
||||
then
|
||||
gdbus call --session --dest 'org.gnome.Shell' --object-path '/org/gnome/Shell' --method 'org.gnome.Shell.ScreenTransition' & gsettings set org.gnome.shell.extensions.user-theme name "Jasper-Dark" && gsettings set org.gnome.desktop.interface gtk-theme "Jasper-Dark" && cp -rfv "/usr/share/themes/Jasper-Dark"/gtk-4.0 "$HOME"/.config/
|
||||
|
||||
else
|
||||
gdbus call --session --dest 'org.gnome.Shell' --object-path '/org/gnome/Shell' --method 'org.gnome.Shell.ScreenTransition' & gsettings set org.gnome.shell.extensions.user-theme name "Jasper-Light" && gsettings set org.gnome.desktop.interface gtk-theme "Jasper-Light" && cp -rfv "/usr/share/themes/Jasper-Light"/gtk-4.0 "$HOME"/.config/
|
||||
fi
|
||||
else
|
||||
if dconf read /org/gnome/desktop/interface/color-scheme | grep dark
|
||||
then
|
||||
gdbus call --session --dest 'org.gnome.Shell' --object-path '/org/gnome/Shell' --method 'org.gnome.Shell.ScreenTransition' & gsettings set org.gnome.shell.extensions.user-theme name "Jasper-$1-Dark" && gsettings set org.gnome.desktop.interface gtk-theme "Jasper-$1-Dark" && cp -rfv "/usr/share/themes/Jasper-$1-Dark"/gtk-4.0 "$HOME"/.config/
|
||||
else
|
||||
gdbus call --session --dest 'org.gnome.Shell' --object-path '/org/gnome/Shell' --method 'org.gnome.Shell.ScreenTransition' & gsettings set org.gnome.shell.extensions.user-theme name "Jasper-$1-Light" && gsettings set org.gnome.desktop.interface gtk-theme "Jasper-$1-Light" && cp -rfv "/usr/share/themes/Jasper-$1-Light"/gtk-4.0 "$HOME"/.config/
|
||||
fi
|
||||
fi
|
@ -1,150 +0,0 @@
|
||||
import gi
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Gio
|
||||
import subprocess
|
||||
import os
|
||||
import os.path
|
||||
from pathlib import Path
|
||||
|
||||
import time
|
||||
import threading
|
||||
|
||||
class Application:
|
||||
|
||||
### MAIN WINDOW ###
|
||||
def __init__(self):
|
||||
self.column_names = False
|
||||
self.drop_nan = False
|
||||
self.df = None
|
||||
application_id="org.pika.layouts"
|
||||
|
||||
self.builder = Gtk.Builder()
|
||||
self.builder.add_from_file("/usr/lib/pika/gnome-layouts/main.ui")
|
||||
self.builder.connect_signals(self)
|
||||
win = self.builder.get_object("main_window")
|
||||
|
||||
|
||||
### Enable Extensions
|
||||
|
||||
subprocess.run(["gsettings set org.gnome.shell disable-user-extensions false"], shell=True, stdout=subprocess.DEVNULL)
|
||||
|
||||
accent_box = self.builder.get_object("accent_box")
|
||||
|
||||
accent_output = subprocess.run(["dconf read /org/pika/layouts/pika-theme | grep 1"], shell=True)
|
||||
|
||||
if (accent_output.returncode) != 0:
|
||||
accent_box.hide()
|
||||
|
||||
### Window props ###
|
||||
|
||||
win.connect("destroy", Gtk.main_quit)
|
||||
|
||||
self.window = self.builder.get_object("main_window")
|
||||
self.window.show()
|
||||
|
||||
settings = Gio.Settings.new("org.pika.layouts")
|
||||
|
||||
|
||||
### Themes
|
||||
def on_pika_theme_button_pressed(self, widget):
|
||||
accent_box = self.builder.get_object("accent_box")
|
||||
subprocess.run(["/usr/lib/pika/gnome-layouts/theme.sh pika"], shell=True)
|
||||
accent_box.show()
|
||||
def on_gnome_theme_button_pressed(self, widget):
|
||||
accent_box = self.builder.get_object("accent_box")
|
||||
subprocess.run(["/usr/lib/pika/gnome-layouts/theme.sh gnome"], shell=True)
|
||||
accent_box.hide()
|
||||
|
||||
|
||||
if settings.get_int("layout-num") == 1:
|
||||
win10toggle = self.builder.get_object("win10_button")
|
||||
win10toggle.set_active(True)
|
||||
|
||||
if settings.get_int("layout-num") == 2:
|
||||
win11toggle = self.builder.get_object("win11_button")
|
||||
win11toggle.set_active(True)
|
||||
|
||||
if settings.get_int("layout-num") == 3:
|
||||
gnometoggle = self.builder.get_object("gnome_button")
|
||||
gnometoggle.set_active(True)
|
||||
|
||||
if settings.get_int("layout-num") == 4:
|
||||
macostoggle = self.builder.get_object("macos_button")
|
||||
macostoggle.set_active(True)
|
||||
if settings.get_int("layout-num") == 5:
|
||||
macostoggle = self.builder.get_object("gnome2_button")
|
||||
macostoggle.set_active(True)
|
||||
if settings.get_int("layout-num") == 6:
|
||||
macostoggle = self.builder.get_object("unity_button")
|
||||
macostoggle.set_active(True)
|
||||
|
||||
### Layouts ###
|
||||
|
||||
def on_win10_button_pressed(self, widget):
|
||||
settings = Gio.Settings.new("org.pika.layouts")
|
||||
settings.set_int("layout-num", 1)
|
||||
subprocess.run(["/usr/lib/pika/gnome-layouts/layout-scripts/win10.sh"], shell=True)
|
||||
|
||||
def on_win11_button_pressed(self, widget):
|
||||
settings = Gio.Settings.new("org.pika.layouts")
|
||||
settings.set_int("layout-num", 2)
|
||||
subprocess.run(["/usr/lib/pika/gnome-layouts/layout-scripts/win11.sh"], shell=True)
|
||||
def on_gnome_button_pressed(self, widget):
|
||||
settings = Gio.Settings.new("org.pika.layouts")
|
||||
settings.set_int("layout-num", 3)
|
||||
subprocess.run(["/usr/lib/pika/gnome-layouts/layout-scripts/reset.sh"], shell=True)
|
||||
def on_macos_button_pressed(self, widget):
|
||||
settings = Gio.Settings.new("org.pika.layouts")
|
||||
settings.set_int("layout-num", 4)
|
||||
subprocess.run(["/usr/lib/pika/gnome-layouts/layout-scripts/macos.sh"], shell=True)
|
||||
def on_gnome2_button_pressed(self, widget):
|
||||
settings = Gio.Settings.new("org.pika.layouts")
|
||||
settings.set_int("layout-num", 5)
|
||||
subprocess.run(["/usr/lib/pika/gnome-layouts/layout-scripts/gnome2.sh"], shell=True)
|
||||
def on_unity_button_pressed(self, widget):
|
||||
settings = Gio.Settings.new("org.pika.layouts")
|
||||
settings.set_int("layout-num", 6)
|
||||
subprocess.run(["/usr/lib/pika/gnome-layouts/layout-scripts/unity.sh"], shell=True)
|
||||
### Settings ###
|
||||
|
||||
### Accent Colors
|
||||
|
||||
def blue_accent_button_pressed_cb (self, widget):
|
||||
subprocess.run(["/usr/lib/pika/gnome-layouts/dconf-accent.sh Blue"], shell=True)
|
||||
subprocess.run(["pkexec /usr/lib/pika/gnome-layouts/papirus-folders -u -C blue"], shell=True)
|
||||
subprocess.run(["echo 'theme change done!'"], shell=True)
|
||||
def green_accent_button_pressed_cb (self, widget):
|
||||
subprocess.run(["/usr/lib/pika/gnome-layouts/dconf-accent.sh Green"], shell=True)
|
||||
subprocess.run(["pkexec /usr/lib/pika/gnome-layouts/papirus-folders -u -C green"], shell=True)
|
||||
subprocess.run(["echo 'theme change done!'"], shell=True)
|
||||
def yellow_accent_button_pressed_cb (self, widget):
|
||||
subprocess.run(["/usr/lib/pika/gnome-layouts/dconf-accent.sh Yellow"], shell=True)
|
||||
subprocess.run(["pkexec /usr/lib/pika/gnome-layouts/papirus-folders -u -C yellow"], shell=True)
|
||||
subprocess.run(["echo 'theme change done!'"], shell=True)
|
||||
def orange_accent_button_pressed_cb (self, widget):
|
||||
subprocess.run(["/usr/lib/pika/gnome-layouts/dconf-accent.sh Orange"], shell=True)
|
||||
subprocess.run(["pkexec /usr/lib/pika/gnome-layouts/papirus-folders -u -C orange"], shell=True)
|
||||
subprocess.run(["echo 'theme change done!'"], shell=True)
|
||||
def red_accent_button_pressed_cb (self, widget):
|
||||
subprocess.run(["/usr/lib/pika/gnome-layouts/dconf-accent.sh Red"], shell=True)
|
||||
subprocess.run(["pkexec /usr/lib/pika/gnome-layouts/papirus-folders -u -C red"], shell=True)
|
||||
subprocess.run(["echo 'theme change done!'"], shell=True)
|
||||
def pink_accent_button_pressed_cb (self, widget):
|
||||
subprocess.run(["/usr/lib/pika/gnome-layouts/dconf-accent.sh Pink"], shell=True)
|
||||
subprocess.run(["pkexec /usr/lib/pika/gnome-layouts/papirus-folders -u -C pink"], shell=True)
|
||||
subprocess.run(["echo 'theme change done!'"], shell=True)
|
||||
def purple_accent_button_pressed_cb (self, widget):
|
||||
subprocess.run(["/usr/lib/pika/gnome-layouts/dconf-accent.sh Purple"], shell=True)
|
||||
subprocess.run(["pkexec /usr/lib/pika/gnome-layouts/papirus-folders -u -C violet"], shell=True)
|
||||
subprocess.run(["echo 'theme change done!'"], shell=True)
|
||||
def teal_accent_button_pressed_cb (self, widget):
|
||||
subprocess.run(["/usr/lib/pika/gnome-layouts/dconf-accent.sh Teal"], shell=True)
|
||||
subprocess.run(["pkexec /usr/lib/pika/gnome-layouts/papirus-folders -u -C teal"], shell=True)
|
||||
subprocess.run(["echo 'theme change done!'"], shell=True)
|
||||
def gray_accent_button_pressed_cb (self, widget):
|
||||
subprocess.run(["/usr/lib/pika/gnome-layouts/dconf-accent.sh Grey"], shell=True)
|
||||
subprocess.run(["pkexec /usr/lib/pika/gnome-layouts/papirus-folders -u -C grey"], shell=True)
|
||||
subprocess.run(["echo 'theme change done!'"], shell=True)
|
||||
|
||||
Application()
|
||||
Gtk.main()
|
@ -1,835 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.40.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.24"/>
|
||||
<object class="GtkRadioButton" id="radiobutton1">
|
||||
<property name="label" translatable="yes">radiobutton</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw-indicator">True</property>
|
||||
</object>
|
||||
<object class="GtkApplicationWindow" id="main_window">
|
||||
<property name="width-request">700</property>
|
||||
<property name="height-request">520</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="default-width">700</property>
|
||||
<property name="default-height">512</property>
|
||||
<property name="show-menubar">False</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="main_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkStack" id="main_stack">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="transition-type">crossfade</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="layouts_scroll">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">5</property>
|
||||
<property name="margin-end">5</property>
|
||||
<property name="margin-top">5</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<!-- n-columns=3 n-rows=2 -->
|
||||
<object class="GtkGrid" id="layouts_grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="row-spacing">10</property>
|
||||
<property name="column-spacing">10</property>
|
||||
<property name="column-homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="win10_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="win10_preview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-left">10</property>
|
||||
<property name="margin-right">10</property>
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="pixbuf">../../../../../../../../../usr/lib/pika/gnome-layouts/previews/win10.svg</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="win10_button">
|
||||
<property name="label" translatable="yes">Traditional</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="tooltip-text" translatable="yes">The good old michealsoft binbows layout:
|
||||
* A Bottom taskbar.
|
||||
* An Application Menu binded to the "Super Key".
|
||||
* Desktop Icons.
|
||||
* Full window controls on the right side of the window.</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="draw-indicator">True</property>
|
||||
<property name="group">radiobutton1</property>
|
||||
<signal name="pressed" handler="on_win10_button_pressed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="win11_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="win11_preview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-left">10</property>
|
||||
<property name="margin-right">10</property>
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="pixbuf">../../../../../../../../../usr/lib/pika/gnome-layouts/previews/win11.svg</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="win11_button">
|
||||
<property name="label" translatable="yes">Eleven</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="tooltip-text" translatable="yes">The michealsoft binbows layout but newer:
|
||||
* A Bottom taskbar with centered icons.
|
||||
* A More modern Application Menu binded to the "Super Key".
|
||||
* Desktop Icons.
|
||||
* Full window controls on the right side of the window.
|
||||
* "Activities" button for wasy workspace management.</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="draw-indicator">True</property>
|
||||
<property name="group">radiobutton1</property>
|
||||
<signal name="pressed" handler="on_win11_button_pressed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="macos_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="macos_preview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-left">10</property>
|
||||
<property name="margin-right">10</property>
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="pixbuf">../../../../../../../../../usr/lib/pika/gnome-layouts/previews/macos.svg</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="macos_button">
|
||||
<property name="label" translatable="yes">Pineapple</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="tooltip-text" translatable="yes">The Ma....... i mean the PearOS layout:
|
||||
* A Bottom Dock and a top panel.
|
||||
* A Fullscreen Application grid.
|
||||
* Desktop Icons.
|
||||
* Full window controls on the left side of the window.
|
||||
* "Activities" button for wasy workspace management.</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="draw-indicator">True</property>
|
||||
<property name="group">radiobutton1</property>
|
||||
<signal name="pressed" handler="on_macos_button_pressed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="unity_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="unity_preview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-left">10</property>
|
||||
<property name="margin-right">10</property>
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="pixbuf">../../../../../../../../../usr/lib/pika/gnome-layouts/previews/unity.svg</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="unity_button">
|
||||
<property name="label" translatable="yes">Unity</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="tooltip-text" translatable="yes">The Ubuntu Unity Experience:
|
||||
* A Leftside Dock and a top panel.
|
||||
* Desktop Icons.
|
||||
* Full window controls on the left side of the window.</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="draw-indicator">True</property>
|
||||
<property name="group">radiobutton1</property>
|
||||
<signal name="pressed" handler="on_unity_button_pressed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="gnome2_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="gnome2_preview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-left">10</property>
|
||||
<property name="margin-right">10</property>
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="pixbuf">../../../../../../../../../usr/lib/pika/gnome-layouts/previews/gnome2.svg</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="gnome2_button">
|
||||
<property name="label" translatable="yes">GNOME 2</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="tooltip-text" translatable="yes">The Old Gnome/Mate Experience.</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="draw-indicator">True</property>
|
||||
<property name="group">radiobutton1</property>
|
||||
<signal name="pressed" handler="on_gnome2_button_pressed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="gnome_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="gnome_preview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-left">10</property>
|
||||
<property name="margin-right">10</property>
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="pixbuf">../../../../../../../../../usr/lib/pika/gnome-layouts/previews/gnome.svg</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="gnome_button">
|
||||
<property name="label" translatable="yes">GNOME</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">False</property>
|
||||
<property name="tooltip-text" translatable="yes">The Stock GNOME Experience.</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="draw-indicator">True</property>
|
||||
<property name="group">radiobutton1</property>
|
||||
<signal name="pressed" handler="on_gnome_button_pressed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">Layouts</property>
|
||||
<property name="title" translatable="yes">Layouts</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="theme_scroll">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">5</property>
|
||||
<property name="margin-end">5</property>
|
||||
<property name="margin-top">5</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="accent_box">
|
||||
<property name="name">accent_box</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">start</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="blue_accent_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="pressed" handler="blue_accent_button_pressed_cb" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkImage" id="blue_accent_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="tooltip-text" translatable="yes">Blue</property>
|
||||
<property name="pixbuf">../../../../../../../../../usr/lib/pika/gnome-layouts/accent-colors/blue.svg</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="green_accent_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="pressed" handler="green_accent_button_pressed_cb" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkImage" id="green_accent_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="tooltip-text" translatable="yes">Green</property>
|
||||
<property name="pixbuf">../../../../../../../../../usr/lib/pika/gnome-layouts/accent-colors/green.svg</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="yellow_accent_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="pressed" handler="yellow_accent_button_pressed_cb" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkImage" id="yellow_accent_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="tooltip-text" translatable="yes">Yellow</property>
|
||||
<property name="pixbuf">../../../../../../../../../usr/lib/pika/gnome-layouts/accent-colors/yellow.svg</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="orange_accent_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="pressed" handler="orange_accent_button_pressed_cb" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkImage" id="orange_accent_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="tooltip-text" translatable="yes">Orange</property>
|
||||
<property name="pixbuf">../../../../../../../../../usr/lib/pika/gnome-layouts/accent-colors/orange.svg</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="red_accent_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="pressed" handler="red_accent_button_pressed_cb" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkImage" id="red_accent_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="tooltip-text" translatable="yes">Red</property>
|
||||
<property name="pixbuf">../../../../../../../../../usr/lib/pika/gnome-layouts/accent-colors/red.svg</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pink_accent_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="pressed" handler="pink_accent_button_pressed_cb" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkImage" id="pink_accent_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="tooltip-text" translatable="yes">Pink</property>
|
||||
<property name="pixbuf">../../../../../../../../../usr/lib/pika/gnome-layouts/accent-colors/pink.svg</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="purple_accent_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="pressed" handler="purple_accent_button_pressed_cb" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkImage" id="purple_accent_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="tooltip-text" translatable="yes">Purple</property>
|
||||
<property name="pixbuf">../../../../../../../../../usr/lib/pika/gnome-layouts/accent-colors/purple.svg</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="teal_accent_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="pressed" handler="teal_accent_button_pressed_cb" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkImage" id="teal_accent_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="tooltip-text" translatable="yes">Teal</property>
|
||||
<property name="pixbuf">../../../../../../../../../usr/lib/pika/gnome-layouts/accent-colors/teal.svg</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="gray_accent_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="pressed" handler="gray_accent_button_pressed_cb" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkImage" id="gray_accent_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="tooltip-text" translatable="yes">Gray</property>
|
||||
<property name="pixbuf">../../../../../../../../../usr/lib/pika/gnome-layouts/accent-colors/gray.svg</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">8</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">15</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<!-- n-columns=2 n-rows=2 -->
|
||||
<object class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="column-spacing">5</property>
|
||||
<property name="column-homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="pika_theme_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-start">5</property>
|
||||
<property name="margin-end">5</property>
|
||||
<property name="margin-top">15</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<signal name="pressed" handler="on_pika_theme_button_pressed" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="pixel-size">36</property>
|
||||
<property name="icon-name">pika-logo</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">PikaOS Theming</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="gnome_theme_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-start">5</property>
|
||||
<property name="margin-end">5</property>
|
||||
<property name="margin-top">15</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<signal name="pressed" handler="on_gnome_theme_button_pressed" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="pixel-size">36</property>
|
||||
<property name="icon-name">gnome-foot</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="label" translatable="yes">Gnome Theming</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="pixbuf">../../../../../../../../../usr/lib/pika/gnome-layouts/previews/pika-theme.png</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="pixbuf">../../../../../../../../../usr/lib/pika/gnome-layouts/previews/gnome-theme.png</property>
|
||||
<property name="pixel-size">96</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">themes</property>
|
||||
<property name="title" translatable="yes">Themes & Colors</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="main_Header">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="show-close-button">True</property>
|
||||
<child type="title">
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkStackSwitcher">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<property name="stack">main_stack</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
@ -1,533 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# This script allows changing the color of folders in Papirus icon theme
|
||||
#
|
||||
# @author: Sergei Eremenko (https://github.com/SmartFinn)
|
||||
# @license: MIT license (MIT)
|
||||
# @link: https://github.com/PapirusDevelopmentTeam/papirus-folders
|
||||
|
||||
if test -z "$BASH_VERSION"; then
|
||||
printf "Error: this script only works in bash.\n" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if (( BASH_VERSINFO[0] * 10 + BASH_VERSINFO[1] < 40 )); then
|
||||
printf "Error: this script requires bash version >= 4.0\n" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# set -x # Uncomment to debug this shell script
|
||||
set -o errexit \
|
||||
-o noclobber \
|
||||
-o pipefail
|
||||
|
||||
readonly THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
|
||||
readonly PROGNAME="$(basename "${BASH_SOURCE[0]}")"
|
||||
readonly VERSION="1.12.0"
|
||||
readonly -a ARGS=("$@")
|
||||
|
||||
msg() {
|
||||
printf "%s: %b\n" "$PROGNAME" "$*"
|
||||
}
|
||||
|
||||
verbose() {
|
||||
[ -t 4 ] || return 0
|
||||
msg "$@" >&4
|
||||
}
|
||||
|
||||
err() {
|
||||
msg "Error:" "$*" >&2
|
||||
}
|
||||
|
||||
_exit() {
|
||||
msg "$*" "Exiting ..."
|
||||
exit 0
|
||||
}
|
||||
|
||||
fatal() {
|
||||
err "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat <<- EOF
|
||||
USAGE
|
||||
$ $PROGNAME [options] -t <theme> {-C --color} <color>
|
||||
$ $PROGNAME [options] -t <theme> {-D --default}
|
||||
$ $PROGNAME [options] -t <theme> {-R --restore}
|
||||
OPERATIONS
|
||||
-C --color <color> change color of folders
|
||||
-D --default back to the default color
|
||||
-R --restore restore the last used color from the config file
|
||||
OPTIONS
|
||||
-l --list show available colors
|
||||
-o --once do not save the changes to the config file
|
||||
-t --theme <theme> make changes to the specified theme (Default: Papirus)
|
||||
-u --update-caches update icon caches for Papirus and siblings
|
||||
-V --version print $PROGNAME version and exit
|
||||
-v --verbose be verbose
|
||||
-h --help show this help
|
||||
EOF
|
||||
|
||||
exit "${1:-0}"
|
||||
}
|
||||
|
||||
_is_root_user() {
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
_is_user_dir() {
|
||||
[ -n "$USER_HOME" ] || return 1
|
||||
|
||||
# if $THEME_DIR is placed in home dir
|
||||
if [ -z "${THEME_DIR##"$USER_HOME"/*}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
_is_writable() {
|
||||
if [ -w "$THEME_DIR/48x48/places/folder.svg" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
_is_valid_color() {
|
||||
local color="$1"
|
||||
|
||||
eval "$(declare_colors)"
|
||||
|
||||
for i in "${colors[@]}"; do
|
||||
[ "$i" == "$color" ] || continue
|
||||
return 0
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
declare_colors() {
|
||||
local color=''
|
||||
local -a colors=()
|
||||
local -a valid_colors=("adwaita" "black" "blue" "bluegrey" "breeze" "brown"
|
||||
"carmine" "cyan" "darkcyan" "deeporange" "green" "grey"
|
||||
"indigo" "magenta" "nordic" "orange" "palebrown" "paleorange"
|
||||
"pink" "purple" "red" "teal" "violet" "white" "yaru" "yellow")
|
||||
|
||||
for color in "${valid_colors[@]}"; do
|
||||
if [ -e "$THEME_DIR/48x48/places/folder-$color.svg" ]; then
|
||||
colors=( "${colors[@]}" "$color" )
|
||||
fi
|
||||
done
|
||||
|
||||
# return array of colors
|
||||
declare -p colors
|
||||
}
|
||||
|
||||
declare_current_color() {
|
||||
local icon_file icon_name current_color=''
|
||||
|
||||
icon_file=$(readlink -f "$THEME_DIR/48x48/places/folder.svg")
|
||||
icon_name=$(basename "$icon_file" .svg)
|
||||
current_color="${icon_name##*-}"
|
||||
|
||||
declare -p current_color
|
||||
}
|
||||
|
||||
get_theme_dir() {
|
||||
local data_dir icons_dir
|
||||
local -a data_dirs=()
|
||||
local -a icons_dirs=(
|
||||
"$USER_HOME/.icons"
|
||||
"${XDG_DATA_HOME:-$USER_HOME/.local/share}/icons"
|
||||
)
|
||||
|
||||
# Get data directories from XDG_DATA_DIRS variable and
|
||||
# convert colon-separated list into bash array
|
||||
IFS=: read -ra data_dirs <<< "${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
|
||||
|
||||
for data_dir in "${data_dirs[@]}"; do
|
||||
[ -d "$data_dir/icons" ] || continue
|
||||
icons_dirs=( "${icons_dirs[@]}" "${data_dir%/}/icons" )
|
||||
done
|
||||
|
||||
for icons_dir in "${icons_dirs[@]}"; do
|
||||
[ -f "$icons_dir/$THEME_NAME/index.theme" ] || continue
|
||||
printf '%s' "$icons_dir/$THEME_NAME"
|
||||
verbose "'$THEME_NAME' is found in '$icons_dir'."
|
||||
return 0
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
get_real_user() {
|
||||
# return name of the user that runs the script
|
||||
local user=''
|
||||
|
||||
if [ -n "$PKEXEC_UID" ]; then
|
||||
user="$(id -nu "$PKEXEC_UID")"
|
||||
elif [ -n "$SUDO_USER" ]; then
|
||||
user="$SUDO_USER"
|
||||
else
|
||||
user="$(id -nu)"
|
||||
fi
|
||||
|
||||
printf '%s' "$user"
|
||||
}
|
||||
|
||||
get_user_home() {
|
||||
local user="$1"
|
||||
|
||||
getent passwd "$user" | awk -F: '{print $(NF-1)}'
|
||||
}
|
||||
|
||||
config() {
|
||||
# usage: config [{-n --new}] {-s --set} key=value... | {-g --get} key...
|
||||
local config_dir
|
||||
local config_file
|
||||
|
||||
if _is_user_dir; then
|
||||
config_dir="${XDG_CONFIG_HOME:-$USER_HOME/.config}/$PROGNAME"
|
||||
else
|
||||
config_dir="/var/lib/$PROGNAME"
|
||||
fi
|
||||
|
||||
config_file="$config_dir/keep"
|
||||
|
||||
while (( "$#" )); do
|
||||
case "$1" in
|
||||
-g|--get) shift;
|
||||
[ -f "$config_file" ] || return 1
|
||||
|
||||
for key; do
|
||||
[ -n "$key" ] || continue
|
||||
awk -F= -v key="$key" '
|
||||
$1 == key {
|
||||
print $2
|
||||
exit
|
||||
}
|
||||
' "$config_file"
|
||||
done
|
||||
|
||||
break
|
||||
;;
|
||||
-n|--new) shift;
|
||||
rm -f "$config_file"
|
||||
;;
|
||||
-e|--exists) shift;
|
||||
# return 1 if test config_file not exist or empty
|
||||
if [ -f "$config_file" ] && [ -s "$config_file" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
-s|--set) shift;
|
||||
[ "$ONCE" -eq "1" ] && break
|
||||
[ -d "$config_dir" ] || mkdir -p "$config_dir"
|
||||
[ -f "$config_file" ] || touch "$config_file"
|
||||
|
||||
verbose "Saving params to '$config_file' ..."
|
||||
cat >> "$config_file" <<- EOF
|
||||
$(for key_value; do echo "$key_value"; done)
|
||||
EOF
|
||||
|
||||
break
|
||||
;;
|
||||
*)
|
||||
err "illegal option -- '$1'"
|
||||
return 1
|
||||
esac
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
change_color() {
|
||||
local color="${1:?${FUNCNAME[-1]}: color is not set}"
|
||||
local size prefix file_path file_name symlink_path
|
||||
local -a sizes=(22x22 24x24 32x32 48x48 64x64)
|
||||
local -a prefixes=("folder-$color" "user-$color")
|
||||
|
||||
for size in "${sizes[@]}"; do
|
||||
for prefix in "${prefixes[@]}"; do
|
||||
for file_path in "$THEME_DIR/$size/places/$prefix"{-*,}.svg; do
|
||||
[ -f "$file_path" ] || continue # is a file
|
||||
[ -L "$file_path" ] && continue # is not a symlink
|
||||
|
||||
file_name="${file_path##*/}"
|
||||
symlink_path="${file_path/-$color/}" # remove color suffix
|
||||
|
||||
ln -sf "$file_name" "$symlink_path" || {
|
||||
fatal "Fail to create '$symlink_path' symlink"
|
||||
}
|
||||
done
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
list_colors() {
|
||||
local color='' prefix=''
|
||||
|
||||
eval "$(declare_colors)"
|
||||
eval "$(declare_current_color)"
|
||||
|
||||
for color in "${colors[@]}"; do
|
||||
if [ "$current_color" == "$color" ]; then
|
||||
prefix='>'
|
||||
else
|
||||
prefix=''
|
||||
fi
|
||||
|
||||
printf '%2s %s\n' "$prefix" "$color"
|
||||
done
|
||||
}
|
||||
|
||||
do_change_color() {
|
||||
_is_valid_color "$SELECTED_COLOR" || {
|
||||
fatal "Unable to find '$SELECTED_COLOR' color in '$THEME_NAME'"
|
||||
}
|
||||
|
||||
verify_privileges
|
||||
|
||||
msg "Changing color of folders to '$SELECTED_COLOR' for '$THEME_NAME' ..."
|
||||
change_color "$SELECTED_COLOR"
|
||||
config --new --set "theme=$THEME_NAME" "color=$SELECTED_COLOR"
|
||||
update_icon_cache
|
||||
}
|
||||
|
||||
do_revert_default() {
|
||||
verify_privileges
|
||||
|
||||
msg "Restoring default folder color for '$THEME_NAME' ..."
|
||||
change_color "${DEFAULT_COLORS[$THEME_NAME]:-blue}"
|
||||
config --new
|
||||
update_icon_cache
|
||||
}
|
||||
|
||||
do_restore_color() {
|
||||
local saved_color=''
|
||||
|
||||
if config --exists; then
|
||||
THEME_NAME="$(config --get theme)"
|
||||
saved_color="$(config --get color)"
|
||||
else
|
||||
_exit "Unable to find config file."
|
||||
fi
|
||||
|
||||
THEME_DIR="$(get_theme_dir)" || {
|
||||
_exit "Unable to find '$THEME_NAME' icon theme."
|
||||
}
|
||||
|
||||
_is_valid_color "$saved_color" || {
|
||||
_exit "Unable to find '$saved_color' color in '$THEME_NAME'."
|
||||
}
|
||||
|
||||
verify_privileges
|
||||
|
||||
change_color "$saved_color"
|
||||
msg "'$saved_color' color of the folders has been restored."
|
||||
}
|
||||
|
||||
delete_icon_caches() {
|
||||
local icon_cache real_user='' real_home=''
|
||||
|
||||
real_user="$(get_real_user)"
|
||||
real_home="$(get_user_home "$real_user")"
|
||||
|
||||
declare -a icon_caches=(
|
||||
# KDE 5 icon caches
|
||||
"$real_home/.cache/icon-cache.kcache"
|
||||
"/var/tmp/kdecache-$real_user/icon-cache.kcache"
|
||||
)
|
||||
|
||||
verbose "Deleting icon caches ..."
|
||||
for icon_cache in "${icon_caches[@]}"; do
|
||||
[ -e "$icon_cache" ] || continue
|
||||
rm -f "$icon_cache"
|
||||
done
|
||||
}
|
||||
|
||||
update_icon_cache() {
|
||||
[ -z "$DISABLE_UPDATE_ICON_CACHE" ] || return 0
|
||||
|
||||
delete_icon_caches
|
||||
|
||||
verbose "Rebuilding icon cache for '$THEME_NAME' ..."
|
||||
gtk-update-icon-cache -qf "$THEME_DIR" || true
|
||||
}
|
||||
|
||||
update_icon_caches() {
|
||||
local theme=''
|
||||
|
||||
delete_icon_caches
|
||||
|
||||
for theme in "${!DEFAULT_COLORS[@]}"; do
|
||||
[ -f "$THEME_DIR/../$theme/index.theme" ] || continue
|
||||
verbose "Rebuilding icon cache for '$theme' ..."
|
||||
gtk-update-icon-cache -qf "$THEME_DIR/../$theme" || true
|
||||
done
|
||||
}
|
||||
|
||||
verify_privileges() {
|
||||
_is_root_user && return 0
|
||||
_is_user_dir && return 0
|
||||
_is_writable && return 0
|
||||
|
||||
verbose "This operation requires root privileges."
|
||||
|
||||
if command -v sudo > /dev/null; then
|
||||
exec sudo USER_HOME="$USER_HOME" XDG_DATA_DIRS="$XDG_DATA_DIRS" \
|
||||
"$THIS_SCRIPT" "${ARGS[@]}"
|
||||
else
|
||||
fatal "You need to be root to run this command."
|
||||
fi
|
||||
}
|
||||
|
||||
parse_args() {
|
||||
local arg='' opt=''
|
||||
local -a args=()
|
||||
|
||||
# Show help if no argument is passed
|
||||
if [ -z "$1" ]; then
|
||||
usage 2
|
||||
fi
|
||||
|
||||
# Translate --gnu-long-options to -g (short options)
|
||||
for arg; do
|
||||
case "$arg" in
|
||||
--help) args+=( -h ) ;;
|
||||
--list) args+=( -l ) ;;
|
||||
--once) args+=( -o ) ;;
|
||||
--theme) args+=( -t ) ;;
|
||||
--update-caches) args+=( -u ) ;;
|
||||
--verbose) args+=( -v ) ;;
|
||||
--color|--colour) args+=( -C ) ;;
|
||||
--default) args+=( -D ) ;;
|
||||
--restore) args+=( -R ) ;;
|
||||
--version) args+=( -V ) ;;
|
||||
--[0-9a-Z]*)
|
||||
err "illegal option -- '$arg'"
|
||||
usage 2
|
||||
;;
|
||||
*) args+=("$arg")
|
||||
esac
|
||||
done
|
||||
|
||||
# Reset the positional parameters to the short options
|
||||
set -- "${args[@]}"
|
||||
|
||||
while getopts ":C:DRlot:uvVh" opt; do
|
||||
case "$opt" in
|
||||
C ) OPERATIONS+=("change-color")
|
||||
SELECTED_COLOR="$OPTARG"
|
||||
;;
|
||||
D ) OPERATIONS+=("revert-default") ;;
|
||||
R ) OPERATIONS+=("restore-color") ;;
|
||||
l ) OPERATIONS+=("list-colors") ;;
|
||||
o ) ONCE=1 ;;
|
||||
t ) THEME_NAME="$OPTARG" ;;
|
||||
u ) OPERATIONS+=("update-icon-caches") ;;
|
||||
v ) VERBOSE=1 ;;
|
||||
V ) printf "%s %s\n" "$PROGNAME" "$VERSION"
|
||||
exit 0
|
||||
;;
|
||||
h ) usage 0 ;;
|
||||
: ) err "option requires an argument -- '-$OPTARG'"
|
||||
usage 2
|
||||
;;
|
||||
\?) err "illegal option -- '-$OPTARG'"
|
||||
usage 2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((OPTIND-1))
|
||||
|
||||
# Return an error if any positional parameters are found
|
||||
if [ -n "$1" ]; then
|
||||
err "illegal parameter -- '$1'"
|
||||
usage 2
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
# default values of options
|
||||
declare THEME_NAME="${THEME_NAME:-Papirus}"
|
||||
declare -i VERBOSE="${VERBOSE:-0}"
|
||||
declare -i ONCE="${ONCE:-0}"
|
||||
declare -A DEFAULT_COLORS=(
|
||||
['ePapirus']='blue'
|
||||
['Papirus']='blue'
|
||||
['Papirus-Dark']='blue'
|
||||
)
|
||||
|
||||
declare SELECTED_COLOR=''
|
||||
declare -a OPERATIONS=()
|
||||
|
||||
parse_args "${ARGS[@]}"
|
||||
|
||||
if [ "$VERBOSE" -eq "1" ]; then
|
||||
# open a file descriptor for verbose messages
|
||||
exec 4>&1
|
||||
# close the file descriptor before exiting
|
||||
trap 'exec 4>&-' EXIT HUP INT TERM
|
||||
fi
|
||||
|
||||
# set USER_HOME variable instead HOME to prevent changing user's icons
|
||||
# when running with sudo
|
||||
[ -n "$USER_HOME" ] || USER_HOME="$(get_user_home "$(id -nu)")"
|
||||
|
||||
if [ -f "$THEME_NAME/index.theme" ]; then
|
||||
# THEME_NAME is a path to an icon theme
|
||||
THEME_DIR="$(readlink -f "$THEME_NAME")"
|
||||
THEME_NAME="$(basename "$THEME_DIR")"
|
||||
verbose "The path to '$THEME_DIR' theme is specified."
|
||||
else
|
||||
THEME_DIR="$(get_theme_dir)" || {
|
||||
fatal "Fail to find '$THEME_NAME' icon theme."
|
||||
}
|
||||
fi
|
||||
|
||||
for operation in "${OPERATIONS[@]}"; do
|
||||
case "$operation" in
|
||||
change-color)
|
||||
do_change_color
|
||||
;;
|
||||
revert-default)
|
||||
do_revert_default
|
||||
;;
|
||||
restore-color)
|
||||
do_restore_color
|
||||
;;
|
||||
list-colors)
|
||||
if [ -t 1 ]; then
|
||||
cat <<- EOF
|
||||
List of available colors:
|
||||
$(list_colors)
|
||||
EOF
|
||||
else
|
||||
list_colors
|
||||
fi
|
||||
;;
|
||||
update-icon-caches)
|
||||
verify_privileges
|
||||
update_icon_caches
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
verbose "Done!"
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
main
|
||||
|
||||
exit 1
|
Before Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 68 KiB |
@ -1,8 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
if [[ "$RELOG_NEEDED" == 1 ]]; then
|
||||
if zenity --question --text="New extensions have been installed!, reload required!"
|
||||
then
|
||||
gnome-session-quit --force --no-prompt
|
||||
fi
|
||||
fi
|
@ -1,56 +0,0 @@
|
||||
#! /bin/bash
|
||||
rm -rfv $HOME/.config/gtk-4.0
|
||||
|
||||
if [[ $1 == pika ]]
|
||||
then
|
||||
dconf write /org/pika/layouts/pika-theme 1
|
||||
gnome-extensions enable user-theme@gnome-shell-extensions.gcampax.github.com
|
||||
dconf write /org/gnome/desktop/wm/preferences/titlebar-font "'Ubuntu Bold 11'"
|
||||
dconf write /org/gnome/desktop/sound/theme-name "'pika'"
|
||||
dconf write /org/gnome/desktop/interface/icon-theme "'Papirus'"
|
||||
dconf write /org/gnome/desktop/interface/monospace-font-name "'Ubuntu Mono 13'"
|
||||
dconf write /org/gnome/desktop/interface/document-font-name "'Sans 11'"
|
||||
dconf write /org/gnome/desktop/interface/font-name "'Ubuntu 11'"
|
||||
dconf write /org/gnome/desktop/interface/gtk-theme "'Jasper-Yellow-Dark'"
|
||||
dconf write /org/gnome/shell/extensions/user-theme/name "'Jasper-Yellow-Dark'"
|
||||
echo '#! /bin/bash' > $HOME/.config/pika_theme || touch $HOME/.config/pika_theme && echo '#! /bin/bash' > $HOME/.config/pika_theme
|
||||
echo 'KVANTUM_THEME_DARK=Orchis-dark#' >> $HOME/.config/pika_theme
|
||||
echo 'KVANTUM_THEME_LIGHT=Orchis#' >> $HOME/.config/pika_theme
|
||||
echo 'GTK_THEME_DARK=$(dconf read /org/gnome/desktop/interface/gtk-theme | 'sed \"s+\'++\"' | 'sed \"s+\'++\"' | 'sed \"s+-Dark++\"' | 'sed \"s+-Light++\"')'-Dark >> $HOME/.config/pika_theme
|
||||
echo 'GTK_THEME_LIGHT=$(dconf read /org/gnome/desktop/interface/gtk-theme | 'sed \"s+\'++\"' | 'sed \"s+\'++\"' | 'sed \"s+-Dark++\"' | 'sed \"s+-Light++\"')'-Light >> $HOME/.config/pika_theme
|
||||
echo 'GTK_THEME_PATH_DARK=/usr/share/themes/$GTK_THEME_DARK' >> $HOME/.config/pika_theme
|
||||
echo 'GTK_THEME_PATH_LIGHT=/usr/share/themes/GTK_THEME_LIGHT' >> $HOME/.config/pika_theme
|
||||
dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'"
|
||||
pika-gnome-theme dark
|
||||
pkexec /usr/lib/pika/gnome-layouts/papirus-folders -u -C yellow
|
||||
if dconf read /org/gnome/desktop/interface/color-scheme | grep dark
|
||||
then
|
||||
pika-gnome-theme dark
|
||||
else
|
||||
pika-gnome-theme
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $1 == gnome ]]
|
||||
then
|
||||
dconf write /org/pika/layouts/pika-theme 0
|
||||
dconf write /org/gnome/shell/extensions/user-theme/name "''"
|
||||
dconf write /org/gnome/desktop/wm/preferences/titlebar-font "'Cantarell Bold 11'"
|
||||
dconf write /org/gnome/desktop/sound/theme-name "'freedesktop'"
|
||||
dconf write /org/gnome/desktop/interface/icon-theme "'Adwaita'"
|
||||
dconf write /org/gnome/desktop/interface/monospace-font-name "'Monospace 11'"
|
||||
dconf write /org/gnome/desktop/interface/document-font-name "'Sans 11'"
|
||||
dconf write /org/gnome/desktop/interface/font-name "'Cantarell 11'"
|
||||
dconf write /org/gnome/shell/extensions/nightthemeswitcher/commands/enabled false
|
||||
dconf write /org/gnome/shell/extensions/nightthemeswitcher/gtk-variants/day "'adw-gtk3'"
|
||||
dconf write /org/gnome/shell/extensions/nightthemeswitcher/gtk-variants/night "'adw-gtk3-dark'"
|
||||
dconf write /org/gnome/shell/extensions/nightthemeswitcher/shell-variants/day "''"
|
||||
dconf write /org/gnome/shell/extensions/nightthemeswitcher/shell-variants/night "''"
|
||||
echo '#! /bin/bash' > $HOME/.config/pika_theme || touch $HOME/.config/pika_theme && echo '#! /bin/bash' > $HOME/.config/pika_theme
|
||||
echo 'KVANTUM_THEME_DARK=' >> $HOME/.config/pika_theme
|
||||
echo 'KVANTUM_THEME_LIGHT=' >> $HOME/.config/pika_theme
|
||||
echo 'GTK_THEME_DARK=' >> $HOME/.config/pika_theme
|
||||
echo 'GTK_THEME_LIGHT=' >> $HOME/.config/pika_theme
|
||||
echo 'GTK_THEME_PATH_DARK=' >> $HOME/.config/pika_theme
|
||||
echo 'GTK_THEME_PATH_LIGHT=' >> $HOME/.config/pika_theme
|
||||
fi
|
@ -1,18 +0,0 @@
|
||||
<schemalist>
|
||||
<schema path="/org/pika/layouts/" id="org.pika.layouts">
|
||||
<key type="i" name="layout-num">
|
||||
<default>3</default>
|
||||
<summary>What layout is selected.</summary>
|
||||
<description>
|
||||
What layout is selected.
|
||||
</description>
|
||||
</key>
|
||||
<key type="i" name="pika-theme">
|
||||
<default>1</default>
|
||||
<summary>What Theme is being used.</summary>
|
||||
<description>
|
||||
What Theme is being used.
|
||||
</description>
|
||||
</key>
|
||||
</schema>
|
||||
</schemalist>
|