diff options
author | Ken Moore <moorekou@gmail.com> | 2016-06-16 11:41:51 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-06-16 11:41:51 -0400 |
commit | 3507d048bef5a1c3565b0f60e329a999a691a4c3 (patch) | |
tree | 78f5a0a5d95f19bbf399291bf90bcaa196f6b284 /src-qt5/core/lumina-desktop | |
parent | Adjust the default keyboard shortcuts a bit to try and avoid conflicts betwee... (diff) | |
download | lumina-3507d048bef5a1c3565b0f60e329a999a691a4c3.tar.gz lumina-3507d048bef5a1c3565b0f60e329a999a691a4c3.tar.bz2 lumina-3507d048bef5a1c3565b0f60e329a999a691a4c3.zip |
Another round of small bug fixes/tweaks:
1) Fix up the desktopbar plugin to work with the new file locations for configs.
2) Fix up the replacement of the "~/" prefix on a file path with the users home dir.
3) Add default favorites for the ~/[Documents, Downloads, Pictures, Videos] directories.
4) Add the ability to specify quicklaunch apps within luminaDesktop.conf (almost the same as the favorites options).
5) Another couple tweaks for the Glass theme.
6) Have the non-applauncher desktop plugins fill in from the bottom-right of the screen. This provides automatic separation between the auto-generated launchers and other plugins.
7) Add a second, auto-hidden panel at the top of the primary screen by default with the desktopbar plugin there (for instance access to favorites & ~/Desktop files/dirs)
Diffstat (limited to 'src-qt5/core/lumina-desktop')
4 files changed, 38 insertions, 65 deletions
diff --git a/src-qt5/core/lumina-desktop/LDesktopPluginSpace.cpp b/src-qt5/core/lumina-desktop/LDesktopPluginSpace.cpp index a55f3e31..ff460125 100644 --- a/src-qt5/core/lumina-desktop/LDesktopPluginSpace.cpp +++ b/src-qt5/core/lumina-desktop/LDesktopPluginSpace.cpp @@ -113,7 +113,9 @@ void LDesktopPluginSpace::addDesktopPlugin(QString plugID){ //No previous location - need to calculate initial geom QSize sz = plug->defaultPluginSize(); //in grid coordinates geom.setSize(sz); - geom = findOpenSpot(geom.width(), geom.height() ); + //if an applauncher - add from top-left, otherwise add in from bottom-right + if(plugID.startsWith("applauncher")){ geom = findOpenSpot(geom.width(), geom.height() ); } + else{ geom = findOpenSpot(geom.width(), geom.height(), RoundUp(this->height()/GRIDSIZE), RoundUp(this->width()/GRIDSIZE), true); } }else if(!ValidGeometry(plugID, gridToGeom(geom)) ){ //Find a new location for the plugin (saved location is invalid) geom = findOpenSpot(geom.width(), geom.height(), geom.y(), geom.x(), false); //try to get it within the same general area first diff --git a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf index 4eabfb70..318bb0f9 100644 --- a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf +++ b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf @@ -54,7 +54,7 @@ theme_font=Arial #Name of the font family to use theme_fontsize=10pt #Default size of the fonts to use on the desktop (can also use a percentage of the screen height (<number>%) ) #DESKTOP SETTINGS (used for the primary screen in multi-screen setups) -desktop_visiblepanels=1 #[0 - 12] The number of panels visible by default +desktop_visiblepanels=2 #[0 - 12] The number of panels visible by default #desktop.backgroundfiles= #list of absolute file paths for image files (disable for Lumina default) desktop_backgroundrotateminutes=5 #[positive integer] number of minutes between background rotations (if multiple files) desktop_plugins=rssreader #list of plugins to be shown on the desktop by default @@ -62,12 +62,19 @@ desktop_generate_icons=true #[true/false] Auto-generate launchers for ~/Desktop #PANEL SETTINGS (preface with panel1.<setting> or panel2.<setting>, depending on the number of panels you have visible by default) panel1_location=bottom #[top/bottom/left/right] Screen edge the panel should be on -panel1_pixelsize=4%H #number of pixels wide/high the panel should be (or <number>%[W/H] for a percentage of the screen width/height) +panel1_pixelsize=3.5%H #number of pixels wide/high the panel should be (or <number>%[W/H] for a percentage of the screen width/height) panel1_autohide=false #[true/false] Have the panel become visible on mouse-over panel1_plugins=systemstart, taskmanager-nogroups, spacer, systemtray, clock #list of plugins for the panel panel1_pinlocation=center #[left/center/right] Note:[left/right] corresponds to [top/bottom] for vertical panels panel1_edgepercent=99 #[1->100] percentage of the screen edge to use +panel2_location=top +panel2_pixelsize=3%H +panel2_autohide=true +panel2_plugins=spacer, desktopbar, spacer +panel2_pinlocation=center +panel2_edgepercent=10 + #MENU SETTINGS (right-click menu) menu_plugins=terminal, filemanager, applications, line, settings #list of menu plugins to show @@ -83,3 +90,11 @@ favorites_add_ifexists=trojita.desktop favorites_add_ifexists=smplayer.desktop favorites_add_ifexists=vlc.desktop favorites_add_ifexists=pithos.desktop +favorites_add_ifexists=~/Documents +favorites_add_ifexists=~/Downloads +favorites_add_ifexists=~/Pictures +favorites_add_ifexists=~/Videos + +#QUICKLAUNCH CUSTOMIZATION (requires the use of the "systemstart" panel plugin) +#quicklaunch_add=<file/dir path> #Create a quicklaunch shortcut for this file/dir +#quicklaunch_add_ifexists=<file/dir path> #Create a quicklaunch shortcut for this file/dir if the file/dir exists diff --git a/src-qt5/core/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp b/src-qt5/core/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp index 0aa896ce..60329e7e 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp @@ -10,41 +10,21 @@ LDeskBarPlugin::LDeskBarPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ this->layout()->setContentsMargins(0,0,0,0); this->setStyleSheet( "QToolButton::menu-indicator{ image: none; } QToolButton{ padding: 0px; }"); - //Find the path to the desktop folder - if(QFile::exists(QDir::homePath()+"/Desktop")){ desktopPath = QDir::homePath()+"/Desktop"; } - else if(QFile::exists(QDir::homePath()+"/desktop")){ desktopPath = QDir::homePath()+"/desktop"; } - else{ desktopPath=""; } - //Make sure the favorites directory exists - if(!QFile::exists(QDir::homePath()+"/.lumina/favorites") ){ - QDir dir; - dir.mkpath(QDir::homePath()+"/.lumina/favorites"); - } - //Setup the filter lists for the different types of files - /*audioFilter <<"*.ogg"<<"*.mp3"<<"*.wav"<<"*.aif"<<"*.iff"<<"*.m3u"<<"*.m4a"<<"*.mid"<<"*.mpa"<<"*.ra"<<"*.wma"; - videoFilter <<"*.3g2"<<"*.3gp"<<"*.asf"<<"*.asx"<<"*.avi"<<"*.flv"<<"*.m4v"<<"*.mov"<<"*.mp4"<<"*.mpg"<<"*.rm"<<"*.srt"<<"*.swf"<<"*.vob"<<"*.wmv"; - pictureFilter <<"*.bmp"<<"*.dds"<<"*.gif"<<"*.jpg"<<"*.png"<<"*.psd"<<"*.thm"<<"*.tif"<<"*.tiff"<<"*.ai"<<"*.eps"<<"*.ps"<<"*.svg"<<"*.ico"; - docsFilter << "*.txt"<<"*.rtf"<<"*.doc"<<"*.docx"<<"*.odf"<<"*.pdf";*/ + //initialize the desktop bar items initializeDesktop(); //setup the directory watcher + QString fav = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/favorites.list"; + if(!QFile::exists(fav)){ QProcess::execute("touch \""+fav+"\""); } watcher = new QFileSystemWatcher(this); - if(!desktopPath.isEmpty()){ - watcher->addPath(desktopPath); - watcher->addPath(QDir::homePath()+"/.lumina/favorites"); - } - connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(desktopChanged()) ); - QTimer::singleShot(1,this, SLOT(desktopChanged()) ); //make sure to load it the first time + watcher->addPath( fav ); + connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(filechanged(QString)) ); + QTimer::singleShot(1,this, SLOT(updateFiles()) ); //make sure to load it the first time QTimer::singleShot(0,this, SLOT(OrientationChange()) ); //adjust sizes/layout - connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(desktopChanged()) ); + connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(updateFiles()) ); } LDeskBarPlugin::~LDeskBarPlugin(){ - if(!desktopPath.isEmpty()){ - watcher->removePath(desktopPath); - disconnect(watcher); - } - delete watcher; - } // ======================= @@ -107,23 +87,6 @@ QAction* LDeskBarPlugin::newAction(QString filepath, QString name, QIcon icon){ return act; } -/*void LDeskBarPlugin::updateMenu(QMenu* menu, QFileInfoList files, bool trim){ - menu->clear(); - //re-create the menu (since it is hidden from view) - QStringList filevals; - for(int i=0; i<files.length(); i++){ - qDebug() << "New Menu Item:" << files[i].fileName(); - if(trim){ totals.removeAll(files[i]); } - filevals << files[i].fileName()+"::::"+files[i].canonicalFilePath(); - //menu->addAction( newAction( files[i].canonicalFilePath(), files[i].fileName(), "") ); - } - //Now sort the list by file name - filevals.sort(); - for(int i=0; i<filevals.length(); i++){ - menu->addAction( newAction( filevals[i].section("::::",1,1), filevals[i].section("::::",0,0), "") ); - } -}*/ - // ======================= // PRIVATE SLOTS // ======================= @@ -133,14 +96,13 @@ void LDeskBarPlugin::ActionTriggered(QAction* act){ qDebug() << "Open File:" << cmd; LSession::LaunchApplication(cmd); } - -void LDeskBarPlugin::desktopChanged(){ - QStringList newfavs = LUtils::listFavorites(); - if(lastHomeUpdate.isNull() || (QFileInfo(QDir::homePath()+"/Desktop").lastModified() > lastHomeUpdate) || newfavs!=favs ){ - favs = newfavs; - homefiles = LSession::handle()->DesktopFiles(); - lastHomeUpdate = QDateTime::currentDateTime(); - QStringList favitems = favs; +void LDeskBarPlugin::filechanged(QString file){ + updateFiles(); + if(!watcher->files().contains(file)){ watcher->addPath(file); } //make sure the file does not get removed from the watcher +} +void LDeskBarPlugin::updateFiles(){ + QFileInfoList homefiles = LSession::handle()->DesktopFiles(); + QStringList favitems = LUtils::listFavorites(); //Remember for format for favorites: <name>::::[app/dir/<mimetype>]::::<full path> for(int i=0; i<homefiles.length(); i++){ QString type; @@ -218,7 +180,6 @@ void LDeskBarPlugin::desktopChanged(){ fileB->setMenu(fileM); } connect(fileB->menu(), SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed())); - } //end of check for if updates are needed //Setup the visibility of the buttons appB->setVisible( !appM->isEmpty() ); @@ -244,4 +205,4 @@ void LDeskBarPlugin::updateIcons(){ docM->setIcon( LXDG::findIcon("x-office-document","") ); fileB->setIcon( LXDG::findIcon("document-multiple", "") ); fileB->setToolTip(tr("Favorite Files") ); -}
\ No newline at end of file +} diff --git a/src-qt5/core/lumina-desktop/panel-plugins/desktopbar/LDeskBar.h b/src-qt5/core/lumina-desktop/panel-plugins/desktopbar/LDeskBar.h index 57d40e4c..74f41230 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/desktopbar/LDeskBar.h +++ b/src-qt5/core/lumina-desktop/panel-plugins/desktopbar/LDeskBar.h @@ -37,15 +37,10 @@ public: ~LDeskBarPlugin(); private: - //QHBoxLayout *layout; - QString desktopPath; QFileSystemWatcher *watcher; //Special toolbuttons and menus QToolButton *appB, *fileB, *dirB; QMenu *appM, *dirM, *audioM, *videoM, *pictureM, *fileM, *otherM, *docM; - //QStringList audioFilter, videoFilter, pictureFilter, docsFilter; - QFileInfoList homefiles; - QStringList favs; QList<QToolButton*> APPLIST; QDateTime lastHomeUpdate; @@ -60,13 +55,14 @@ private: private slots: void ActionTriggered(QAction* act); - void desktopChanged(); + void filechanged(QString); + void updateFiles(); void updateIcons(); public slots: void LocaleChange(){ updateIcons(); - desktopChanged(); + updateFiles(); } void OrientationChange(){ @@ -90,4 +86,3 @@ public slots: #endif - |