hyprpanel
This commit is contained in:
1 parent
10080a83ee
commit
5151ac24da
322 files changed
+38276
No files matched your search
@@ -0,0 +1,74 @@
|
||||
// <3 Aylur for this brightness service
|
||||
import { bash, dependencies, sh } from 'lib/utils';
|
||||
|
||||
if (!dependencies('brightnessctl')) App.quit();
|
||||
|
||||
const get = (args: string): number => Number(Utils.exec(`brightnessctl ${args}`));
|
||||
const screen = await bash`ls -w1 /sys/class/backlight | head -1`;
|
||||
const kbd = await bash`ls -w1 /sys/class/leds | grep '::kbd_backlight$' | head -1`;
|
||||
|
||||
class Brightness extends Service {
|
||||
static {
|
||||
Service.register(
|
||||
this,
|
||||
{},
|
||||
{
|
||||
screen: ['float', 'rw'],
|
||||
kbd: ['int', 'rw'],
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
#kbdMax = get(`--device ${kbd} max`);
|
||||
#kbd = get(`--device ${kbd} get`);
|
||||
#screenMax = get(`--device ${screen} max`);
|
||||
#screen = get(`--device ${screen} get`) / (get(`--device ${screen} max`) || 1);
|
||||
|
||||
get kbd(): number {
|
||||
return this.#kbd;
|
||||
}
|
||||
get screen(): number {
|
||||
return this.#screen;
|
||||
}
|
||||
|
||||
set kbd(value) {
|
||||
if (value < 0 || value > this.#kbdMax) return;
|
||||
|
||||
sh(`brightnessctl -d ${kbd} s ${value} -q`).then(() => {
|
||||
this.#kbd = value;
|
||||
this.changed('kbd');
|
||||
});
|
||||
}
|
||||
|
||||
set screen(percent) {
|
||||
if (percent < 0) percent = 0;
|
||||
|
||||
if (percent > 1) percent = 1;
|
||||
|
||||
sh(`brightnessctl set ${Math.round(percent * 100)}% -d ${screen} -q`).then(() => {
|
||||
this.#screen = percent;
|
||||
this.changed('screen');
|
||||
});
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
const screenPath = `/sys/class/backlight/${screen}/brightness`;
|
||||
const kbdPath = `/sys/class/leds/${kbd}/brightness`;
|
||||
|
||||
Utils.monitorFile(screenPath, async (f) => {
|
||||
const v = await Utils.readFileAsync(f);
|
||||
this.#screen = Number(v) / this.#screenMax;
|
||||
this.changed('screen');
|
||||
});
|
||||
|
||||
Utils.monitorFile(kbdPath, async (f) => {
|
||||
const v = await Utils.readFileAsync(f);
|
||||
this.#kbd = Number(v) / this.#kbdMax;
|
||||
this.changed('kbd');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default new Brightness();
|
||||
@@ -0,0 +1,97 @@
|
||||
import { dependencies, sh } from 'lib/utils';
|
||||
import options from 'options';
|
||||
const hyprland = await Service.import('hyprland');
|
||||
|
||||
const WP = `${Utils.HOME}/.config/background`;
|
||||
|
||||
class Wallpaper extends Service {
|
||||
static {
|
||||
Service.register(
|
||||
this,
|
||||
{},
|
||||
{
|
||||
wallpaper: ['string'],
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
#blockMonitor = false;
|
||||
#isRunning = false;
|
||||
|
||||
#wallpaper(): void {
|
||||
if (!dependencies('swww')) return;
|
||||
|
||||
hyprland.monitors.map((m) => m.name);
|
||||
sh('hyprctl cursorpos').then((pos) => {
|
||||
sh([
|
||||
'swww',
|
||||
'img',
|
||||
'--invert-y',
|
||||
'--transition-type',
|
||||
'grow',
|
||||
'--transition-duration',
|
||||
'1.5',
|
||||
'--transition-fps',
|
||||
'30',
|
||||
'--transition-pos',
|
||||
pos.replace(' ', ''),
|
||||
WP,
|
||||
]).then(() => {
|
||||
this.changed('wallpaper');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async #setWallpaper(path: string): Promise<void> {
|
||||
this.#blockMonitor = true;
|
||||
|
||||
await sh(`cp ${path} ${WP}`);
|
||||
this.#wallpaper();
|
||||
|
||||
this.#blockMonitor = false;
|
||||
}
|
||||
|
||||
readonly set = (path: string): void => {
|
||||
this.#setWallpaper(path);
|
||||
};
|
||||
readonly isRunning = (): boolean => {
|
||||
return this.#isRunning;
|
||||
};
|
||||
|
||||
get wallpaper(): string {
|
||||
return WP;
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
options.wallpaper.enable.connect('changed', () => {
|
||||
if (options.wallpaper.enable.value) {
|
||||
this.#isRunning = true;
|
||||
Utils.execAsync('swww-daemon')
|
||||
.then(() => {
|
||||
this.#wallpaper();
|
||||
})
|
||||
.catch(() => null);
|
||||
} else {
|
||||
this.#isRunning = false;
|
||||
Utils.execAsync('pkill swww-daemon').catch(() => null);
|
||||
}
|
||||
});
|
||||
|
||||
if (!dependencies('swww') || !options.wallpaper.enable.value) return this;
|
||||
|
||||
this.#isRunning = true;
|
||||
Utils.monitorFile(WP, () => {
|
||||
if (!this.#blockMonitor) this.#wallpaper();
|
||||
});
|
||||
|
||||
Utils.execAsync('swww-daemon')
|
||||
.then(() => {
|
||||
this.#wallpaper();
|
||||
})
|
||||
.catch(() => null);
|
||||
}
|
||||
}
|
||||
|
||||
export default new Wallpaper();
|
||||
Executable
+173
@@ -0,0 +1,173 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import dbus
|
||||
import dbus.service
|
||||
import dbus.mainloop.glib
|
||||
from gi.repository import GLib
|
||||
import subprocess
|
||||
import logging
|
||||
|
||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
||||
|
||||
AGENT_PATH = "/test/agent"
|
||||
CAPABILITY = "NoInputNoOutput"
|
||||
|
||||
def send_notification_with_actions(title, message, actions, action_handler):
|
||||
bus = dbus.SessionBus()
|
||||
notification_object = bus.get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
|
||||
notify_interface = dbus.Interface(notification_object, "org.freedesktop.Notifications")
|
||||
bus.add_signal_receiver(action_handler,
|
||||
dbus_interface="org.freedesktop.Notifications",
|
||||
signal_name="ActionInvoked")
|
||||
notify_interface.Notify("bluetooth_agent", 0, "", title, message, actions, {}, -1)
|
||||
|
||||
class Agent(dbus.service.Object):
|
||||
def __init__(self, bus):
|
||||
dbus.service.Object.__init__(self, bus, AGENT_PATH)
|
||||
|
||||
@dbus.service.method("org.bluez.Agent1", in_signature="", out_signature="")
|
||||
def Release(self):
|
||||
logging.info("Release")
|
||||
|
||||
def get_device_name(self, device):
|
||||
bus = dbus.SystemBus()
|
||||
device_proxy = bus.get_object("org.bluez", device)
|
||||
device_properties = dbus.Interface(device_proxy, "org.freedesktop.DBus.Properties")
|
||||
return device_properties.Get("org.bluez.Device1", "Name")
|
||||
|
||||
@dbus.service.method("org.bluez.Agent1", in_signature="o", out_signature="")
|
||||
def RequestPinCode(self, device):
|
||||
device_name = self.get_device_name(device)
|
||||
logging.info(f"RequestPinCode {device_name} ({device})")
|
||||
self.request_input("Enter PIN code", f"Enter PIN code for device {device_name}", device, "pin")
|
||||
|
||||
@dbus.service.method("org.bluez.Agent1", in_signature="o", out_signature="u")
|
||||
def RequestPasskey(self, device):
|
||||
device_name = self.get_device_name(device)
|
||||
logging.info(f"RequestPasskey {device_name} ({device})")
|
||||
self.request_input("Enter Passkey", f"Enter passkey for device {device_name}", device, "passkey")
|
||||
|
||||
@dbus.service.method("org.bluez.Agent1", in_signature="ou", out_signature="")
|
||||
def DisplayPasskey(self, device, passkey):
|
||||
device_name = self.get_device_name(device)
|
||||
logging.info(f"DisplayPasskey {device_name} passkey {passkey}")
|
||||
send_notification_with_actions("Bluetooth Pairing Request", f"Passkey for device {device_name} is {passkey}", [], lambda *args: None)
|
||||
|
||||
@dbus.service.method("org.bluez.Agent1", in_signature="ou", out_signature="")
|
||||
def RequestConfirmation(self, device, passkey):
|
||||
device_name = self.get_device_name(device)
|
||||
logging.info(f"RequestConfirmation {device_name} passkey {passkey}")
|
||||
actions = ["confirm", "Confirm", "deny", "Deny"]
|
||||
|
||||
def action_handler(notification_id, action_key):
|
||||
if action_key == "confirm":
|
||||
logging.info(f"Confirmed pairing for {device_name}")
|
||||
self.send_reply(device)
|
||||
elif action_key == "deny":
|
||||
logging.info(f"Denied pairing for {device_name}")
|
||||
self.send_error(device, "org.bluez.Error.Rejected")
|
||||
|
||||
send_notification_with_actions("Bluetooth Pairing Request",
|
||||
f"Confirm passkey {passkey} for device {device_name}",
|
||||
actions, action_handler)
|
||||
return
|
||||
|
||||
@dbus.service.method("org.bluez.Agent1", in_signature="o", out_signature="")
|
||||
def RequestAuthorization(self, device):
|
||||
device_name = self.get_device_name(device)
|
||||
logging.info(f"RequestAuthorization {device_name}")
|
||||
actions = ["confirm", "Confirm", "deny", "Deny"]
|
||||
|
||||
def action_handler(notification_id, action_key):
|
||||
if action_key == "confirm":
|
||||
logging.info(f"Authorized device {device_name}")
|
||||
self.send_reply(device)
|
||||
elif action_key == "deny":
|
||||
logging.info(f"Denied authorization for {device_name}")
|
||||
self.send_error(device, "org.bluez.Error.Rejected")
|
||||
|
||||
send_notification_with_actions("Bluetooth Service Authorization",
|
||||
f"Authorize device {device_name}",
|
||||
actions, action_handler)
|
||||
return
|
||||
|
||||
@dbus.service.method("org.bluez.Agent1", in_signature="os", out_signature="")
|
||||
def AuthorizeService(self, device, uuid):
|
||||
device_name = self.get_device_name(device)
|
||||
logging.info(f"AuthorizeService {device_name} uuid {uuid}")
|
||||
actions = ["confirm", "Confirm", "deny", "Deny"]
|
||||
|
||||
def action_handler(notification_id, action_key):
|
||||
if action_key == "confirm":
|
||||
logging.info(f"Authorized service {uuid} for device {device_name}")
|
||||
self.send_reply(device)
|
||||
elif action_key == "deny":
|
||||
logging.info(f"Denied authorization for service {uuid} on device {device_name}")
|
||||
self.send_error(device, "org.bluez.Error.Rejected")
|
||||
|
||||
send_notification_with_actions("Bluetooth Service Authorization",
|
||||
f"Authorize service {uuid} for device {device_name}",
|
||||
actions, action_handler)
|
||||
return
|
||||
|
||||
@dbus.service.method("org.bluez.Agent1", in_signature="", out_signature="")
|
||||
def Cancel(self):
|
||||
logging.info("Cancel")
|
||||
|
||||
def request_input(self, title, message, device, input_type):
|
||||
def action_handler(notification_id, action_key):
|
||||
if action_key == "input":
|
||||
result = subprocess.run(["zenity", "--entry", "--title", title, "--text", message], capture_output=True, text=True)
|
||||
user_input = result.stdout.strip()
|
||||
if input_type == "pin":
|
||||
self.handle_pin_input(device, user_input)
|
||||
elif input_type == "passkey":
|
||||
self.handle_passkey_input(device, user_input)
|
||||
elif action_key == "cancel":
|
||||
self.send_error(device, "org.bluez.Error.Rejected")
|
||||
|
||||
actions = ["input", "Enter", "cancel", "Cancel"]
|
||||
send_notification_with_actions(title, message, actions, action_handler)
|
||||
|
||||
def handle_pin_input(self, device, pin_code):
|
||||
logging.info(f"PIN code entered for {device}: {pin_code}")
|
||||
self.send_reply(device)
|
||||
|
||||
def handle_passkey_input(self, device, passkey):
|
||||
logging.info(f"Passkey entered for {device}: {passkey}")
|
||||
self.send_reply(device)
|
||||
|
||||
def send_reply(self, device):
|
||||
logging.info(f"Sending reply for {device}")
|
||||
bus = dbus.SystemBus()
|
||||
agent = bus.get_object("org.bluez", device)
|
||||
agent_interface = dbus.Interface(agent, "org.bluez.Device1")
|
||||
agent_interface.Pair(reply_handler=self.success_callback, error_handler=self.error_callback)
|
||||
|
||||
def send_error(self, device, error):
|
||||
logging.info(f"Sending error for {device}")
|
||||
bus = dbus.SystemBus()
|
||||
agent = bus.get_object("org.bluez", device)
|
||||
agent_interface = dbus.Interface(agent, "org.bluez.Device1")
|
||||
agent_interface.CancelPairing(reply_handler=self.success_callback, error_handler=self.error_callback)
|
||||
|
||||
def success_callback(self):
|
||||
logging.info("Operation succeeded")
|
||||
|
||||
def error_callback(self, error):
|
||||
logging.error(f"Operation failed: {error}")
|
||||
|
||||
def register_agent():
|
||||
bus = dbus.SystemBus()
|
||||
manager = dbus.Interface(bus.get_object("org.bluez", "/org/bluez"), "org.bluez.AgentManager1")
|
||||
path = AGENT_PATH
|
||||
agent = Agent(bus)
|
||||
manager.RegisterAgent(path, CAPABILITY)
|
||||
manager.RequestDefaultAgent(path)
|
||||
logging.info("Agent registered")
|
||||
|
||||
if __name__ == "__main__":
|
||||
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
||||
register_agent()
|
||||
loop = GLib.MainLoop()
|
||||
loop.run()
|
||||
@@ -0,0 +1,70 @@
|
||||
import { defaultColorMap } from 'lib/types/defaults/options';
|
||||
import { ColorMapValue, ColorMapKey, HexColor, MatugenColors } from 'lib/types/options';
|
||||
import { getMatugenVariations } from './variations';
|
||||
import { bash, dependencies, Notify, isAnImage } from 'lib/utils';
|
||||
import options from 'options';
|
||||
import icons from 'lib/icons';
|
||||
import { Variable } from 'types/variable';
|
||||
const { scheme_type, contrast } = options.theme.matugen_settings;
|
||||
const { matugen } = options.theme;
|
||||
|
||||
const updateOptColor = (color: HexColor, opt: Variable<HexColor>): void => {
|
||||
opt.value = color;
|
||||
};
|
||||
|
||||
export async function generateMatugenColors(): Promise<MatugenColors | undefined> {
|
||||
if (!matugen.value || !dependencies('matugen')) {
|
||||
return;
|
||||
}
|
||||
const wallpaperPath = options.wallpaper.image.value;
|
||||
|
||||
try {
|
||||
if (!wallpaperPath.length || !isAnImage(wallpaperPath)) {
|
||||
Notify({
|
||||
summary: 'Matugen Failed',
|
||||
body: "Please select a wallpaper in 'Theming > General' first.",
|
||||
iconName: icons.ui.warning,
|
||||
timeout: 7000,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const normalizedContrast = contrast.value > 1 ? 1 : contrast.value < -1 ? -1 : contrast.value;
|
||||
const contents = await bash(
|
||||
`matugen image ${wallpaperPath} -t scheme-${scheme_type.value} --contrast ${normalizedContrast} --json hex`,
|
||||
);
|
||||
|
||||
return JSON.parse(contents).colors[options.theme.matugen_settings.mode.value];
|
||||
} catch (error) {
|
||||
const errMsg = `An error occurred while generating matugen colors: ${error}`;
|
||||
console.error(errMsg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const isColorValid = (color: string): color is ColorMapKey => {
|
||||
return defaultColorMap.hasOwnProperty(color);
|
||||
};
|
||||
|
||||
export const replaceHexValues = (incomingHex: HexColor, matugenColors: MatugenColors): HexColor => {
|
||||
if (!options.theme.matugen.value) {
|
||||
return incomingHex;
|
||||
}
|
||||
|
||||
const matugenVariation = getMatugenVariations(matugenColors, options.theme.matugen_settings.variation.value);
|
||||
updateOptColor(matugenVariation.base, options.theme.bar.menus.menu.media.card.color as Variable<HexColor>);
|
||||
|
||||
for (const curColor of Object.keys(defaultColorMap)) {
|
||||
const currentColor: string = curColor;
|
||||
if (!isColorValid(currentColor)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const curColorValue: ColorMapValue = defaultColorMap[currentColor];
|
||||
if (curColorValue === incomingHex) {
|
||||
return matugenVariation[currentColor];
|
||||
}
|
||||
}
|
||||
|
||||
return incomingHex;
|
||||
};
|
||||
@@ -0,0 +1,570 @@
|
||||
import { MatugenColors, MatugenVariation, MatugenVariations } from 'lib/types/options';
|
||||
|
||||
/*
|
||||
* NOTE: This maps the values of the default colors to the values generated by Matugen.
|
||||
* Each of the variations are carefully tested and curated to make sure that colors don't
|
||||
* have weird luminocity overlaps (light on light, dark on dark).
|
||||
*/
|
||||
export const getMatugenVariations = (matugenColors: MatugenColors, variation: MatugenVariations): MatugenVariation => {
|
||||
const matVtns = {
|
||||
standard_1: {
|
||||
rosewater: matugenColors.secondary,
|
||||
flamingo: matugenColors.secondary,
|
||||
pink: matugenColors.tertiary,
|
||||
mauve: matugenColors.primary,
|
||||
red: matugenColors.tertiary,
|
||||
maroon: matugenColors.primary,
|
||||
peach: matugenColors.tertiary,
|
||||
yellow: matugenColors.secondary,
|
||||
green: matugenColors.primary,
|
||||
teal: matugenColors.secondary,
|
||||
sky: matugenColors.secondary,
|
||||
sapphire: matugenColors.primary,
|
||||
blue: matugenColors.primary,
|
||||
lavender: matugenColors.primary,
|
||||
text: matugenColors.on_background,
|
||||
subtext1: matugenColors.outline,
|
||||
subtext2: matugenColors.outline,
|
||||
overlay2: matugenColors.outline,
|
||||
overlay1: matugenColors.outline,
|
||||
overlay0: matugenColors.outline,
|
||||
surface2: matugenColors.outline,
|
||||
surface1: matugenColors.surface_bright,
|
||||
surface0: matugenColors.surface_bright,
|
||||
base2: matugenColors.inverse_on_surface,
|
||||
base: matugenColors.inverse_on_surface,
|
||||
mantle: matugenColors.surface_dim,
|
||||
crust: matugenColors.surface_dim,
|
||||
notifications_closer: matugenColors.primary,
|
||||
notifications_background: matugenColors.surface_dim,
|
||||
dashboard_btn_text: matugenColors.surface_dim,
|
||||
red2: matugenColors.tertiary,
|
||||
peach2: matugenColors.tertiary,
|
||||
pink2: matugenColors.tertiary,
|
||||
mantle2: matugenColors.surface_dim,
|
||||
surface1_2: matugenColors.inverse_on_surface,
|
||||
surface0_2: matugenColors.surface_bright,
|
||||
overlay1_2: matugenColors.outline,
|
||||
text2: matugenColors.on_background,
|
||||
lavender2: matugenColors.primary,
|
||||
crust2: matugenColors.surface_dim,
|
||||
maroon2: matugenColors.primary,
|
||||
mauve2: matugenColors.primary,
|
||||
green2: matugenColors.primary,
|
||||
surface2_2: matugenColors.surface,
|
||||
sky2: matugenColors.secondary,
|
||||
teal2: matugenColors.secondary,
|
||||
yellow2: matugenColors.secondary,
|
||||
pink3: matugenColors.tertiary,
|
||||
red3: matugenColors.secondary,
|
||||
mantle3: matugenColors.inverse_on_surface,
|
||||
surface0_3: matugenColors.outline,
|
||||
surface2_3: matugenColors.outline,
|
||||
overlay1_3: matugenColors.outline,
|
||||
lavender3: matugenColors.primary,
|
||||
mauve3: matugenColors.primary,
|
||||
green3: matugenColors.primary,
|
||||
sky3: matugenColors.secondary,
|
||||
teal3: matugenColors.secondary,
|
||||
yellow3: matugenColors.secondary,
|
||||
maroon3: matugenColors.primary,
|
||||
crust3: matugenColors.surface_dim,
|
||||
},
|
||||
standard_2: {
|
||||
rosewater: matugenColors.primary,
|
||||
flamingo: matugenColors.primary,
|
||||
pink: matugenColors.tertiary,
|
||||
mauve: matugenColors.secondary,
|
||||
red: matugenColors.tertiary,
|
||||
maroon: matugenColors.secondary,
|
||||
peach: matugenColors.tertiary,
|
||||
yellow: matugenColors.primary,
|
||||
green: matugenColors.secondary,
|
||||
teal: matugenColors.primary,
|
||||
sky: matugenColors.primary,
|
||||
sapphire: matugenColors.secondary,
|
||||
blue: matugenColors.secondary,
|
||||
lavender: matugenColors.secondary,
|
||||
text: matugenColors.on_background,
|
||||
subtext1: matugenColors.outline,
|
||||
subtext2: matugenColors.outline,
|
||||
overlay2: matugenColors.outline,
|
||||
overlay1: matugenColors.outline,
|
||||
overlay0: matugenColors.outline,
|
||||
surface2: matugenColors.outline,
|
||||
surface1: matugenColors.surface_bright,
|
||||
surface0: matugenColors.surface_bright,
|
||||
base2: matugenColors.inverse_on_surface,
|
||||
base: matugenColors.inverse_on_surface,
|
||||
mantle: matugenColors.surface_dim,
|
||||
crust: matugenColors.surface_dim,
|
||||
notifications_closer: matugenColors.tertiary,
|
||||
notifications_background: matugenColors.surface_dim,
|
||||
dashboard_btn_text: matugenColors.surface_dim,
|
||||
red2: matugenColors.tertiary,
|
||||
peach2: matugenColors.tertiary,
|
||||
pink2: matugenColors.tertiary,
|
||||
mantle2: matugenColors.surface_dim,
|
||||
surface1_2: matugenColors.inverse_on_surface,
|
||||
surface0_2: matugenColors.surface_bright,
|
||||
overlay1_2: matugenColors.outline,
|
||||
text2: matugenColors.on_background,
|
||||
lavender2: matugenColors.secondary,
|
||||
crust2: matugenColors.surface_dim,
|
||||
maroon2: matugenColors.secondary,
|
||||
surface2_2: matugenColors.surface,
|
||||
mauve2: matugenColors.secondary,
|
||||
green2: matugenColors.secondary,
|
||||
sky2: matugenColors.primary,
|
||||
teal2: matugenColors.primary,
|
||||
yellow2: matugenColors.primary,
|
||||
pink3: matugenColors.tertiary,
|
||||
red3: matugenColors.secondary,
|
||||
mantle3: matugenColors.inverse_on_surface,
|
||||
surface0_3: matugenColors.outline,
|
||||
surface2_3: matugenColors.outline,
|
||||
overlay1_3: matugenColors.outline,
|
||||
lavender3: matugenColors.secondary,
|
||||
mauve3: matugenColors.secondary,
|
||||
green3: matugenColors.secondary,
|
||||
sky3: matugenColors.primary,
|
||||
teal3: matugenColors.primary,
|
||||
yellow3: matugenColors.primary,
|
||||
maroon3: matugenColors.secondary,
|
||||
crust3: matugenColors.surface_dim,
|
||||
},
|
||||
standard_3: {
|
||||
rosewater: matugenColors.secondary,
|
||||
flamingo: matugenColors.secondary,
|
||||
pink: matugenColors.secondary,
|
||||
mauve: matugenColors.primary,
|
||||
red: matugenColors.secondary,
|
||||
maroon: matugenColors.primary,
|
||||
peach: matugenColors.secondary,
|
||||
yellow: matugenColors.secondary,
|
||||
green: matugenColors.primary,
|
||||
teal: matugenColors.secondary,
|
||||
sky: matugenColors.secondary,
|
||||
sapphire: matugenColors.primary,
|
||||
blue: matugenColors.primary,
|
||||
lavender: matugenColors.primary,
|
||||
text: matugenColors.on_background,
|
||||
subtext1: matugenColors.outline,
|
||||
subtext2: matugenColors.outline,
|
||||
overlay2: matugenColors.outline,
|
||||
overlay1: matugenColors.outline,
|
||||
overlay0: matugenColors.outline,
|
||||
surface2: matugenColors.outline,
|
||||
surface1: matugenColors.surface_bright,
|
||||
surface0: matugenColors.surface_bright,
|
||||
base2: matugenColors.inverse_on_surface,
|
||||
base: matugenColors.inverse_on_surface,
|
||||
mantle: matugenColors.surface_dim,
|
||||
crust: matugenColors.surface_dim,
|
||||
notifications_closer: matugenColors.secondary,
|
||||
notifications_background: matugenColors.surface_dim,
|
||||
dashboard_btn_text: matugenColors.surface_dim,
|
||||
red2: matugenColors.secondary,
|
||||
peach2: matugenColors.secondary,
|
||||
pink2: matugenColors.secondary,
|
||||
mantle2: matugenColors.surface_dim,
|
||||
surface1_2: matugenColors.inverse_on_surface,
|
||||
surface0_2: matugenColors.surface_bright,
|
||||
surface2_2: matugenColors.surface,
|
||||
overlay1_2: matugenColors.outline,
|
||||
text2: matugenColors.on_background,
|
||||
lavender2: matugenColors.primary,
|
||||
crust2: matugenColors.surface_dim,
|
||||
maroon2: matugenColors.primary,
|
||||
mauve2: matugenColors.primary,
|
||||
green2: matugenColors.primary,
|
||||
sky2: matugenColors.secondary,
|
||||
teal2: matugenColors.secondary,
|
||||
yellow2: matugenColors.secondary,
|
||||
pink3: matugenColors.secondary,
|
||||
red3: matugenColors.secondary,
|
||||
mantle3: matugenColors.inverse_on_surface,
|
||||
surface0_3: matugenColors.outline,
|
||||
surface2_3: matugenColors.outline,
|
||||
overlay1_3: matugenColors.outline,
|
||||
lavender3: matugenColors.primary,
|
||||
mauve3: matugenColors.primary,
|
||||
green3: matugenColors.primary,
|
||||
sky3: matugenColors.secondary,
|
||||
teal3: matugenColors.secondary,
|
||||
yellow3: matugenColors.secondary,
|
||||
maroon3: matugenColors.primary,
|
||||
crust3: matugenColors.surface_dim,
|
||||
},
|
||||
vivid_1: {
|
||||
rosewater: matugenColors.surface,
|
||||
flamingo: matugenColors.surface,
|
||||
pink: matugenColors.surface,
|
||||
mauve: matugenColors.surface,
|
||||
red: matugenColors.surface,
|
||||
maroon: matugenColors.surface,
|
||||
peach: matugenColors.surface,
|
||||
yellow: matugenColors.surface,
|
||||
green: matugenColors.surface,
|
||||
teal: matugenColors.surface,
|
||||
sky: matugenColors.surface,
|
||||
sapphire: matugenColors.surface,
|
||||
blue: matugenColors.surface,
|
||||
lavender: matugenColors.surface,
|
||||
text: matugenColors.surface,
|
||||
subtext1: matugenColors.primary_container,
|
||||
subtext2: matugenColors.primary_container,
|
||||
overlay2: matugenColors.primary_container,
|
||||
overlay1: matugenColors.primary_container,
|
||||
overlay0: matugenColors.primary_container,
|
||||
surface2: matugenColors.surface_container_high,
|
||||
surface1: matugenColors.surface_container_high,
|
||||
surface0: matugenColors.surface_container_high,
|
||||
base2: matugenColors.primary,
|
||||
base: matugenColors.primary,
|
||||
mantle: matugenColors.surface_container_low,
|
||||
crust: matugenColors.surface_container_lowest,
|
||||
red2: matugenColors.primary_container,
|
||||
peach2: matugenColors.primary_container,
|
||||
pink2: matugenColors.primary_container,
|
||||
mantle2: matugenColors.primary,
|
||||
surface1_2: matugenColors.primary,
|
||||
surface0_2: matugenColors.primary,
|
||||
overlay1_2: matugenColors.surface_container_high,
|
||||
text2: matugenColors.outline,
|
||||
lavender2: matugenColors.primary_container,
|
||||
crust2: matugenColors.primary,
|
||||
maroon2: matugenColors.primary_container,
|
||||
mauve2: matugenColors.primary_container,
|
||||
surface2_2: matugenColors.primary_container,
|
||||
green2: matugenColors.primary_container,
|
||||
sky2: matugenColors.primary_container,
|
||||
teal2: matugenColors.primary_container,
|
||||
yellow2: matugenColors.primary_container,
|
||||
pink3: matugenColors.primary_fixed,
|
||||
red3: matugenColors.secondary,
|
||||
mantle3: matugenColors.primary,
|
||||
surface0_3: matugenColors.primary,
|
||||
surface2_3: matugenColors.outline,
|
||||
overlay1_3: matugenColors.primary,
|
||||
lavender3: matugenColors.primary,
|
||||
mauve3: matugenColors.primary,
|
||||
green3: matugenColors.primary_fixed,
|
||||
sky3: matugenColors.primary,
|
||||
teal3: matugenColors.primary,
|
||||
yellow3: matugenColors.primary_fixed,
|
||||
maroon3: matugenColors.primary_fixed,
|
||||
crust3: matugenColors.primary,
|
||||
},
|
||||
vivid_2: {
|
||||
rosewater: matugenColors.surface,
|
||||
flamingo: matugenColors.surface,
|
||||
pink: matugenColors.surface,
|
||||
mauve: matugenColors.surface,
|
||||
red: matugenColors.surface,
|
||||
maroon: matugenColors.surface,
|
||||
peach: matugenColors.surface,
|
||||
yellow: matugenColors.surface,
|
||||
green: matugenColors.surface,
|
||||
teal: matugenColors.surface,
|
||||
sky: matugenColors.surface,
|
||||
sapphire: matugenColors.surface,
|
||||
blue: matugenColors.surface,
|
||||
lavender: matugenColors.surface,
|
||||
text: matugenColors.surface,
|
||||
subtext1: matugenColors.secondary_container,
|
||||
subtext2: matugenColors.secondary_container,
|
||||
overlay2: matugenColors.secondary_container,
|
||||
overlay1: matugenColors.secondary_container,
|
||||
overlay0: matugenColors.secondary_container,
|
||||
surface2: matugenColors.surface_container_high,
|
||||
surface1: matugenColors.surface_container_high,
|
||||
surface0: matugenColors.surface_container_high,
|
||||
base2: matugenColors.secondary,
|
||||
base: matugenColors.secondary,
|
||||
mantle: matugenColors.surface_container_low,
|
||||
crust: matugenColors.surface_container_lowest,
|
||||
red2: matugenColors.secondary_container,
|
||||
peach2: matugenColors.secondary_container,
|
||||
pink2: matugenColors.secondary_container,
|
||||
surface2_2: matugenColors.primary_container,
|
||||
mantle2: matugenColors.secondary,
|
||||
surface1_2: matugenColors.secondary,
|
||||
surface0_2: matugenColors.secondary,
|
||||
overlay1_2: matugenColors.surface_container_high,
|
||||
text2: matugenColors.outline,
|
||||
lavender2: matugenColors.secondary_container,
|
||||
crust2: matugenColors.secondary,
|
||||
maroon2: matugenColors.secondary_container,
|
||||
mauve2: matugenColors.secondary_container,
|
||||
green2: matugenColors.secondary_container,
|
||||
sky2: matugenColors.secondary_container,
|
||||
teal2: matugenColors.secondary_container,
|
||||
yellow2: matugenColors.secondary_container,
|
||||
pink3: matugenColors.secondary_fixed,
|
||||
red3: matugenColors.secondary,
|
||||
mantle3: matugenColors.secondary,
|
||||
surface0_3: matugenColors.secondary,
|
||||
surface2_3: matugenColors.outline,
|
||||
overlay1_3: matugenColors.secondary,
|
||||
lavender3: matugenColors.secondary,
|
||||
mauve3: matugenColors.secondary,
|
||||
green3: matugenColors.secondary_fixed,
|
||||
sky3: matugenColors.secondary,
|
||||
teal3: matugenColors.secondary,
|
||||
yellow3: matugenColors.secondary_fixed,
|
||||
maroon3: matugenColors.secondary_fixed,
|
||||
crust3: matugenColors.secondary,
|
||||
},
|
||||
vivid_3: {
|
||||
rosewater: matugenColors.surface,
|
||||
flamingo: matugenColors.surface,
|
||||
pink: matugenColors.surface,
|
||||
mauve: matugenColors.surface,
|
||||
red: matugenColors.surface,
|
||||
maroon: matugenColors.surface,
|
||||
peach: matugenColors.surface,
|
||||
yellow: matugenColors.surface,
|
||||
green: matugenColors.surface,
|
||||
teal: matugenColors.surface,
|
||||
sky: matugenColors.surface,
|
||||
sapphire: matugenColors.surface,
|
||||
blue: matugenColors.surface,
|
||||
lavender: matugenColors.surface,
|
||||
text: matugenColors.surface,
|
||||
subtext1: matugenColors.tertiary_container,
|
||||
subtext2: matugenColors.tertiary_container,
|
||||
overlay2: matugenColors.tertiary_container,
|
||||
overlay1: matugenColors.tertiary_container,
|
||||
overlay0: matugenColors.tertiary_container,
|
||||
surface2: matugenColors.surface_container_high,
|
||||
surface1: matugenColors.surface_container_high,
|
||||
surface0: matugenColors.surface_container_high,
|
||||
base2: matugenColors.tertiary,
|
||||
base: matugenColors.tertiary,
|
||||
mantle: matugenColors.surface_container_low,
|
||||
crust: matugenColors.surface_container_lowest,
|
||||
red2: matugenColors.tertiary_container,
|
||||
peach2: matugenColors.tertiary_container,
|
||||
pink2: matugenColors.tertiary_container,
|
||||
mantle2: matugenColors.tertiary,
|
||||
surface1_2: matugenColors.tertiary,
|
||||
surface0_2: matugenColors.tertiary,
|
||||
overlay1_2: matugenColors.surface_container_high,
|
||||
text2: matugenColors.outline,
|
||||
lavender2: matugenColors.tertiary_container,
|
||||
surface2_2: matugenColors.primary_container,
|
||||
crust2: matugenColors.tertiary,
|
||||
maroon2: matugenColors.tertiary_container,
|
||||
mauve2: matugenColors.tertiary_container,
|
||||
green2: matugenColors.tertiary_container,
|
||||
sky2: matugenColors.tertiary_container,
|
||||
teal2: matugenColors.tertiary_container,
|
||||
yellow2: matugenColors.tertiary_container,
|
||||
pink3: matugenColors.tertiary_fixed,
|
||||
red3: matugenColors.secondary,
|
||||
mantle3: matugenColors.tertiary,
|
||||
surface0_3: matugenColors.tertiary,
|
||||
surface2_3: matugenColors.outline,
|
||||
overlay1_3: matugenColors.tertiary,
|
||||
lavender3: matugenColors.tertiary,
|
||||
mauve3: matugenColors.tertiary,
|
||||
green3: matugenColors.tertiary_fixed,
|
||||
sky3: matugenColors.tertiary,
|
||||
teal3: matugenColors.tertiary,
|
||||
yellow3: matugenColors.tertiary_fixed,
|
||||
maroon3: matugenColors.tertiary_fixed,
|
||||
crust3: matugenColors.tertiary,
|
||||
},
|
||||
monochrome_1: {
|
||||
rosewater: matugenColors.primary,
|
||||
flamingo: matugenColors.primary,
|
||||
pink: matugenColors.primary,
|
||||
mauve: matugenColors.primary,
|
||||
red: matugenColors.primary,
|
||||
maroon: matugenColors.primary,
|
||||
peach: matugenColors.primary,
|
||||
yellow: matugenColors.primary,
|
||||
green: matugenColors.primary,
|
||||
teal: matugenColors.primary,
|
||||
sky: matugenColors.primary,
|
||||
sapphire: matugenColors.primary,
|
||||
blue: matugenColors.primary,
|
||||
lavender: matugenColors.primary,
|
||||
text: matugenColors.on_background,
|
||||
subtext1: matugenColors.outline,
|
||||
subtext2: matugenColors.outline,
|
||||
overlay2: matugenColors.outline,
|
||||
overlay1: matugenColors.outline,
|
||||
overlay0: matugenColors.outline,
|
||||
surface2: matugenColors.outline,
|
||||
surface1: matugenColors.surface_bright,
|
||||
surface0: matugenColors.surface_bright,
|
||||
base2: matugenColors.inverse_on_surface,
|
||||
base: matugenColors.inverse_on_surface,
|
||||
mantle: matugenColors.surface_dim,
|
||||
crust: matugenColors.surface_dim,
|
||||
notifications_closer: matugenColors.primary,
|
||||
notifications_background: matugenColors.surface_dim,
|
||||
dashboard_btn_text: matugenColors.surface_dim,
|
||||
red2: matugenColors.primary,
|
||||
peach2: matugenColors.primary,
|
||||
pink2: matugenColors.primary,
|
||||
mantle2: matugenColors.surface_dim,
|
||||
surface1_2: matugenColors.inverse_on_surface,
|
||||
surface0_2: matugenColors.surface_bright,
|
||||
surface2_2: matugenColors.surface,
|
||||
overlay1_2: matugenColors.outline,
|
||||
text2: matugenColors.on_background,
|
||||
lavender2: matugenColors.primary,
|
||||
crust2: matugenColors.surface_dim,
|
||||
maroon2: matugenColors.primary,
|
||||
mauve2: matugenColors.primary,
|
||||
green2: matugenColors.primary,
|
||||
sky2: matugenColors.primary,
|
||||
teal2: matugenColors.primary,
|
||||
yellow2: matugenColors.primary,
|
||||
pink3: matugenColors.primary,
|
||||
red3: matugenColors.secondary,
|
||||
mantle3: matugenColors.inverse_on_surface,
|
||||
surface0_3: matugenColors.outline,
|
||||
surface2_3: matugenColors.outline,
|
||||
overlay1_3: matugenColors.outline,
|
||||
lavender3: matugenColors.primary,
|
||||
mauve3: matugenColors.primary,
|
||||
green3: matugenColors.primary,
|
||||
sky3: matugenColors.primary,
|
||||
teal3: matugenColors.primary,
|
||||
yellow3: matugenColors.primary,
|
||||
maroon3: matugenColors.primary,
|
||||
crust3: matugenColors.surface_dim,
|
||||
},
|
||||
monochrome_2: {
|
||||
rosewater: matugenColors.secondary,
|
||||
flamingo: matugenColors.secondary,
|
||||
pink: matugenColors.secondary,
|
||||
mauve: matugenColors.secondary,
|
||||
red: matugenColors.secondary,
|
||||
maroon: matugenColors.secondary,
|
||||
peach: matugenColors.secondary,
|
||||
yellow: matugenColors.secondary,
|
||||
green: matugenColors.secondary,
|
||||
teal: matugenColors.secondary,
|
||||
sky: matugenColors.secondary,
|
||||
sapphire: matugenColors.secondary,
|
||||
blue: matugenColors.secondary,
|
||||
lavender: matugenColors.secondary,
|
||||
text: matugenColors.on_background,
|
||||
subtext1: matugenColors.outline,
|
||||
subtext2: matugenColors.outline,
|
||||
overlay2: matugenColors.outline,
|
||||
overlay1: matugenColors.outline,
|
||||
overlay0: matugenColors.outline,
|
||||
surface2: matugenColors.outline,
|
||||
surface1: matugenColors.surface_bright,
|
||||
surface0: matugenColors.surface_bright,
|
||||
base2: matugenColors.inverse_on_surface,
|
||||
base: matugenColors.inverse_on_surface,
|
||||
mantle: matugenColors.surface_dim,
|
||||
crust: matugenColors.surface_dim,
|
||||
notifications_closer: matugenColors.secondary,
|
||||
notifications_background: matugenColors.surface_dim,
|
||||
dashboard_btn_text: matugenColors.surface_dim,
|
||||
red2: matugenColors.secondary,
|
||||
peach2: matugenColors.secondary,
|
||||
pink2: matugenColors.secondary,
|
||||
mantle2: matugenColors.surface_dim,
|
||||
surface1_2: matugenColors.inverse_on_surface,
|
||||
surface0_2: matugenColors.surface_bright,
|
||||
overlay1_2: matugenColors.outline,
|
||||
surface2_2: matugenColors.surface,
|
||||
text2: matugenColors.on_background,
|
||||
lavender2: matugenColors.secondary,
|
||||
crust2: matugenColors.surface_dim,
|
||||
maroon2: matugenColors.secondary,
|
||||
mauve2: matugenColors.secondary,
|
||||
green2: matugenColors.secondary,
|
||||
sky2: matugenColors.secondary,
|
||||
teal2: matugenColors.secondary,
|
||||
yellow2: matugenColors.secondary,
|
||||
pink3: matugenColors.secondary,
|
||||
red3: matugenColors.secondary,
|
||||
mantle3: matugenColors.inverse_on_surface,
|
||||
surface0_3: matugenColors.outline,
|
||||
surface2_3: matugenColors.outline,
|
||||
overlay1_3: matugenColors.outline,
|
||||
lavender3: matugenColors.secondary,
|
||||
mauve3: matugenColors.secondary,
|
||||
green3: matugenColors.secondary,
|
||||
sky3: matugenColors.secondary,
|
||||
teal3: matugenColors.secondary,
|
||||
yellow3: matugenColors.secondary,
|
||||
maroon3: matugenColors.secondary,
|
||||
crust3: matugenColors.surface_dim,
|
||||
},
|
||||
monochrome_3: {
|
||||
rosewater: matugenColors.tertiary,
|
||||
flamingo: matugenColors.tertiary,
|
||||
pink: matugenColors.tertiary,
|
||||
mauve: matugenColors.tertiary,
|
||||
red: matugenColors.tertiary,
|
||||
maroon: matugenColors.tertiary,
|
||||
peach: matugenColors.tertiary,
|
||||
yellow: matugenColors.tertiary,
|
||||
green: matugenColors.tertiary,
|
||||
teal: matugenColors.tertiary,
|
||||
sky: matugenColors.tertiary,
|
||||
sapphire: matugenColors.tertiary,
|
||||
blue: matugenColors.tertiary,
|
||||
lavender: matugenColors.tertiary,
|
||||
text: matugenColors.on_background,
|
||||
subtext1: matugenColors.outline,
|
||||
subtext2: matugenColors.outline,
|
||||
overlay2: matugenColors.outline,
|
||||
overlay1: matugenColors.outline,
|
||||
overlay0: matugenColors.outline,
|
||||
surface2: matugenColors.outline,
|
||||
surface1: matugenColors.surface_bright,
|
||||
surface0: matugenColors.surface_bright,
|
||||
base2: matugenColors.inverse_on_surface,
|
||||
base: matugenColors.inverse_on_surface,
|
||||
mantle: matugenColors.surface_dim,
|
||||
crust: matugenColors.surface_dim,
|
||||
notifications_closer: matugenColors.tertiary,
|
||||
notifications_background: matugenColors.surface_dim,
|
||||
dashboard_btn_text: matugenColors.surface_dim,
|
||||
red2: matugenColors.tertiary,
|
||||
peach2: matugenColors.tertiary,
|
||||
pink2: matugenColors.tertiary,
|
||||
mantle2: matugenColors.surface_dim,
|
||||
surface1_2: matugenColors.inverse_on_surface,
|
||||
surface0_2: matugenColors.surface_bright,
|
||||
overlay1_2: matugenColors.outline,
|
||||
text2: matugenColors.on_background,
|
||||
lavender2: matugenColors.tertiary,
|
||||
crust2: matugenColors.surface_dim,
|
||||
maroon2: matugenColors.tertiary,
|
||||
surface2_2: matugenColors.surface,
|
||||
mauve2: matugenColors.tertiary,
|
||||
green2: matugenColors.tertiary,
|
||||
sky2: matugenColors.tertiary,
|
||||
teal2: matugenColors.tertiary,
|
||||
yellow2: matugenColors.tertiary,
|
||||
pink3: matugenColors.tertiary,
|
||||
red3: matugenColors.secondary,
|
||||
mantle3: matugenColors.inverse_on_surface,
|
||||
surface0_3: matugenColors.outline,
|
||||
surface2_3: matugenColors.outline,
|
||||
overlay1_3: matugenColors.outline,
|
||||
lavender3: matugenColors.tertiary,
|
||||
mauve3: matugenColors.tertiary,
|
||||
green3: matugenColors.tertiary,
|
||||
sky3: matugenColors.tertiary,
|
||||
teal3: matugenColors.tertiary,
|
||||
yellow3: matugenColors.tertiary,
|
||||
maroon3: matugenColors.tertiary,
|
||||
crust3: matugenColors.surface_dim,
|
||||
},
|
||||
};
|
||||
return matVtns[variation];
|
||||
};
|
||||
Executable
+72
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
outputDir="$HOME/Videos/Screencasts"
|
||||
|
||||
checkRecording() {
|
||||
if pgrep -f "gpu-screen-recorder" >/dev/null; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
startRecording() {
|
||||
if checkRecording; then
|
||||
echo "A recording is already in progress."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
target="$2"
|
||||
|
||||
outputFile="recording_$(date +%Y-%m-%d_%H-%M-%S).mp4"
|
||||
outputPath="$outputDir/$outputFile"
|
||||
mkdir -p "$outputDir"
|
||||
|
||||
if [ -z "$target" ]; then
|
||||
echo "Usage: $0 start screen [screen_name]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
GPU_TYPE=$(lspci | grep -E 'VGA|3D' | grep -Ev '00:02.0|Integrated' > /dev/null && echo "" || echo "-encoder cpu")
|
||||
|
||||
gpu-screen-recorder -w "$target" -f 60 -a "$(pactl get-default-sink).monitor" -o "$outputPath" $GPU_TYPE &
|
||||
|
||||
echo "Recording started. Output will be saved to $outputPath"
|
||||
}
|
||||
|
||||
stopRecording() {
|
||||
if ! checkRecording; then
|
||||
echo "No recording is in progress."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pkill -f gpu-screen-recorder
|
||||
recentFile=$(ls -t "$outputDir"/recording_*.mp4 | head -n 1)
|
||||
notify-send "Recording stopped" "Your recording has been saved." \
|
||||
-i video-x-generic \
|
||||
-a "Screen Recorder" \
|
||||
-t 10000 \
|
||||
-u normal \
|
||||
--action="scriptAction:-xdg-open $outputDir=Directory" \
|
||||
--action="scriptAction:-xdg-open $recentFile=Play"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
startRecording "$@"
|
||||
;;
|
||||
stop)
|
||||
stopRecording
|
||||
;;
|
||||
status)
|
||||
if checkRecording; then
|
||||
echo "recording"
|
||||
else
|
||||
echo "not recording"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start [screen_name|window_id]|stop|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
outputDir="$HOME/Pictures/Screenshots/"
|
||||
outputFile="snapshot_$(date +%Y-%m-%d_%H-%M-%S).png"
|
||||
outputPath="$outputDir/$outputFile"
|
||||
mkdir -p "$outputDir"
|
||||
|
||||
mode=${1:-area}
|
||||
|
||||
case "$mode" in
|
||||
active)
|
||||
command="grimblast copysave active $outputPath"
|
||||
;;
|
||||
output)
|
||||
command="grimblast copysave output $outputPath"
|
||||
;;
|
||||
area)
|
||||
command="grimblast copysave area $outputPath"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option: $mode"
|
||||
echo "Usage: $0 {active|output|area}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if eval "$command"; then
|
||||
recentFile=$(find "$outputDir" -name 'snapshot_*.png' -printf '%T+ %p\n' | sort -r | head -n 1 | cut -d' ' -f2-)
|
||||
notify-send "Grimblast" "Your snapshot has been saved." \
|
||||
-i video-x-generic \
|
||||
-a "Grimblast" \
|
||||
-t 7000 \
|
||||
-u normal \
|
||||
--action="scriptAction:-xdg-open $outputDir=Directory" \
|
||||
--action="scriptAction:-xdg-open $recentFile=View"
|
||||
fi
|
||||
Reference in new issue
Block a user