Compare commits

...

2 Commits

Author SHA1 Message Date
John Mertz 7630ee5878 Take ownership of brightness file, if possible
Improve errors, if not.
2023-11-17 18:40:36 -07:00
John Mertz 62e9b4b53d Fix tofi path 2023-11-17 13:25:58 -07:00
2 changed files with 8 additions and 4 deletions

View File

@ -65,6 +65,7 @@
# Files containing current and max brightness values
my $cur_file = "/sys/class/backlight/intel_backlight/brightness";
chmod('0644',$cur_file) unless ( -w $cur_file );
my $max_file = "/sys/class/backlight/intel_backlight/max_brightness";
my $cur_log = $ENV{HOME}."/.spool/blc.current";
my $last_log = $ENV{HOME}."/.spool/blc.last";
@ -125,9 +126,12 @@ sub logger
sub writef
{
my $target = shift;
open(my $fh,'>',$cur_file);
print $fh $target;
close($fh);
if (open(my $fh,'>',$cur_file)) {
print $fh $target;
close($fh);
} else {
print "Failed to write to $cur_file: $!\n";
}
}
sub increment

View File

@ -6,4 +6,4 @@ cd ${HOME}/.private-scripts/snippets
HEIGHT=$(swaymsg -t get_outputs | tr '\n' ' ' | sed -e 's/ */ /g' | sed -e 's/\(.*"focused": [a-z]*\),/\1\n/' | less | grep '"focused": true' | sed -e 's/.*"rect": {[^}]*"height": \([0-9]*\).*/\1/')
cat $(find ./ -type f | sed -E 's/\.\///' | tofi --prompt-text 'Snippets: ' --height $HEIGHT --config ${HOME}/.dotfiles/tofi/sidebar.toml) | wl-copy -p
cat $(find ./ -type f | sed -E 's/\.\///' | ${HOME}/.local/bin/tofi --prompt-text 'Snippets: ' --height $HEIGHT --config ${HOME}/.dotfiles/tofi/sidebar.toml) | wl-copy -p