Skip to content

Instantly share code, notes, and snippets.

@tillbaks
Created August 22, 2024 07:37
Show Gist options
  • Save tillbaks/72604baa9fca0016991075768017697d to your computer and use it in GitHub Desktop.
Save tillbaks/72604baa9fca0016991075768017697d to your computer and use it in GitHub Desktop.
linux-tiling-htpc
configuration {
font: "VictorMono Bold 14";
show-icons: true;
modi: "drun";
timeout {
delay: 30;
action: "kb-cancel";
}
drun {
display-name: "";
}
}
@theme "/usr/share/rofi/themes/purple.rasi"
//@theme "/usr/share/rofi/themes/gruvbox-dark-hard.rasi"
window {
padding: 50px;
fullscreen: false;
border: 0;
}
prompt {
enabled: false;
}
inputbar {
enabled: false;
}
listview {
columns: 6;
lines: 3;
spacing: 0;
margin: 0;
padding: 0;
cycle: true;
dynamic: true;
layout: vertical;
border: 0;
scrollbar: false;
}
element {
margin: 0;
padding: 2%;
spacing: 0;
border: 0;
orientation: vertical;
}
element-text {
horizontal-align: 0.5;
margin: 15px 0 0 0;
background-color: none;
}
element-icon {
size: 100;
margin: 0;
padding: 0;
border: 0;
horizontal-align: 0.5;
vertical-align: 0.5;
spacing: 0;
}
configuration {
font: "VictorMono Bold 20";
show-icons: true;
me-select-entry: "";
me-accept-entry: [ MousePrimary ];
combi {
display-name: "search";
}
timeout {
delay: 30;
action: "kb-cancel";
}
drun {
display-name: "";
}
dmenu {
display-name: "";
}
window {
display-name: "";
}
}
@theme "/usr/share/rofi/themes/purple.rasi"
//@theme "/usr/share/rofi/themes/gruvbox-dark-hard.rasi"
mainbox {
padding: 20px;
}
prompt {
str: "search";
}
listview {
padding: 20px 0 0 0;
lines: 8;
columns: 1;
}
element {
padding: 10px;
}
element-text {
background-color: none;
}
element-icon {
size: 35;
margin: 0 10px 0 0;
}
#
# Please note not all available settings / options are set here.
# For a full list, see the wiki
#
# See https://wiki.hyprland.org/Configuring/Monitors/
monitor=,preferred,auto,2
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
# Execute your favorite apps at launch
# exec-once = waybar & hyprpaper & firefox
# Source a file (multi-file configs)
# source = ~/.config/hypr/myColors.conf
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input {
kb_layout = us
kb_variant =
kb_model =
kb_options =
kb_rules =
follow_mouse = no
accel_profile = adaptive
touchpad {
natural_scroll = no
}
sensitivity = 0.15 # -1.0 - 1.0, 0 means no modification.
}
general {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
allow_tearing = true
gaps_in = 5
gaps_out = 10
border_size = 2
col.active_border = rgba(33ccff77) rgba(00ff9977) 45deg
col.inactive_border = rgba(59595900)
layout = dwindle
resize_on_border = true
extend_border_grab_area = 5
}
cursor {
no_warps = true
inactive_timeout = 3
}
env = WLR_DRM_NO_ATOMIC,1
# VRR apps
windowrulev2 = immediate, class:^(steam_app_2708610)$
misc {
disable_hyprland_logo = true
disable_splash_rendering = true
vrr = 2
}
decoration {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
rounding = 7
# blur = yes
# blur_size = 3
# blur_passes = 1
# blur_new_optimizations = on
drop_shadow = no
shadow_range = 4
shadow_render_power = 3
col.shadow = rgba(1a1a1aee)
}
animations {
enabled = yes
# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
bezier = myBezier, 0.05, 0.9, 0.1, 1.05
animation = windows, 1, 2, myBezier
animation = windowsOut, 1, 2, default, popin 80%
animation = border, 1, 4, default
animation = borderangle, 1, 3, default
animation = fade, 1, 2, default
animation = workspaces, 1, 1, default
}
dwindle {
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = yes # you probably want this
no_gaps_when_only = true
}
master {
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
new_status = master
no_gaps_when_only = true
}
gestures {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
workspace_swipe = off
}
# Example windowrule v1
# windowrule = float, ^(kitty)$
# Example windowrule v2
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
windowrule = float, file_progress
windowrule = float, confirm
windowrule = float, dialog
windowrule = float, download
windowrule = float, notification
windowrule = float, error
windowrule = float, splash
windowrule = float, confirmreset
windowrule = float, title:Open File
windowrule = float, title:branchdialog
windowrule = float, Lxappearance
windowrule = float, Rofi
windowrule = animation none,Rofi
windowrule = float, viewnior
windowrule = float, Viewnior
windowrule = float, feh
windowrule = float, pavucontrol-qt
windowrule = float, pavucontrol
windowrule = float, file-roller
windowrule = fullscreen, wlogout
windowrule = float, title:wlogout
windowrule = fullscreen, title:wlogout
windowrule = idleinhibit focus, mpv
windowrule = idleinhibit fullscreen, firefox
windowrule = float, title:^(Media viewer)$
windowrule = float, title:^(Volume Control)$
windowrule = float, title:^(Picture-in-Picture)$
windowrule = size 800 600, title:^(Volume Control)$
windowrule = move 75 44%, title:^(Volume Control)$
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
$mainMod = SUPER
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind = $mainMod, RETURN, exec, alacritty
#bind = $mainMod, Q, killactive,
bind = $mainMod SHIFT, Q, exit,
bind = $mainMod, SPACE, togglefloating,
bind = $mainMod, F, fullscreen,
bind = $mainMod, R, exec, wofi --show drun
bind = $mainMod, P, pseudo, # dwindle
bind = $mainMod, J, togglesplit, # dwindle
# Move focus with mainMod + arrow keys
bind = $mainMod, left, movefocus, l
bind = $mainMod, right, movefocus, r
bind = $mainMod, up, movefocus, u
bind = $mainMod, down, movefocus, d
# Switch workspaces with mainMod + [0-9]
bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2
bind = $mainMod, 3, workspace, 3
bind = $mainMod, 4, workspace, 4
bind = $mainMod, 5, workspace, 5
bind = $mainMod, 6, workspace, 6
bind = $mainMod, 7, workspace, 7
bind = $mainMod, 8, workspace, 8
bind = $mainMod, 9, workspace, 9
bind = $mainMod, 0, workspace, 10
# Move active window to a workspace with mainMod + SHIFT + [0-9]
bind = $mainMod SHIFT, 1, movetoworkspace, 1
bind = $mainMod SHIFT, 2, movetoworkspace, 2
bind = $mainMod SHIFT, 3, movetoworkspace, 3
bind = $mainMod SHIFT, 4, movetoworkspace, 4
bind = $mainMod SHIFT, 5, movetoworkspace, 5
bind = $mainMod SHIFT, 6, movetoworkspace, 6
bind = $mainMod SHIFT, 7, movetoworkspace, 7
bind = $mainMod SHIFT, 8, movetoworkspace, 8
bind = $mainMod SHIFT, 9, movetoworkspace, 9
bind = $mainMod SHIFT, 0, movetoworkspace, 10
# Scroll through existing workspaces with mainMod + scroll
bind = $mainMod, mouse_down, workspace, e+1
bind = $mainMod, mouse_up, workspace, e-1
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow
# RF Remote binds
bind = $mainMod, TAB, exec, ~/keymap.sh guide
bind = $mainMod, G, exec, ~/keymap.sh guide
bind = $mainMod, D, exec, ~/keymap.sh menu
bind = ALT, F4, killactive
bind = ,XF86AudioPlay, exec, playerctl play-pause
bind = ,XF86AudioRewind, exec, playerctl position 10- || ~/keymap.sh left
bind = ,XF86AudioForward, exec, playerctl position 30+ || ~/keymap.sh right
#bind = ,UP, exec, ~/keymap.sh up
#bind = ,DOWN, exec, ~/keymap.sh down
# bindr = ,Menu, exec, ~/keymap.sh guide
bindle = ,XF86AudioRaiseVolume, exec, ~/keymap.sh volume-up
bindle = ,XF86AudioLowerVolume, exec, ~/keymap.sh volume-down
bindlr = ,XF86Sleep, exec, ~/keymap.sh tv-power
bind = ALT, UP, fullscreen
bind = $mainMod, E, exec, ~/scripts/start_app.sh files
bind = CTRL_ALT, DELETE, exec, alacritty -e btop
bind = , XF86HomePage, exec, ~/scripts/start_app.sh firefox
# will reset the submap, meaning end the current one and return to the global one
submap=reset
# Assign apps
windowrule = workspace name:firefox,^(firefox)$
windowrule = workspace name:chrome,^(chromium)$
windowrule = workspace name:media,^(com.github.iwalton3.jellyfin-media-player)$
windowrule = workspace name:media,^(Kodi)$
windowrule = workspace name:games,^(steamwebhelper)$
windowrule = workspace name:games,^(lutris)$
windowrule = workspace name:games,^(org.libretro.RetroArch)$
windowrule = workspace name:files,^(thunar)$
windowrule = workspace name:files,^(transmission-remote-gtk)$
# Exec
exec-once = ~/scripts/autostart.sh
[
{
"name": "Firefox",
"command": "/home/johannes/scripts/start_app.sh firefox",
"icon": "firefox"
},
{
"name": "Chrome",
"command": "/home/johannes/scripts/start_app.sh chromium",
"icon": "chrome"
},
{
"name": "Filmer och Serier",
"description": "Jellyfin",
"command": "/home/johannes/scripts/start_app.sh media",
"icon": "jellyfin"
},
{
"name": "Steam",
"command": "/home/johannes/scripts/start_app.sh steam",
"icon": "steam"
},
{
"name": "Lutris",
"command": "/home/johannes/scripts/start_app.sh lutris",
"icon": "com.github.tkashkin.gamehub"
},
{
"name": "RetroArch",
"command": "/home/johannes/scripts/start_app.sh retroarch",
"icon": "retroarch"
},
{
"name": "Filer",
"command": "/home/johannes/scripts/start_app.sh files",
"icon": "dde-file-manager"
},
{
"name": "Nerladdningar",
"command": "/home/johannes/scripts/start_app.sh downloads",
"icon": "deepin-download"
},
{
"name": "Alla program..",
"command": "killall rofi && /home/johannes/keymap.sh apps",
"icon": "applications-utilities"
}
]
[
{
"name": "4K@120Hz",
"command": "hyprctl keyword monitor HDMI-A-1, 3840x2160@120Hz, 0x0, 2",
"icon": "user-desktop"
},
{
"name": "4K@60Hz (Default)",
"command": "hyprctl keyword monitor HDMI-A-1, 3840x2160@60Hz, 0x0, 2",
"icon": "user-desktop"
},
{
"name": "4K@50Hz",
"command": "hyprctl keyword monitor HDMI-A-1, 3840x2160@50Hz, 0x0, 2",
"icon": "user-desktop"
},
{
"name": "4K@30Hz",
"command": "hyprctl keyword monitor HDMI-A-1, 3840x2160@30Hz, 0x0, 2",
"icon": "user-desktop"
},
{
"name": "4K@25Hz",
"command": "hyprctl keyword monitor HDMI-A-1, 3840x2160@25Hz, 0x0, 2",
"icon": "user-desktop"
},
{
"name": "4K@24Hz",
"command": "hyprctl keyword monitor HDMI-A-1, 3840x2160@24Hz, 0x0, 2",
"icon": "user-desktop"
}
]
[
{
"name": "Fullscreen",
"command": "hyprctl dispatch fullscreen",
"icon": "view-fullscreen"
},
{
"name": "Pause/Play",
"command": "playerctl play-pause",
"icon": "media-playback-pause"
},
{
"name": "Vardagsrum Belysning",
"command": "~/scripts/call_hass.sh script/toggle_livingroom_lights",
"icon": "com.github.panosx2.brightness"
},
{
"name": "TV: Refresh Rate",
"command": "killall rofi; rofi -modi custom:'~/scripts/rofi-json.sh ~/scripts/menu_display.json' -show custom -kb-cancel 'Super_L,Escape,BackSpace,Menu,XF86HomePage,MouseSecondary' -kb-remove-char-back ''",
"icon": "user-desktop"
},
{
"name": "Audio Settings",
"command": "pavucontrol",
"icon": "audio-speakers"
},
{
"name": "Audio Effects",
"command": "easyeffects",
"icon": "audio-speakers"
},
{
"name": "Reboot",
"command": "systemctl reboot",
"icon": "system-reboot"
},
{
"name": "Sleep",
"command": "systemctl suspend",
"icon": "system-suspend"
},
{
"name": "Exit App",
"command": "swaymsg kill",
"icon": "application-exit"
}
]
#!/bin/bash
user_file="$(eval echo ${1})"
if [[ "$user_file" = /* ]]; then
config_file="$user_file"
else
cwd=$(dirname $0)
config_file="${cwd}/${user_file}"
fi
json=$(cat ${config_file})
if [ $# -eq 1 ]; then
echo $json | jq -cr '.[] | "\(.name)|\(.command)|\(.icon)"' |
while IFS="|" read -r name command icon; do
if [[ $name == "null" ]]; then
continue
fi
if [[ $icon == "null" ]]; then
icon="system-run"
fi
echo -en "${name}\0icon\x1f${icon}\n"
done
exit 1
fi
if [ $# -eq 2 ]; then
selected=$2
task=$(echo $json | jq ".[] | select(.name == \"$selected\")")
if [[ $task == "" ]]; then
exit 1
fi
command=$(echo $task | jq -j ".command")
if [[ $command == "null" ]]; then
command=$(echo $task | jq -j ".name")
fi
bash -c "$command" >/dev/null
exit
fi
#!/bin/bash
# make sure rofi is not visible or it will interfere with desktop switching
killall rofi
[[ -z $(pgrep -x sway) ]] && wm="hypr" || wm="sway"
echo $wm
app=$1
export DISPLAY=:0
case "$wm $app" in
"hypr firefox")
result=$(hyprctl -j clients | jq -r '.[] | select(.class == "firefox") | .address' | head -1)
if [ -z $result ]; then
firefox &
else
hyprctl dispatch focuswindow address:$result
fi
;;
"hypr chromium")
result=$(hyprctl -j clients | jq -r '.[] | select(.class == "chromium") | .address' | head -1)
if [ -z $result ]; then
chromium --enable-features=UseOzonePlatform --ozone-platform=wayland &
else
hyprctl dispatch focuswindow address:$result
fi
;;
"hypr media")
result=$(hyprctl -j clients | jq -r '.[] | select(.class == "org.jellyfin.jellyfinmediaplayer") | .address' | head -1)
if [ -z $result ]; then
jellyfinmediaplayer &
else
hyprctl dispatch focuswindow address:$result
fi
;;
"hypr steam")
result=$(hyprctl -j clients | jq -r '.[] | select(.class == "steamwebhelper") | .address' | head -1)
if [ -z $result ]; then
env --unset SDL_VIDEODRIVER steam &
# steam &
else
hyprctl dispatch focuswindow address:$result
fi
;;
"hypr lutris")
result=$(hyprctl -j clients | jq -r '.[] | select(.class == "lutris") | .address' | head -1)
if [ -z $result ]; then
lutris &
else
hyprctl dispatch focuswindow address:$result
fi
;;
"hypr retroarch")
result=$(hyprctl -j clients | jq -r '.[] | select(.class == "org.libretro.RetroArch") | .address' | head -1)
if [ -z $result ]; then
retroarch &
else
hyprctl dispatch focuswindow address:$result
fi
;;
"hypr files")
result=$(hyprctl -j clients | jq -r '.[] | select(.class == "thunar") | .address' | head -1)
if [ -z $result ]; then
thunar &
else
hyprctl dispatch focuswindow address:$result
fi
;;
"hypr downloads")
result=$(hyprctl -j clients | jq -r '.[] | select(.class == "transmission-remote-gtk") | .address' | head -1)
if [ -z $result ]; then
transmission-remote-gtk &
else
hyprctl dispatch focuswindow address:$result
fi
;;
"sway firefox")
swaymsg '[app_id="firefox"]' focus
if [ "$?" -ne "0" ]; then
firefox &
fi | head -1
;;
"sway chrome")
swaymsg '[app_id="google-chrome"]' focus
if [ "$?" -ne "0" ]; then
google-chrome-stable --enable-features=UseOzonePlatform --ozone-platform=wayland &
fi
;;
"sway media")
swaymsg '[app_id="org.jellyfin.jellyfinmediaplayer"]' focus
if [ "$?" -ne "0" ]; then
jellyfinmediaplayer &
fi
;;
"sway steam")
swaymsg '[class="steam"]' focus
if [ "$?" -ne "0" ]; then
SDL_VIDEODRIVER=x11 steam &
fi
;;
"sway lutris")
swaymsg '[app_id="lutris"]' focus
if [ "$?" -ne "0" ]; then
lutris &
fi
;;
"sway retroarch")
swaymsg '[app_id="org.libretro.RetroArch"]' focus
if [ "$?" -ne "0" ]; then
retroarch &
fi
;;
"sway files")
swaymsg '[app_id="thunar"]' focus
if [ "$?" -ne "0" ]; then
thunar &
fi
;;
"sway downloads")
swaymsg '[app_id="transmission-remote-gtk"]' focus
if [ "$?" -ne "0" ]; then
transmission-remote-gtk &
fi
;;
*)
#i3-nagbar -m "action=$action not found."
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment