mirror of
https://github.com/rbreaves/kinto.git
synced 2025-08-05 18:38:26 +02:00
- Updated setup.py with DE hotkey defaults
This commit is contained in:
42
setup.py
42
setup.py
@@ -78,11 +78,49 @@ if len(check_xdotool) == 0:
|
|||||||
if runpkg != 0:
|
if runpkg != 0:
|
||||||
requirements(pkgm)
|
requirements(pkgm)
|
||||||
|
|
||||||
|
distro = cmdline("awk -F= '$1==\"NAME\" { print $2 ;}' /etc/os-release").lower()
|
||||||
|
distroVersion = cmdline("awk -F= '$1==\"VERSION_ID\" { print $2 ;}' /etc/os-release").lower()
|
||||||
|
dename = cmdline("./system-config/dename.sh")
|
||||||
|
|
||||||
|
print("Detected\nOS: " + distro + " " + distroVersion + "\nDE: " + dename + "\n")
|
||||||
|
addhotkeys = yn_choice("Do you want to apply system level shortcuts?\nThis will add standardized shortcuts for Kinto to fully operate.\n")
|
||||||
|
if(addhotkeys):
|
||||||
|
if distro == "ubuntu" and dename == "gnome":
|
||||||
|
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left \"['<Primary><Alt>Left','<Super>Left']\"")
|
||||||
|
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right \"['<Primary><Alt>Right','<Super>Right']\"")
|
||||||
|
elif distro == "pop!_os" and dename == "gnome":
|
||||||
|
cmdline("gsettings set org.gnome.desktop.wm.keybindings close \"['<Alt>F4','<Super>w']\"")
|
||||||
|
cmdline("gsettings set org.gnome.desktop.wm.keybindings toggle-maximized \"['<Alt>F10','<Primary><Super>Up']\"")
|
||||||
|
elif distro == "elementaryos" and dename == "gnome":
|
||||||
|
cmdline("gsettings set org.gnome.desktop.wm.keybindings show-desktop \"['<Super>d','<Super>Down']\"")
|
||||||
|
cmdline("gsettings set org.gnome.desktop.wm.keybindings toggle-maximized \"['<Alt>F10','<Super>Up']\"")
|
||||||
|
cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Control><Shift>Space','<Super>Space']\"")
|
||||||
|
elif distro == "galliumos" and dename == "xfce":
|
||||||
|
cmdline("xfconf-query --channel xfce4-keyboard-shortcuts --property \"/xfwm4/custom/<Super>d\" --create --type string --set \"show_desktop_key\"")
|
||||||
|
cmdline("xfconf-query --channel xfce4-keyboard-shortcuts --property \"/xfwm4/custom/<Alt><Shift>Tab\" --set \"cycle_reverse_windows_key\"")
|
||||||
|
cmdline("xfconf-query --channel xfce4-keyboard-shortcuts --property \"/xfwm4/custom/<Alt>Tab\" --set \"cycle_windows_key\"")
|
||||||
|
cmdline("xfconf-query --channel xfce4-keyboard-shortcuts --property \"/xfwm4/custom/<Alt><Shift>Tab\" --set \"cycle_windows_key\"")
|
||||||
|
cmdline("xfconf-query --channel xfce4-keyboard-shortcuts --property \"/xfwm4/custom/<Alt>Tab\" --set \"cycle_reverse_windows_key\"")
|
||||||
|
cmdline("xfconf-query --channel xfce4-keyboard-shortcuts --property \"/xfwm4/custom/<Super>h\" --create --type string --set \"hide_window_key\"")
|
||||||
|
cmdline("xfconf-query --channel xfce4-keyboard-shortcuts --property \"/commands/custom/<Primary><Shift>space\" --create --type string --set \"xfce4-popup-whiskermenu\"")
|
||||||
|
cmdline("xfconf-query --channel xfce4-keyboard-shortcuts --property \"/xfwm4/custom/<Super>Left\" --create --type string --set \"move_window_prev_workspace_key\"")
|
||||||
|
cmdline("xfconf-query --channel xfce4-keyboard-shortcuts --property \"/xfwm4/custom/<Super>Right\" --create --type string --set \"move_window_next_workspace_key\"")
|
||||||
|
elif distro == "fedora" and dename == "gnome":
|
||||||
|
cmdline("gsettings set org.gnome.desktop.wm.keybindings show-desktop \"['<Super>d']\"")
|
||||||
|
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left \"['<Primary><Alt>Left','<Super>Left']\"")
|
||||||
|
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right \"['<Primary><Alt>Right','<Super>Right']\"")
|
||||||
|
elif distro == "manjaro linux" and dename == "kde":
|
||||||
|
cmdline("kwriteconfig5 --file \"$HOME/.config/kglobalshortcutsrc\" --group \"kwin\" --key \"Maximize Window\" \"Alt+F10,Meta+PgUp,Maximize Window\"")
|
||||||
|
cmdline("kwriteconfig5 --file \"$HOME/.config/kglobalshortcutsrc\" --group \"kwin\" --key \"Minimize Window\" \"Meta+h,Meta+PgDown,Minimize Window\"")
|
||||||
|
cmdline("kwriteconfig5 --file \"$HOME/.config/kglobalshortcutsrc\" --group \"kwin\" --key \"Switch to Next Desktop\" \"Meta+Right,Meta+Right,Switch to Next Desktop\"")
|
||||||
|
cmdline("kwriteconfig5 --file \"$HOME/.config/kglobalshortcutsrc\" --group \"kwin\" --key \"Switch to Previous Desktop\" \"Meta+Left,Meta+Left,Switch to Previous Desktop\"")
|
||||||
|
cmdline("kquitapp5 kglobalaccel && sleep 2s && kglobalaccel5 &")
|
||||||
|
else:
|
||||||
|
print("A supported OS and DE was not found, you may not have full system level shortcuts installed.")
|
||||||
|
|
||||||
if os.path.exists(homedir + '/.config/ibus/bus') and cmdline("ls ~/.config/ibus/bus -1rt") == "":
|
if os.path.exists(homedir + '/.config/ibus/bus') and cmdline("ls ~/.config/ibus/bus -1rt") == "":
|
||||||
install_ibus()
|
install_ibus()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
f = open("defaults.json")
|
f = open("defaults.json")
|
||||||
except IOError:
|
except IOError:
|
||||||
|
151
system-config/dename.sh
Executable file
151
system-config/dename.sh
Executable file
@@ -0,0 +1,151 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function detect_gnome()
|
||||||
|
{
|
||||||
|
ps -e | grep -E '^.* gnome-session' > /dev/null
|
||||||
|
if [ $? -ne 0 ];
|
||||||
|
then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
VERSION=`gnome-session --version | awk '{print $2}'`
|
||||||
|
DESKTOP="gnome"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function detect_kde()
|
||||||
|
{
|
||||||
|
ps -e | grep -E '^.* kded4$' > /dev/null
|
||||||
|
if [ $? -ne 0 ];
|
||||||
|
then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
VERSION=`kded4 --version | grep -m 1 'KDE' | awk -F ':' '{print $2}' | awk '{print $1}'`
|
||||||
|
DESKTOP="KDE"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function detect_unity()
|
||||||
|
{
|
||||||
|
ps -e | grep -E 'unity-panel' > /dev/null
|
||||||
|
if [ $? -ne 0 ];
|
||||||
|
then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
VERSION=`unity --version | awk '{print $2}'`
|
||||||
|
DESKTOP="unity"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function detect_xfce()
|
||||||
|
{
|
||||||
|
ps -e | grep -E '^.* xfce4-session$' > /dev/null
|
||||||
|
if [ $? -ne 0 ];
|
||||||
|
then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
VERSION=`xfce4-session --version | grep xfce4-session | awk '{print $2}'`
|
||||||
|
DESKTOP="xfce"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function detect_cinnamon()
|
||||||
|
{
|
||||||
|
ps -e | grep -E '^.* cinnamon$' > /dev/null
|
||||||
|
if [ $? -ne 0 ];
|
||||||
|
then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
VERSION=`cinnamon --version | awk '{print $2}'`
|
||||||
|
DESKTOP="cinnamon"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function detect_mate()
|
||||||
|
{
|
||||||
|
ps -e | grep -E '^.* mate-panel$' > /dev/null
|
||||||
|
if [ $? -ne 0 ];
|
||||||
|
then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
VERSION=`mate-about --version | awk '{print $4}'`
|
||||||
|
DESKTOP="mate"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function detect_lxde()
|
||||||
|
{
|
||||||
|
ps -e | grep -E '^.* lxsession$' > /dev/null
|
||||||
|
if [ $? -ne 0 ];
|
||||||
|
then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# We can detect LXDE version only thru package manager
|
||||||
|
which apt-cache > /dev/null 2> /dev/null
|
||||||
|
if [ $? -ne 0 ];
|
||||||
|
then
|
||||||
|
which yum > /dev/null 2> /dev/null
|
||||||
|
if [ $? -ne 0 ];
|
||||||
|
then
|
||||||
|
VERSION='unknown'
|
||||||
|
else
|
||||||
|
# For Fedora
|
||||||
|
VERSION=`yum list lxde-common | grep lxde-common | awk '{print $2}' | awk -F '-' '{print $1}'`
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# For Lubuntu and Knoppix
|
||||||
|
VERSION=`apt-cache show lxde-common /| grep 'Version:' | awk '{print $2}' | awk -F '-' '{print $1}'`
|
||||||
|
fi
|
||||||
|
DESKTOP="lxde"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function detect_sugar()
|
||||||
|
{
|
||||||
|
if [ "$DESKTOP_SESSION" == "sugar" ];
|
||||||
|
then
|
||||||
|
VERSION=`python -c "from jarabe import config; print config.version"`
|
||||||
|
DESKTOP="sugar"
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DESKTOP="unknown"
|
||||||
|
if detect_unity;
|
||||||
|
then
|
||||||
|
if detect_kde;
|
||||||
|
then
|
||||||
|
if detect_gnome;
|
||||||
|
then
|
||||||
|
if detect_xfce;
|
||||||
|
then
|
||||||
|
if detect_cinnamon;
|
||||||
|
then
|
||||||
|
if detect_mate;
|
||||||
|
then
|
||||||
|
if detect_lxde;
|
||||||
|
then
|
||||||
|
detect_sugar
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$1" == '-v' ];
|
||||||
|
then
|
||||||
|
echo $VERSION
|
||||||
|
else
|
||||||
|
if [ "$1" == '-n' ];
|
||||||
|
then
|
||||||
|
echo $DESKTOP
|
||||||
|
else
|
||||||
|
echo $DESKTOP $VERSION
|
||||||
|
fi
|
||||||
|
fi
|
Reference in New Issue
Block a user