Fully updated to the actual (Boussole v1) config and got rid of most things that shouldn't be there

This commit is contained in:
Guillem George 2025-10-28 19:25:40 +01:00
parent 6b616b44dd
commit 71f2b38a0d
192 changed files with 854 additions and 605 deletions

View file

@ -1,2 +1,2 @@
$active_color = rgba(98C1D9FF)
$active_color = rgba(de3c3cff)
$inactive_color = rgba(595959aa)

View file

@ -1,3 +1,9 @@
[main]
shell=zsh
font=DejaVu Sans Mono:size=12
font= JetBrainsMono Nerd Font Propo:size=12
# Theme
include = ~/.config/foot/github-dark.ini
[cursor]
style=beam
blink=true

View file

@ -0,0 +1,9 @@
# -*- conf -*-
# Github Dark
# By Gu://em_
# Needed a lot of work
[colors]
background=0d1117
foreground=c9d1d9

View file

@ -0,0 +1,6 @@
theme = "github_dark"
# theme = "adwaita-light"
[editor]
line-number = "relative"

View file

@ -0,0 +1,6 @@
[[language]]
name="c"
indent = { tab-width=4, unit=" "}
# formatter = { command = "clang-format", args=["--style=file"] }
auto-format = true

View file

@ -6,9 +6,8 @@
# Set programs that you use
$terminal = foot
#$fileManager = cosmic-files
$fileManager = nautilus
$menu = albert toggle
$menu = rofi -show drun
$notificationManager = swaync-client -t
@ -25,6 +24,9 @@ exec-once = ~/.config/hypr/scripts/autostart.sh
exec-once = wl-paste --type text --watch cliphist store # Stores only text data
exec-once = wl-paste --type image --watch cliphist store # Stores only image data
# No update message
ecosystem:no_update_news = true
#############################
### ENVIRONMENT VARIABLES ###

View file

@ -46,7 +46,7 @@ bind = $mainMod, D, exec, $menu # Legacy menu shortcut
bind = $mainMod, L, exec, hyprlock # Lockscreen
bind = $mainMod, B, exec, ~/.config/hypr/scripts/toggle-waybar.sh # Toggle sidebar
bind = $mainMod SHIFT, R, exec, ~/.config/hypr/scripts/reload.sh # Reload desktop
bind = $mainMod, F11, exec, ~/.config/hypr/scripts/gamemode.sh # Gamemode
bind = $mainMod, F11, exec, ~/.config/hypr/scripts/simplemode.sh # Simple mode (No amimations or whatever fancy effect)
bind = $mainMod SHIFT, M, exit, # Exit desktop session
# Shortcuts
@ -63,6 +63,12 @@ bind = $mainMod, right, movefocus, r
bind = $mainMod, up, movefocus, u
bind = $mainMod, down, movefocus, d
# Move windows with mainMod + shift + arrow keys
bind = $mainMod SHIFT, left, movewindow, l
bind = $mainMod SHIFT, right, movewindow, r
bind = $mainMod SHIFT, up, movewindow, u
bind = $mainMod SHIFT, down, movewindow, d
# Layout
bind = $mainMod, F, fullscreen,
bind = $mainMod, V, togglesplit, # Horizontal/vertical split

View file

@ -1,10 +0,0 @@
################
### MONITORS ###
################
# See https://wiki.hyprland.org/Configuring/Monitors/
monitor=,preferred,auto,auto
monitor=eDP-1,preferred,0x0,1 # Laptop screen
monitor=DP-1, preferred, 0x-1080, 1 # HP Home monitor
monitor=DP-2, preferred, 0x-1080, 1 # HP Home monitor
monitor=HDMI-A-1, preferred, 0x-1440, 1 # Dell monitor

View file

@ -5,9 +5,9 @@
# See https://wiki.hyprland.org/Configuring/Monitors/
# All screens
monitorv2 {
mode = preferred
position = auto
scale = auto
}
# monitorv2 {
# mode = preferred
# position = auto
# scale = auto
# }

View file

@ -5,19 +5,19 @@
# See https://wiki.hyprland.org/Configuring/Monitors/
# Laptop screen
monitorv2 {
output = eDP-1
mode = preferred
position = 0x0
scale = 1
}
# monitorv2 {
# output = eDP-1
# mode = preferred
# position = 0x0
# scale = 1
# }
# Other monitors (mirror laptop screen)
monitorv2 {
output = *
mode = preferred
position = auto
scale = 1
mirror = eDP-1
}
# # Other monitors (mirror laptop screen)
# monitorv2 {
# output = *
# mode = preferred
# position = auto
# scale = 1
# mirror = eDP-1
# }

View file

@ -1,12 +1,25 @@
# BACKGROUND
## Old config
# background {
# monitor =
# path = ~/.config/hypr/images/lockscreen.jpg
# blur_passes = 0
# #contrast = 0.8916
# #brightness = 0.8172
# #vibrancy = 0.1696
# #vibrancy_darkness = 0.0
# }
background {
monitor =
path = ~/.config/hypr/images/lockscreen.jpg
blur_passes = 0
#contrast = 0.8916
#brightness = 0.8172
#vibrancy = 0.1696
#vibrancy_darkness = 0.0
path = screenshot # 'screenshot' = auto-capture screen and blur it
# path = $HOME/afs/Images/lockk.png
blur_passes = 3
blur_size = 4
noise = 0.0
contrast = 0.7
brightness = 0.8172
vibrancy = 0.2
vibrancy_darkness = 0.0
}
# GENERAL
@ -31,7 +44,7 @@ input-field {
font_color = rgb(200, 200, 200)
fade_on_empty = false
font_family = DejaVu Sans
placeholder_text = <i><span foreground="##ffffff99">Enter Pass</span></i>
placeholder_text = <i><span foreground="##ffffff99">Enter password</span></i>
hide_input = false
position = 0, -350
halign = center
@ -83,16 +96,40 @@ label {
#}
# USER
#label {
# monitor =
# text = Hi, Guillem #$USER
# color = rgba(216, 222, 233, 0.70)
# font_size = 20
# font_family = DejaVu Sans
# position = 0, -200
# halign = center
# valign = center
#}
label {
monitor =
text = $USER
color = rgba(216, 222, 233, 0.70)
font_size = 20
font_family = JetbrainsMonoNL NF
position = 0, -200
halign = center
valign = center
}
# Timer
label {
monitor =
text = cmd[update:0] echo "Locked since $TIME"
color = rgba(216, 222, 233, 0.40)
font_size = 20
font_family = JetbrainsMonoNL NF
position = 0, -250
halign = center
valign = center
}
# # Failed login attempts
# label {
# monitor =
# text = cmd[update:1000] echo "$ATTEMPTS Failed attempts"
# color = rgba(216, 222, 233, 0.40)
# font_size = 20
# font_family = JetbrainsMonoNL NF
# position = 0, -250
# halign = center
# valign = center
# }
# CURRENT SONG
label {
@ -100,7 +137,7 @@ label {
text = cmd[update:1000] echo "$(~/.config/hypr/scripts/songdetails.sh)"
color = rgba(255, 255, 255, 0.7)
font_size = 16
font_family = DejaVu Sans
font_family = JetbrainsMonoNL NF
position = 0, 20
halign = center
valign = bottom

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

10
.config/hypr/scripts/.__afs88AC Executable file
View file

@ -0,0 +1,10 @@
time_elapsed=0
while true; do
hours=$(($time_elapsed/3600))
minutes=$(($time_elapsed/60))
seconds=$(($time_elapsed%60))
printf '%02d:%02d:%02d\n' $hours $minutes $seconds
echo "$hours:$minutes:$seconds"
time_elapsed=$(($time_elapsed+1))
sleep 1
done

View file

@ -5,8 +5,8 @@
# If you want to add your own applications you may rather want to use exec-once in the environment.conf file
hyprpaper &
hyprpm reload -nn &
albert &
#hyprpm reload -nn &
swaync &
systemctl --user start hyprpolkitagent &
~/.config/hypr/scripts/restore-waybar.sh
waybar
#systemctl --user start hyprpolkitagent &
#~/.config/hypr/scripts/restore-waybar.sh

View file

@ -1,7 +1,6 @@
killall albert
killall hyprpaper
killall waybar
killall swaync
kill $(pidof hyprpaper)
kill $(pidof waybar)
kill $(pidof swaync)
hyprctl reload

View file

@ -13,10 +13,10 @@ if [ "$HYPRGAMEMODE" = 1 ] ; then
keyword general:border_size 1;\
keyword decoration:rounding 0"
killall waybar
hyprctl notify 1 2000 0 "Enabled game mode"
hyprctl notify 1 2000 0 "Enabled simple mode"
exit
fi
hyprctl reload
~/.config/hypr/scripts/restore-waybar.sh
hyprctl notify 1 2000 0 "Disabled game mode"
hyprctl notify 1 2000 0 "Disabled simple mode"

View file

@ -1,2 +0,0 @@
song_info=$(playerctl metadata --format '{{title}} 󰎆 {{artist}}')
echo "$song_info"

View file

@ -1,35 +0,0 @@
#!/bin/sh
device=znt0001:00-14e5:650e-touchpad
toggle_variable="device[${device}]:enabled"
hyprctl keyword "${toggle_variable}" true
status_file="$HOME/.config/hypr/status/touchpad"
enable_touchpad() {
printf "on" > "${status_file}"
hyprctl notify 1 2000 0 "Enabled touchpad"
hyprctl keyword "${toggle_variable}" true
}
disable_touchpad() {
printf "off" > "${status_file}"
hyprctl notify 0 2000 0 "Disabled Touchpad"
hyprctl keyword "${toggle_variable}" false
}
if ! [ -f "${status_file}" ]; then
hyprctl notify 3 3000 0 "Status file missing"
enable_touchpad
else
if [ $(cat "${status_file}") = "on" ]; then
disable_touchpad
elif [ $(cat "${status_file}") = "off" ]; then
enable_touchpad
fi
fi

View file

@ -1 +0,0 @@
on

View file

@ -1 +1 @@
on
off

4
.config/rofi/config.rasi Normal file
View file

@ -0,0 +1,4 @@
//@theme "/home/guillem.george/.local/share/rofi/themes/seventy-eight.rasi"
@theme "/home/guillem.george/.local/share/rofi/themes/boussole.rasi"

View file

@ -1 +0,0 @@
../colors/colors.css

View file

@ -1,149 +0,0 @@
{
"layer": "top",
"position": "bottom",
"height": 24,
"spacing": 5,
"modules-left": ["hyprland/workspaces"],
"modules-center": ["clock"],
"modules-right": ["tray", "idle_inhibitor", "group/network_grp", "group/audio"],
"group/network_grp": {
"orientation": "inherit",
"drawer": {
"transition-duration": 300,
"transition-left-to-right": true
},
"modules": [
"network",
"network#speed"
]
},
"group/audio": {
"orientation": "inherit",
"drawer": {
"transition-duration": 300,
"transition-left-to-right": true
},
"modules": [
"pulseaudio",
"pulseaudio#mic",
"pulseaudio#volume",
]
},
"hyprland/workspaces": {
"format": "<span size='larger'>{icon}</span>",
"on-click": "activate",
"format-icons": {
"active": "\uf444",
"default": "\uf4c3"
},
"icon-size": 10,
"sort-by-number": true,
"persistent-workspaces": {
"1": [],
"2": [],
"3": [],
"4": [],
"5": [],
}
},
"clock": {
"format": "{:%d.%m.%Y | %H:%M}"
},
//"wireplumber": {
// "format": "\udb81\udd7e {volume}%",
// "max-volume": 100,
// "scroll-step": 5
//},
"pulseaudio": {
"format": "{icon} ",
"format-bluetooth": "{icon}",
"tooltip-format": "{volume}% {icon} | {desc}",
"format-muted": "󰖁",
"format-icons": {
"headphones": "",
"handsfree": "󱡏",
"headset": "",
"phone": "",
"portable": "",
"car": " ",
"default": [
"󰕿",
"󰖀",
"󰕾"
]
},
"on-click": "volume mute",
//"on-click-middle": "pavucontrol",
"on-scroll-up": "wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+",
"on-scroll-down": "wpctl set-volume @DEFAULT_AUDIO_SINK@ -5%",
"smooth-scrolling-threshold": 1
},
"pulseaudio#volume": {
"format": " {volume}% "
},
// TODO missing
"pulseaudio#mic": {
"format": "{format_source}",
"format-source": "󰍬",
"format-source-muted": "󰍭",
"tooltip-format": "{volume}% {format_source} ",
"on-click": "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle",
"on-scroll-down": "wpctl set-volume @DEFAULT_SOURCE@ 5%-",
"on-scroll-up": "wpctl set-volume -l 1 @DEFAULT_SOURCE@ 5%+"
},
"memory": {
"interval": 30,
"format": "\uf4bc {used:0.1f}G"
},
"temperature": {
"format": "{temperatureC}°C"
},
"network": {
"format": "",
"format-ethernet": "\udb83\udc9d",
"format-wifi": "{icon}",
"format-disconnected": "\udb83\udc9c",
"format-icons": ["\udb82\udd2f", "\udb82\udd1f", "\udb82\udd22", "\udb82\udd25", "\udb82\udd28"],
"tooltip-format-wifi": "{essid} ({signalStrength}%)",
"tooltip-format-ethernet": "{ifname}",
"tooltip-format-disconnected": "Disconnected",
},
"network#speed": {
"format": "{bandwidthDownBits}",
"interval": 5,
"tooltip-format": "{ipaddr}",
"tooltip-format-wifi": "{essid} ({signalStrength}%)  \n{ipaddr} | {frequency} MHz{icon} ",
"tooltip-format-ethernet": "{ifname} 󰈀 \n{ipaddr} | {frequency} MHz{icon}",
"tooltip-format-disconnected": "Disconnected",
"tooltip": true
},
"hyprland/language": {
"format": "{short}"
},
"tray": {
"icon-size": 16,
"spacing": 16
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "\udb80\udd76",
"deactivated": "\udb83\udfaa"
}
}
}

View file

@ -1,52 +0,0 @@
@define-color foreground #eeeeee;
@define-color foreground-inactive #aaaaaa;
@define-color background #000000;
* {
font-family: JetBrainsMono Nerd Font Propo;
font-size: 17px;
padding: 0;
margin: 0;
}
#waybar {
color: @foreground;
background-color: @background;
}
#workspaces button {
color: @foreground;
padding: 0 0.2em;
}
#workspaces button.empty {
color: @foreground-inactive;
}
#memory,
#wireplumber,
#audio,
#custom-battery_percentage,
#idle_inhibitor,
#language,
#network,
#bluetooth
{
padding-right: 1em
}
#battery {
padding-right: 0.3em
}
#tray {
padding-right: 0.5em
}
#network_grp {
padding: 0em
}
#pulseaudio.mic {
padding-left: .7em
}

View file

@ -1,292 +0,0 @@
@import "colors.css";
@define-color active @accentColor;
* {
font-size: 16px;
font-family: "JetBrainsMono Nerd Font,JetBrainsMono NF";
min-width: 8px;
min-height: 0px;
border: none;
border-radius: 0;
box-shadow: none;
text-shadow: none;
padding: 0px;
}
window#waybar {
transition-property: background-color;
transition-duration: 0.5s;
border-radius: 4px;
border: 1px solid alpha(@active, 0.2);
background: @background;
background: alpha(@background, 0.7);
color: lighter(@active);
}
menu,
tooltip {
border-radius: 2px;
padding: 2px;
border: 1px solid @active;
background: @background;
color: lighter(@active);
}
menu label,
tooltip label {
font-size: 14px;
color: lighter(@active);
}
#submap,
#tray>.needs-attention {
animation-name: blink-active;
animation-duration: 1s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
.modules-right {
margin: 0px 6px 4px 6px;
border-radius: 4px;
background: alpha(@background, 0);
color: lighter(@active);
}
.modules-left {
transition-property: background-color;
transition-duration: 0.5s;
margin: 6px 5px 6px 5px; /* Testing with 5 pixels on left/right */
border-radius: 4px;
background: alpha(@background, 0.0);
color: lighter(@active);
border: 1px solid alpha(@active, 0.0);
}
#gcpu,
#custom-github,
#memory,
#disk,
#together,
#submap,
#custom-weather,
#custom-recorder,
#connection,
#cnoti,
#brightness,
#power,
#custom-updates,
#tray,
/*#audio,*/ /* Duplicate with #sound */
#sound,
#privacy { /*Controls all the right modules for some reason*/
border-radius: 2px;
margin: 2px 1px 3px 1px;
background: alpha(darker(@active), 0.0);
border: 1px solid alpha(darker(@active), 0.0);
}
/* Override specific parameters*/
#brightness,
#sound {
padding: 1px 0px;
}
#custom-notifications {
padding-left: 4px;
}
#custom-hotspot,
#custom-github,
#custom-notifications {
font-size: 14px;
}
#custom-hotspot {
padding-right: 2px;
}
#custom-vpn,
#custom-hotspot {
background: alpha(darker(@active), 0.3);
}
#privacy-item {
padding: 6px 0px 6px 6px;
}
#gcpu {
padding: 8px 0px 8px 0px;
}
#custom-cpu-icon {
font-size: 25px;
}
#custom-cputemp,
#disk,
#memory,
#cpu {
font-size: 14px;
font-weight: bold;
}
#custom-github {
padding-top: 2px;
padding-right: 4px;
}
#custom-dmark {
color: alpha(@foreground, 0.3);
}
#submap {
margin-bottom: 0px;
}
#workspaces {
margin: 0px 2px;
padding: 2px 0px;
border-radius: 8px;
}
#workspaces button {
transition-property: background-color;
transition-duration: 0.1s;
color: @foreground;
background: transparent;
border-radius: 4px;
color: alpha(@foreground, 0.3);
padding: 2px 0px;
}
#workspaces button.urgent {
font-weight: bold;
color: @foreground;
}
#workspaces button.active {
padding: 2px 0px;
background: alpha(@active, 0.4);
color: lighter(@active);
border-radius: 2px;
}
#network.wifi {
padding-right: 5px;
margin: 2px 0px;
}
#network.disconnected {
padding-right: 5px;
margin: 2px 0px;
}
#network.ethernet {
padding-right: 3px;
margin: 2px 0px;
}
#submap {
min-width: 0px;
margin: 4px 6px 4px 6px;
}
#custom-weather,
#tray {
padding: 4px 0px 4px 0px;
}
#bluetooth {
padding-top: 2px;
}
#battery {
border-radius: 8px;
padding: 4px 0px;
margin: 4px 2px 4px 2px;
}
#battery.discharging.warning {
animation-name: blink-yellow;
animation-duration: 1s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#battery.discharging.critical {
animation-name: blink-red;
animation-duration: 1s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#clock {
font-weight: bold;
padding: 4px 2px 2px 2px;
}
#pulseaudio.mic {
border-radius: 4px;
color: lighter(@active);
padding-left: 2px;
}
#backlight-slider slider,
#pulseaudio-slider slider {
background-color: transparent;
box-shadow: none;
}
#backlight-slider trough,
#pulseaudio-slider trough {
margin-top: 4px;
min-width: 6px;
min-height: 60px;
border-radius: 8px;
background-color: alpha(@background, 0.6);
}
#backlight-slider highlight,
#pulseaudio-slider highlight {
border-radius: 8px;
background-color: lighter(@active);
}
#bluetooth.discoverable,
#bluetooth.discovering,
#bluetooth.pairable {
border-radius: 8px;
animation-name: blink-active;
animation-duration: 1s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
@keyframes blink-active {
to {
background-color: @active;
color: @foreground;
}
}
@keyframes blink-red {
to {
background-color: #c64d4f;
color: @foreground;
}
}
@keyframes blink-yellow {
to {
background-color: #cf9022;
color: @foreground;
}
}

1
.local/bin/bin Symbolic link
View file

@ -0,0 +1 @@
/home/guillem.george/afs/.confs/.local/bin

394
.local/bin/grimblast Executable file
View file

@ -0,0 +1,394 @@
#!/usr/bin/env bash
## Grimblast: a helper for screenshots within hyprland
## Requirements:
## - `grim`: screenshot utility for wayland
## - `slurp`: to select an area
## - `hyprctl`: to read properties of current window (provided by Hyprland)
## - `hyprpicker`: to freeze the screen when selecting area
## - `wl-copy`: clipboard utility (provided by wl-clipboard)
## - `jq`: json utility to parse hyprctl output
## - `notify-send`: to show notifications (provided by libnotify)
## Those are needed to be installed, if unsure, run `grimblast check`
##
## See `man 1 grimblast` or `grimblast usage` for further details.
## Author: Misterio (https://github.com/misterio77)
## This tool is based on grimshot, with swaymsg commands replaced by their
## hyprctl equivalents.
## https://github.com/OctopusET/sway-contrib/blob/master/grimshot/grimshot
NAME="$(basename "$0")"
# Check whether another instance is running
GRIMBLASTLOCK="${XDG_RUNTIME_DIR:-${XDG_CACHE_DIR:-$HOME/.cache}}/$NAME.lock"
killhyprpicker() {
pidof -q hyprpicker && pkill hyprpicker
}
cleanup() {
rm -f "$GRIMBLASTLOCK"
killhyprpicker
}
# Entry point
trap cleanup EXIT
[[ -e $GRIMBLASTLOCK ]] && exit 2
touch "$GRIMBLASTLOCK"
[[ $HYPRLAND_INSTANCE_SIGNATURE ]] || {
echo "Error: HYPRLAND_INSTANCE_SIGNATURE not set! (is hyprland running?)" >&2
exit 1
}
# Globals
# General settings. These can be set by the user. See man page for more details
[[ $DEFAULT_TARGET_DIR ]] || {
USER_DIRS="${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs"
[[ -f $USER_DIRS ]] && source "$USER_DIRS"
DEFAULT_TARGET_DIR="${XDG_SCREENSHOTS_DIR:-${XDG_PICTURES_DIR:-$HOME}}"
}
: "${DEFAULT_TMP_EDITOR_DIR:=/tmp}" "${GRIMBLAST_EDITOR:=gimp}" "${DATE_FORMAT:=%Y%m%d_%H%M%S}"
# Screenshot variables. In addition to these, there's:
# SCALE
EXPIRE_TIME=3000
FILETYPE=png
# These have an effect depending on whether they're set
# CURSOR
# FREEZE
NOTIFY=false
SHOW_FILE_NOTIFY=false
WAIT=0
# Notification functions
notify() {
notify-send -t "$EXPIRE_TIME" -a "$NAME" "$@"
}
notify::ok() {
if $NOTIFY; then
notify "$@"
fi
}
notify::error() {
if $NOTIFY; then
TITLE=${2:-"Screenshot"}
MESSAGE=${1:-"Error taking screenshot with grim"}
notify -u critical "$TITLE" "$MESSAGE"
fi
echo "$1" >&2
}
# If invoked with -h, print usage before dying
die() {
killhyprpicker
local msg OPTIND option
while getopts 'h' option; do
case "$option" in
h) usage >&2 ;;
?) echo "die: Usage: die [-h] MESSAGE" >&2 ;;
esac
done
shift $((OPTIND - 1))
msg=${1:-Bye}
notify::error "Error: $msg"
exit 2
}
notify::showparentdir() {
if $SHOW_FILE_NOTIFY; then
if [[ $(notify::ok -A 'Show file="Show file"' "$@") == "Show file" ]]; then
gdbus call --session --dest org.freedesktop.FileManager1 --object-path /org/freedesktop/FileManager1 --method org.freedesktop.FileManager1.ShowItems "['file://$4']" "" || die "Could not display parent directory with gdbus"
fi
else
notify::ok "$@"
fi
}
# Miscellaneous functions
grimblast::wait() {
[[ $WAIT == 0 ]] || sleep "$WAIT"
}
get-mime-type() {
case $FILETYPE in
png | jpeg) echo "image/$FILETYPE" ;;
ppm) echo "image/x-portable-pixmap" ;;
esac
}
freezescreen() {
hyprpicker -rz &
sleep 0.2
}
# Checks whether an individual tool is available
# If invoked with -q (quiet), no output is printed, useful for use in tests
# Exits with 0 if the tool is available, non-zero otherwise
grimblast::check() {
local cmd result OPTIND option status quiet=false
while getopts 'q' option; do
case "$option" in
q) quiet=true ;;
?) echo 'check: Usage: check [-q] COMMAND' >&2 ;;
esac
done
shift $((OPTIND - 1))
cmd=$1
command -v "$cmd" >/dev/null 2>&1
status=$?
if ((status == 0)); then
result="OK"
else
result="NOT FOUND"
fi
$quiet || echo " $cmd: $result"
return $status
}
# The actual grim command used is printed to stderr
screenshot() {
local file="$1" geom="$2" output="$3"
xargs --verbose grim <<<"${CURSOR:+-c} ${SCALE:+-s \"$SCALE\"} -t \"$FILETYPE\" ${output:+-o \"$output\"} ${geom:+-g \"$geom\"} \"$file\""
}
# Special actions: usage and check. These are special because they allow to exit early
usage() {
cat <<EOF
Usage:
$NAME [-n|--notify] [-o|--openparentdir] [-e|--expire-time <ms>] [-c|--cursor] [-f|--freeze] [-w N|--wait N] [-s N|--scale N] [-t TYPE|--filetype TYPE] (copy|save|copysave|edit) [active|screen|output|area] [FILE|-]
$NAME check
$NAME usage
Commands:
copy: Copy the screenshot data into the clipboard.
save: Save the screenshot to a regular file or '-' to pipe to STDOUT.
copysave: Combine the previous 2 options.
edit: Open screenshot in the image editor of your choice (default is gimp). See man page for info.
check: Verify if required tools are installed and exit.
usage: Show this message and exit.
Targets:
active: Currently active window.
screen: All visible outputs.
output: Currently active output.
area: Manually select a region or window.
EOF
}
check() {
local status
echo "Checking if required tools are installed. If something is missing, install it to your system and make it available in PATH..."
for t in grim slurp hyprctl hyprpicker wl-copy jq notify-send; do
grimblast::check "$t" || status=$?
done
exit $status
}
# Target functions. These calculate global variables depending on the target.
# Specifically: GEOM, WHAT and OUTPUT. Not all would be set by all targets.
# These would later be used by the action functions.
active() {
local focused app_id
grimblast::wait
focused="$(hyprctl activewindow -j)" app_id=$(jq -r '.class' <<<"$focused")
GEOM="$(jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' <<<"$focused")"
WHAT="$app_id window"
}
screen() {
grimblast::wait
GEOM=""
WHAT="Screen"
}
output() {
grimblast::wait
GEOM=""
OUTPUT=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .name')
WHAT="$OUTPUT"
}
area() {
local fullscreen_workspaces workspaces windows
grimblast::wait
[[ $CURSOR ]] && die "'-c|--cursor' cannot be used with TARGET 'area'"
if [[ $FREEZE ]] && grimblast::check -q hyprpicker; then
freezescreen
fi
# disable animation for layer namespace "selection" (slurp)
# this removes the black border seen around screenshots
hyprctl keyword layerrule "noanim,selection" >/dev/null
fullscreen_workspaces="$(hyprctl workspaces -j | jq -r 'map(select(.hasfullscreen) | .id)')"
workspaces="$(hyprctl monitors -j | jq -r '[(foreach .[] as $monitor (0; if $monitor.specialWorkspace.name == "" then $monitor.activeWorkspace else $monitor.specialWorkspace end)).id]')"
windows="$(hyprctl clients -j | jq -r --argjson workspaces "$workspaces" --argjson fullscreenWorkspaces "$fullscreen_workspaces" 'map((select(([.workspace.id] | inside($workspaces)) and ([.workspace.id] | inside($fullscreenWorkspaces) | not) or .fullscreen > 0)))')"
# convert SLURP_ARGS to a bash array
IFS=' ' read -ra SLURP_ARGS <<<"$SLURP_ARGS"
GEOM="$(jq -r '.[] | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' <<<"$windows" | slurp "${SLURP_ARGS[@]}")"
# Check if user exited slurp without selecting the area
[[ $GEOM ]] || {
killhyprpicker
exit 1
}
WHAT="Area"
}
# Action functions.
# These take the global variables set by target functions and take the screenshot.
copy() {
[[ $FILETYPE == "png" ]] || die "Clipboard operations only support PNG format. Use --filetype png or omit the option."
screenshot - "$GEOM" "$OUTPUT" | wl-copy --type "$(get-mime-type)" || die "Clipboard error"
notify::ok "$WHAT copied to buffer"
}
save() {
local file title message
file="${1:-$DEFAULT_TARGET_DIR/$(date +"$DATE_FORMAT").$FILETYPE}"
screenshot "$file" "$GEOM" "$OUTPUT" || die "Could not take screenshot with grim"
title="Screenshot of $WHAT" message="$(basename "$file")"
killhyprpicker
notify::showparentdir "$title" "$message" -i "$file"
echo "$file"
}
edit() {
local editor="${GRIMBLAST_EDITOR%% *}"
grimblast::check -q "$editor" || die "$editor is not installed"
local file title message
file="${1:-$DEFAULT_TMP_EDITOR_DIR/$(date +"$DATE_FORMAT").$FILETYPE}"
screenshot "$file" "$GEOM" "$OUTPUT" || die "Could not take screenshot"
title="Screenshot of $WHAT" message="Open screenshot in $editor"
notify::ok "$title" "$message" -i "$file"
$GRIMBLAST_EDITOR "$file"
echo "$file"
}
copysave() {
[[ $FILETYPE == "png" ]] || die "Clipboard operations only support PNG format. Use --filetype png or omit the option."
local file title message
file="${1:-$DEFAULT_TARGET_DIR/$(date +"$DATE_FORMAT").$FILETYPE}"
if [[ $file = "-" ]]; then
screenshot - "$GEOM" "$OUTPUT" | tee >(wl-copy --type "$(get-mime-type)") || die "Clipboard error"
notify::ok "$WHAT copied to buffer and piped to stdout"
else
screenshot - "$GEOM" "$OUTPUT" | tee "$file" | wl-copy --type "$(get-mime-type)" || die "Clipboard error"
title="Screenshot of $WHAT"
message="$WHAT copied to buffer and saved to $file"
notify::showparentdir "$title" "$message" -i "$file"
echo "$file"
fi
}
parse-action() {
local action="$1" file="$2"
case "$action" in
copy) copy ;;
save) save "$file" ;;
edit) edit "$file" ;;
copysave) copysave "$file" ;;
*) die -h "Unknown action $action" ;;
esac
}
parse-target() {
case "$1" in
active) active ;;
screen) screen ;;
output) output ;;
area) area ;;
window) die "$(echo -e "Target 'window' is now included in 'area'.\nSimply run with 'area' and single click over the window you want.")" ;;
*) die -h "Unknown target to take a screen shot from $1" ;;
esac
}
main() {
local parsed_args
parsed_args="$(getopt --name "$NAME" --options 'nocfe:w:s:t:' --longoptions 'notify,openparentdir,cursor,freeze,expire-time:,wait:,scale:,filetype:' -- "$@")" || {
usage >&2
exit 1
}
eval "set -- $parsed_args"
while true; do
case $1 in
-n | --notify)
NOTIFY=true
shift
;;
-o | --openparentdir)
SHOW_FILE_NOTIFY=true
shift
;;
-e | --expire-time)
[[ $2 =~ ^[0-9]+$ ]] || {
echo "$NAME: ERROR: Invalid or missing argument for '-e|--expire-time'" >&2
exit 1
}
EXPIRE_TIME=$2
shift 2
;;
-c | --cursor)
CURSOR=1
shift
;;
-f | --freeze)
FREEZE=1
shift
;;
-w | --wait)
[[ $2 =~ ^[0-9]*(\.[0-9]+)?$ ]] || {
echo "$NAME: ERROR: Invalid value for '-w|--wait'" >&2
exit 1
}
WAIT=$2
shift 2
;;
-s | --scale)
[[ "$2" =~ ^[0-9]*(\.[0-9]+)?$ ]] || {
echo "$NAME: ERROR: Invalid or missing argument for '-s|--scale'" >&2
exit 1
}
SCALE=$2
shift 2
;;
-t | --filetype)
[[ "$2" =~ ^(png|ppm|jpeg)$ ]] || {
echo "$NAME: ERROR: Invalid filetype '$2'. Must be png, ppm, or jpeg" >&2
exit 1
}
FILETYPE=$2
shift 2
;;
--)
shift
break
;;
*)
echo "$NAME: ERROR: Invalid option: $1" >&2
usage >&2
exit 1
;;
esac
done
ACTION="${1:-usage}"
if [[ $1 =~ ^(usage|check)$ ]]; then
"$1"
exit
fi
shift
parse-target "${1:-screen}"
shift
parse-action "$ACTION" "$@"
}
main "$@"

29
.local/bin/mktp.sh Executable file
View file

@ -0,0 +1,29 @@
#!/bin/sh
if [ $# -eq 0 ]; then
echo "Missing argument"
fi
# Dir
mkdir $1
cd $1
#Header
header="${1^^}_H"
echo -e "#ifndef ${header}\n#define ${header}\n\n#endif // ${header}" >> $1.h
# Source
echo -e "#include <stdio.h>
#include \"$1.h\"
int main(void)
{
printf(\"%\", );
puts();
}
" >> $1.c
cd ..

1
.local/bin/runc.sh Executable file
View file

@ -0,0 +1 @@
gcc -std=c99 -pedantic -Werror -Wall -Wextra -Wvla -g -fsanitize=address *.c && ./a.out

33
.local/bin/submit.sh Executable file
View file

@ -0,0 +1,33 @@
#!/bin/sh
bold=$(tput bold)
normal=$(tput sgr0)
push() {
clang-format-epita .
git add --all
git commit -m "push"
git tag -ma "exercises-$exercise-$(git rev-parse --short HEAD)"
# git tag -ma "exercises-tutorial-$exercise-$(git rev-parse --short HEAD)"
git push --follow-tags
}
# Main
if [ $# -ne 1 ]; then
current_folder=${PWD##*/}
echo "Submit as$bold $current_folder$normal ? [Y/n]"
read yesno
if [ "$yesno" == "y" ] || [ "$yesno" == "Y" ] || [ -z "$yesno" ]; then
exercise=$current_folder
echo "------------------------------------"
echo "Pushing with tag$bold exercises-$exercise-$(git rev-parse --short HEAD)$normal"
push
else
exit 1;
fi
else
exercise=$1
push
fi

32
.local/bin/tutorial-submit.sh Executable file
View file

@ -0,0 +1,32 @@
#!/bin/sh
bold=$(tput bold)
normal=$(tput sgr0)
push() {
clang-format-epita .
git add --all
git commit -m "push"
git tag -ma "exercises-tutorial-$exercise-$(git rev-parse --short HEAD)"
git push --follow-tags
}
# Main
if [ $# -ne 1 ]; then
current_folder=${PWD##*/}
echo "Submit as$bold $current_folder$normal ? [Y/n]"
read yesno
if [ "$yesno" == "y" ] || [ "$yesno" == "Y" ] || [ -z "$yesno" ]; then
exercise=$current_folder
echo "------------------------------------"
echo "Pushing with tag$bold exercises-tutorial-$exercise-$(git rev-parse --short HEAD)$normal"
push
else
exit 1;
fi
else
exercise=$1
push
fi

View file

@ -1 +0,0 @@
0.49.0

View file

@ -0,0 +1,2 @@
[Icon Theme]
Inherits=volantes_cursors

View file

@ -0,0 +1 @@
progress

View file

@ -0,0 +1 @@
size_ver

View file

@ -0,0 +1 @@
h_double_arrow

View file

@ -0,0 +1 @@
progress

View file

@ -0,0 +1 @@
sb_h_double_arrow

View file

@ -0,0 +1 @@
sb_v_double_arrow

View file

@ -0,0 +1 @@
progress

View file

@ -0,0 +1 @@
dnd-move

View file

@ -0,0 +1 @@
dnd-move

View file

@ -0,0 +1 @@
pointer

View file

@ -0,0 +1 @@
x-cursor

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1 @@
default

View file

@ -0,0 +1 @@
size_bdiag

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1 @@
bd_double_arrow

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1 @@
not-allowed

View file

@ -0,0 +1 @@
dnd-move

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1 @@
crosshair

View file

@ -0,0 +1 @@
cross

View file

@ -0,0 +1 @@
not-allowed

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1 @@
cross

Binary file not shown.

View file

@ -0,0 +1 @@
copy

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1 @@
dnd-move

View file

@ -0,0 +1 @@
dotbox

Binary file not shown.

View file

@ -0,0 +1 @@
sb_v_double_arrow

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1 @@
right_ptr

View file

@ -0,0 +1 @@
right_ptr

View file

@ -0,0 +1 @@
dotbox

View file

@ -0,0 +1 @@
size_hor

View file

@ -0,0 +1 @@
pointer

View file

@ -0,0 +1 @@
size_hor

View file

@ -0,0 +1 @@
fd_double_arrow

View file

@ -0,0 +1 @@
dnd-move

View file

@ -0,0 +1 @@
size_bdiag

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more