Improves power menu
Power menu will now add a suspend option for non-phones. Also, it correctly calls i3lock if not on my phone
This commit is contained in:
parent
1ab519531c
commit
f9301f1959
3 changed files with 121 additions and 8 deletions
|
@ -1,6 +1,19 @@
|
|||
#!/usr/bin/sh
|
||||
|
||||
isPhone(){
|
||||
case "$(hostname)" in
|
||||
*-phone) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
if type -p rofi 2> /dev/null; then
|
||||
alias selectcommand="rofi -dmenu -i -theme themes/power.rasi -me-select-entry '' -me-accept-entry MousePrimary"
|
||||
if isPhone; then
|
||||
theme="themes/power-phone.rasi"
|
||||
else
|
||||
theme="themes/power.rasi"
|
||||
fi
|
||||
alias selectcommand="rofi -dmenu -i -theme $theme -me-select-entry '' -me-accept-entry MousePrimary"
|
||||
shutdown=""
|
||||
reboot=""
|
||||
lock=""
|
||||
|
@ -15,24 +28,33 @@ else
|
|||
logout="Logout"
|
||||
fi
|
||||
|
||||
hostname="$(hostname)"
|
||||
|
||||
selection=$( \
|
||||
echo -e "$shutdown\n$reboot\n$lock\n$logout\n$suspend" | selectcommand
|
||||
);
|
||||
echo $selection;
|
||||
if isPhone; then
|
||||
selection="$(echo -e "$shutdown\n$reboot\n$lock\n$logout" | selectcommand)"
|
||||
else
|
||||
notify-send "Not phone"
|
||||
selection="$(echo -e "$shutdown\n$reboot\n$lock\n$logout\n$suspend" | selectcommand)"
|
||||
fi
|
||||
|
||||
sleep .2
|
||||
|
||||
case $selection in
|
||||
$lock)
|
||||
#i3exit lock
|
||||
if isPhone; then
|
||||
screenlock --suspend
|
||||
else
|
||||
i3exit lock
|
||||
fi
|
||||
;;
|
||||
$logout)
|
||||
pkill dwm
|
||||
;;
|
||||
$suspend)
|
||||
systemctl suspend
|
||||
#i3exit lock
|
||||
if !isPhone; then
|
||||
i3exit lock
|
||||
fi
|
||||
;;
|
||||
$reboot)
|
||||
systemctl reboot
|
||||
|
|
91
rofi/.config/rofi/themes/power-phone.rasi
Normal file
91
rofi/.config/rofi/themes/power-phone.rasi
Normal file
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
*
|
||||
* Author : Aditya Shakya
|
||||
* Mail : adi1090x@gmail.com
|
||||
* Github : @adi1090x
|
||||
* Twitter : @adi1090x
|
||||
*
|
||||
*/
|
||||
|
||||
configuration {
|
||||
disable-history: false;
|
||||
fullscreen: false;
|
||||
hide-scrollbar: true;
|
||||
sidebar-mode: false;
|
||||
}
|
||||
|
||||
@import "gruvbox-dark.rasi"
|
||||
|
||||
* {
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
}
|
||||
|
||||
window {
|
||||
transparency: "real";
|
||||
border-radius: 12px;
|
||||
width: 100px;
|
||||
location: east;
|
||||
x-offset: -15px;
|
||||
y-offset: -200px;
|
||||
}
|
||||
|
||||
listview {
|
||||
lines: 4;
|
||||
margin: 8px;
|
||||
spacing: 8px;
|
||||
cycle: true;
|
||||
dynamic: true;
|
||||
layout: vertical;
|
||||
}
|
||||
|
||||
mainbox {
|
||||
background-color: @background;
|
||||
children: [ listview ];
|
||||
}
|
||||
|
||||
element {
|
||||
background-color: @background-light;
|
||||
text-color: @foreground;
|
||||
orientation: vertical;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
element-text {
|
||||
font: "iosevka 45";
|
||||
expand: true;
|
||||
horizontal-align: 0.5;
|
||||
vertical-align: 0;
|
||||
margin: 0px 10px 63px 10px;
|
||||
}
|
||||
|
||||
element normal.urgent,
|
||||
element alternate.urgent {
|
||||
background-color: @urgent;
|
||||
text-color: @foreground;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
element normal.active,
|
||||
element alternate.active {
|
||||
background-color: @background-alt;
|
||||
text-color: @foreground;
|
||||
}
|
||||
|
||||
element selected {
|
||||
background-color: @accent;
|
||||
text-color: @background;
|
||||
border: 0px;
|
||||
border-radius: 10px;
|
||||
border-color: @border;
|
||||
}
|
||||
|
||||
element selected.urgent {
|
||||
background-color: @urgent;
|
||||
text-color: @foreground;
|
||||
}
|
||||
|
||||
element selected.active {
|
||||
background-color: @background-alt;
|
||||
color: @foreground;
|
||||
}
|
|
@ -31,7 +31,7 @@ window {
|
|||
}
|
||||
|
||||
listview {
|
||||
lines: 4;
|
||||
lines: 5;
|
||||
margin: 8px;
|
||||
spacing: 8px;
|
||||
cycle: true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue