From 6cbadb5d5da5b5ecb29532b70993882112e659fd Mon Sep 17 00:00:00 2001 From: John Mertz Date: Sat, 7 Jan 2023 08:16:47 -0500 Subject: [PATCH 1/3] ts4 --- README.md | 10 +- audio/stream-podcasts.pl | 2 +- nvim.sh | 4 +- send-to-kodi.sh | 64 +++--- sway/idle.sh | 4 + sway/power-menu.sh | 7 + sway/startsway.sh | 2 +- sway/wallpaper.pl | 120 +++++++++++ sway/window-fade.pl | 15 ++ thinkpad/blc.pl | 442 +++++++++++++++++++-------------------- thinkpad/pow.pl | 42 ++++ waybar/waybar-debian.sh | 6 + wofi/wofi-alt-tab.sh | 4 + wofi/wofi-wifi-menu.sh | 2 +- 14 files changed, 461 insertions(+), 263 deletions(-) diff --git a/README.md b/README.md index f334947..50330cf 100644 --- a/README.md +++ b/README.md @@ -125,11 +125,11 @@ it to be *hidden*. ``` "sway/workspaces": { - "format": "{icon}", - "format-icons": { - "0": "0 \uf073", // Example of workspace with a label - "grave": "", - ... + "format": "{icon}", + "format-icons": { + "0": "0 \uf073", // Example of workspace with a label + "grave": "", + ... ``` [**sway/swayidle.sh**](https://git.john.me.tz/jpm/scripts/src/branch/master/sway/swayidle.sh) diff --git a/audio/stream-podcasts.pl b/audio/stream-podcasts.pl index 77d33d1..87c1dfc 100755 --- a/audio/stream-podcasts.pl +++ b/audio/stream-podcasts.pl @@ -21,7 +21,7 @@ my @default_feeds = ( # It requires FIFO to stream. For a player that does support STDIN, uncomment # above and delete the following 4 lines unless (-e "/tmp/fifo.mp3") { - system("mkfifo /tmp/fifo.mp3"); + system("mkfifo /tmp/fifo.mp3"); } my $player = "> /tmp/fifo.mp3 & omxplayer /tmp/fifo.mp3"; diff --git a/nvim.sh b/nvim.sh index fac8c42..74dd19c 100755 --- a/nvim.sh +++ b/nvim.sh @@ -1,7 +1,7 @@ #!/bin/bash if [ -e /bin/which ] && [ "`which flatpak 2>/dev/null`" ]; then - flatpak run io.neovim.nvim $@ 2>/dev/null + flatpak run io.neovim.nvim $@ 2>/dev/null else - nvim $@ + nvim $@ fi diff --git a/send-to-kodi.sh b/send-to-kodi.sh index 81279eb..91ddaad 100755 --- a/send-to-kodi.sh +++ b/send-to-kodi.sh @@ -16,7 +16,7 @@ local_port=12345 show_help() { - cat</dev/null; then - zenity --error --ellipsize --text "$*" - else - echo "$*" 1>&2 - fi + if type zenity &>/dev/null; then + zenity --error --ellipsize --text "$*" + else + echo "$*" 1>&2 + fi - exit 1 + exit 1 } send_json() { - curl \ - ${user:+--user "$user:$pass"} \ - -X POST \ - -H "Content-Type: application/json" \ - -d '{"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"'"$1"'"}},"id":1}' \ - http://$host:$port/jsonrpc \ - || error "Failed to send link - is Kodi running?" + curl \ + ${user:+--user "$user:$pass"} \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"'"$1"'"}},"id":1}' \ + http://$host:$port/jsonrpc \ + || error "Failed to send link - is Kodi running?" } ytplugin='plugin://plugin.video.youtube/?action=play_video&videoid=' @@ -63,35 +63,35 @@ ytplugin='plugin://plugin.video.youtube/?action=play_video&videoid=' # Dialog box? input=$1 until [[ $input ]]; do - input="$(zenity --entry --title "Send to Kodi" --text \ - "Paste a video link here")" || exit + input="$(zenity --entry --title "Send to Kodi" --text \ + "Paste a video link here")" || exit done if [[ $input =~ ^file:// ]]; then - # Remove file:// and carrige return (\r) at the end - input="$(sed 's%^file://%%;s/\r$//' <<< "$input")" + # Remove file:// and carrige return (\r) at the end + input="$(sed 's%^file://%%;s/\r$//' <<< "$input")" fi # Get URL for... # Local media if [[ -e $input ]]; then - type nc &>/dev/null || error "netcat required" - [[ $local_hostname && $local_port ]] || \ - error "Please set local hostname and port in configuration" + type nc &>/dev/null || error "netcat required" + [[ $local_hostname && $local_port ]] || \ + error "Please set local hostname and port in configuration" - # Start netcat in background and kill it when we exit - nc -lp $local_port < "$input" & - trap "kill $!" EXIT + # Start netcat in background and kill it when we exit + nc -lp $local_port < "$input" & + trap "kill $!" EXIT - url="tcp://$local_hostname:$local_port" + url="tcp://$local_hostname:$local_port" # youtube.com / youtu.be elif [[ $input =~ ^https?://(www\.)?youtu(\.be/|be\.com/watch\?v=) ]]; then - url="$ytplugin$(\ - sed 's/.*\(youtu\.be\/\|[&?]v=\)\([a-zA-Z0-9_-]\+\).*/\2/'\ - <<< "$input"\ - )" + url="$ytplugin$(\ + sed 's/.*\(youtu\.be\/\|[&?]v=\)\([a-zA-Z0-9_-]\+\).*/\2/'\ + <<< "$input"\ + )" # Playable formats elif [[ $input =~ \.(mp4|mkv|mov|avi|flv|wmv|asf|mp3|flac|mka|m4a|aac|ogg|pls|jpg|png|gif|jpeg|tiff)(\?.*)?$ ]]; then @@ -99,9 +99,9 @@ elif [[ $input =~ \.(mp4|mkv|mov|avi|flv|wmv|asf|mp3|flac|mka|m4a|aac|ogg|pls|jp # Youtube-dl else - type youtube-dl &>/dev/null || error "youtube-dl required" - url="$(youtube-dl -gf best "$input")" || \ - error "No videos found, or site not supported by youtube-dl" + type youtube-dl &>/dev/null || error "youtube-dl required" + url="$(youtube-dl -gf best "$input")" || \ + error "No videos found, or site not supported by youtube-dl" fi [[ $url ]] && send_json "$url" diff --git a/sway/idle.sh b/sway/idle.sh index 88027ef..f4c88eb 100755 --- a/sway/idle.sh +++ b/sway/idle.sh @@ -53,6 +53,10 @@ elif [ $1 == "fade" ]; then elif [ $1 == "unfade" ]; then if [ -e $HOME/.spool/sway-hidden ]; then kill -USR2 `cat $HOME/.spool/sway-transparency` +<<<<<<< Updated upstream +======= + /home/jpm/scripts/sway/displays.pl -w +>>>>>>> Stashed changes fi elif [ $1 == "dim" ]; then echo $($HOME/scripts/thinkpad/blc.pl %) > $BLFILE diff --git a/sway/power-menu.sh b/sway/power-menu.sh index 108a0b4..21f6739 100755 --- a/sway/power-menu.sh +++ b/sway/power-menu.sh @@ -32,10 +32,17 @@ elif [ "$res" == "↹ Restart i3" ]; then i3 restart elif [ "$res" == "↻ Reload Sway" ]; then sway reload +<<<<<<< Updated upstream /home/jpm/scripts/sway/displays.pl elif [ "$res" == "↻ Reload Waybar" ]; then # Need to integrate with sway/displays.pl for alternative outputs /home/jpm/scripts/sway/displays.pl -w +======= + /home/jpm/scripts/distrobox/debian12/displays.sh +elif [ "$res" == "↻ Reload Waybar" ]; then + # Need to integrate with sway/displays.pl for alternative outputs + /home/jpm/scripts/distrobox/debian12/displays.sh -w +>>>>>>> Stashed changes elif [ "$res" == "🡙 Reboot" ]; then rm $SSH_AUTH_SOCK sudo systemctl reboot -i diff --git a/sway/startsway.sh b/sway/startsway.sh index 11fc075..28e92db 100755 --- a/sway/startsway.sh +++ b/sway/startsway.sh @@ -20,7 +20,7 @@ export FLATPAK_IDE_LOG_LEVEL="0" export "$( gnome-keyring-daemon --start )" #WLR_RENDERER=vulkan sway --debug 2>> $HOME/.swaylog >> $HOME/.swaylog -WLR_RENDERER=gles2 sway --debug 2>> $HOME/.swaylog >> $HOME/.swaylog; export SWAYSOCK=`sway --get-socketpath` +WLR_RENDERER=gles2 sway --debug 2>> $HOME/.swaylog >> $HOME/.swaylog #WLR_RENDERER=vulkan sway --debug 2>> $HOME/.swaylog >> $HOME/.swaylog #WLR_RENDERER=gles2 $HOME/build/sway/build/sway/sway --debug 2>> $HOME/.swaylog >> $HOME/.swaylog export SWAYSOCK=`sway --get-socketpath` diff --git a/sway/wallpaper.pl b/sway/wallpaper.pl index d01e7ff..8baa926 100755 --- a/sway/wallpaper.pl +++ b/sway/wallpaper.pl @@ -32,6 +32,7 @@ Sets a wallpaper by cropping an appropriate sized section of a larger image.\n All arguments other than the below are assumed to be output names, as defined in my sway/displays.pl script. If no outputs are provided, all available that are currently enabled will be set.\n +<<<<<<< Updated upstream --path= Path to wallpaper directory. -p Default: $ENV{HOME}/wallpapers\n --daemon=N Configures the wallpaper to be periodically rotated for all @@ -39,12 +40,26 @@ are currently enabled will be set.\n each rotation, if provided (default: 300).\n --nocrop Don't crop a selection from the image. Instead, pass the whole -n image to swaybg and let it handle the scaling\n +======= +--path= Path to wallpaper directory. +-p Default: $ENV{HOME}/wallpapers\n +--daemon=N Configures the wallpaper to be periodically rotated for all +-d N of the given outputs. N indicates the number of seconds between + each rotation, if provided (default: 300).\n +--nocrop Don't crop a selection from the image. Instead, pass the whole +-n image to swaybg and let it handle the scaling\n +>>>>>>> Stashed changes --verbose=N Define minimum log level. Counting from 1: LOG_DEBUG, LOG_INFO, -v N LOG_NOTICE, LOG_WARNING, LOG_ERR, LOG_CRIT, LOG_ALERT, LOG_EMERG Default: 5; If provided without a value for N then all (1). --recursive=N Enumerate images recursively through directories in the path. +<<<<<<< Updated upstream -r N N indicates the directory depth, unlimited if no N is provided. --help This menu +======= +-r N N indicates the directory depth, unlimited if no N is provided. +--help This menu +>>>>>>> Stashed changes -h\n You can send SIGUSR1 to force the daemon to reload immediately. Rotation timer will be reset.\n"); @@ -54,6 +69,14 @@ will be reset.\n"); sub new { my ($class, %args) = @_; +<<<<<<< Updated upstream + + use AnyEvent::Sway; + $args{ipc} = AnyEvent::Sway->new(); + use Image::Magick; + $args{im} = Image::Magick->new(); + $args{error} = (); +======= use AnyEvent::Sway; $args{ipc} = AnyEvent::Sway->new(); @@ -65,7 +88,72 @@ sub new return bless { %args }; } +>>>>>>> Stashed changes + $args{pidfile} = "/tmp/$ENV{USER}-wallpaper.pid"; + +<<<<<<< Updated upstream + return bless { %args }; +} + +======= +if (-e $wp->{pidfile}) { + if (-r $wp->{pidfile}) { + if (open(my $fh, '<', $wp->{pidfile})) { + my $pid = <$fh>; + chomp($pid); + use Proc::ProcessTable; + my $pt = Proc::ProcessTable->new(); + foreach my $p ( @{ $pt->table() } ) { + if ($p->{pid} eq $pid) { + my $name = $0; + $name =~ s/$ENV{PWD}//; + if ($p->{'cmndline'} =~ m#$name#) { + $wp->do_log("LOG_CRIT", "Another process is already running with PID: $pid (running and listed in $wp->{pidfile})"); + # Die locally because do_log will remove pidfile that this iteration does not belong to + exit(1); + } else { + $wp->do_log("LOG_CRIT", "Found matching $pid with different cmdline: $p->{cmndline} (not $0)",1); + # PID in pidfile doesn't look like it is another wallpaper + unlink($wp->{pidfile}); + last; + } + return $p->{'pid'}; + } + } + } else { + $wp->do_log("LOG_CRIT", "Pidfile $wp->{pidfile} exists, but cannot be opened. Assuming it is running already."); + # Die locally because do_log will remove pidfile that this iteration does not belong to + exit(1); + } + } else { + $wp->do_log("LOG_CRIT", "Pidfile $wp->{pidfile} exists, but is not readable. Assuming it is running already."); + # Die locally because do_log will remove pidfile that this iteration does not belong to + exit(1); + } +} + +# SIGUSR reset the timer, force immediate reload, continue looping +$SIG{USR1} = sub { + alarm 0; + $wp->do_log("LOG_INFO", "Reloading due to SIGUSR1"); +}; + +# SIGTERM reset the timer, clean pid, and allow for the main loop to finish run +$SIG{TERM} = sub { + $wp->do_log("LOG_INFO", "Going down clean due to SIGTERM"); + clean($wp); + $wp->{daemon} = 0; +}; + +# SIGKILL clean pid then exit immediately +$SIG{KILL} = sub { + $wp->do_log("LOG_INFO", "Hard kill with SIGKILL, attempting to remove pidfile"); + clean($wp); + exit(0); +}; + +>>>>>>> Stashed changes # simply returns the array of hashes provided by swaymsg sub get_outputs { @@ -151,10 +239,17 @@ sub choose_image if (-d $_) { $self->do_log("LOG_DEBUG", "Ignoring sub-directory $_"); next; +<<<<<<< Updated upstream } if ($_ =~ m/\.(png|jpg)$/) { push(@i,$_); } +======= + } + if ($_ =~ m/\.(png|jpg)$/) { + push(@i,$_); + } +>>>>>>> Stashed changes } return $i[rand(scalar(@i))] || return undef; @@ -223,12 +318,21 @@ sub do_log # Journald is borked. Just don't bother logging return 0; if ($self->{daemon}) { +<<<<<<< Updated upstream #use Log::Journald qw(send); #send( #PRIORITY => ERROR->{$level}, #MESSAGE => $msg, #PERL_PACKAGE => 'Sway Wallpapers' #) || warn "Could not send log ($level $msg): $!"; +======= + use Log::Journald qw(send); + send( + PRIORITY => ERROR->{$level}, + MESSAGE => $msg, + PERL_PACKAGE => 'Sway Wallpapers' + ) || warn "Could not send log ($level $msg): $!"; +>>>>>>> Stashed changes if ($die) { $msg = '(FATAL) ' . $msg; exit(1); @@ -250,7 +354,10 @@ sub run $self->do_log("LOG_DEBUG", "Fetching outputs from IPC"); $self->{outputs} = $self->get_outputs(); # Local copy of targets so that it will re-check active every time +<<<<<<< Updated upstream print "Changing $_\n" foreach(@{$self->{targets}}); +======= +>>>>>>> Stashed changes my @t = @{$self->{targets}} if (scalar(@{$self->{targets}})); $self->do_log("LOG_DEBUG", "Removing inactive ouputs"); my $active = $self->get_active(); @@ -261,7 +368,10 @@ sub run } $self->do_log("LOG_DEBUG", "Looping desired ouputs"); foreach my $target (@t) { +<<<<<<< Updated upstream print $target."\n"; +======= +>>>>>>> Stashed changes $self->do_log("LOG_DEBUG", "Ensuring that desired output is active"); unless (defined($active->{$target})) { $self->do_log('LOG_DEBUG', "Target $target is not an active output"); @@ -365,6 +475,7 @@ while (my $arg = shift(@ARGV)) { die "Redundant argument '$arg'. Recursive search already set.\n" unless ($recursive == 0); if (scalar(@ARGV) && $ARGV[0] =~ m/^\d+$/) { $recursive = shift(@ARGV); +<<<<<<< Updated upstream } else { $recursive = -1; } @@ -412,6 +523,15 @@ if (-e $wp->{pidfile}) { $wp->do_log("LOG_CRIT", "Pidfile $wp->{pidfile} exists, but is not readable. Assuming it is running already."); # Die locally because do_log will remove pidfile that this iteration does not belong to exit(1); +======= + } else { + $recursive = -1; + } + } elsif ($arg =~ m/^-/) { + die "Unrecognized argument: $arg\n"; + } else { + push(@targets,$arg); +>>>>>>> Stashed changes } } diff --git a/sway/window-fade.pl b/sway/window-fade.pl index 01a3bc3..d64ade1 100755 --- a/sway/window-fade.pl +++ b/sway/window-fade.pl @@ -15,6 +15,7 @@ sub usage() { print("$0 [value] [-p|--plus] [-m|--minus] [-a x|--attribute=x] [-d N|--delay=N] Fade the opacity of one or more windows via the Sway IPC interface.\n +<<<<<<< Updated upstream value The target opacity or offset between 0 (full transparency) and 1 (fully opaque). Change will be made in increments of 0.01 with a delay between each.\n @@ -27,6 +28,20 @@ value The target opacity or offset between 0 (full transparency) and 1 --delay=N Change the delay in ms between each percentage point change in -d N opacity. Default: 20\n --help This menu +======= +value The target opacity or offset between 0 (full transparency) and 1 + (fully opaque). Change will be made in increments of 0.01 with a + delay between each.\n +--attribute=x Attribute of window(s) to fade. +-a x Default: [title="*"]\n +--plus Increases opacity by increment instead of setting it directly +-p to that increment.\n +--minus Decreases opacity by increment instead of setting it directly +-m to that increment.\n +--delay=N Change the delay in ms between each percentage point change in +-d N opacity. Default: 20\n +--help This menu +>>>>>>> Stashed changes -h\n"); exit(0); } diff --git a/thinkpad/blc.pl b/thinkpad/blc.pl index d0fb906..010aa4a 100755 --- a/thinkpad/blc.pl +++ b/thinkpad/blc.pl @@ -16,26 +16,26 @@ # $0 + "+%c" -= 10 +=4 =1 =100 "+%p" # [ # { -# "action" => "increment", -# "value" => 1 +# "action" => "increment", +# "value" => 1 # },{ -# "action" => "print", -# "value" => "+%c" +# "action" => "print", +# "value" => "+%c" # },{ -# "action" => "decrement", -# "value" => 10 +# "action" => "decrement", +# "value" => 10 # },{ -# "action" => "increment", -# "value" => 4 +# "action" => "increment", +# "value" => 4 # },{ -# "action" => "set", -# "value" => 1 +# "action" => "set", +# "value" => 1 # },{ -# "action" => "set", -# "value" => 100 +# "action" => "set", +# "value" => 100 # },{ -# "action" => "print", -# "value" => "+%p" +# "action" => "print", +# "value" => "+%p" # } # ] # @@ -57,7 +57,7 @@ # --delay-increment=0 --delay-action=1000 # # With the latter, you could even have the backlight do morse code: -# clear | S ( . . . ) |pause| O ( _ _ _ ) |pause| +# clear | S ( . . . ) |pause| O ( _ _ _ ) |pause| # =0 =100 =0 =100 =0 =100 =0 =0 =100 =100 =0 =100 =100 =0 =100 =100 =0 =0 ... # # Perhaps add an argument to repeat indefinitely. This is all getting a bit @@ -71,114 +71,114 @@ my $last_log = $ENV{HOME}."/.spool/blc.last"; sub to_percent { - my $value = shift; - return int($value/get_max()*100); + my $value = shift; + return int($value/get_max()*100); } sub get_offset { - return int(get_max()/100); + return int(get_max()/100); } sub get_current { - open(my $c,'<',"$cur_file"); - my $current = <$c>; - close $c; - chomp $current; - return $current; + open(my $c,'<',"$cur_file"); + my $current = <$c>; + close $c; + chomp $current; + return $current; } sub get_max { - open(my $m,'<',"$max_file"); - my $max = <$m>; - close $m; - chomp $max; - return $max; + open(my $m,'<',"$max_file"); + my $max = <$m>; + close $m; + chomp $max; + return $max; } sub get_min { - return int((get_max()/100)+2); + return int((get_max()/100)+2); } sub writable { - if (! -w $cur_file) { - die "You don't have permission to write $cur_file\n"; - } - return 1; + if (! -w $cur_file) { + die "You don't have permission to write $cur_file\n"; + } + return 1; } sub logger { - my ($current, $target) = @_; - open(my $fh,'>',$last_log); - print $fh to_percent($current); - close($fh); - open($fh,'>',$cur_log); - print $fh to_percent($target); - close($fh); + my ($current, $target) = @_; + open(my $fh,'>',$last_log); + print $fh to_percent($current); + close($fh); + open($fh,'>',$cur_log); + print $fh to_percent($target); + close($fh); } sub writef { - my $target = shift; - open(my $fh,'>',$cur_file); - print $fh $target; - close($fh); + my $target = shift; + open(my $fh,'>',$cur_file); + print $fh $target; + close($fh); } sub increment { - if (writable()) { - my $current = get_current(); - my $max = get_max(); - my $target = $current+get_offset(); - if ($target > $max) { - $target = $max; - } - return $target; + if (writable()) { + my $current = get_current(); + my $max = get_max(); + my $target = $current+get_offset(); + if ($target > $max) { + $target = $max; } + return $target; + } } sub decrement { - if (writable()) { - my $current = get_current(); - my $min = get_min(); - my $target = $current-get_offset(); - if ($target < $min) { - $target = $min; - } - set($target); - return $target; + if (writable()) { + my $current = get_current(); + my $min = get_min(); + my $target = $current-get_offset(); + if ($target < $min) { + $target = $min; } + set($target); + return $target; + } } sub set { - my $value = shift; - if (writable()) { - my $current = get_current(); - logger($current,$value); - if ($value > $current) { - for (my $i=$current;$i<=$value;$i++) { - writef($i); - } - } else { - for (my $i=$current;$i>=$value;$i--) { - writef($i); - } - } - return $value; + my $value = shift; + if (writable()) { + my $current = get_current(); + logger($current,$value); + if ($value > $current) { + for (my $i=$current;$i<=$value;$i++) { + writef($i); + } + } else { + for (my $i=$current;$i>=$value;$i--) { + writef($i); + } } + return $value; + } } sub help { - print " + print " Backlight Control Usage: blc.pl [--silent|--notify] [OPTION] [VALUE] @@ -189,18 +189,18 @@ Output printed to STDOUT unless: --silent Do not display output (overrides --notify) --notify Send output to notification daemon. --notify=N will - change the display duration in ms. Default is 200ms + change the display duration in ms. Default is 200ms Output option must preceed the first Action option. Actions: = VALUE Set backlight to specific value. VALUE greater than - 100 will be treated as absolute value. VALUE eqaul to - or less than 100 will be treated as a percentage -+ Increment by 1% + 100 will be treated as absolute value. VALUE eqaul to + or less than 100 will be treated as a percentage ++ Increment by 1% += VALUE Increment by VALUE percent -- Decrement by 1% +- Decrement by 1% -= VALUE Decrement by VALUE percent Actions corrected to 1% or 100% if over or under. All actions @@ -210,9 +210,9 @@ Final percentage printed as below, skipping other options. Print: -== Print current absolute value -^ Print maximum absolute value -% Print current percentage (does not include % symbol) +== Print current absolute value +^ Print maximum absolute value +% Print current percentage (does not include % symbol) --help Help (not impacted by --silent or --notify) --HELP Advanced help (same as above) @@ -221,28 +221,28 @@ Any other option will be printed literally"; sub advanced { - $current = get_current(); - $max = get_max(); - print ". + $current = get_current(); + $max = get_max(); + print ". Print functions can be strung together but command will exit with the first non-print option. eg. - \$ blc.pl == / ^ - 21/100 - \$ blc.pl == ++ - ('==' ignored) - (Backlight incremented) + \$ blc.pl == / ^ + 21/100 + \$ blc.pl == ++ + ('==' ignored) + (Backlight incremented) Escape options with \\ in quotes to display them literally. eg. - \$ blc.pl == / ^ '\\=' % \'\\%\' - " . $current . "/" . $max . "=" . int($current/$max*100) . "% + \$ blc.pl == / ^ '\\=' % \'\\%\' + " . $current . "/" . $max . "=" . int($current/$max*100) . "% Only one \'\\' is removed per block. eg. - \$ blc.pl '\\% \\' - % \\ + \$ blc.pl '\\% \\' + % \\ "; } @@ -252,140 +252,140 @@ my (@output, $target, $silent, $notify); my $operation_found = 0; if (scalar @ARGV) { - while ($arg = shift) { - if ($arg eq '%') { - push @output,to_percent(get_current); - } elsif ($arg eq '^') { - push @output,get_max(); - } elsif ($arg eq '==') { - push @output,get_current(); - } elsif ($arg eq '--help') { - help(); - print " (see --HELP).\n\n"; - exit(); - } elsif ($arg eq '--HELP') { - help(); - advanced(); - exit(); - } elsif ($arg eq '--silent') { - $silent = 1; - } elsif ($arg =~ /^--notify/) { - $notify = 1; - if ($arg =~ /=[0-9]+$/) { - $duration = $arg; - $duration =~ s/.*=([0-9]+)/$1/; - } else { - $duration = 1000; - } - } elsif ($arg eq '+') { - unshift(@ARGV,1); - unshift(@ARGV,'+='); - } elsif ($arg =~ /^\+=/) { - my $offset; - if ($arg =~ m/^\+=(.+)$/) { - $offset = $1; - } else { - $offset = shift || die "+= without accompanying offset value\n"; - } - unless ($offset =~ /^\d+$/) { - die "+= is not a number ($offset)\n"; - } - for (my $j=0;$j<$offset;$j++) { - $target = increment(); - @output = to_percent($target); - } - $operation_found = 1; - } elsif ($arg eq '-') { - unshift(@ARGV,1); - unshift(@ARGV,'-='); - } elsif ($arg =~ /^-=/) { - my $offset; - if ($arg =~ m/^-=(.+)$/) { - $offset = $1; - } else { - $offset = shift || die "-= without accompanying offset value\n"; - } - unless ($offset =~ /^\d+$/) { - die "-= is not a number ($offset)\n"; - } - for (my $j=0;$j<$offset;$j++) { - $target = decrement(); - @output = to_percent($target); - } - $operation_found = 1; - } elsif ($arg =~ m/^=/) { - my $value; - if ($arg =~ m/^=(.+)$/) { - $target = $1; - } else { - $target = shift || die "= without accompanying absolute value\n"; - } - unless ($target =~ /^\d+$/) { - die "= is not a number ($target)\n"; - } - if ($target < 1) { - $target = set(get_min()); - } elsif ($target > get_max()) { - $target = set(get_max()); - } elsif ($target > 100) { - $target = set($target); - } else { - $target = set( - int((get_max()*$target/100)+1) - ); - } - @output = to_percent($target); - $operation_found = 1; - } else { - push(@output,$arg); - } + while ($arg = shift) { + if ($arg eq '%') { + push @output,to_percent(get_current); + } elsif ($arg eq '^') { + push @output,get_max(); + } elsif ($arg eq '==') { + push @output,get_current(); + } elsif ($arg eq '--help') { + help(); + print " (see --HELP).\n\n"; + exit(); + } elsif ($arg eq '--HELP') { + help(); + advanced(); + exit(); + } elsif ($arg eq '--silent') { + $silent = 1; + } elsif ($arg =~ /^--notify/) { + $notify = 1; + if ($arg =~ /=[0-9]+$/) { + $duration = $arg; + $duration =~ s/.*=([0-9]+)/$1/; + } else { + $duration = 1000; + } + } elsif ($arg eq '+') { + unshift(@ARGV,1); + unshift(@ARGV,'+='); + } elsif ($arg =~ /^\+=/) { + my $offset; + if ($arg =~ m/^\+=(.+)$/) { + $offset = $1; + } else { + $offset = shift || die "+= without accompanying offset value\n"; + } + unless ($offset =~ /^\d+$/) { + die "+= is not a number ($offset)\n"; + } + for (my $j=0;$j<$offset;$j++) { + $target = increment(); + @output = to_percent($target); + } + $operation_found = 1; + } elsif ($arg eq '-') { + unshift(@ARGV,1); + unshift(@ARGV,'-='); + } elsif ($arg =~ /^-=/) { + my $offset; + if ($arg =~ m/^-=(.+)$/) { + $offset = $1; + } else { + $offset = shift || die "-= without accompanying offset value\n"; + } + unless ($offset =~ /^\d+$/) { + die "-= is not a number ($offset)\n"; + } + for (my $j=0;$j<$offset;$j++) { + $target = decrement(); + @output = to_percent($target); + } + $operation_found = 1; + } elsif ($arg =~ m/^=/) { + my $value; + if ($arg =~ m/^=(.+)$/) { + $target = $1; + } else { + $target = shift || die "= without accompanying absolute value\n"; + } + unless ($target =~ /^\d+$/) { + die "= is not a number ($target)\n"; + } + if ($target < 1) { + $target = set(get_min()); + } elsif ($target > get_max()) { + $target = set(get_max()); + } elsif ($target > 100) { + $target = set($target); + } else { + $target = set( + int((get_max()*$target/100)+1) + ); + } + @output = to_percent($target); + $operation_found = 1; + } else { + push(@output,$arg); } + } } else { - @output = ( - '{"Backlight":{"Max":"' - . get_max() - . '","Current":"' - . get_current() - . '","Percentage","' - . int(get_current()/get_max()*100) - . '%"}}' - ); + @output = ( + '{"Backlight":{"Max":"' + . get_max() + . '","Current":"' + . get_current() + . '","Percentage","' + . int(get_current()/get_max()*100) + . '%"}}' + ); } if ($silent) { - exit(); + exit(); } elsif ($notify) { - my $concat = ''; - foreach (@output) { - $concat .= $_; - } + my $concat = ''; + foreach (@output) { + $concat .= $_; + } =pod - use Gtk2::Notify -init, "Backlight"; - my $notification = Gtk2::Notify::new('Backlight', $concat, '', "notification-display-brightness"); + use Gtk2::Notify -init, "Backlight"; + my $notification = Gtk2::Notify::new('Backlight', $concat, '', "notification-display-brightness"); - $notification->set_hint_string('x-canonical-private-synchronous','blc'); - $notification->set_urgency('NOTIFY_URGENCY_LOW'); - $notification->set_hint_int32('value',(split('%',$concat))[0]); - $notification->set_timeout($duration); - $notification->show(); - exit; - print "notify-send --urgency=normal" - . ' --icon="notification-display-brightness"' - . ' --hint=string:x-canonical-private-synchronous:blc' - . ' --expire-time=' . $duration - . ' "Backlight"' - . ' "' . $concat . " '" . join("','", @output) . "'\""; - system "notify-send --urgency=normal" - . ' --icon="notification-display-brightness"' - . ' --hint=string:x-canonical-private-synchronous:blc' - . ' --hint=int:value:' . (split('%',$concat))[0] - . ' --expire-time=' . $duration - . ' "' . $concat . "\""; + $notification->set_hint_string('x-canonical-private-synchronous','blc'); + $notification->set_urgency('NOTIFY_URGENCY_LOW'); + $notification->set_hint_int32('value',(split('%',$concat))[0]); + $notification->set_timeout($duration); + $notification->show(); + exit; + print "notify-send --urgency=normal" + . ' --icon="notification-display-brightness"' + . ' --hint=string:x-canonical-private-synchronous:blc' + . ' --expire-time=' . $duration + . ' "Backlight"' + . ' "' . $concat . " '" . join("','", @output) . "'\""; + system "notify-send --urgency=normal" + . ' --icon="notification-display-brightness"' + . ' --hint=string:x-canonical-private-synchronous:blc' + . ' --hint=int:value:' . (split('%',$concat))[0] + . ' --expire-time=' . $duration + . ' "' . $concat . "\""; =cut - exit(); + exit(); } else { - print foreach @output; - print "\n"; - exit(); + print foreach @output; + print "\n"; + exit(); } diff --git a/thinkpad/pow.pl b/thinkpad/pow.pl index 9d28d3c..d794dc1 100755 --- a/thinkpad/pow.pl +++ b/thinkpad/pow.pl @@ -47,7 +47,10 @@ foreach (@devices) { close $t; $output .= '"Type":"' . $type . '"'; if ($name =~ /BAT[0-9]+/) { +<<<<<<< Updated upstream $nobat = 0; +======= +>>>>>>> Stashed changes open(my $s,'<',"$_/status"); my $status = <$s>; chomp $status; @@ -85,10 +88,13 @@ foreach (@devices) { . '"'; } $output .= "},"; +<<<<<<< Updated upstream } unless ($nobat) { print('{"AC":{"Type":"AC","Status":"Plugged-In"}}'); exit(); +======= +>>>>>>> Stashed changes } $battery_total{'percentage'} = sprintf("%0d", @@ -109,6 +115,7 @@ if ($bar) { my $class = 'discharging'; $output = ''; if ($powref->{AC}->{Status} eq "Plugged-In") { +<<<<<<< Updated upstream $class = 'charging'; $output .= ""; } elsif ($powref->{Total}->{Percentage} <= 10) { @@ -116,6 +123,15 @@ if ($bar) { $output .= ""; } elsif ($powref->{Total}->{Percentage} <= 35) { $class = 'low'; +======= + $class = 'charging'; + $output .= ""; + } elsif ($powref->{Total}->{Percentage} <= 10) { + $class = 'critical'; + $output .= ""; + } elsif ($powref->{Total}->{Percentage} <= 35) { + $class = 'low'; +>>>>>>> Stashed changes $output .= ""; } elsif ($powref->{Total}->{Percentage} <= 60) { $output .= ""; @@ -138,11 +154,19 @@ if ($bar) { my $total = ''; $output = "Device Status Percentage\n"; foreach my $device (keys %{$powref}) { +<<<<<<< Updated upstream my $status; if ($powref->{$device}->{Status} eq "Plugged-In") { $status = ""; } elsif (!defined($powref->{$device}->{Percentage}) || $powref->{$device}->{Percentage} == 0) { $status = " "; +======= + my $status; + if ($powref->{$device}->{Status} eq "Plugged-In") { + $status = ""; + } elsif (!defined($powref->{$device}->{Percentage}) || $powref->{$device}->{Percentage} == 0) { + $status = " "; +>>>>>>> Stashed changes } elsif ($powref->{$device}->{Percentage} <= 10) { $status = " " . $powref->{$device}->{'Percentage'} . "%"; } elsif ($powref->{$device}->{Percentage} <= 35) { @@ -151,6 +175,7 @@ if ($bar) { $status = " " . $powref->{$device}->{'Percentage'} . "%"; } elsif ($powref->{$device}->{Percentage} <= 85) { $status = " " . $powref->{$device}->{'Percentage'} . "%"; +<<<<<<< Updated upstream } else { $status = " " . $powref->{$device}->{'Percentage'} . "%"; } @@ -166,6 +191,23 @@ if ($bar) { } $output .= sprintf("%-24s %-12s %-12s\n", $name, $powref->{$device}->{Status}, $status); } +======= + } else { + $status = " " . $powref->{$device}->{'Percentage'} . "%"; + } + if ($device eq 'Total') { + $total .= sprintf("%-24s %-12s", $device, $status); + } else { + #$output .= sprintf("%".length($powref->{$device->{'Type'}})."s (%".length($powref->{$device->{'Type'}})."s): %3d\%\n", $device, $device->{'Type'}, $device->{'Percentage'}); + my $name = ' ('.$powref->{$device}->{'Type'}.')'; + if ((length($device)+length($name)) >= 24) { + $name = substr($device, 0, (21-length($name))) . '...' . $name; + } else { + $name = substr(($device.$name), 0, 24); + } + $output .= sprintf("%-24s %-12s %-12s\n", $name, $powref->{$device}->{Status}, $status); + } +>>>>>>> Stashed changes } $output .= $total; } diff --git a/waybar/waybar-debian.sh b/waybar/waybar-debian.sh index 468a6e1..91bdbb3 100755 --- a/waybar/waybar-debian.sh +++ b/waybar/waybar-debian.sh @@ -23,9 +23,15 @@ elif [ "$1" == 'upgrade' ]; then COUNT=`apt list --upgradable 2> /dev/null | wc -l` let COUNT-- echo $COUNT > /home/jpm/.spool/apt-upgradeable +<<<<<<< Updated upstream if [ -e /var/run/reboot-required ]; then grep -B1 -A4 upgrade /var/log/apt/history.log | tail -n 6 | swaynag --config=${HOME}/.dotfiles/sway/swaynag --edge=bottom --message="New packages require restart" --button="Restart Now" "sudo systemctl reboot" --dismiss-button="Later" --detailed-message --detailed-button "Show/Hide Upgrade Details" fi +======= + if [ -e /var/run/reboot-required ]; then + grep -B1 -A4 upgrade /var/log/apt/history.log | tail -n 6 | swaynag --config=${HOME}/.dotfiles/sway/swaynag --edge=bottom --message="New packages require restart" --button="Restart Now" "sudo systemctl reboot" --dismiss-button="Later" --detailed-message --detailed-button "Show/Hide Upgrade Details" + fi +>>>>>>> Stashed changes elif [ "$1" == 'update' ]; then sudo apt update >/dev/null 2>/dev/null COUNT=`apt list --upgradable 2> /dev/null | wc -l` diff --git a/wofi/wofi-alt-tab.sh b/wofi/wofi-alt-tab.sh index e04509c..f8ccb96 100755 --- a/wofi/wofi-alt-tab.sh +++ b/wofi/wofi-alt-tab.sh @@ -6,7 +6,11 @@ swaymsg -t get_tree | sed -e 's/^\(.*\) [—-] .*$/\1/'| sed -e 's/^\([0-9]*\)\t*\(.*\)/\2 \1/' | wofi -s $HOME/.dotfiles/wofi/style.css -c \ +<<<<<<< Updated upstream $HOME/.dotfiles/wofi/sidebar -d | { +======= + $HOME/.dotfiles/wofi/sidebar -d | { +>>>>>>> Stashed changes read -r id=`echo $REPLY | rev | cut -d' ' -f1 | rev` swaymsg "[con_id=$id]" focus diff --git a/wofi/wofi-wifi-menu.sh b/wofi/wofi-wifi-menu.sh index 26e48b3..0ce96bf 100755 --- a/wofi/wofi-wifi-menu.sh +++ b/wofi/wofi-wifi-menu.sh @@ -37,7 +37,7 @@ fi CHENTRY=$(echo -e "$TOGGLE\nmanual\n$LIST" | uniq -u | wofi -s $HOME/.dotfiles/wofi/style.css -i -d --prompt "Wi-Fi SSID: " -c $HOME/.dotfiles/wofi/sidebar) if [[ $CHENTRY == "" ]]; then - exit + exit fi #echo "$CHENTRY" CHSSID=$(echo "$CHENTRY" | sed 's/\s\{2,\}/\|/g' | awk -F "|" '{print $1}') From 823fa0e3608d16b16b8a04b9d295b3bbfcb968a4 Mon Sep 17 00:00:00 2001 From: John Mertz Date: Sat, 7 Jan 2023 13:25:17 -0500 Subject: [PATCH 2/3] clean merge --- thinkpad/pow.pl | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/thinkpad/pow.pl b/thinkpad/pow.pl index d794dc1..007c2e9 100755 --- a/thinkpad/pow.pl +++ b/thinkpad/pow.pl @@ -47,10 +47,6 @@ foreach (@devices) { close $t; $output .= '"Type":"' . $type . '"'; if ($name =~ /BAT[0-9]+/) { -<<<<<<< Updated upstream - $nobat = 0; -======= ->>>>>>> Stashed changes open(my $s,'<',"$_/status"); my $status = <$s>; chomp $status; @@ -88,13 +84,6 @@ foreach (@devices) { . '"'; } $output .= "},"; -<<<<<<< Updated upstream -} -unless ($nobat) { - print('{"AC":{"Type":"AC","Status":"Plugged-In"}}'); - exit(); -======= ->>>>>>> Stashed changes } $battery_total{'percentage'} = sprintf("%0d", @@ -115,15 +104,6 @@ if ($bar) { my $class = 'discharging'; $output = ''; if ($powref->{AC}->{Status} eq "Plugged-In") { -<<<<<<< Updated upstream - $class = 'charging'; - $output .= ""; - } elsif ($powref->{Total}->{Percentage} <= 10) { - $class = 'critical'; - $output .= ""; - } elsif ($powref->{Total}->{Percentage} <= 35) { - $class = 'low'; -======= $class = 'charging'; $output .= ""; } elsif ($powref->{Total}->{Percentage} <= 10) { @@ -131,7 +111,6 @@ if ($bar) { $output .= ""; } elsif ($powref->{Total}->{Percentage} <= 35) { $class = 'low'; ->>>>>>> Stashed changes $output .= ""; } elsif ($powref->{Total}->{Percentage} <= 60) { $output .= ""; @@ -154,19 +133,11 @@ if ($bar) { my $total = ''; $output = "Device Status Percentage\n"; foreach my $device (keys %{$powref}) { -<<<<<<< Updated upstream - my $status; - if ($powref->{$device}->{Status} eq "Plugged-In") { - $status = ""; - } elsif (!defined($powref->{$device}->{Percentage}) || $powref->{$device}->{Percentage} == 0) { - $status = " "; -======= my $status; if ($powref->{$device}->{Status} eq "Plugged-In") { $status = ""; } elsif (!defined($powref->{$device}->{Percentage}) || $powref->{$device}->{Percentage} == 0) { $status = " "; ->>>>>>> Stashed changes } elsif ($powref->{$device}->{Percentage} <= 10) { $status = " " . $powref->{$device}->{'Percentage'} . "%"; } elsif ($powref->{$device}->{Percentage} <= 35) { @@ -175,23 +146,6 @@ if ($bar) { $status = " " . $powref->{$device}->{'Percentage'} . "%"; } elsif ($powref->{$device}->{Percentage} <= 85) { $status = " " . $powref->{$device}->{'Percentage'} . "%"; -<<<<<<< Updated upstream - } else { - $status = " " . $powref->{$device}->{'Percentage'} . "%"; - } - if ($device eq 'Total') { - $total .= sprintf("%-24s %-12s", $device, $status); - } else { - #$output .= sprintf("%".length($powref->{$device->{'Type'}})."s (%".length($powref->{$device->{'Type'}})."s): %3d\%\n", $device, $device->{'Type'}, $device->{'Percentage'}); - my $name = ' ('.$powref->{$device}->{'Type'}.')'; - if ((length($device)+length($name)) >= 24) { - $name = substr($device, 0, (21-length($name))) . '...' . $name; - } else { - $name = substr(($device.$name), 0, 24); - } - $output .= sprintf("%-24s %-12s %-12s\n", $name, $powref->{$device}->{Status}, $status); - } -======= } else { $status = " " . $powref->{$device}->{'Percentage'} . "%"; } @@ -207,7 +161,6 @@ if ($bar) { } $output .= sprintf("%-24s %-12s %-12s\n", $name, $powref->{$device}->{Status}, $status); } ->>>>>>> Stashed changes } $output .= $total; } From 00eef394419a3ff5daa722e3edc9db0e682e9986 Mon Sep 17 00:00:00 2001 From: John Mertz Date: Sat, 7 Jan 2023 13:32:14 -0500 Subject: [PATCH 3/3] Fix merge conflicts --- sway/idle.sh | 3 -- sway/power-menu.sh | 7 --- sway/wallpaper.pl | 104 ---------------------------------------- sway/window-fade.pl | 15 ------ waybar/waybar-debian.sh | 6 --- wofi/wofi-alt-tab.sh | 4 -- 6 files changed, 139 deletions(-) diff --git a/sway/idle.sh b/sway/idle.sh index f4c88eb..5f25f48 100755 --- a/sway/idle.sh +++ b/sway/idle.sh @@ -53,10 +53,7 @@ elif [ $1 == "fade" ]; then elif [ $1 == "unfade" ]; then if [ -e $HOME/.spool/sway-hidden ]; then kill -USR2 `cat $HOME/.spool/sway-transparency` -<<<<<<< Updated upstream -======= /home/jpm/scripts/sway/displays.pl -w ->>>>>>> Stashed changes fi elif [ $1 == "dim" ]; then echo $($HOME/scripts/thinkpad/blc.pl %) > $BLFILE diff --git a/sway/power-menu.sh b/sway/power-menu.sh index 21f6739..b7c8c89 100755 --- a/sway/power-menu.sh +++ b/sway/power-menu.sh @@ -32,17 +32,10 @@ elif [ "$res" == "↹ Restart i3" ]; then i3 restart elif [ "$res" == "↻ Reload Sway" ]; then sway reload -<<<<<<< Updated upstream - /home/jpm/scripts/sway/displays.pl -elif [ "$res" == "↻ Reload Waybar" ]; then - # Need to integrate with sway/displays.pl for alternative outputs - /home/jpm/scripts/sway/displays.pl -w -======= /home/jpm/scripts/distrobox/debian12/displays.sh elif [ "$res" == "↻ Reload Waybar" ]; then # Need to integrate with sway/displays.pl for alternative outputs /home/jpm/scripts/distrobox/debian12/displays.sh -w ->>>>>>> Stashed changes elif [ "$res" == "🡙 Reboot" ]; then rm $SSH_AUTH_SOCK sudo systemctl reboot -i diff --git a/sway/wallpaper.pl b/sway/wallpaper.pl index 8baa926..034c404 100755 --- a/sway/wallpaper.pl +++ b/sway/wallpaper.pl @@ -32,15 +32,6 @@ Sets a wallpaper by cropping an appropriate sized section of a larger image.\n All arguments other than the below are assumed to be output names, as defined in my sway/displays.pl script. If no outputs are provided, all available that are currently enabled will be set.\n -<<<<<<< Updated upstream ---path= Path to wallpaper directory. --p Default: $ENV{HOME}/wallpapers\n ---daemon=N Configures the wallpaper to be periodically rotated for all --d N of the given outputs. N indicates the number of seconds between - each rotation, if provided (default: 300).\n ---nocrop Don't crop a selection from the image. Instead, pass the whole --n image to swaybg and let it handle the scaling\n -======= --path= Path to wallpaper directory. -p Default: $ENV{HOME}/wallpapers\n --daemon=N Configures the wallpaper to be periodically rotated for all @@ -48,18 +39,12 @@ are currently enabled will be set.\n each rotation, if provided (default: 300).\n --nocrop Don't crop a selection from the image. Instead, pass the whole -n image to swaybg and let it handle the scaling\n ->>>>>>> Stashed changes --verbose=N Define minimum log level. Counting from 1: LOG_DEBUG, LOG_INFO, -v N LOG_NOTICE, LOG_WARNING, LOG_ERR, LOG_CRIT, LOG_ALERT, LOG_EMERG Default: 5; If provided without a value for N then all (1). --recursive=N Enumerate images recursively through directories in the path. -<<<<<<< Updated upstream --r N N indicates the directory depth, unlimited if no N is provided. ---help This menu -======= -r N N indicates the directory depth, unlimited if no N is provided. --help This menu ->>>>>>> Stashed changes -h\n You can send SIGUSR1 to force the daemon to reload immediately. Rotation timer will be reset.\n"); @@ -69,14 +54,6 @@ will be reset.\n"); sub new { my ($class, %args) = @_; -<<<<<<< Updated upstream - - use AnyEvent::Sway; - $args{ipc} = AnyEvent::Sway->new(); - use Image::Magick; - $args{im} = Image::Magick->new(); - $args{error} = (); -======= use AnyEvent::Sway; $args{ipc} = AnyEvent::Sway->new(); @@ -88,15 +65,9 @@ sub new return bless { %args }; } ->>>>>>> Stashed changes $args{pidfile} = "/tmp/$ENV{USER}-wallpaper.pid"; -<<<<<<< Updated upstream - return bless { %args }; -} - -======= if (-e $wp->{pidfile}) { if (-r $wp->{pidfile}) { if (open(my $fh, '<', $wp->{pidfile})) { @@ -153,7 +124,6 @@ $SIG{KILL} = sub { exit(0); }; ->>>>>>> Stashed changes # simply returns the array of hashes provided by swaymsg sub get_outputs { @@ -239,17 +209,10 @@ sub choose_image if (-d $_) { $self->do_log("LOG_DEBUG", "Ignoring sub-directory $_"); next; -<<<<<<< Updated upstream } if ($_ =~ m/\.(png|jpg)$/) { push(@i,$_); } -======= - } - if ($_ =~ m/\.(png|jpg)$/) { - push(@i,$_); - } ->>>>>>> Stashed changes } return $i[rand(scalar(@i))] || return undef; @@ -318,21 +281,12 @@ sub do_log # Journald is borked. Just don't bother logging return 0; if ($self->{daemon}) { -<<<<<<< Updated upstream - #use Log::Journald qw(send); - #send( - #PRIORITY => ERROR->{$level}, - #MESSAGE => $msg, - #PERL_PACKAGE => 'Sway Wallpapers' - #) || warn "Could not send log ($level $msg): $!"; -======= use Log::Journald qw(send); send( PRIORITY => ERROR->{$level}, MESSAGE => $msg, PERL_PACKAGE => 'Sway Wallpapers' ) || warn "Could not send log ($level $msg): $!"; ->>>>>>> Stashed changes if ($die) { $msg = '(FATAL) ' . $msg; exit(1); @@ -354,10 +308,6 @@ sub run $self->do_log("LOG_DEBUG", "Fetching outputs from IPC"); $self->{outputs} = $self->get_outputs(); # Local copy of targets so that it will re-check active every time -<<<<<<< Updated upstream - print "Changing $_\n" foreach(@{$self->{targets}}); -======= ->>>>>>> Stashed changes my @t = @{$self->{targets}} if (scalar(@{$self->{targets}})); $self->do_log("LOG_DEBUG", "Removing inactive ouputs"); my $active = $self->get_active(); @@ -368,10 +318,6 @@ sub run } $self->do_log("LOG_DEBUG", "Looping desired ouputs"); foreach my $target (@t) { -<<<<<<< Updated upstream - print $target."\n"; -======= ->>>>>>> Stashed changes $self->do_log("LOG_DEBUG", "Ensuring that desired output is active"); unless (defined($active->{$target})) { $self->do_log('LOG_DEBUG', "Target $target is not an active output"); @@ -475,55 +421,6 @@ while (my $arg = shift(@ARGV)) { die "Redundant argument '$arg'. Recursive search already set.\n" unless ($recursive == 0); if (scalar(@ARGV) && $ARGV[0] =~ m/^\d+$/) { $recursive = shift(@ARGV); -<<<<<<< Updated upstream - } else { - $recursive = -1; - } - } elsif ($arg =~ m/^-/) { - die "Unrecognized argument: $arg\n"; - } else { - print "Adding $arg to targets\n"; - push(@targets,$arg); -print "Setting $_\n" foreach(@targets); -$wp->{targets} = \@targets || undef; -print "Set $_\n" foreach(@{$wp->{targets}}); - } -} - -if (-e $wp->{pidfile}) { - if (-r $wp->{pidfile}) { - if (open(my $fh, '<', $wp->{pidfile})) { - my $pid = <$fh>; - chomp($pid); - use Proc::ProcessTable; - my $pt = Proc::ProcessTable->new(); - foreach my $p ( @{ $pt->table() } ) { - if ($p->{pid} eq $pid) { - my $name = $0; - $name =~ s/$ENV{PWD}//; - if ($p->{'cmndline'} =~ m#$name#) { - $wp->do_log("LOG_CRIT", "Another process is already running with PID: $pid (running and listed in $wp->{pidfile})"); - # Die locally because do_log will remove pidfile that this iteration does not belong to - exit(1); - } else { - $wp->do_log("LOG_CRIT", "Found matching $pid with different cmdline: $p->{cmndline} (not $0)",1); - # PID in pidfile doesn't look like it is another wallpaper - unlink($wp->{pidfile}); - last; - } - return $p->{'pid'}; - } - } - } else { - $wp->do_log("LOG_CRIT", "Pidfile $wp->{pidfile} exists, but cannot be opened. Assuming it is running already."); - # Die locally because do_log will remove pidfile that this iteration does not belong to - exit(1); - } - } else { - $wp->do_log("LOG_CRIT", "Pidfile $wp->{pidfile} exists, but is not readable. Assuming it is running already."); - # Die locally because do_log will remove pidfile that this iteration does not belong to - exit(1); -======= } else { $recursive = -1; } @@ -531,7 +428,6 @@ if (-e $wp->{pidfile}) { die "Unrecognized argument: $arg\n"; } else { push(@targets,$arg); ->>>>>>> Stashed changes } } diff --git a/sway/window-fade.pl b/sway/window-fade.pl index d64ade1..e05906c 100755 --- a/sway/window-fade.pl +++ b/sway/window-fade.pl @@ -15,20 +15,6 @@ sub usage() { print("$0 [value] [-p|--plus] [-m|--minus] [-a x|--attribute=x] [-d N|--delay=N] Fade the opacity of one or more windows via the Sway IPC interface.\n -<<<<<<< Updated upstream -value The target opacity or offset between 0 (full transparency) and 1 - (fully opaque). Change will be made in increments of 0.01 with a - delay between each.\n ---attribute=x Attribute of window(s) to fade. --a x Default: [title="*"]\n ---plus Increases opacity by increment instead of setting it directly --p to that increment.\n ---minus Decreases opacity by increment instead of setting it directly --m to that increment.\n ---delay=N Change the delay in ms between each percentage point change in --d N opacity. Default: 20\n ---help This menu -======= value The target opacity or offset between 0 (full transparency) and 1 (fully opaque). Change will be made in increments of 0.01 with a delay between each.\n @@ -41,7 +27,6 @@ value The target opacity or offset between 0 (full transparency) and 1 --delay=N Change the delay in ms between each percentage point change in -d N opacity. Default: 20\n --help This menu ->>>>>>> Stashed changes -h\n"); exit(0); } diff --git a/waybar/waybar-debian.sh b/waybar/waybar-debian.sh index 91bdbb3..a9fd08e 100755 --- a/waybar/waybar-debian.sh +++ b/waybar/waybar-debian.sh @@ -23,15 +23,9 @@ elif [ "$1" == 'upgrade' ]; then COUNT=`apt list --upgradable 2> /dev/null | wc -l` let COUNT-- echo $COUNT > /home/jpm/.spool/apt-upgradeable -<<<<<<< Updated upstream - if [ -e /var/run/reboot-required ]; then - grep -B1 -A4 upgrade /var/log/apt/history.log | tail -n 6 | swaynag --config=${HOME}/.dotfiles/sway/swaynag --edge=bottom --message="New packages require restart" --button="Restart Now" "sudo systemctl reboot" --dismiss-button="Later" --detailed-message --detailed-button "Show/Hide Upgrade Details" - fi -======= if [ -e /var/run/reboot-required ]; then grep -B1 -A4 upgrade /var/log/apt/history.log | tail -n 6 | swaynag --config=${HOME}/.dotfiles/sway/swaynag --edge=bottom --message="New packages require restart" --button="Restart Now" "sudo systemctl reboot" --dismiss-button="Later" --detailed-message --detailed-button "Show/Hide Upgrade Details" fi ->>>>>>> Stashed changes elif [ "$1" == 'update' ]; then sudo apt update >/dev/null 2>/dev/null COUNT=`apt list --upgradable 2> /dev/null | wc -l` diff --git a/wofi/wofi-alt-tab.sh b/wofi/wofi-alt-tab.sh index f8ccb96..7b34d0e 100755 --- a/wofi/wofi-alt-tab.sh +++ b/wofi/wofi-alt-tab.sh @@ -6,11 +6,7 @@ swaymsg -t get_tree | sed -e 's/^\(.*\) [—-] .*$/\1/'| sed -e 's/^\([0-9]*\)\t*\(.*\)/\2 \1/' | wofi -s $HOME/.dotfiles/wofi/style.css -c \ -<<<<<<< Updated upstream - $HOME/.dotfiles/wofi/sidebar -d | { -======= $HOME/.dotfiles/wofi/sidebar -d | { ->>>>>>> Stashed changes read -r id=`echo $REPLY | rev | cut -d' ' -f1 | rev` swaymsg "[con_id=$id]" focus