updated ryuuko

This commit is contained in:
emily 2024-05-29 21:10:12 +02:00
parent 01ccbeba55
commit df6b96bb6f
Signed by: snaki
GPG key ID: F6F4C66207FCF995
14 changed files with 570 additions and 206 deletions

View file

@ -26,6 +26,7 @@
] ++ lib.optionals config.kyouma.machine-type.graphical [
linux-manual
colmena
clinfo
thunderbird
obsidian
krita

View file

@ -1,4 +1,4 @@
{ config, inputs, lib, pkgs, ... }: {
{ inputs, lib, pkgs, ... }: {
imports = [
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x1-extreme-gen4
../../common
@ -10,7 +10,8 @@
boot.extraModprobeConfig = ''
options i915 enable_guc=3
'';
boot.initrd.kernelModules = [ "i915" ];
boot.initrd.kernelModules = [ "i915" "amdgpu" ];
boot.initrd.supportedFilesystems = [ "btrfs" ];
boot.kernelParams = [
"intel_iommu=on"
"i915.enable_guc=3"
@ -32,7 +33,11 @@
hardware.opengl = {
driSupport32Bit = true;
extraPackages = [ pkgs.intel-media-driver pkgs.libvdpau-va-gl ];
extraPackages = with pkgs; [
intel-media-driver
libvdpau-va-gl
rocmPackages.clr.icd
];
};
hardware.sane = {
enable = true;

View file

@ -3,7 +3,6 @@
inputs.home-manager.nixosModules.home-manager
inputs.stylix.nixosModules.stylix
./nixvim.nix
./scripts.nix
];
kyouma.machine-type.graphical = true;
@ -12,7 +11,7 @@
boot.plymouth.enable = true;
security.pam.services.swaylock = {};
security.pam.services.hyprlock = {};
services.dbus.packages = [ pkgs.gcr ];
services.geoclue2.enable = true;
@ -32,6 +31,7 @@
GDK_BACKEND = "wayland,x11";
MOZ_ENABLE_WAYLAND = "1";
CLUTTER_BACKEND = "wayland";
LIBVA_DRIVER_NAME = "iHD";
};
xdg.icons.enable = true;
xdg.portal = {
@ -106,6 +106,42 @@
fi
'';
};
home.file."./local/bin/hypr/colorpicker.sh" = {
enable = true;
executable = true;
source = pkgs.writeShellApplication {
name = "colorpicker";
text = builtins.readFile ./files/scripts/colorpicker.sh;
runtimeInputs = with pkgs; [ coreutils grim slurp imagemagick_light wl-clipboard libnotify ];
};
};
home.file."./local/bin/hypr/rofi_powermenu.sh" = {
enable = true;
executable = true;
source = pkgs.writeShellApplication {
name = "rofi-powermenu";
text = builtins.readFile ./files/scripts/rofi_powermenu.sh;
runtimeInputs = with pkgs; [ rofi coreutils-full toybox xdg-user-dirs ];
};
};
home.file."./local/bin/hypr/rofi_screenshot.sh" = {
enable = true;
executable = true;
source = pkgs.writeShellApplication {
name = "rofi-screenshot";
text = builtins.readFile ./files/scripts/rofi_screenshot.sh;
runtimeInputs = with pkgs; [ coreutils grim hyprland imv slurp wl-clipboard libnotify pulseaudio toybox rofi xdg-user-dirs ];
};
};
home.file."./local/bin/hypr/screenshot.sh" = {
enable = true;
executable = true;
source = pkgs.writeShellApplication {
name = "screenshot";
text = builtins.readFile ./files/scripts/screenshot.sh;
runtimeInputs = with pkgs; [ coreutils grim imv slurp wl-clipboard libnotify pulseaudio ];
};
};
home.file."Pictures/wallpapers/sylviaritter/wallpaper.png" = {
enable = true;
source = config.stylix.image;
@ -114,12 +150,6 @@
enable = true;
source = config.stylix.image;
};
home.file.".local/bin/hypr" = {
enable = true;
executable = true;
recursive = true;
source = ./files/scripts;
};
wayland.windowManager.hyprland = {
enable = true;
settings = let
@ -127,7 +157,6 @@
pactl = "${pkgs.pulseaudio}/bin/pactl";
playerctl = "${pkgs.playerctl}/bin/playerctl";
notifysend = "${pkgs.libnotify}/bin/notify-send";
swaylock = "${pkgs.swaylock}/bin/swaylock";
dolphin = "${pkgs.libsForQt5.dolphin}/bin/dolphin";
firefox = "${pkgs.firefox}/bin/firefox";
brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl";
@ -239,17 +268,21 @@
"eDP-1, 3840x2400@60, 0x0, 1, bitdepth, 10"
#"eDP-1, 2560x1600@60, 0x0, 1, bitdepth, 10"
#"eDP-1, 1920x1200@60, 0x0, 1, bitdepth, 10"
"desc:ASUSTek COMPUTER INC ASUS VA24E M7LMTF021529, 1920x1080@60, -320x-1080, 1"
"desc:ASUSTek COMPUTER INC ASUS VA24E M7LMTF021525, 1920x1080@60, 1600x-1080, 1"
"desc:GIGA-BYTE TECHNOLOGY CO. LTD. AORUS AD27QD 19320B000455, 2560x1440@143.972,3840x0, 1,bitdepth,10"
"desc:Samsung Electric Company S27E500 0x3043394D, 1920x1080@70,6400x180, 1"
",preferred,auto,1"
];
workspace = [
"1, monitor:eDP-1, default:true"
"2, monitor:eDP-1"
"3, monitor:eDP-1"
"8, monitor:DP-2"
"9, monitor:DP-3"
"10, monitor:eDP-1"
"1, monitor:desc:GIGA-BYTE TECHNOLOGY CO. LTD. AORUS AD27QD 19320B000455, default:true"
"2, monitor:desc:GIGA-BYTE TECHNOLOGY CO. LTD. AORUS AD27QD 19320B000455"
"3, monitor:desc:GIGA-BYTE TECHNOLOGY CO. LTD. AORUS AD27QD 19320B000455"
"4, monitor:desc:GIGA-BYTE TECHNOLOGY CO. LTD. AORUS AD27QD 19320B000455"
"5, monitor:desc:GIGA-BYTE TECHNOLOGY CO. LTD. AORUS AD27QD 19320B000455"
"6, monitor:desc:GIGA-BYTE TECHNOLOGY CO. LTD. AORUS AD27QD 19320B000455"
"7, monitor:desc:GIGA-BYTE TECHNOLOGY CO. LTD. AORUS AD27QD 19320B000455"
"8, monitor:desc:Samsung Electric Company S27E500 0x3043394D"
"9, monitor:desc:Samsung Electric Company S27E500 0x3043394D"
"10,monitor:desc:GIGA-BYTE TECHNOLOGY CO. LTD. AORUS AD27QD 19320B000455"
];
windowrule = [
"float, foot-float"
@ -276,10 +309,11 @@
"$mod, D, exec, ${rofi} -show drun -theme ~/.config/rofi/launcher.rasi"
"$mod, R, exec, ${rofi} -show run -theme ~/.config/rofi/runner.rasi"
"$mod, A, exec, ~/.local/bin/hypr/rofi_screenshot.sh"
"$mod, X, exec, ~/.local/bin/hypr/rofi_powermenu.sh"
# Misc
"$mod, C, exec, ~/.local/bin/hypr/colorpicker.sh"
"CTRL_ALT, L, exec, ${swaylock} -f -i $XDG_PICTURES_DIR/wallpapers/lockscreen.png"
"CTRL_ALT, L, exec, ${pkgs.hyprlock}/bin/hyprlock"
# Function keys
", XF86AudioMute, exec, ${pactl} set-sink-mute @DEFAULT_SINK@ toggle"
@ -401,6 +435,10 @@
"$mod ALT, down, moveactive, 0 80"
"$mod ALT, J, moveactive, 0 80"
];
bindl = [
",switch:on:Lid Switch,exec, lsusb -d 17ef:30b4 && hyprctl keyword monitor 'eDP-1, disable'"
",switch:off:Lid Switch,exec, hyprctl keyword monitor 'eDP-1, 3840x2400@60, 0x0, 1, bitdepth,10'"
];
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
@ -411,10 +449,51 @@
};
};
programs.hyprlock = {
enable = true;
settings = {
general = {
grace = 1;
hide_cursor = true;
disable_loading_bar = true;
};
background = [{
path = "screenshot";
#path = "$HOME/Pictures/wallpapers/lockscreen.png";
blur_passes = 3;
contrast = 1.25;
}];
input-field = [{
size = "250, 60";
outline_thickness = 2;
dots_size = 0.2;
dots_spacing = 0.2;
dots_center = true;
outer_color = "rgba(0, 0, 0, 0)";
inner_color = "rgba(0, 0, 0, 0.5)";
font_color = "rgb(200, 200, 200)";
fade_on_empty = true;
fade_timeout = 5000;
font_family = "JetBrains Mono Nerd Font Mono";
fail_text = "<i>$FAIL <b>$ATTEMPTS</b></i>";
position = "0, 200";
halign = "center";
valign = "bottom";
}];
label = [{
text = "cmd[update:250] date +%X";
color = "rgba(255, 255, 255, 0.6)";
font_size = "100";
font_family = "JetBrains Mono Nerd Font Mono ExtraBold";
position = "0, -300";
halign = "center";
valign = "top";
}];
};
};
programs.imv.enable = true;
programs.swaylock.enable = true;
programs.wpaperd = {
enable = true;
settings.default = {
@ -647,13 +726,13 @@
services.swayidle =
let
swaylock = "${pkgs.swaylock}/bin/swaylock";
hyprlock = "${pkgs.hyprlock}/bin/hyprlock";
in {
enable = true;
systemdTarget = "hyprland-session.target";
events = [
{ event = "before-sleep"; command = "${swaylock} -f -i $XDG_PICTURES_DIR/wallpapers/lockscreen.png"; }
{ event = "lock"; command = "${swaylock} -f -i $XDG_PICTURES_DIR/wallpapers/lockscreen.png"; }
{ event = "before-sleep"; command = hyprlock; }
{ event = "lock"; command = hyprlock; }
];
};

View file

@ -0,0 +1,122 @@
@import "shared/colors.rasi"
configuration {
show-icons: false;
}
window {
transparency: "real";
location: center;
anchor: center;
fullscreen: false;
width: 300px;
x-offset: 0px;
y-offset: 0px;
margin: 0px;
padding: 0px;
border: 2px solid;
border-radius: 15px;
border-color: @border;
cursor: "default";
background-color: @background;
}
mainbox {
enabled: true;
spacing: 10px;
margin: 0px;
padding: 30px;
background-color: transparent;
children: [ "inputbar", "message", "listview" ];
}
inputbar {
enabled: true;
spacing: 10px;
padding: 0px;
border: 0px;
border-radius: 0px;
border-color: @selected;
background-color: transparent;
text-color: @foreground;
children: [ "textbox-prompt-colon", "prompt"];
}
textbox-prompt-colon {
enabled: true;
expand: false;
str: "";
padding: 10px 14px;
border-radius: 0px;
background-color: var(urgent);
text-color: @background;
}
prompt {
enabled: true;
padding: 10px;
border-radius: 0px;
background-color: var(active);
text-color: @background;
}
message {
enabled: true;
margin: 0px;
padding: 10px;
border: 0px solid;
border-radius: 0px;
border-color: @selected;
background-color: @background-alt;
text-color: @foreground;
}
textbox {
background-color: inherit;
text-color: inherit;
vertical-align: 0.5;
horizontal-align: 0.0;
}
listview {
enabled: true;
columns: 6;
lines: 1;
cycle: true;
scrollbar: false;
layout: vertical;
spacing: 10px;
background-color: transparent;
cursor: "default";
}
element {
enabled: true;
padding: 2px;
border: 0px solid;
border-radius: 0px;
border-color: @selected;
background-color: transparent;
text-color: @foreground;
cursor: pointer;
}
element-text {
font: "feather 20";
background-color: transparent;
text-color: inherit;
cursor: inherit;
vertical-align: 0.5;
horizontal-align: 0.5;
}
element normal.normal,
element alternate.normal {
background-color: var(background-alt);
text-color: var(foreground);
}
element normal.urgent,
element alternate.urgent,
element selected.active {
background-color: var(urgent);
text-color: var(background);
}
element normal.active,
element alternate.active,
element selected.urgent {
background-color: var(active);
text-color: var(background);
}
element selected.normal {
background-color: var(selected);
text-color: var(background);
}

View file

@ -1,8 +1,4 @@
/**
* Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
**/
/*****----- Configuration -----*****/
@import "shared/colors.rasi"
configuration {
modi: "drun,run,filebrowser";
show-icons: true;
@ -11,11 +7,6 @@ configuration {
display-filebrowser: "";
drun-display-format: "{name}";
}
/*****----- Global Properties -----*****/
@import "shared/colors.rasi"
/*****----- Main Window -----*****/
window {
/* properties for window widget */
transparency: "real";
@ -36,8 +27,6 @@ window {
cursor: "default";
background-color: @background;
}
/*****----- Main Box -----*****/
mainbox {
enabled: true;
spacing: 10px;
@ -46,8 +35,6 @@ mainbox {
background-color: transparent;
children: [ "inputbar", "message", "listview", "mode-switcher" ];
}
/*****----- Inputbar -----*****/
inputbar {
enabled: true;
spacing: 10px;
@ -58,7 +45,6 @@ inputbar {
text-color: @foreground;
children: [ "textbox-prompt-colon", "entry" ];
}
prompt {
enabled: true;
background-color: inherit;
@ -81,8 +67,6 @@ entry {
placeholder: "Search...";
placeholder-color: inherit;
}
/*****----- Listview -----*****/
listview {
enabled: true;
columns: 2;
@ -106,8 +90,6 @@ scrollbar {
border-radius: 10px;
background-color: @background-alt;
}
/*****----- Elements -----*****/
element {
enabled: true;
spacing: 10px;
@ -153,8 +135,6 @@ element-text {
vertical-align: 0.5;
horizontal-align: 0.0;
}
/*****----- Mode Switcher -----*****/
mode-switcher{
enabled: true;
spacing: 10px;
@ -174,8 +154,6 @@ button selected {
background-color: var(urgent);
text-color: var(background);
}
/*****----- Message -----*****/
message {
enabled: true;
margin: 0px;

View file

@ -0,0 +1,122 @@
@import "shared/colors.rasi"
configuration {
show-icons: false;
}
window {
transparency: "real";
location: center;
anchor: center;
fullscreen: false;
width: 510px;
x-offset: 0px;
y-offset: 0px;
margin: 0px;
padding: 0px;
border: 2px solid;
border-radius: 15px;
border-color: @border;
cursor: "default";
background-color: @background;
}
mainbox {
enabled: true;
spacing: 10px;
margin: 0px;
padding: 30px;
background-color: transparent;
children: [ "inputbar", "message", "listview" ];
}
inputbar {
enabled: true;
spacing: 10px;
padding: 0px;
border: 0px;
border-radius: 0px;
border-color: @selected;
background-color: transparent;
text-color: @foreground;
children: [ "textbox-prompt-colon", "prompt"];
}
textbox-prompt-colon {
enabled: true;
expand: false;
str: "";
padding: 10px 14px;
border-radius: 0px;
background-color: var(urgent);
text-color: @background;
}
prompt {
enabled: true;
padding: 10px;
border-radius: 0px;
background-color: var(active);
text-color: @background;
}
message {
enabled: true;
margin: 0px;
padding: 10px;
border: 0px solid;
border-radius: 0px;
border-color: @selected;
background-color: @background-alt;
text-color: @foreground;
}
textbox {
background-color: inherit;
text-color: inherit;
vertical-align: 0.5;
horizontal-align: 0.0;
}
listview {
enabled: true;
columns: 6;
lines: 1;
cycle: true;
scrollbar: false;
layout: vertical;
spacing: 10px;
background-color: transparent;
cursor: "default";
}
element {
enabled: true;
padding: 15px;
border: 0px solid;
border-radius: 0px;
border-color: @selected;
background-color: transparent;
text-color: @foreground;
cursor: pointer;
}
element-text {
font: "feather 20";
background-color: transparent;
text-color: inherit;
cursor: inherit;
vertical-align: 0.5;
horizontal-align: 0.5;
}
element normal.normal,
element alternate.normal {
background-color: var(background-alt);
text-color: var(foreground);
}
element normal.urgent,
element alternate.urgent,
element selected.active {
background-color: var(urgent);
text-color: var(background);
}
element normal.active,
element alternate.active,
element selected.urgent {
background-color: var(active);
text-color: var(background);
}
element selected.normal {
background-color: var(selected);
text-color: var(background);
}

View file

@ -1,8 +1,4 @@
/**
* Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
**/
/*****----- Configuration -----*****/
@import "shared/colors.rasi"
configuration {
modi: "run";
show-icons: true;
@ -11,11 +7,6 @@ configuration {
display-filebrowser: "";
drun-display-format: "{name}";
}
/*****----- Global Properties -----*****/
@import "shared/colors.rasi"
/*****----- Main Window -----*****/
window {
/* properties for window widget */
transparency: "real";
@ -36,8 +27,6 @@ window {
cursor: "default";
background-color: @background;
}
/*****----- Main Box -----*****/
mainbox {
enabled: true;
spacing: 10px;
@ -46,8 +35,6 @@ mainbox {
background-color: transparent;
children: [ "inputbar", "listview" ];
}
/*****----- Inputbar -----*****/
inputbar {
enabled: true;
spacing: 10px;
@ -58,7 +45,6 @@ inputbar {
text-color: @foreground;
children: [ "textbox-prompt-colon", "entry" ];
}
prompt {
enabled: true;
background-color: inherit;
@ -81,8 +67,6 @@ entry {
placeholder: "Run...";
placeholder-color: inherit;
}
/*****----- Listview -----*****/
listview {
enabled: true;
columns: 2;
@ -106,8 +90,6 @@ scrollbar {
border-radius: 10px;
background-color: @background-alt;
}
/*****----- Elements -----*****/
element {
enabled: true;
spacing: 10px;
@ -153,8 +135,6 @@ element-text {
vertical-align: 0.5;
horizontal-align: 0.0;
}
/*****----- Mode Switcher -----*****/
mode-switcher{
enabled: true;
spacing: 10px;
@ -174,8 +154,6 @@ button selected {
background-color: var(urgent);
text-color: var(background);
}
/*****----- Message -----*****/
message {
enabled: true;
margin: 0px;

View file

@ -1,20 +1,7 @@
/**
* Copyright (C) 2020-2023 Aditya Shakya <adi1090x@gmail.com>
**/
/*****----- Configuration -----*****/
@import "shared/colors.rasi"
configuration {
show-icons: false;
}
/*****----- Global Properties -----*****/
@import "shared/colors.rasi"
/*
USE_ICON=YES
*/
/*****----- Main Window -----*****/
window {
transparency: "real";
location: center;
@ -31,8 +18,6 @@ window {
cursor: "default";
background-color: @background;
}
/*****----- Main Box -----*****/
mainbox {
enabled: true;
spacing: 10px;
@ -41,8 +26,6 @@ mainbox {
background-color: transparent;
children: [ "inputbar", "message", "listview" ];
}
/*****----- Inputbar -----*****/
inputbar {
enabled: true;
spacing: 10px;
@ -54,7 +37,6 @@ inputbar {
text-color: @foreground;
children: [ "textbox-prompt-colon", "prompt"];
}
textbox-prompt-colon {
enabled: true;
expand: false;
@ -71,8 +53,6 @@ prompt {
background-color: var(active);
text-color: @background;
}
/*****----- Message -----*****/
message {
enabled: true;
margin: 0px;
@ -89,8 +69,6 @@ textbox {
vertical-align: 0.5;
horizontal-align: 0.0;
}
/*****----- Listview -----*****/
listview {
enabled: true;
columns: 6;
@ -103,8 +81,6 @@ listview {
background-color: transparent;
cursor: "default";
}
/*****----- Elements -----*****/
element {
enabled: true;
padding: 15px;
@ -123,7 +99,6 @@ element-text {
vertical-align: 0.5;
horizontal-align: 0.5;
}
element normal.normal,
element alternate.normal {
background-color: var(background-alt);

View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
color=$(grim -g "$(slurp -b 20262C00 -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | tail -n1 | cut -d' ' -f4)
image=/tmp/${color}.png
main() {
if [[ "$color" ]]; then
# copy color code to clipboard
echo "$color" | tr -d "\n" | wl-copy
# generate preview
convert -size 48x48 xc:"$color" "${image}"
# notify about it
notify-send -h string:x-canonical-private-synchronous:sys-notify-picker -u low -i "${image}" "$color, copied to clipboard."
fi
}
main

View file

@ -0,0 +1,97 @@
#!/usr/bin/env bash
# Import Current Theme
DIR="$HOME/.config/hypr"
RASI="$DIR/rofi/powermenu.rasi"
CNFR="$DIR/rofi/confirm.rasi"
# Theme Elements
prompt="$(hostname) ($XDG_CURRENT_DESKTOP)"
mesg="Uptime : $(uptime -p | sed -E -e 's/up //g' -e 's/week|weeks/w/g' -e 's/day|days/d/g' -e 's/hour|hours/h/g' -e 's/minute|minutes/m/g')"
# Options
option_1=""
option_2="☀"
option_3=""
option_4=""
option_5="↺"
option_6=""
yes=''
no=''
# Rofi CMD
rofi_cmd() {
rofi -dmenu \
-p "$prompt" \
-mesg "$mesg" \
-markup-rows \
-theme "${RASI}"
}
# Pass variables to rofi dmenu
run_rofi() {
echo -e "$option_1\n$option_2\n$option_3\n$option_4\n$option_5\n$option_6" | rofi_cmd
}
# Confirmation CMD
confirm_cmd() {
rofi -dmenu \
-p 'Confirmation' \
-mesg 'Are you Sure?' \
-theme "${CNFR}"
}
# Ask for confirmation
confirm_exit() {
echo -e "$yes\n$no" | confirm_cmd
}
# Confirm and execute
confirm_run () {
selected="$(confirm_exit)"
if [[ "$selected" == "$yes" ]]; then
${1} && ${2} && ${3} && ${4}
else
exit
fi
}
# Execute Command
run_cmd() {
if [[ "$1" == '--opt1' ]]; then
hyprlock
elif [[ "$1" == '--opt2' ]]; then
confirm_run 'hyprctl dispatch exit 0'
elif [[ "$1" == '--opt3' ]]; then
confirm_run 'pulsemixer --mute' 'hyprlock' 'systemctl suspend' #"$DIR/scripts/lockscreen"
elif [[ "$1" == '--opt4' ]]; then
confirm_run 'systemctl hibernate'
elif [[ "$1" == '--opt5' ]]; then
confirm_run 'systemctl reboot'
elif [[ "$1" == '--opt6' ]]; then
confirm_run 'systemctl poweroff'
fi
}
# Actions
chosen="$(run_rofi)"
case ${chosen} in
"$option_1")
run_cmd --opt1
;;
"$option_2")
run_cmd --opt2
;;
"$option_3")
run_cmd --opt3
;;
"$option_4")
run_cmd --opt4
;;
"$option_5")
run_cmd --opt5
;;
"$option_6")
run_cmd --opt6
;;
esac

View file

@ -6,10 +6,10 @@ RASI="$DIR/screenshot.rasi"
# Theme Elements
prompt='Screenshot'
mesg="Directory :: `xdg-user-dir PICTURES`/screenshots"
mesg="Directory :: $(xdg-user-dir PICTURES)/screenshots"
# Options
layout=`cat ${RASI} | grep 'USE_ICON' | cut -d'=' -f2`
layout=$(< "${RASI}" grep 'USE_ICON' | cut -d'=' -f2)
if [[ "$layout" == 'NO' ]]; then
option_1=" Capture Desktop"
option_2=" Capture Area"
@ -30,7 +30,7 @@ rofi_cmd() {
-p "$prompt" \
-mesg "$mesg" \
-markup-rows \
-theme ${RASI}
-theme "${RASI}"
}
# Pass variables to rofi dmenu
@ -39,9 +39,9 @@ run_rofi() {
}
# Screenshot
time=`date +%Y-%m-%d-%H-%M-%S`
dir="`xdg-user-dir PICTURES`/screenshots"
file="${time}_${geometry}.png"
time=$(date +%Y-%m-%d-%H-%M-%S)
dir="$(xdg-user-dir PICTURES)/screenshots"
file="${time}.png"
# Directory
if [[ ! -d "$dir" ]]; then
@ -49,7 +49,7 @@ if [[ ! -d "$dir" ]]; then
fi
# notify and view screenshot
iDIR="$HOME/.config/hypr/mako/icons"
iDIR="$HOME/.config/hypr/mako-icons"
notify_view() {
notify_cmd_shot="notify-send -h string:x-canonical-private-synchronous:sys-notify-shot -u low -i ${iDIR}/picture.png"
${notify_cmd_shot} "Copied to clipboard."
@ -64,7 +64,7 @@ notify_view() {
# countdown
countdown () {
for sec in `seq $1 -1 1`; do
for sec in $(seq "$1" -1 1); do
notify-send -h string:x-canonical-private-synchronous:sys-notify-count -t 1000 -i "$iDIR"/timer.png "Taking shot in : $sec"
sleep 1
done
@ -72,31 +72,31 @@ countdown () {
# take shots
shotnow () {
cd ${dir} && sleep 0.5 && grim - | tee "$file" | wl-copy
cd "${dir}" && sleep 0.5 && grim - | tee "$file" | wl-copy
notify_view
}
shot5 () {
countdown '5'
sleep 1 && cd ${dir} && grim - | tee "$file" | wl-copy
sleep 1 && cd "${dir}" && grim - | tee "$file" | wl-copy
notify_view
}
shot10 () {
countdown '10'
sleep 1 && cd ${dir} && grim - | tee "$file" | wl-copy
sleep 1 && cd "${dir}" && grim - | tee "$file" | wl-copy
notify_view
}
shotwin () {
w_pos=`hyprctl activewindow | grep 'at:' | cut -d':' -f2 | tr -d ' ' | tail -n1`
w_size=`hyprctl activewindow | grep 'size:' | cut -d':' -f2 | tr -d ' ' | tail -n1 | sed s/,/x/g`
cd ${dir} && sleep 0.3 && grim -g "$w_pos $w_size" - | tee "$file" | wl-copy
w_pos=$(hyprctl activewindow | grep 'at:' | cut -d':' -f2 | tr -d ' ' | tail -n1)
w_size=$(hyprctl activewindow | grep 'size:' | cut -d':' -f2 | tr -d ' ' | tail -n1 | sed s/,/x/g)
cd "${dir}" && sleep 0.3 && grim -g "$w_pos $w_size" - | tee "$file" | wl-copy
notify_view
}
shotarea () {
cd ${dir} && grim -g "$(slurp -b 20262CCC -c B4A1DBff -s B4A1DB0D -w 2 && sleep 0.3)" - | tee "$file" | wl-copy
cd "${dir}" && grim -g "$(slurp -b 20262CCC -c B4A1DBff -s B4A1DB0D -w 2 && sleep 0.3)" - | tee "$file" | wl-copy
notify_view
}
@ -118,19 +118,19 @@ run_cmd() {
# Actions
chosen="$(run_rofi)"
case ${chosen} in
$option_1)
"$option_1")
run_cmd --opt1
;;
$option_2)
"$option_2")
run_cmd --opt2
;;
$option_3)
"$option_3")
run_cmd --opt3
;;
$option_4)
"$option_4")
run_cmd --opt4
;;
$option_5)
"$option_5")
run_cmd --opt5
;;
esac

View file

@ -0,0 +1,78 @@
#!/usr/bin/env bash
iDIR="$HOME/.config/hypr/mako-icons"
time=$(date +%Y-%m-%d-%H-%M-%S)
dir="$(xdg-user-dir PICTURES)/screenshots"
file="${time}.png"
# notify and view screenshot
notify_cmd_shot="notify-send -h string:x-canonical-private-synchronous:sys-notify-shot -u low -i ${iDIR}/picture.png"
notify_view () {
${notify_cmd_shot} "Copied to clipboard."
paplay /usr/share/sounds/freedesktop/stereo/screen-capture.oga &>/dev/null &
imv "${dir}/$file"
if [[ -e "$dir/$file" ]]; then
${notify_cmd_shot} "Screenshot Saved."
else
${notify_cmd_shot} "Screenshot Deleted."
fi
}
# countdown
countdown () {
for sec in $(seq "$1" -1 1); do
notify-send -h string:x-canonical-private-synchronous:sys-notify-count -t 1000 -i "$iDIR"/timer.png "Taking shot in : $sec"
sleep 1
done
}
# take shots
shotnow () {
cd "${dir}" && sleep 0.5 && grim - | tee "$file" | wl-copy
notify_view
}
shot5 () {
countdown '5'
sleep 1 && cd "${dir}" && grim - | tee "$file" | wl-copy
notify_view
}
shot10 () {
countdown '10'
sleep 1 && cd "${dir}" && grim - | tee "$file" | wl-copy
notify_view
}
shotwin () {
w_pos=$(hyprctl activewindow | grep 'at:' | cut -d':' -f2 | tr -d ' ' | tail -n1)
w_size=$(hyprctl activewindow | grep 'size:' | cut -d':' -f2 | tr -d ' ' | tail -n1 | sed s/,/x/g)
cd "${dir}" && grim -g "$w_pos $w_size" - | tee "$file" | wl-copy
notify_view
}
shotarea () {
cd "${dir}" && grim -g "$(slurp -b 20262CCC -c B4A1DBff -s B4A1DB0D -w 2 && sleep 0.3)" - | tee "$file" | wl-copy
notify_view
}
if [[ ! -d "$dir" ]]; then
mkdir -p "$dir"
fi
if [[ "$1" == "--now" ]]; then
shotnow
elif [[ "$1" == "--in5" ]]; then
shot5
elif [[ "$1" == "--in10" ]]; then
shot10
elif [[ "$1" == "--win" ]]; then
shotwin
elif [[ "$1" == "--area" ]]; then
shotarea
else
echo -e "Available Options : --now --in5 --in10 --win --area"
fi
exit 0

View file

@ -1,87 +0,0 @@
{ pkgs, inputs, ... }: {
imports = [
inputs.home-manager.nixosModules.home-manager
];
home-manager.users.emily.home.file.".local/bin/hypr/colorpicker.sh" = {
enable = true;
executable = true;
text = ''
#!/${pkgs.bash}/bin/bash
color=$(${pkgs.grim}/bin/grim -g "`${pkgs.slurp}/bin/slurp -b 20262C00 -p`" -t ppm - | \
${pkgs.imagemagick_light}/bin/convert - -format '%[pixel:p{0,0}]' txt:- | \
${pkgs.coreutils}/bin/tail -n1 | ${pkgs.coreutils}/bin/cut -d' ' -f4)
image=/tmp/''${color}.png
main() {
if [[ "$color" ]]; then
${pkgs.coreutils}/bin/echo $color | ${pkgs.coreutils}/bin/tr -d "\n" | ${pkgs.wl-clipboard}/bin/wl-copy
${pkgs.imagemagick_light}/bin/convert -size 48x48 xc:"$color" ''${image}
${pkgs.libnotify}/bin/notify-send -h string:x-canonical-private-synchronous:sys-notify-picker -u low -i ''${image} "$color, copied to clipboard."
fi
}
main
'';
};
home-manager.users.emily.home.file.".local/bin/hypr/screenshot.sh" = let
cu = "${pkgs.coreutils}/bin";
grim = "${pkgs.grim}/bin/grim";
notify-send = "${pkgs.libnotify}/bin/notify-send";
paplay = "${pkgs.pulseaudio}/bin/paplay";
slurp = "${pkgs.slurp}/bin/slurp";
imv = "${pkgs.imv}/bin/imv";
wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy";
in {
enable = true;
executable = true;
text = ''
#!/${pkgs.bash}/bin/bash
iDIR="$HOME/.config/mako-icons"
time=`${cu}/date +%Y-%m-%d-%H-%M-%S`
dir="$HOME/Pictures/screenshots"
file="''${time}.png"
notify_cmd_shot="${notify-send} -h string:x-canonical-private-synchronous:sys-notify-shot -u low -i ''${iDIR}/picture.png"
notify_view () {
''${notify_cmd_shot} "Copied to clipboard."
${paplay} /usr/share/sounds/freedesktop/stereo/screen-capture.oga &>/dev/null &
${imv} "''${dir}/$file"
if [[ -e "$dir/$file" ]]; then
''${notify_cmd_shot} "Screenshot Saved."
else
''${notify_cmd_shot} "Screenshot Deleted."
fi
}
countdown () {
for sec in `${cu}/seq $1 -1 1`; do
${notify-send} -h string:x-canonical-private-synchronous:sys-notify-count -t 1000 -i "$iDIR"/timer.png "Taking shot in : $sec"
${cu}/sleep 1
done
}
shotnow () {
cd ''${dir} && ${cu}/sleep 0.5 && ${grim} - | ${cu}/tee "$file" | ${wl-copy}
notify_view
}
shotarea () {
cd ''${dir} && ${grim} -g "$(${slurp} -b 20262CCC -c B4A1DBff -s B4A1DB0D -w 2 && ${cu}/sleep 0.3)" - | ${cu}/tee "$file" | ${wl-copy}
notify_view
}
if [[ ! -d "$dir" ]]; then
${cu}/mkdir -p "$dir"
fi
if [[ "$1" == "--now" ]]; then
shotnow
elif [[ "$1" == "--in5" ]]; then
countdown '5'
shotnow
elif [[ "$1" == "--in10" ]]; then
countdown '10'
shotnow
elif [[ "$1" == "--area" ]]; then
shotarea
else
echo -e "Available Options : --now --in5 --in10 --area"
fi
exit 0
'';
};
}

View file

@ -97,5 +97,4 @@ gitin checkout main
gitin merge --ff-only "${BRANCH}"
gitin push origin main
pkill ssh-agent
echo "Update successful"