Browse Source

adjust copy.sh to use localectl first then setxkbmap next if localectl not available

Introduce wallpaper rofi menu
pull/116/head
JaKooLit 2 years ago
parent
commit
978cb01c77
  1. 17
      config/rofi/config-wallpaper.rasi
  2. 17
      config/rofi/resolution/1080p/config-wallpaper.rasi
  3. 19
      config/rofi/resolution/1440p/config-wallpaper.rasi
  4. 34
      copy.sh

17
config/rofi/config-wallpaper.rasi

@ -3,7 +3,7 @@
/* ---- Configuration ---- */
configuration {
modi: "drun,run";
modi: "drun,run,filebrowser";
font: "Fira Code SemiBold 12";
show-icons: true;
display-drun: "";
@ -40,7 +40,8 @@ window {
enabled: true;
border-radius: 12px;
border-radius: 12px;
background-color: @background-color;
background-color: transparent;
background-image: url("~/.config/rofi/.current_wallpaper", height);
}
/* ---- Mainbox ---- */
@ -48,10 +49,9 @@ mainbox {
enabled: true;
orientation: horizontal;
padding: 8px;
/*background-image: url("~/.config/rofi/.current_wallpaper", width);*/
children: [ "imagebox"];
border-radius: 12px;
background-color: @active-background;
background-color: transparent;
}
/* ---- Imagebox ---- */
@ -131,6 +131,7 @@ element {
padding: 5px;
margin: 2px;
cursor: pointer;
orientation: vertical;
background-color: transparent;
border-radius: 10px;
border: 0px;
@ -184,16 +185,18 @@ element alternate.active {
element-icon {
background-color: transparent;
text-color: inherit;
size: 150px;
size: 130px;
cursor: inherit;
horizontal-align: 0.5;
}
element-text {
font: "Fira Code SemiBold 8";
background-color: transparent;
text-color: transparent;
text-color: inherit;
cursor: inherit;
vertical-align: 0.5;
horizontal-align: 0.5;
}
/*****----- Message -----*****/

17
config/rofi/resolution/1080p/config-wallpaper.rasi

@ -3,7 +3,7 @@
/* ---- Configuration ---- */
configuration {
modi: "drun,run";
modi: "drun,run,filebrowser";
font: "Fira Code SemiBold 12";
show-icons: true;
display-drun: "";
@ -40,7 +40,8 @@ window {
enabled: true;
border-radius: 12px;
border-radius: 12px;
background-color: @background-color;
background-color: transparent;
background-image: url("~/.config/rofi/.current_wallpaper", height);
}
/* ---- Mainbox ---- */
@ -48,10 +49,9 @@ mainbox {
enabled: true;
orientation: horizontal;
padding: 8px;
/*background-image: url("~/.config/rofi/.current_wallpaper", width);*/
children: [ "imagebox"];
border-radius: 12px;
background-color: @active-background;
background-color: transparent;
}
/* ---- Imagebox ---- */
@ -131,6 +131,7 @@ element {
padding: 5px;
margin: 2px;
cursor: pointer;
orientation: vertical;
background-color: transparent;
border-radius: 10px;
border: 0px;
@ -184,16 +185,18 @@ element alternate.active {
element-icon {
background-color: transparent;
text-color: inherit;
size: 150px;
size: 130px;
cursor: inherit;
horizontal-align: 0.5;
}
element-text {
font: "Fira Code SemiBold 8";
background-color: transparent;
text-color: transparent;
text-color: inherit;
cursor: inherit;
vertical-align: 0.5;
horizontal-align: 0.5;
}
/*****----- Message -----*****/

19
config/rofi/resolution/1440p/config-wallpaper.rasi

@ -3,7 +3,7 @@
/* ---- Configuration ---- */
configuration {
modi: "drun,run";
modi: "drun,run,filebrowser";
font: "Fira Code SemiBold 14";
show-icons: true;
display-drun: "";
@ -40,7 +40,8 @@ window {
enabled: true;
border-radius: 12px;
border-radius: 12px;
background-color: @background-color;
background-color: transparent;
background-image: url("~/.config/rofi/.current_wallpaper", height);
}
/* ---- Mainbox ---- */
@ -48,10 +49,9 @@ mainbox {
enabled: true;
orientation: horizontal;
padding: 8px;
/*background-image: url("~/.config/rofi/.current_wallpaper", width);*/
children: [ "imagebox"];
border-radius: 12px;
background-color: @active-background;
background-color: transparent;
}
/* ---- Imagebox ---- */
@ -112,7 +112,7 @@ entry {
listview {
enabled: true;
columns: 4;
lines: 5;
lines: 4;
spacing: 4px;
dynamic: true;
cycle: true;
@ -131,6 +131,7 @@ element {
padding: 5px;
margin: 2px;
cursor: pointer;
orientation: vertical;
background-color: transparent;
border-radius: 10px;
border: 0px;
@ -184,16 +185,18 @@ element alternate.active {
element-icon {
background-color: transparent;
text-color: inherit;
size: 150px;
size: 130px;
cursor: inherit;
horizontal-align: 0.5;
}
element-text {
font: "Fira Code SemiBold 10";
background-color: transparent;
text-color: transparent;
text-color: inherit;
cursor: inherit;
vertical-align: 0.5;
horizontal-align: 0.5;
}
/*****----- Message -----*****/

34
copy.sh

@ -50,25 +50,17 @@ if hostnamectl | grep -q 'Chassis: vm'; then
sed -i '/monitor = Virtual-1, 1920x1080@60,auto,1/s/^#//' config/hypr/UserConfigs/Monitors.conf
fi
# Preparing hyprland.conf to check for current keyboard layout
# Function to detect keyboard layout in an X server environment
detect_x_layout() {
if command -v setxkbmap >/dev/null 2>&1; then
layout=$(setxkbmap -query | grep layout | awk '{print $2}')
# Function to detect keyboard layout using localectl or setxkbmap
detect_layout() {
if command -v localectl >/dev/null 2>&1; then
layout=$(localectl status --no-pager | awk '/X11 Layout/ {print $3}')
if [ -n "$layout" ]; then
echo "$layout"
else
echo "unknown"
fi
else
echo "unknown"
fi
}
# Function to detect keyboard layout in a tty environment
detect_tty_layout() {
if command -v localectl >/dev/null 2>&1; then
layout=$(localectl status --no-pager | awk '/X11 Layout/ {print $3}')
elif command -v setxkbmap >/dev/null 2>&1; then
layout=$(setxkbmap -query | grep layout | awk '{print $2}')
if [ -n "$layout" ]; then
echo "$layout"
else
@ -79,22 +71,14 @@ detect_tty_layout() {
fi
}
# Detect the current keyboard layout based on the environment
if [ -n "$DISPLAY" ]; then
# System is in an X server environment
layout=$(detect_x_layout)
else
# System is in a tty environment
layout=$(detect_tty_layout)
fi
echo "Keyboard layout: $layout"
# Detect the current keyboard layout
layout=$(detect_layout)
printf "${NOTE} Detecting keyboard layout to prepare necessary changes in hyprland.conf before copying\n\n"
# Prompt the user to confirm whether the detected layout is correct
while true; do
read -p "$ORANGE Detected keyboard layout or keymap: $layout. Is this correct? [y/n] " confirm
read -p "$ORANGE Detected current keyboard layout is: $layout. Is this correct? [y/n] " confirm
case $confirm in
[yY])

Loading…
Cancel
Save