Compare commits
2 Commits
baba42bff9
...
05921b1d01
Author | SHA1 | Date |
---|---|---|
John Mertz | 05921b1d01 | |
John Mertz | 8e46f79ae8 |
|
@ -4,7 +4,7 @@ ROFI=$(pgrep -c rofi | cut -b 1)
|
||||||
echo $ROFI
|
echo $ROFI
|
||||||
|
|
||||||
if [[ "$ROFI" -eq "0" ]]; then
|
if [[ "$ROFI" -eq "0" ]]; then
|
||||||
rofi -config /home/jpm/.config/rofi/config -show drun
|
rofi -config /home/jpm/.config/rofi/config.rasi -show drun
|
||||||
else
|
else
|
||||||
killall rofi 2&>1 /dev/null
|
killall rofi 2&>1 /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# Passwordless sudo required
|
# Passwordless sudo required
|
||||||
|
|
||||||
res=$(echo "Connection|John.Me.tz|MailCleaner|Disconnect|Restart" | rofi -sep "|" -dmenu -i -p 'P ' "" -columns 9 -width 45 -l 1 -config /home/jpm/.config/rofi/config -hide-scrollbar -eh 1 -location 0 -auto-select -no-fullscreen)
|
res=$(echo "Connection|John.Me.tz|MailCleaner|Disconnect|Restart" | rofi -sep "|" -dmenu -i -p 'P ' "" -columns 9 -width 45 -l 1 -config /home/jpm/.config/rofi/config.rasi -hide-scrollbar -eh 1 -location 0 -auto-select -no-fullscreen)
|
||||||
|
|
||||||
if [ $res = "Connection" ]; then
|
if [ $res = "Connection" ]; then
|
||||||
/usr/bin/uxterm -e 'sudo /usr/bin/nmtui'
|
/usr/bin/uxterm -e 'sudo /usr/bin/nmtui'
|
||||||
|
|
|
@ -4,7 +4,7 @@ res=$(echo "john.me.tz|root@john.me.tz|t470s.lan.john.me.tz|shb.ng|\
|
||||||
kipary.fastnet.ch|media.lan.john.me.tz|pipcam0.lan.john.me.tz|\
|
kipary.fastnet.ch|media.lan.john.me.tz|pipcam0.lan.john.me.tz|\
|
||||||
therm.lan.john.me.tz|hud.lan.john.me.tz|vm.lan.john.me.tz|mac.lan.john.me.tz|AndroidUSB" | \
|
therm.lan.john.me.tz|hud.lan.john.me.tz|vm.lan.john.me.tz|mac.lan.john.me.tz|AndroidUSB" | \
|
||||||
rofi -sep "|" -dmenu -i -p 'P ' "" -columns 1 -rows 1 -width 45 -l 1 -config \
|
rofi -sep "|" -dmenu -i -p 'P ' "" -columns 1 -rows 1 -width 45 -l 1 -config \
|
||||||
/home/jpm/.config/rofi/config -hide-scrollbar -eh 1 -location 0 -yoffset 0 \
|
/home/jpm/.config/rofi/config.rasi -hide-scrollbar -eh 1 -location 0 -yoffset 0 \
|
||||||
-padding 12 -opacity 100 -auto-select -no-fullscreen)
|
-padding 12 -opacity 100 -auto-select -no-fullscreen)
|
||||||
|
|
||||||
echo $res > /home/jpm/.last_ssh_shortcut
|
echo $res > /home/jpm/.last_ssh_shortcut
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
# "width": __WIDTH__ (optional)
|
# "width": __WIDTH__ (optional)
|
||||||
my $waybar_template = "$ENV{'HOME'}/.config/waybar/config.template";
|
my $waybar_template = "$ENV{'HOME'}/.config/waybar/config.template";
|
||||||
|
|
||||||
|
my $swaysock = "/home/jpm/.config/sway-ipc.sock";
|
||||||
|
|
||||||
# Path to actual config file generated from template
|
# Path to actual config file generated from template
|
||||||
my $waybar_config = "$ENV{'HOME'}/.config/waybar/config";
|
my $waybar_config = "$ENV{'HOME'}/.config/waybar/config";
|
||||||
|
|
||||||
|
@ -206,7 +208,7 @@ close($fh);
|
||||||
# Fetch connected displays
|
# Fetch connected displays
|
||||||
use JSON::XS;
|
use JSON::XS;
|
||||||
my $json = JSON::XS->new();
|
my $json = JSON::XS->new();
|
||||||
my $displays_raw = `swaymsg -t get_outputs --raw`;
|
my $displays_raw = `swaymsg -s $swaysock -t get_outputs --raw`;
|
||||||
my $displays = $json->decode($displays_raw);
|
my $displays = $json->decode($displays_raw);
|
||||||
|
|
||||||
# For each connected display, collect the desired settings for enabled
|
# For each connected display, collect the desired settings for enabled
|
||||||
|
@ -252,7 +254,8 @@ foreach my $output (keys %$on) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (scalar(@unavailable)) {
|
if (scalar(@unavailable)) {
|
||||||
die "Config requires unavailable output(s) " . join(', ', @unavailable) . "\n";
|
die "Config requires unavailable output(s) " . join(', ', @unavailable)
|
||||||
|
. "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Skip enabling/disabling displays if only running waybar (re)start
|
# Skip enabling/disabling displays if only running waybar (re)start
|
||||||
|
@ -262,13 +265,13 @@ unless ($waybar_only) {
|
||||||
foreach (@off) {
|
foreach (@off) {
|
||||||
|
|
||||||
# Sway returns status as JSON
|
# Sway returns status as JSON
|
||||||
my $res_raw = `sway output $_ disable`;
|
my $res_raw = `swaymsg -s $swaysock output $_ disable`;
|
||||||
my $res = $json->decode($res_raw)->[0];
|
my $res = $json->decode($res_raw)->[0];
|
||||||
|
|
||||||
# If failed, print to STDERR
|
# If failed, print to STDERR
|
||||||
unless ($res->{success}) {
|
unless ($res->{success}) {
|
||||||
print STDERR "Error ($res->{error}) in command 'sway"
|
print STDERR "Error ($res->{error}) in command 'swaymsg"
|
||||||
. "output $_ disable'\n";
|
. " -s $swaysock output $_ disable'\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -316,7 +319,8 @@ foreach my $out (keys %$on) {
|
||||||
push @active, $on->{$out}->{output};
|
push @active, $on->{$out}->{output};
|
||||||
unless ($waybar_only) {
|
unless ($waybar_only) {
|
||||||
# Build command, starting by enabling and powering on
|
# Build command, starting by enabling and powering on
|
||||||
my $cmd = "sway output $on->{$out}->{output} enable dpms on";
|
my $cmd = "swaymsg -s $swaysock output $on->{$out}->{output}" .
|
||||||
|
" enable dpms on";
|
||||||
|
|
||||||
# If additional options are provided, add them to command
|
# If additional options are provided, add them to command
|
||||||
if (defined $on->{$out}->{rotate}) {
|
if (defined $on->{$out}->{rotate}) {
|
||||||
|
@ -328,7 +332,8 @@ foreach my $out (keys %$on) {
|
||||||
if (defined $on->{$out}->{width} &&
|
if (defined $on->{$out}->{width} &&
|
||||||
defined $on->{$out}->{height} )
|
defined $on->{$out}->{height} )
|
||||||
{
|
{
|
||||||
$cmd .= " mode $on->{$out}->{width}x$on->{$out}->{height}";
|
$cmd .= " mode $on->{$out}->{width}x" .
|
||||||
|
"$on->{$out}->{height}";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sway returns status as JSON
|
# Sway returns status as JSON
|
||||||
|
@ -337,7 +342,8 @@ foreach my $out (keys %$on) {
|
||||||
|
|
||||||
# If failed, print to STDERR
|
# If failed, print to STDERR
|
||||||
unless ($res->{success}) {
|
unless ($res->{success}) {
|
||||||
print STDERR "Error ($res->{error}) in command '$cmd'\n";
|
print STDERR "Error ($res->{error}) in command " .
|
||||||
|
"'$cmd'\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +377,6 @@ open($fh, '>', $active_outputs);
|
||||||
print $fh join(' ', @active);
|
print $fh join(' ', @active);
|
||||||
close($fh);
|
close($fh);
|
||||||
|
|
||||||
|
|
||||||
# Restore array formatting
|
# Restore array formatting
|
||||||
$waybar = '[' . $waybar . ']';
|
$waybar = '[' . $waybar . ']';
|
||||||
|
|
||||||
|
@ -385,5 +390,5 @@ unless ($pid) {
|
||||||
open ($fh, '>', $waybar_config);
|
open ($fh, '>', $waybar_config);
|
||||||
print $fh $waybar;
|
print $fh $waybar;
|
||||||
close $fh;
|
close $fh;
|
||||||
`nohup waybar --config=$waybar_config >> waybar.log`;
|
`WAYLAND_DISPLAY=wayland-1 nohup waybar --config=$waybar_config >> waybar.log`;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue